Official list of changes
========================

The v1.08 installer ships with a 'whatsnew.txt' file describing most
if not all changes, described succinctly.


Comprehensive links chronology in the Dink Network message board
================================================================

Development - Dink Smallwood v1.08 - Suggestions
http://www.dinknetwork.com/forum.cgi?MID=48641

Development - The Three Pillars of Dink v1.08
http://www.dinknetwork.com/forum.cgi?MID=52195

General Dink Discussion - Help Test Dink Smallwood v1.08 - Alpha 1 -> 5
http://www.dinknetwork.com/forum.cgi?MID=50116

General Dink Discussion - Dink Smallwood v1.08 Beta 1 Now Available
http://www.dinknetwork.com/forum.cgi?MID=54349

General Dink Discussion - Dink Smallwood v1.08 Beta 2
http://www.dinknetwork.com/forum.cgi?MID=54523

General Dink Discussion - Dink Smallwood v1.08 Beta 3
http://www.dinknetwork.com/forum.cgi?MID=55267

News Comments - New File: Dink Smallwood v1.08 - Release Candidate 1 -> 2
http://www.dinknetwork.com/forum.cgi?MID=57155

News Comments - New File: Dink Smallwood v1.08 - Release Candidate 3
http://www.dinknetwork.com/forum.cgi?MID=57519

News Comments - New File: Dink Smallwood v1.08 - Release Candidate 4
http://www.dinknetwork.com/forum.cgi?MID=57829

News Comments - New File: Dink Smallwood v1.08 - Release Candidate 5
http://www.dinknetwork.com/forum.cgi?MID=58202

News Comments - New File: Dink Smallwood v1.08 - Release Candidate 6
http://www.dinknetwork.com/forum.cgi?MID=59442

News Comments - New File: Dink Smallwood v1.08 - Release Candidate 7
http://www.dinknetwork.com/forum.cgi?MID=59848

News Comments - New File: Dink Smallwood 1.08 Final
http://www.dinknetwork.com/forum.cgi?MID=60436


First version of the compatibility thread:
http://www.dinknetwork.com/forum.cgi?MID=60061

Second version of the compatibility thread:
http://www.dinknetwork.com/forum.cgi?MID=67349


Other sources of information
============================

The v1.08 announcement mentions a plan to reuse all improvements from
the "reDink" version, which are described in its readme_reDink.txt.

The included dinkc.chm has a section "Internal Functions by Version"
with a "v1.08+" entry, describing all added DinkC commands.

Grep //redink1 in the 1.08 source code.

[X] Paul Jewsbury posted a list of v1.08 bugs he ran into:
    http://www.dinknetwork.com/forum.cgi?MID=89849

    => The descriptions are pretty vague, without explaining how to
       reproduce the problem. They mostly concern the old DinkC
       engine, and each change is likely to further break
       compatibility. So I'm not in favor of fixing them: rather, it
       would make sense to implement a proper scripting engine (in
       progress).

    [X] "The operator /= is buggy. If you use a function as the
        divisor it will divide by the LAST function to have been
        calculated, not the one you want. *= works in that
        circumstance, though, and so does /.
	=> Can be reproduced, due to "/" and "/=" sharing the same
	code, and DinkC advancing 1 character in both cases (while it
	should advance 2 chars for "/=").

    [ ] "sp_pframe is apparently broken; changing from one frame to
        another with a different hit box doesn't update the hit box,
        however it does work when its sequenced. I saw this with Red
        Shield and I'm sure it worked before. (I'm not talking about
        hardness, though its the same hardbox.)"
	=> This one may be fixed, though it can break
	   backward-compatibility.


Incorporating changes in FreeDink
=================================

I suggest different approaches depending on the kind of fix:

- bug fix with no side effect: apply fix

- bug fix that was exploited in a released D-Mod: don't apply fix in
  v1.07 mode, add in v1.08 mode

- good improvement: apply change

- bad improvement already used in a released D-Mod: apply change in
  v1.08 mode, or if possible, don't apply change at all, and fix the
  D-Mod

- bad improvement never used in a released D-Mod: don't apply change
  and mark as deprecated

- DinkC changes: offer 2 versions of the engine (1.07 and 1.08) as
  well as a new DinkC with a clean syntax, a different file extension,
  and UTF-8 support.


List of changes
===============

whatsnew.txt
------------

Fixes:
[X] Support for windowed mode (-window parameter).
    => this refers to fixing the colors in windowed mode, which SDL
    already provided for us.
[X] Dink moves at a normal (slower) speed on faster computers.
[X] Framerate can no longer exceed 83 FPS (to fix problems with vsync
    disabled).
    => See 2007-09-18 - 2007-09-20 commits; I also improved the code
    for better correctness. See framerate.txt.
[X] The 1-pixel row above the status bar now draws sprite graphics.
    => just playy = 400 instead of 399; fixed 2008-05-22
[X] Scrolling now appears on 1-pixel rows and columns near status bar.
    => fixed 2008-06-08, in 'transition'.
[X] Dink can no longer walk around the edges of the screen during a screenlock.
    => fixed 2008-06-08, with stricter checks because it didn't work
    in all cases.
[X] Removed screenlock on restart game
    => fixed 2008-06-08, in DinkC binding for 'restart_game'.
[X] Dink's speed reset to normal (3) on load to prevent 'hyper-sword' bug.
    => fixed 2008-06-08, in 'load_game'.
[X] Time for save game correctly displayed (2:05 instead of 2:5).
    => fixed 2008-06-08, in 'decipher_string'.
[X] The first tile on the fire and water tile pages animate correctly.
    => fixed 2008-06-08, in 'process_animated_tiles'.
[X] Dink's map position appears correctly after warps.
    => fixed 2008-07-17 in 'process_warp_man' (sprite warp) and
    2008-07-18 in DinkC's 'load_screen' (script warp)
[X] Properly exits when closed with Alt-F4.
    => done as part of FreeDink v1.07 clean-up
[X] Level-up no longer lost if in inventory screen, fixed several
    other experience count issues.
    => Cf. also 'add_exp' dinkc.chm entry below
    => Implemented unconditionaly 2008-07-24
[X] Fixed issue of a phantom keyboard key causing the Map to not be displayed.
    => Could not reproduce the problem, but applied the code clean-up.
    => Implemented unconditionaly 2008-07-19
[X] Fixed issue of loading regular bmp sequences over top of previous sequences
    (before the animation would be 'corrupt')
    => See for further explanation http://www.dinknetwork.com/forum.cgi?MID=92733
    => fixed 2008-05-22, but differently (clean sequence reload)

[X] Dinkedit: several spelling/grammar fixes
[X] Removed extra space in "I'm gesturing wildly to  no avail!"
    => Fixed 2008-06-08

Improvements:
[X] Support for high-color (-truecolor parameter).
    => Implemented conditionally 2008-07-15 -> 2008-07-17

Improvements that potentially break backward compatibility:
[X] "dnotalk" script is run if no sprites are around when Dink talks (not
    required).
[X] "dnomagic" script is run if Dink tries to use magic without arming any (not
    required).
[X] "button4" script is run when the user hits the enter key (not required).
[X] "button7" through "button10" scripts will be run when extra gamepad buttons
    are pressed.
    => there's a naming conflict: "Edit: Well, that's beautiful... As
    you may or may not be aware, as of 1.08, you can change the
    function of the Enter key in your D-Mod with a script named
    'button4'. Secret of Parizaya just happens to have a script named
    button4, interfering with the Enter key's ability to
    work. Therefore, Secret of Parizaya is currently incompatible with
    1.08. Tada." (http://www.dinknetwork.com/forum.cgi?MID=59442)
    => Implemented conditionally 2008-07-20
[X] Variables can begin with another variable stub (i.e. &goldtemp will work with
    &gold).
    => Implemented conditionally 2008-07-04
[X] &missle_source is defined for all attacks, not just missiles.
    => Implemented conditionally 2008-07-24
[X] &return is a built-in variable that stores the last return value of any
    function (built-in or custom).
    => Implemented conditionally 2008-07-04
[X] Custom functions can have up to 9 arguments, stored in the built-in variables
    &arg1 through &arg9.
    => Implemented conditionally 2008-07-04
[X] Corpses appear as the same size as the living sprite.
    => that is, if an ennemy has a size of 50%, its dead body will
       also have a size of 50% (previously it was 100%)
    => Implemented unconditionaly 2008-07-20, I don't think this was
       ever worked-around in a released D-Mod

DinkC changes:

Fixes:
[X] playavi(str avifile)
    Removed command.
    => Cf. dinkc.chm entry
    => Implemented unconditionaly 2008-03-09
[X] run_script_by_number(int script, "proc");
    No longer runs a random procedure if it cannot locate proc specified.
    => Fixed 2008-07-04
[X] sp_sound(int sprite, int value)
    Passing a -1 will no longer crash the game.
    => Fixed 2008-07-01

Backward-incompatible fixes:
[X] compare_magic(str magicitem)
    Works correctly.
    => Compare the magic index rather than the weapon index
    => Implemented conditionally 2008-07-23
[X] sp_move_nohard(int sprite, bool value)
    When activated, a sprite can move freely through all hardness.  Previously
    had no effect.
    => Cf. sp_move_nohard dinkc.chm entry: actually had effect but
       only when in scripted moves
    => Implemented conditionally 2008-07-23
[X] screenlock(int value)
    Returns the current screenlock value if value is -1.
    => Implemented conditionally 2008-07-23

New functions:
[X] clear_editor_info()
    Removes the editor_seq and editor_frame for all sprites on the map.
    => Implemented conditionally 2008-07-07
[X] get_date_day()
    Returns the current day.
[X] get_date_month()
    Returns the current month.
[X] get_date_year()
    Returns the current year.
[X] get_item(str item)
    Returns first slot of this item.
    => Implemented conditionally 2008-07-07
[X] get_magic(str magicitem)
    Returns first slot of this magic.
    => Implemented conditionally 2008-07-07
[X] get_next_sprite_with_this_brain(int brain, int spriteignore, int spritestart)
    Begins searching for brains of type 'brain' starting with 'spritestart'.
[X] get_time_game()
    Returns the number of minutes the player has been playing the game (total).
[X] get_time_real()
    Returns the number of minutes in the day (900 = 3 pm).
[X] get_truecolor()
    Returns true if the game is in true-color mode.
[X] load_map(str mapdat, str dinkdat)
    Loads a new map.dat/dink.dat.  Saved and loaded with the save game.
    => Implemented conditionally 2008-07-07
[X] load_palette(str palbmp)
    Loads a new global palette (only works in full screen 256 color mode). Saved
    and loaded with the save game.
    => Implemented conditionally 2008-07-07
[X] load_tile(str tilebmp, int index)
    Loads a new tile set for the given index.  Saved and loaded with the save
    game.
    => Implemented conditionally 2008-07-07
[X] loopmidi(bool loop)
    If 1, all midis will automatically loop.  If 0, midis will not loop.
    => Implemented conditionally 2008-07-17
    => Fixed "Procedure void loopmidi( void ); not found in script"
       warning 2008-11-27
[X] make_global_function(str script, str function)
    Allows you to use the specified function in DinkC without the use of
    external.
    => Implemented conditionally 2008-07-04
[X] math_abs(int num)
[X] math_mod(int num1, int num2)
[X] math_sqrt(int num1)
[X] map_hard_tile(int maptile, int hardtileindex)
    Gets or sets the hard tiles on the current map screen.  'maptile' refers to
    the tiles on the current screen from 1 (upper-left corner) to 96
    (lower-right corner).
    => Implemented conditionally 2008-07-07
[X] map_tile(int maptile, int tileindex)
    Gets or sets the tiles on the current map screen.  'maptile' refers to the
    tiles on the current screen from 1 (upper-left corner) to 96 (lower-right
    corner).
    => Implemented conditionally 2008-07-07
[X] set_dink_base_push(int dinkbasepush)
    Sets the base-push for Dink.  Default is 310.  Not saved with save games.
    => Implemented conditionally 2008-07-18
[X] set_font_color(int colorindex, int red, int green, int blue)
    Changes the specified color index to the specified color.
    => Implemented conditionally 2008-07-07
[X] set_save_game_info(str line)
    Sets the line of information to be displayed in the save game summary.  The
    default is "Level &level".
    => Implemented conditionally 2008-07-07
[X] show_console()
    Shows the console, which accepts DinkC commands as input (Escape to cancel).
[X] show_inventory()
    Displays the inventory screen.
    => Implemented conditionally 2008-07-18
[X] sp_blood_seq(int sprite, int seq)
    The start of the blood sequences.
    => Implemented conditionally 2008-07-04
[X] sp_blood_num(int sprite, int num)
    How many blood sequences follow sp_blood_seq.
    => Implemented conditionally 2008-07-04
[X] sp_clip_bottom(int sprite, int pixels)
[X] sp_clip_left(int sprite, int pixels)
[X] sp_clip_right(int sprite, int pixels)
[X] sp_clip_top(int sprite, int pixels)
    => Implemented conditionally 2008-07-04
[X] sp_freeze(int sprite, bool freeze (-1 to return))
    If 1, acts like freeze.  If 0, acts like unfreeze.  -1 will return whether
    the given sprite is frozen or not (basically a better 'busy' function).
[X] var_used()
    Returns the number of variables used.
    => Implemented conditionally 2008-07-18
[X] sp_move_x(int sprite, int value)
    Like sp_mx, but does not return a value.
    => Implemented conditionally 2008-07-20
[X] sp_move_y(int sprite, int value)
    Like sp_my, but does not return a value.
    => Implemented conditionally 2008-07-20

Non-changes:
[?] Variables are no longer shared between two instances of the same
    script.
    => Unless I'm mistaken, this is already the case in v1.07.
    Local ones, at least.
[?] Status is drawn on load so the magic-level is always displayed.
    => 'draw_status_all' is already called in DinkC's load_game, so I
       don't see how redink1's patch changes the situation
[?] Restoring game will not redraw status bar if it wasn't drawn.
    => pupdate_status is set to 1 on load, so this doesn't work

Changes not-implemented:
[X] ffcreate.exe will only include .bmp files (to prevent the .ff file including itself in an
    infinite loop of hard-drive punishment).
    => Not planning to support ffcreate, dir.ff files are handled
       weirdly by the engine, and foster obfuscation


Changes not documented in whatsnew.txt
--------------------------------------

[X] Enabled screen scrolling in windowed mode (it was explicitely
    disabled in command-line options parsing).

[X] max_idata changed from 600 to 1000; idata store additional sprite
    data during dink.ini initial loading. Some 1.08 D-Mods such as
    "City of Dead" require more than 600 idata, and v1.07 ignores part
    of them, resulting in misplaced sprites.
    => Implemented conditionally 2008-07-04

[X] avoid crash when &magic_cost is < 100
    => does it more simply in 'update_status_all', and avoid a
       precedence mistake in 'draw_status_all'
    => Implemented unconditionaly 2008-07-24

[X] Change the fade_down (but not fade_up) palette-mode algorithm to
    use time-based rather than absolute increments. Should avoid
    incomplete fades on slow computers.
    => Implemented conditionally 2008-07-25

[X] New DinkC function: set_smooth_follow
    => Implemented conditionally 2008-07-08

[X] Cleaner but backward-incompatible DinkC scope: before, when there
    were 2 identical variables in different scopes (local/global), the
    first memory slot had priority; now, local variables always have
    priority over global variables.
    => Implemented conditionally 2008-07-04

[X] DinkC: Added "/=" alternative to "/". However, there's a potential
    bug there, because the script cursor is moved 1 character forward
    in both case, instead of 2 for "/=" (that's what's done for
    "*="). "*=" is also added in the v1.08 patch, except that it was
    already present in v1.07 and checked before in the code, so this
    doesn't have any effect.
    => Implemented conditionally 2008-07-04

[X] When a sprite hits another, the reference sprite for the blood is
    now the sprite that _was_ hit, not the one who hits. This is most
    useful with v1.08 sprite-specific blood, it's not really
    noticeable in v1.07.

[X] Entry for sp_custom: "sp_custom gets or sets the custom key value
    for the active_sprite.  Each sprite can store unlimited keys. 
    This will not work for sprite 1 (the player sprite)."
    => Implemented conditionally 2008-07-20

[X] Entry for sp_flying: "In 1.07 and earlier, sp_flying would work
    well for missile brains and poorly for the player brain.  In
    1.08+, sp_flying will work properly for all brains."
    => Implemented conditionally 2008-07-08. Not sure about
    implementing it unconditionally. The snake boss from "I, Kara Gu"
    (designed for v1.08) is stuck in a corner without this fix.

[X] Entry for set_callback_random: "In 1.08+, set_callback_random
    returns a callback number, which can be used to kill the callback
    later in the script using callback_kill."
    => Implemented conditionnaly 2008-07-25

[X] Entry for callback_kill: "callback_kill kills the callback_number
    returned by set_callback_random."
    => Implemented conditionnaly 2008-07-25

[X] Entry for set_dink_speed: "1.07 and earlier had timing issues that
    would cause Dink's speed to change rather noticeably in comparison
    to monsters, and his sp_speed return value could vary wildly. 
    1.08+ locks Dink's speed value to the sp_speed equivalents in the
    table."
    => Actually only changes the behavior for '0' (freeze->noop)
    => Implemented conditionnaly 2008-07-25

[X] entry for say(): "Also in 1.07 and earlier, Dink would not
    interpret lines with a colon correctly, like so: say("bonus: 5
    points", 1); // would not display any text at all! This issue has
    also been fixed in 1.08."

[X] entry for hurt(): "In 1.07 and earlier, a negative damage value
    would cause the game to freeze.  1.08 and later will ignore the
    command safely."

    => Actually, I couldn't reproduce the freeze, so v1.08 is
       essentially changing DinkC's behavior: with v1.07 hurt(&sthing,
       -1) would run hit(), with v1.08 it doesn't.
    => Implementing conditionally 2008-07-24

[X] entry for show_bmp(): "1.07 had a couple bugs displaying the map
    dot: it would not be displayed properly if Dink was warped using
    DinkC or if he was on the 32nd screen of any row. This has been
    fixed in 1.08+."
    => Fixed unconditionaly 2008-07-18

[X] entry for add_exp(): "v1.07 and earlier required that
    active_sprite was last hit by Dink [PP].  v1.08 will work with any
    active_sprite."
    => Fixed conditionaly 2008-07-24

[ ] added a woe registry key so as to deprecate
    %WINDIR%/dinksmallwood.ini overwrite.
    => Done by the installer rather than the engine

[ ] Option -dinkpal: with -truecolor, modify dir.ff graphics assuming
    they use the reference palette rather than their own palette,
    during black->near-black and white->near-white changes.  Option is
    *never* set by DFArc2.
    => Option rarely used, and breaks "The Blackmith's Trail".
       Implemented -truecolor with !-dinkpal.

Changes eventually not implemented
----------------------------------

* Dynamic (shell- and Perl4-style) scope in DinkC (referenced in "The
  Three Pillars of Dink v1.08" link above). Good riddance ;)

dinkc.chm (additional information)
----------------------------------

- entry for playavi(): "playavi was removed from 1.08+.  In early
development versions of Dink Smallwood, this command was used to call
an external dplay.exe file to play avi movies. However, this was not
implemented in the final game as it didn't work very well. Before the
Dink Smallwood source code was released, Dan Walma used this command
to add additional features, like changing maps. He released dPlay, a
replacement for dplay.exe. No D-Mods were released that took advantage
of this functionality."

Additional info: additionaly the command used to stop the execution of
the current script, while it's now just ignored in v1.08. This means
v1.07 may stop where v1.08 would continue, e.g.  in "City of the
Dead"'s start.c. "Fairy Goodness Online" also rely on an external
executable but it's launched manually. So removing this command does
not break anything released.

- entry for sp_move_nohard(): "In 1.07 and earlier, the move_no_hard
value only had an effect when the active_sprite was actively moving
(through move and move_stop commands). In 1.08+, the move_no_hard
value should take effect at all times."


Diffing
=======

Files cannot be diffed directly because the indentation changed.

The best way to get rid of identation differences is to transform
source files into canonical forms and indent them:

# Remove the few lines containing to std::*, which confuse 'indent'
./c_canonicalize.sh a
./c_canonicalize.sh b
diff -u -Bbw a_canonical b_canonical


Compilation
===========

The readme.txt says that you need VS.NET or VS2005. The 'Express'
version from MS won't work, because it only support console and .net
applications (eg. it's doesn't provide windows.h).

Trying to compile with VC++6 triggers lots of C++ template errors and
one undefined DDLOCK_DONOTWAIT symbol, plus loads of warnings about
truncated mangled names. I haven't put much work into it.
