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"

