git-svn-id: https://svn.eduke32.com/eduke32@1178 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-12-10 11:36:53 +00:00
parent 6f514cf91e
commit 8ec01d5ea2
34 changed files with 128 additions and 1367 deletions

View file

@ -73,7 +73,8 @@ endif
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -DNOCOPYPROTECT \
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(SRC)/jaudiolib
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(SRC)/jaudiolib \
# -march=pentium3 -mtune=generic -mmmx -m3dnow -msse -mfpmath=sse
OURCXXFLAGS=-fno-exceptions -fno-rtti
LIBS=-lm

View file

@ -58,13 +58,13 @@ $(OBJ)/mvreverb.$o: $(SRC)/jaudiolib/mvreverb.nasm
$(OBJ)/mv_mix-c.$o: $(SRC)/jaudiolib/mv_mix-c.c
$(OBJ)/mvreverb-c.$o: $(SRC)/jaudiolib/mvreverb-c.c
$(OBJ)/pitch.$o: $(SRC)/jaudiolib/pitch.c $(SRC)/jaudiolib/pitch.h
$(OBJ)/multivoc.$o: $(SRC)/jaudiolib/multivoc.c $(SRC)/jaudiolib/usrhooks.h $(SRC)/jaudiolib/linklist.h $(SRC)/jaudiolib/pitch.h $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/_multivc.h
$(OBJ)/multivoc.$o: $(SRC)/jaudiolib/multivoc.c $(SRC)/jaudiolib/linklist.h $(SRC)/jaudiolib/pitch.h $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/_multivc.h
$(OBJ)/fx_man.$o: $(SRC)/jaudiolib/fx_man.c $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/ll_man.h $(SRC)/jaudiolib/fx_man.h
$(OBJ)/dsoundout.$o: $(SRC)/jaudiolib/dsoundout.c $(SRC)/jaudiolib/dsoundout.h
$(OBJ)/openal.$o: $(SRC)/jaudiolib/openal.c $(SRC)/jaudiolib/openal.h
$(OBJ)/dsl.$o: $(SRC)/jaudiolib/dsl.c $(SRC)/jaudiolib/dsl.h $(EINC)/compat.h
$(OBJ)/midi.$o: $(SRC)/jaudiolib/midi.c $(SRC)/jaudiolib/standard.h $(SRC)/jaudiolib/usrhooks.h $(SRC)/jaudiolib/music.h $(SRC)/jaudiolib/_midi.h $(SRC)/jaudiolib/midi.h
$(OBJ)/midi.$o: $(SRC)/jaudiolib/midi.c $(SRC)/jaudiolib/standard.h $(SRC)/jaudiolib/music.h $(SRC)/jaudiolib/_midi.h $(SRC)/jaudiolib/midi.h
$(OBJ)/mpu401.$o: $(SRC)/jaudiolib/mpu401.c $(SRC)/jaudiolib/mpu401.h
$(OBJ)/music.$o: $(SRC)/jaudiolib/music.c $(SRC)/jaudiolib/music.h $(SRC)/jaudiolib/midi.h $(SRC)/jaudiolib/mpu401.h

View file

@ -1,495 +0,0 @@
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"

View file

@ -1,7 +0,0 @@
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

@ -92,7 +92,8 @@ endif
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Wno-char-subscripts \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-DKSFORBUILD -I$(INC)
-DKSFORBUILD -I$(INC) \
# -march=pentium3 -mtune=generic -mmmx -m3dnow -msse -mfpmath=sse
OURCXXFLAGS=-fno-exceptions -fno-rtti
LIBS=
ASFLAGS=-s #-g

View file

@ -29,7 +29,6 @@ $(OBJ)/osd.$o: $(SRC)/osd.c $(INC)/build.h $(INC)/osd.h $(INC)/compat.h $(INC)/b
$(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 $(INC)/dynamicgtk.h
$(OBJ)/dynamicgtk.$o: $(SRC)/dynamicgtk.c $(INC)/dynamicgtk.h

View file

@ -1,49 +0,0 @@
//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

@ -1,141 +0,0 @@
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.

View file

@ -595,7 +595,7 @@ int loadoldboard(char *filename, char fromwhere, int *daposx, int *daposy, int *
// Hash functions
struct HASH_item // size is 12/24 bits.
{
const char *string;
char *string;
int key;
struct HASH_item *next;
};

View file

@ -104,7 +104,7 @@ void initcache(intptr_t dacachestart, int dacachesize)
cac[0].lock = &zerochar;
cacnum = 1;
initprintf("Initialized %.1f megabyte cache\n", (float)(dacachesize/1024.f/1024.f));
initprintf("Initialized %.1fM cache\n", (float)(dacachesize/1024.f/1024.f));
}
void allocache(intptr_t *newhandle, int newbytes, char *newlockptr)

View file

@ -1070,7 +1070,7 @@ static int defsparser(scriptfile *script)
char *frametokptr = script->ltextptr;
char *frameend, *framename = 0, happy=1;
int ftilenume = -1, ltilenume = -1, tilex = 0;
double smoothduration = 0.0f;
double smoothduration = 0.1f;
if (scriptfile_getbraces(script,&frameend)) break;
while (script->textptr < frameend)
@ -1104,8 +1104,6 @@ static int defsparser(scriptfile *script)
ltilenume = tilex;
}
smoothduration = 0.1f;
if (lastmodelid < 0)
{
initprintf("Warning: Ignoring frame definition.\n");

View file

@ -12134,8 +12134,6 @@ void HASH_init(struct HASH_table *t)
{
HASH_free(t);
t->items=Bcalloc(1, t->size * sizeof(struct HASH_item));
// memset commented because it's redundant with calloc
// Bmemset(t->items,0,t->size * sizeof(struct HASH_item));
}
void HASH_free(struct HASH_table *t)
@ -12157,6 +12155,8 @@ void HASH_free(struct HASH_table *t)
tmp = cur;
cur = cur->next;
// initprintf("Free %4d '%s'\n",tmp->key,(tmp->string)?tmp->string:".");
if (tmp->string)
Bfree(tmp->string);
Bfree(tmp);
num++;
}
@ -12202,7 +12202,7 @@ void HASH_add(struct HASH_table *t, const char *s, int key)
return;
if (t->items == NULL)
{
initprintf("HASH_add: not initalized\n");
initprintf("HASH_add(): table not initialized!\n");
return;
}
code = HASH_getcode(s)%t->size;
@ -12211,7 +12211,7 @@ void HASH_add(struct HASH_table *t, const char *s, int key)
if (!cur)
{
cur=Bcalloc(1,sizeof(struct HASH_item));
cur->string=s;
cur->string=Bstrdup(s);
cur->key=key;
cur->next=NULL;
t->items[code]=cur;
@ -12228,7 +12228,7 @@ void HASH_add(struct HASH_table *t, const char *s, int key)
while (cur);
cur=Bcalloc(1,sizeof(struct HASH_item));
cur->string=s;
cur->string=Bstrdup(s);
cur->key=key;
cur->next=NULL;
prev->next=cur;
@ -12239,14 +12239,18 @@ void HASH_replace(struct HASH_table *t, const char *s, int key)
struct HASH_item *cur, *prev=NULL;
int code;
if (t->items==NULL) {initprintf("HASH_add: not initalized\n");return;}
if (t->items==NULL)
{
initprintf("HASH_replace(): table not initialized!\n");
return;
}
code=HASH_getcode(s)%t->size;
cur=t->items[code];
if (!cur)
{
cur=Bcalloc(1,sizeof(struct HASH_item));
cur->string=s;
cur->string=Bstrdup(s);
cur->key=key;
cur->next=NULL;
t->items[code]=cur;
@ -12266,7 +12270,7 @@ void HASH_replace(struct HASH_table *t, const char *s, int key)
while (cur);
cur=Bcalloc(1,sizeof(struct HASH_item));
cur->string=s;
cur->string=Bstrdup(s);
cur->key=key;
cur->next=NULL;
prev->next=cur;
@ -12278,7 +12282,7 @@ int HASH_find(struct HASH_table *t, const char *s)
if (t->items==NULL)
{
initprintf("HASH_find: not initalized\n");
initprintf("HASH_find(): table not initialized!\n");
return -1;
}
cur=t->items[HASH_getcode(s)%t->size];
@ -12297,7 +12301,7 @@ int HASH_findcase(struct HASH_table *t, const char *s)
if (t->items==NULL)
{
initprintf("HASH_findcase: not initalized\n");
initprintf("HASH_findcase(): table not initialized!\n");
return -1;
}
cur=t->items[HASH_getcode(s)%t->size];

View file

@ -105,7 +105,7 @@ static int osdcursorpal=0; */
static symbol_t *osdsymbptrs[MAXSYMBOLS];
static int osdnumsymbols = 0;
static struct HASH_table osdsymbolsH = { MAXSYMBOLS, NULL };
static struct HASH_table osdsymbolsH = { MAXSYMBOLS<<1, NULL };
// application callbacks
static void (*drawosdchar)(int, int, char, int, int) = _internal_drawosdchar;

View file

@ -339,7 +339,7 @@ void drawline2d(float x0, float y0, float x1, float y1, char col)
int cachefilehandle = -1; // texture cache file handle
FILE *cacheindexptr = NULL;
struct HASH_table cacheH = { MAXTILES<<2, NULL };
struct HASH_table cacheH = { MAXTILES<<3, NULL };
char TEXCACHEFILE[BMAX_PATH] = "textures";
@ -1999,7 +1999,6 @@ static int pow2xsplit = 0, skyclamphack = 0;
void drawpoly(double *dpx, double *dpy, int n, int method)
{
#define PI 3.14159265358979323
double ngdx = 0.0, ngdy = 0.0, ngdo = 0.0, ngux = 0.0, nguy = 0.0, nguo = 0.0;
double ngvx = 0.0, ngvy = 0.0, ngvo = 0.0, dp, up, vp, rdp, du0 = 0.0, du1 = 0.0, dui, duj;
double ngdx2, ngux2, ngvx2;

View file

@ -1,388 +0,0 @@
// FMOD Sound Interface
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#include "fmod.h"
#include "fmod_errors.h"
#ifndef F_CALLBACKAPI
#define FMOD_PRE370
#define F_CALLBACKAPI _cdecl
#endif
// some Linux people may need this if GCC can't find FSOUND_Stream_Open
// #define FMOD_PRE370
#include "osd.h"
#include "compat.h"
#include "cache1d.h"
#define NUMCHANNELS 16
#define MAXWAVES 256
static int fmod_inited = 0;
static int musicstat = 0;
// general sample playback
static int numwaves;
static FSOUND_SAMPLE * samples[MAXWAVES];
static char instname[MAXWAVES][16];
static int channels[NUMCHANNELS];
void loadwaves(void);
static unsigned int F_CALLBACKAPI f_open(const char *name)
{
return kopen4load((char *)name, 0) + 1;
}
static void F_CALLBACKAPI f_close(unsigned int handle)
{
kclose(handle - 1);
}
static int F_CALLBACKAPI f_read(void *buffer, int size, unsigned int handle)
{
return kread(handle - 1, buffer, size);
}
static int F_CALLBACKAPI f_seek(unsigned int handle, int pos, signed char mode)
{
return klseek(handle - 1, pos, mode);
}
static int F_CALLBACKAPI f_tell(unsigned int handle)
{
return ktell(handle - 1);
}
void initsb(char dadigistat, char damusistat, int dasamplerate, char danumspeakers, char dabytespersample, char daintspersec, char daquality)
{
char *s;
int i,j;
if (fmod_inited) return;
fmod_inited = 0;
if (dasamplerate < 6000) dasamplerate = 6000;
else if (dasamplerate > 48000) dasamplerate = 48000;
musicstat = damusistat;
printOSD("Initializing FMOD...\n");
printOSD(" Linked version: %.02f\n", FMOD_VERSION);
printOSD(" DLL version: %.02f\n", FSOUND_GetVersion());
if (FSOUND_GetVersion() < FMOD_VERSION)
{
printOSD(" ... Failure: FMOD DLL too old! Sound disabled.\n");
return;
}
printOSD(" Samplerate: %d hz\n", dasamplerate);
//FSOUND_SetOutput(FSOUND_OUTPUT_ASIO);
if (FSOUND_Init(dasamplerate, NUMCHANNELS, 0))
{
printOSD(" ... Success\n");
fmod_inited = 1;
}
else
{
printOSD(" ... Failure: %s\n", FMOD_ErrorString(FSOUND_GetError()));
}
switch (FSOUND_GetOutput())
{
case FSOUND_OUTPUT_NOSOUND:
s = "No Sound"; break;
case FSOUND_OUTPUT_WINMM:
s = "WINMM"; break;
case FSOUND_OUTPUT_DSOUND:
s = "DirectSound"; break;
case FSOUND_OUTPUT_OSS:
s = "OSS"; break;
case FSOUND_OUTPUT_ESD:
s = "ESound"; break;
case FSOUND_OUTPUT_ALSA:
s = "ALSA"; break;
case FSOUND_OUTPUT_ASIO:
s = "ASIO"; break;
default:
s = "Other"; break;
}
printOSD("Using FMOD \"%s\" output driver\n", s);
FSOUND_File_SetCallbacks(
(FSOUND_OPENCALLBACK)f_open,
(FSOUND_CLOSECALLBACK)f_close,
(FSOUND_READCALLBACK)f_read,
(FSOUND_SEEKCALLBACK)f_seek,
(FSOUND_TELLCALLBACK)f_tell);
//FSOUND_SetMemorySystem(fmod_cache, fmod_cachelen, NULL, NULL, NULL);
loadwaves();
for (i=0; i<NUMCHANNELS; i++) channels[i] = -1;
}
void uninitsb(void)
{
if (fmod_inited)
{
FSOUND_Close();
fmod_inited = 0;
}
}
void setears(int daposx, int daposy, int daxvect, int dayvect)
{
}
void wsayfollow(char *dafilename, int dafreq, int davol, int *daxplc, int *dayplc, char followstat)
{
/*
dafilename:
filename
dafreq:
4096 = Middle C
8192 = +1 8ve
davol:
0-256 = volume
daxplc:
dayplc:
followstat: 0 = sound emination origin (fixed)
followstat: 1 = pointer to sprite coordinates (dynamic)
followstat:
0 = position is fixed in space
1 = position follows an object
*/
unsigned char ch1, ch2;
int i, wavnum, bad, oldest=0, free=-1, ox, oy, x, y, vo;
unsigned int oldestpos=0;
int chan;
if (fmod_inited == 0) return;
for (wavnum=numwaves-1;wavnum>=0;wavnum--)
{
bad = 0;
i = 0;
while ((dafilename[i] > 0) && (i < 16))
{
ch1 = dafilename[i]; if ((ch1 >= 97) && (ch1 <= 123)) ch1 -= 32;
ch2 = instname[wavnum][i]; if ((ch2 >= 97) && (ch2 <= 123)) ch2 -= 32;
if (ch1 != ch2) {bad = 1; break;}
i++;
}
if (bad != 0) continue;
for (i=0; i<NUMCHANNELS; i++)
{
if (!FSOUND_IsPlaying(channels[i]))
{
free = i;
break;
}
if (i==0) continue;
if (FSOUND_GetCurrentPosition(channels[i]) > oldestpos)
{
oldest = i;
oldestpos = FSOUND_GetCurrentPosition(channels[i]);
}
}
if (free < 0)
{
FSOUND_StopSound(channels[oldest]);
free = oldest;
}
chan = FSOUND_PlaySoundEx(FSOUND_FREE, samples[wavnum], NULL, 1);
if (chan == -1) return;
FSOUND_SetFrequency(chan, dafreq*11025/4096);
FSOUND_SetVolume(chan, davol);
FSOUND_SetPaused(chan, 0);
channels[free] = chan;
return;
}
}
void wsay(char *dafilename, int dafreq, int volume1, int volume2)
{
unsigned char ch1, ch2;
int i, j, bad, free=-1, oldest=0;
unsigned int oldestpos=0;
int chan;
if (fmod_inited == 0) return;
i = numwaves-1;
do
{
bad = 0;
j = 0;
while ((dafilename[j] > 0) && (j < 16))
{
ch1 = dafilename[j]; if ((ch1 >= 97) && (ch1 <= 123)) ch1 -= 32;
ch2 = instname[i][j]; if ((ch2 >= 97) && (ch2 <= 123)) ch2 -= 32;
if (ch1 != ch2) {bad = 1; break;}
j++;
}
if (bad == 0)
{
for (j=0; j<NUMCHANNELS; j++)
{
if (!FSOUND_IsPlaying(channels[j]))
{
free = j;
break;
}
if (j==0) continue;
if (FSOUND_GetCurrentPosition(channels[j]) > oldestpos)
{
oldest = j;
oldestpos = FSOUND_GetCurrentPosition(channels[j]);
}
}
if (free < 0)
{
FSOUND_StopSound(channels[oldest]);
free = oldest;
}
chan = FSOUND_PlaySoundEx(FSOUND_FREE, samples[i], NULL, 1);
if (chan == -1) return;
FSOUND_SetFrequency(chan, dafreq*11025/4096);
FSOUND_SetVolume(chan, (volume1*volume2)>>1);
// set pan
FSOUND_SetPaused(chan, 0);
channels[free] = chan;
return;
}
i--;
}
while (i >= 0);
}
void loadwaves(void)
{
int fil, dawaversionum, i, tmp;
int wavleng[MAXWAVES], repstart[MAXWAVES], repleng[MAXWAVES], finetune[MAXWAVES];
char *p;
fil = kopen4load("WAVES.KWV", 0);
if (fil != -1)
{
kread(fil, &dawaversionum, 4); dawaversionum = B_LITTLE32(dawaversionum);
if (dawaversionum != 0) { kclose(fil); return; }
kread(fil, &numwaves, 4); numwaves = B_LITTLE32(numwaves);
for (i=0; i<numwaves; i++)
{
kread(fil, &instname[i][0], 16);
kread(fil, &wavleng[i], 4); wavleng[i] = B_LITTLE32(wavleng[i]);
kread(fil, &repstart[i], 4); repstart[i] = B_LITTLE32(repstart[i]);
kread(fil, &repleng[i], 4); repleng[i] = B_LITTLE32(repleng[i]);
kread(fil, &finetune[i], 4); finetune[i] = B_LITTLE32(finetune[i]);
}
}
else
{
dawaversionum = 0;
numwaves = 0;
}
for (i=numwaves; i<MAXWAVES; i++)
{
memset(&instname[i][0], 0, 16);
wavleng[i] = 0;
repstart[i] = 0;
repleng[i] = 0;
finetune[i] = 0;
samples[i] = NULL;
}
if (fil == -1) return;
for (i=0; i<numwaves; i++)
{
if (repleng[i]) tmp = FSOUND_LOOP_NORMAL;
else tmp = FSOUND_LOOP_OFF;
samples[i] = FSOUND_Sample_Alloc(FSOUND_FREE, wavleng[i], tmp, 11025, 255, 128, 1);
if (!samples[i]) continue;
p = (char*)Bmalloc(wavleng[i]);
kread(fil,p,wavleng[i]);
FSOUND_Sample_Upload(samples[i], p, FSOUND_8BITS | FSOUND_MONO | FSOUND_UNSIGNED);
Bfree(p);
if (repleng[i]) FSOUND_Sample_SetLoopPoints(samples[i], repstart[i], repstart[i]+repleng[i]);
}
kclose(fil);
printOSD("Loaded %d waves\n", numwaves);
}
#if 1
static FSOUND_STREAM *musicstream = NULL;
static int musicplaying = 0;
void loadsong(char *filename)
{
if (!musicstat) return;
if (musicstream) return;
#ifdef FMOD_PRE370
musicstream = FSOUND_Stream_OpenFile(filename, FSOUND_LOOP_NORMAL, 0);
#else
musicstream = FSOUND_Stream_Open(filename, FSOUND_LOOP_NORMAL, 0, 0);
#endif
}
void musicon(void)
{
if (!musicstat) return;
if (!musicstream || musicplaying) return;
FSOUND_Stream_Play(FSOUND_FREE, musicstream);
musicplaying = 1;
}
void musicoff(void)
{
if (!musicstat) return;
if (!musicstream || !musicplaying) return;
FSOUND_Stream_Stop(musicstream);
musicplaying = 0;
}
#endif
void refreshaudio(void)
{
}

View file

@ -1,39 +0,0 @@
void initsb(char dadigistat, char damusistat, int dasamplerate, char danumspeakers, char dabytespersample, char daintspersec, char daquality)
{
}
void uninitsb(void)
{
}
void setears(int daposx, int daposy, int daxvect, int dayvect)
{
}
void wsayfollow(char *dafilename, int dafreq, int davol, int *daxplc, int *dayplc, char followstat)
{
}
void wsay(char *dafilename, int dafreq, int volume1, int volume2)
{
}
void loadwaves(void)
{
}
void loadsong(char *filename)
{
}
void musicon(void)
{
}
void musicoff(void)
{
}
void refreshaudio(void)
{
}

View file

@ -222,7 +222,7 @@ int wm_ynbox(char *name, char *fmt, ...)
vsprintf(buf,fmt,va);
va_end(va);
r = MessageBox((HWND)win_gethwnd(),buf,name,MB_YESNO|MB_TASKMODAL);
r = MessageBox((HWND)win_gethwnd(),buf,name,MB_YESNO|MB_ICONQUESTION|MB_TASKMODAL);
if (r==IDYES) return 1;
return 0;
}
@ -3343,13 +3343,17 @@ static int SetupOpenGL(int width, int height, int bitspp)
else if (!Bstrcmp(glinfo.vendor,"3Dfx Interactive Inc.")) err = 1;
else if (!Bstrcmp(glinfo.vendor,"Intel"))
{
if (Bstrcmp(glinfo.vendor,"Intel 865G"))
err = 1;
if (!Bstrcmp(glinfo.renderer,"Intel 865G"))
err = 0;
if (!Bstrcmp(glinfo.renderer,"Intel 945GM"))
err = 0;
else err = 1;
}
if (err)
{
OSD_Printf("Blacklisted OpenGL driver detected. GL modes will be unavailable. Use -forcegl to override.\n");
OSD_Printf("Unsupported OpenGL driver detected. GL modes will be unavailable. Use -forcegl to override.\n");
wm_msgbox("Unsupported OpenGL driver", "Unsupported OpenGL driver detected. GL modes will be unavailable.");
ReleaseOpenGL();
unloadgldriver();
nogl = 1;

View file

@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <shellapi.h>
#endif
#define BUILDDATE " 20081125"
#define BUILDDATE " 20081210"
#define VERSION " 1.2.0devel"
static int floor_over_floor;
@ -7587,7 +7587,7 @@ int ExtPreInit(int argc,const char **argv)
OSD_SetLogFile("mapster32.log");
OSD_SetVersionString("Mapster32"VERSION,0,2);
initprintf("Mapster32"VERSION BUILDDATE"\n");
initprintf("Copyright (c) 2008 EDuke32 team\n");
// initprintf("Copyright (c) 2008 EDuke32 team\n");
G_CheckCommandLine(argc,argv);
@ -8583,9 +8583,7 @@ int ExtInit(void)
int i;
#if 1
i=wm_ynbox("Texture Caching",
"Would you like to enable the on-disk texture cache? This feature will use an undetermined amount of space "
"on your hard disk to store textures in your video card's native format, enabling them to load dramatically "
"faster after the first time they are loaded.\n\n"
"Would you like to enable the on-disk texture cache?\n\n"
"You will generally want to say 'yes' here, especially if using the HRP.");
#else
i = 1;

View file

@ -51,7 +51,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
===================
*/
struct HASH_table gamefuncH = { NUMGAMEFUNCTIONS, NULL };
struct HASH_table gamefuncH = { NUMGAMEFUNCTIONS<<2, NULL };
int32 CONFIG_FunctionNameToNum(char * func)
{
@ -609,11 +609,18 @@ int32 CONFIG_ReadSetup(void)
pathsearchmode = 1;
if (SafeFileExists(setupfilename) && ud.config.scripthandle < 0) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(setupfilename);
else if (SafeFileExists(SETUPFILENAME) && ud.config.scripthandle < 0)
{
Bsprintf(tempbuf,"The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?",setupfilename,SETUPFILENAME);
i=wm_ynbox("Import Configuration Settings",tempbuf);
if (i) ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
}
else if (SafeFileExists("duke3d.cfg") && ud.config.scripthandle < 0)
{
Bsprintf(tempbuf,"The configuration file \"%s\" was not found. "
"Would you like to import configuration data "
"from \"duke3d.cfg\"?",setupfilename);
"Import configuration data from \"duke3d.cfg\"?",setupfilename);
i=wm_ynbox("Import Configuration Settings",tempbuf);
if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg");

View file

@ -251,14 +251,6 @@ enum DukeWeapon_t {
#define deletesprite A_DeleteSprite
void A_DeleteSprite(int s);
#define __USRHOOKS_H
enum USRHOOKS_Errors {
USRHOOKS_Warning = -2,
USRHOOKS_Error = -1,
USRHOOKS_Ok = 0
};
typedef struct {
uint32 bits;
short fvel, svel;

View file

@ -10832,8 +10832,8 @@ void app_main(int argc,const char **argv)
initprintf("%s\n",apptitle);
// initprintf("Compiled %s\n",datetimestring);
initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n");
initprintf("Copyright (c) 2008 EDuke32 team and contributors\n");
// initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n");
// initprintf("Copyright (c) 2008 EDuke32 team and contributors\n");
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d");
@ -10934,9 +10934,7 @@ void app_main(int argc,const char **argv)
if (glusetexcache == -1 || glusetexcachecompression == -1)
{
i=wm_ynbox("Texture Caching",
"Would you like to enable the on-disk texture cache? This feature will use an undetermined amount of space "
"on your hard disk to store textures in your video card's native format, enabling them to load dramatically "
"faster after the first time they are loaded.\n\n"
"Would you like to enable the on-disk texture cache?\n\n"
"You will generally want to say 'yes' here, especially if using the HRP.");
if (i) ud.config.useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1;
else glusetexcache = glusetexcachecompression = 0;
@ -10946,9 +10944,8 @@ void app_main(int argc,const char **argv)
#ifdef _WIN32
if (ud.config.CheckForUpdates == -1)
{
i=wm_ynbox("Automatic Release Notification",
"Would you like EDuke32 to automatically check for new releases "
"at startup?");
i=wm_ynbox("Automatic Update Notifications",
"Would you like to check for new versions of EDuke32 at startup?");
ud.config.CheckForUpdates = 0;
if (i) ud.config.CheckForUpdates = 1;
}

View file

@ -935,20 +935,20 @@ const memberlabel_t InputLabels[]=
char *bitptr; // pointer to bitmap of which bytecode positions contain pointers
#define BITPTR_POINTER 1
struct HASH_table gamevarH = { MAXGAMEVARS, NULL };
struct HASH_table arrayH = { MAXGAMEARRAYS, NULL };
struct HASH_table labelH = { 11264, NULL };
struct HASH_table keywH = { CON_END, NULL };
struct HASH_table gamevarH = { MAXGAMEVARS<<2, NULL };
struct HASH_table arrayH = { MAXGAMEARRAYS<<2, NULL };
struct HASH_table labelH = { 11264<<2, NULL };
struct HASH_table keywH = { CON_END<<2, NULL };
struct HASH_table sectorH = { SECTOR_END, NULL };
struct HASH_table wallH = { WALL_END, NULL };
struct HASH_table userdefH = { USERDEFS_END, NULL };
struct HASH_table sectorH = { SECTOR_END<<2, NULL };
struct HASH_table wallH = { WALL_END<<2, NULL };
struct HASH_table userdefH = { USERDEFS_END<<2, NULL };
struct HASH_table projectileH = { PROJ_END, NULL };
struct HASH_table playerH = { PLAYER_END, NULL };
struct HASH_table inputH = { INPUT_END, NULL };
struct HASH_table actorH = { ACTOR_END, NULL };
struct HASH_table tspriteH = { ACTOR_END, NULL };
struct HASH_table projectileH = { PROJ_END<<2, NULL };
struct HASH_table playerH = { PLAYER_END<<2, NULL };
struct HASH_table inputH = { INPUT_END<<2, NULL };
struct HASH_table actorH = { ACTOR_END<<2, NULL };
struct HASH_table tspriteH = { ACTOR_END<<2, NULL };
void inithashnames();
void freehashnames();
@ -1061,16 +1061,8 @@ static int C_IncreaseScriptSize(int size)
}
//initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script));
if (size <= osize)
{
g_scriptSize = size;
initprintf("Shrinking bytecode buffer, final size: %d*%d bytes\n",g_scriptSize, sizeof(intptr_t));
}
else
{
g_scriptSize = size;
initprintf("Increasing bytecode buffer size to %d*%d bytes...\n",g_scriptSize, sizeof(intptr_t));
}
g_scriptSize = size;
initprintf("Resizing code buffer to %d*%d bytes\n",g_scriptSize, sizeof(intptr_t));
newscript = (intptr_t *)Brealloc(script, g_scriptSize * sizeof(intptr_t));
@ -2174,7 +2166,7 @@ static int C_ParseCommand(void)
if (i == -1)
{
// printf("Defining Definition '%s' to be '%d'\n",label+(g_numLabels<<6),*(g_scriptPtr-1));
HASH_replace(&labelH,label+(g_numLabels<<6),g_numLabels);
HASH_add(&labelH,label+(g_numLabels<<6),g_numLabels);
labeltype[g_numLabels] = LABEL_DEFINE;
labelcode[g_numLabels++] = *(g_scriptPtr-1);
if (*(g_scriptPtr-1) >= 0 && *(g_scriptPtr-1) < MAXTILES && g_dynamicTileMapping)
@ -4833,7 +4825,7 @@ repeatcase:
j++;
}
tempbuf[j] = '\0';
if (Bstrcmp(setupfilename,"duke3d.cfg") == 0) // not set to something else via -cfg
if (Bstrcmp(setupfilename,SETUPFILENAME) == 0) // not set to something else via -cfg
{
char temp[BMAX_PATH];
struct stat st;

View file

@ -45,7 +45,7 @@ extern "C" {
//
// Setup program defines
//
#define SETUPFILENAME "duke3d.cfg"
#define SETUPFILENAME "eduke32.cfg"
// Max number of players

View file

@ -787,21 +787,20 @@ static int X_DoExecute(void)
// Huh?. This does nothing....
// (the result is always j==0....)
if ((klabs(ActorExtra[g_i].lastvx-g_sp->x)+klabs(ActorExtra[g_i].lastvy-g_sp->y)) <
(klabs(ActorExtra[g_i].lastvx-s->x)+klabs(ActorExtra[g_i].lastvy-s->y)))
j = 0;
// if ((klabs(ActorExtra[g_i].lastvx-g_sp->x)+klabs(ActorExtra[g_i].lastvy-g_sp->y)) <
// (klabs(ActorExtra[g_i].lastvx-s->x)+klabs(ActorExtra[g_i].lastvy-s->y)))
// j = 0;
// um yeah, this if() will always fire....
if (j == 0)
// if (j == 0)
{
// search around for target player
// also modifies 'target' x&y if found..
j = A_FurthestVisiblePoint(g_i,s,&ActorExtra[g_i].lastvx,&ActorExtra[g_i].lastvy);
if (j == -1) j = 0;
else j = 1;
j = 1;
if (A_FurthestVisiblePoint(g_i,s,&ActorExtra[g_i].lastvx,&ActorExtra[g_i].lastvy) == -1)
j = 0;
}
}
else
@ -812,10 +811,10 @@ static int X_DoExecute(void)
ActorExtra[g_i].lastvy = s->y;
}
if (j == 1 && (g_sp->statnum == 1 || g_sp->statnum == 6))
if (j && (g_sp->statnum == 1 || g_sp->statnum == 6))
ActorExtra[g_i].timetosleep = SLEEPTIME;
X_DoConditional(j == 1);
X_DoConditional(j);
break;
}
@ -824,14 +823,14 @@ static int X_DoExecute(void)
break;
case CON_IFSQUISHED:
X_DoConditional(A_CheckSquished(g_i, g_p) == 1);
X_DoConditional(A_CheckSquished(g_i, g_p));
break;
case CON_IFDEAD:
j = g_sp->extra;
if (g_sp->picnum == APLAYER)
j--;
X_DoConditional(j < 0);
// j = g_sp->extra;
// if (g_sp->picnum == APLAYER)
// j--;
X_DoConditional(g_sp->extra <= 0);
break;
case CON_AI:
@ -3206,9 +3205,7 @@ static int X_DoExecute(void)
// -1 for none found
// <type> <maxdistvarid> <varid>
int lType=*insptr++, lMaxDist=Gv_GetVar(*insptr++, g_i, g_p), lMaxZDist=Gv_GetVar(*insptr++, g_i, g_p);
int lVarID=*insptr++, lFound=-1, lTemp, lTemp2, j, k;
k=MAXSTATUS-1;
int lVarID=*insptr++, lFound=-1, lTemp, lTemp2, j, k=MAXSTATUS-1;
do
{
j=headspritestat[tw==CON_FINDNEARACTORZVAR?1:k]; // all sprites
@ -3251,9 +3248,7 @@ static int X_DoExecute(void)
// -1 for none found
// <type> <maxdist> <varid>
int lType=*insptr++, lMaxDist=*insptr++, lMaxZDist=*insptr++, lVarID=*insptr++;
int lTemp, lTemp2, lFound=-1, j, k;
k=MAXSTATUS-1;
int lTemp, lTemp2, lFound=-1, j, k=MAXSTATUS-1;
do
{
j=headspritestat[tw==CON_FINDNEARACTORZ?1:k]; // all sprites
@ -3286,24 +3281,16 @@ static int X_DoExecute(void)
}
case CON_FINDPLAYER:
insptr++;
Gv_SetVar(g_iReturnVarID, A_FindPlayer(&sprite[g_i],&j), g_i, g_p);
Gv_SetVar(*insptr++, j, g_i, g_p);
break;
case CON_FINDOTHERPLAYER:
insptr++;
{
// syntax findnearactorvar <type> <maxdistvar> <getvar>
// gets the sprite ID of the nearest actor within max dist
// that is of <type> into <getvar>
// -1 for none found
// <type> <maxdistvarid> <varid>
int var1 = *insptr++, d;
if (tw == CON_FINDPLAYER) j=A_FindPlayer(&sprite[g_i],&d);
else j=P_FindOtherPlayer(g_i,&d);
Gv_SetVar(g_iReturnVarID, j, g_i, g_p);
Gv_SetVar(var1, d, g_i, g_p);
break;
}
Gv_SetVar(g_iReturnVarID, P_FindOtherPlayer(g_p,&j), g_i, g_p);
Gv_SetVar(*insptr++, j, g_i, g_p);
break;
case CON_SETPLAYER:
case CON_GETPLAYER:

View file

@ -519,7 +519,7 @@ int Gv_SetupVar(const char *pszLabel, int lValue, unsigned int dwFlags)
if (i==g_gameVarCount)
{
// we're adding a new one.
HASH_replace(&gamevarH,aGameVars[i].szLabel,i);
HASH_add(&gamevarH,aGameVars[i].szLabel,i);
g_gameVarCount++;
}

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "duke3d.h"
const char *s_buildDate = "20081125";
const char *s_buildDate = "20081210";
char *MusicPtr = NULL;
int g_musicSize;
@ -175,7 +175,7 @@ int SpriteFlags[MAXTILES];
projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES];
char CheatKeys[2] = { sc_D, sc_N };
char setupfilename[BMAX_PATH]= "duke3d.cfg";
char setupfilename[BMAX_PATH]= SETUPFILENAME;
// char datetimestring[] = ""__DATE__" "__TIME__"";
int g_doQuickSave = 0;

View file

@ -185,7 +185,7 @@ int ScanGroups(void)
}
fclose(fp);
}
initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file");
// initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file");
return 0;
}
initprintf("Found no recognized GRP files!\n");

View file

@ -32,11 +32,11 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#include <stdlib.h>
#include <string.h>
#include "standard.h"
#include "usrhooks.h"
#include "music.h"
#include "_midi.h"
#include "midi.h"
#include "mpu401.h"
#include "compat.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -1169,7 +1169,7 @@ void MIDI_StopSong
_MIDI_Funcs->ReleasePatches();
}
USRHOOKS_FreeMem(_MIDI_TrackPtr);
Bfree(_MIDI_TrackPtr);
_MIDI_TrackPtr = NULL;
_MIDI_NumTracks = 0;
@ -1204,7 +1204,6 @@ int MIDI_PlaySong
int tracklength;
track *CurrentTrack;
unsigned char *ptr;
int status;
if (_MIDI_SongLoaded)
{
@ -1251,8 +1250,8 @@ int MIDI_PlaySong
}
_MIDI_TrackMemSize = _MIDI_NumTracks * sizeof(track);
status = USRHOOKS_GetMem((void**)&_MIDI_TrackPtr, _MIDI_TrackMemSize);
if (status != USRHOOKS_Ok)
_MIDI_TrackPtr = Bmalloc(_MIDI_TrackMemSize);
if (_MIDI_TrackPtr == NULL)
{
return(MIDI_NoMemory);
}
@ -1263,7 +1262,7 @@ int MIDI_PlaySong
{
if (*(unsigned int *)ptr != MIDI_TRACK_SIGNATURE)
{
USRHOOKS_FreeMem(_MIDI_TrackPtr);
Bfree(_MIDI_TrackPtr);
_MIDI_TrackPtr = NULL;
_MIDI_TrackMemSize = 0;

View file

@ -47,7 +47,6 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#endif
#include "compat.h"
#include "baselayer.h"
#include "usrhooks.h"
#include "linklist.h"
#include "pitch.h"
#include "multivoc.h"
@ -2794,23 +2793,6 @@ int MV_TestPlayback(void)
}
#endif
int USRHOOKS_GetMem(void **ptr, unsigned int size)
{
*ptr = malloc(size);
if (*ptr == NULL)
return(USRHOOKS_Error);
return(USRHOOKS_Ok);
}
int USRHOOKS_FreeMem(void *ptr)
{
free(ptr);
return(USRHOOKS_Ok);
}
/*---------------------------------------------------------------------
Function: MV_Init
@ -2835,8 +2817,8 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
MV_SetErrorCode(MV_Ok);
MV_TotalMemory = Voices * sizeof(VoiceNode) + sizeof(HARSH_CLIP_TABLE_8);
status = USRHOOKS_GetMem((void **)&ptr, MV_TotalMemory);
if (status != USRHOOKS_Ok)
ptr = Bmalloc(MV_TotalMemory);
if (ptr == NULL)
{
MV_SetErrorCode(MV_NoMem);
return(MV_Error);
@ -2868,7 +2850,7 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
ptr = (char *)Bcalloc(1,TotalBufferSize + 8); // FIXME: temporarily fixes bounds error somewhere...
if (!ptr)
{
USRHOOKS_FreeMem(MV_Voices);
Bfree(MV_Voices);
MV_Voices = NULL;
MV_TotalMemory = 0;
@ -2895,7 +2877,7 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
{
status = MV_ErrorCode;
USRHOOKS_FreeMem(MV_Voices);
Bfree(MV_Voices);
MV_Voices = NULL;
MV_TotalMemory = 0;
@ -2987,7 +2969,7 @@ int MV_Shutdown(void)
RestoreInterrupts(flags);
// Free any voices we allocated
USRHOOKS_FreeMem(MV_Voices);
Bfree(MV_Voices);
MV_Voices = NULL;
MV_TotalMemory = 0;

View file

@ -1,56 +0,0 @@
/*
Copyright (C) 1994-1995 Apogee Software, Ltd.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: USRHOOKS.H
author: James R. Dose
date: July 26, 1994
Public header file for USRHOOKS.C.
This module contains cover functions for operations the library
needs that may be restricted by the calling program. The function
prototypes in this header should not be modified.
**********************************************************************/
#ifndef __USRHOOKS_H
#define __USRHOOKS_H
/*---------------------------------------------------------------------
Error definitions
---------------------------------------------------------------------*/
enum USRHOOKS_Errors
{
USRHOOKS_Warning = -2,
USRHOOKS_Error = -1,
USRHOOKS_Ok = 0
};
/*---------------------------------------------------------------------
Function Prototypes
---------------------------------------------------------------------*/
int USRHOOKS_GetMem( void **ptr, unsigned int size );
int USRHOOKS_FreeMem( void *ptr );
#endif

View file

@ -35,7 +35,7 @@ struct dynitem
short vstat;
short val;
};
struct HASH_table dynnamesH = {4096, NULL};
struct HASH_table dynnamesH = {4096<<2, NULL};
struct dynitem list[]=
{

View file

@ -2254,12 +2254,13 @@ void P_DisplayWeapon(int snum)
pal = p->palookup;
}
guniqhudid = 100;
if (j < 6 || j > 12)
G_DrawTileScaled(weapon_xoffset+80-(p->look_ang>>1),
looking_arc+250-gun_pos,KNEE,gs,o|4|262144,pal);
else G_DrawTileScaled(weapon_xoffset+160-16-(p->look_ang>>1),
looking_arc+214-gun_pos,KNEE+1,gs,o|4|262144,pal);
guniqhudid = 0;
}
if (sprite[p->i].xrepeat < 40)
@ -2302,13 +2303,14 @@ void P_DisplayWeapon(int snum)
if (pal == 0)
pal = p->palookup;
}
guniqhudid = cw;
if ((*kb) < 5 || (*kb) > 9)
G_DrawTileScaled(weapon_xoffset+220-(p->look_ang>>1),
looking_arc+250-gun_pos,KNEE,gs,o,pal);
else
G_DrawTileScaled(weapon_xoffset+160-(p->look_ang>>1),
looking_arc+214-gun_pos,KNEE+1,gs,o,pal);
guniqhudid = 0;
}
}
break;
@ -2614,7 +2616,7 @@ void P_DisplayWeapon(int snum)
else if (p->cursectnum >= 0)
pal = sector[p->cursectnum].floorpal;
else pal = 0;
guniqhudid = cw;
if ((*kb))
{
if ((*kb) < (*aplWeaponTotalTime[p->curr_weapon]))
@ -2635,6 +2637,7 @@ void P_DisplayWeapon(int snum)
}
else
G_DrawWeaponTile(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal);
guniqhudid = 0;
}
}
break;
@ -2653,10 +2656,12 @@ void P_DisplayWeapon(int snum)
else pal = 0;
weapon_xoffset = -48;
guniqhudid = cw;
if ((*kb))
G_DrawWeaponTile(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE+remote_frames[(*kb)],gs,o,pal);
else
G_DrawWeaponTile(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE,gs,o,pal);
guniqhudid = 0;
}
}
break;

View file

@ -330,7 +330,7 @@ static void G_PrecacheSounds(void)
}
}
static void G_DoLoadScreen(char *statustext)
static void G_DoLoadScreen(char *statustext, int percent)
{
int i=0,j;
@ -369,7 +369,11 @@ static void G_DoLoadScreen(char *statustext)
}
if (statustext) gametext(160,180,statustext,0,2+8+16);
j = usehightile;
usehightile = 0;
rotatesprite(33<<16,140<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1);
rotatesprite(153<<16,140<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1);
usehightile = j;
X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
nextpage();
@ -501,8 +505,8 @@ void G_CacheMapData(void)
}
if (totalclock - tc > TICRATE/4)
{
sprintf(tempbuf,"Loading resources... %d%%\n",min(100,100*pc/g_precacheCount));
G_DoLoadScreen(tempbuf);
sprintf(tempbuf,"%d resources remaining\n",g_precacheCount-pc);
G_DoLoadScreen(tempbuf, min(100,100*pc/g_precacheCount));
tc = totalclock;
}
}
@ -562,7 +566,9 @@ void G_UpdateScreenArea(void)
y1 = scale(y1,ydim,200);
y2 = scale(y2,ydim,200);
setview(x1,y1,x2-1,y2-1);
if (getrendermode() >= 3)
setview(x1,y1,x2-1,y2);
else setview(x1,y1,x2-1,y2-1);
G_GetCrosshairColor();
G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
@ -1706,7 +1712,7 @@ int G_EnterLevel(int g)
i = ud.screen_size;
ud.screen_size = 0;
G_DoLoadScreen(NULL);
G_DoLoadScreen(NULL, -1);
G_UpdateScreenArea();
ud.screen_size = i;

View file

@ -1,4 +1,3 @@
//-------------------------------------------------------------------------
/*
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
@ -37,36 +36,6 @@ Windows-specific hooks for JonoF's Duke3D port.
#include "winlayer.h"
int Win_YesNoBox(char *name, char *fmt, ...)
{
char buf[1000];
va_list va;
int r;
va_start(va,fmt);
vsprintf(buf,fmt,va);
va_end(va);
r = MessageBox((HWND)win_gethwnd(),buf,name,MB_YESNO|MB_TASKMODAL);
if (r==IDYES) return 'y';
return 'n';
}
int Win_MsgBox(char *name, char *fmt, ...)
{
char buf[1000];
va_list va;
va_start(va,fmt);
vsprintf(buf,fmt,va);
va_end(va);
MessageBox((HWND)win_gethwnd(),buf,name,MB_OK|MB_TASKMODAL);
return 'y';
}
// this replaces the Error() function in jmact/util_lib.c
extern void G_Shutdown(void); // game.c
void Error(char *error, ...)
@ -82,16 +51,12 @@ void Error(char *error, ...)
vsprintf(buf, error, va);
va_end(va);
MessageBox((HWND)win_gethwnd(),buf,"Fatal Error",MB_OK|MB_TASKMODAL);
MessageBox((HWND)win_gethwnd(),buf,"Fatal Error",MB_OK|MB_ICONERROR|MB_TASKMODAL);
}
exit((error != NULL));
}
#endif
#ifdef _WIN32
int G_GetVersionFromWebsite(char *buffer)
{
int wsainitialized = 0;