Key-472926t14
%%%% Use at own Risk
Use this software and any puzzles modified this software at your own risk.  
I recommend restarting Lode Runner and rebooting your system after you 
have played with this software: especially before doing any serious work.  

Always back up!
While I have not found any obvious problems, this software may damage puzzles 
and render them useless.  Make backup so that if this software or your fiddling
damages a puzzle, you have a backup!

%%%% What you can use this software for
The Hacker's Editor will allow you to do some things that the Lode Runner 
editor will not
1) Clip out puzzles from diffent puzzle sets/files and combine them into one set.

2) Do tile combinations not allowed with the regular editor: burying a 
transporter in bedrock so that you will be transported elsewhere when 
you drill into the tile,  transporter receivers buried in turf, which 
is instant death on arrival, bury tools such as a jackhammer in turf.

3) Do unusual player combinations: Monks started in turf will die on 
startup and appear at random, have all ten monks start from a single 
tile which creates an interesting waterfall effect, Have Jake start on 
a ladder rung or inside trap door turf, have a tool where a monk or 
Jake starts.

4) Program the background for unusuall effects: A complete blackout 
where only Jake and monks are visible, black out the back ground scene 
partially or completely.

5) Make turf, bedrock and other turf tiles appear as other tiles.

6) Make turf and enclosed tools transparent but solid.

%%%% How puzzles are stored and formatted
To get maximum use of this editor, it is best to understand the file 
and puzzle format:
A LR file consist of a file header and a puzzle block for each puzzle.
A file header is a 112 byte block, mostly zeros with:
1) Loderunner copyright notice.
2) Number of puzzles in the set.
3) Online or The Legend Returns file type.
4) Play only which prevents editing with the LR editor. 

A puzzle block consists of a header and a compressed puzzle body.
The puzzle header is an eight byte block containing:
1) Length of the compressed puzzle body: two bytes.
2) Two bytes of zero.
3) The puzzle number: two bytes.
3) Two bytes which seem to always be 01 00.

The puzzle body consists of
1) A title string about 256 bytes long.
2) 14 layers of play field plus border 30x18 bytes each.
3) Number of 'runners', i.e. Jake and Wes.
4) Starting positions of Jake and Wes + 2 bytes each.
5) Number of monks.
6) Starting positions and reentry door of each monk + 3 bytes each.
There seems to be alot of unused areas and many of the areas seem to 
have somewhat random data.  If the title is shortened, the remaining 
text is left there.  There appears to be an enable bit with the monks 
It is set when the monk is used, but the monk count seems to be all that 
is needed, if the count covers the monk and the enable is not set, the monk 
is still used.  Several of the layers 3,4, 11, and 14 always seem to 
be zero.  I have not tried inserting anything there, however.  I have 
been finding uses for some of the layers gradually.  I only just noticed that 
layer 13 was used for doors to puzzle levels 256 or greater.  I, or someone 
else may find a purpose for the other layers yet.
Interestingly, a puzzle with ten monks seems to be one byte shorter then a 
puzzle with any other number of monks.  As a fix, I added the "Monk 
Fix".  If this is off the tenth monk usually appears in a random position. 

%%%% Clipboard 
The internal clipboard is not available to other programs.

%%%% Non working menues
Not all features are implemented.  If they are not, they either do nothing 
or display a message box.
Pull down menus:

%%%% Menus
The FILE MENU works in a standard manner.
"Save Puzzle" saves the current puzzle in a decimal byte format.
"Load Puzzle" is not implemented.
"Save Header" is not implemented.
"Load Header" is not implemented.

The EDIT MENU consists of a number of items:
"Cut Puzzle" will copy the puzzle on the screen to an internal clip board 
and delete the visible puzzle.
"Copy Puzzle" copies the puzzle to the internal clipboard.
"Copy Puzzle Set" copies a reference to the puzzle file in the active 
window.  If the copied puzzle file is closed, the puzzle set is no longer 
available for pasting.
"Paste Puzzle" pastes the puzzle(s) on the clipboard to a place on the 
current puzzle set as selected in the dialog box that comes up: 1) 
beginning of the puzzle set, 2) before the puzzle that is visible on the 
screen, 3) after the puzzle that is on the screen, or 4) at the end of 
the puzzle set.  If there are no puzzle on the active window, the 
puzzle(s) are pasted without a dialog box.
"Delete" deletes the currently viewed puzzle.
"Mark for Moving" marks the current puzzle to be moved to a new 
location.
"Move Here" moves the marked puzzle.
"Single Tile" brings up the tile editor dialog.  Understanding of the 
puzzle format is probably necessary to use the editor successfully.
"Players" allows direct manipulation of data used for monks, Jake, and 
Wes on the visible puzzle.  If you place a monk way off of the normal 
starting position, you may put him in code memory, then you might have a 
mad monk running around loose in your computer!
"Title" allows editing of the current puzzle title.
"Setup Paint Brush" adjusts the data to be "painted" to the screen 
on a left button click
The selections following "Setup Paint Brush" adjust what happens with 
a left click.  The row of eight tool bar button correspond with these 
selections.
"Paint Brush" paints using the data set in "Setup Paint Brush"
"Erase Tool and Turf" erases tools and turf by eraseing data on layers 
1,2,5,6,7, 8,9,10, 13, & 14.
"Erase Tool" erases tools by eraseing data on layers 1,2,5,6,7.
"Erase Turf" erases turf by eraseing data on layers 8,9,10, 13, & 14.
"Paint Monk" is not implemented.
"Paint Jake" is not implemented.
"Paint Wes" is not implemented.
"Hookup Transporters" allows for transporters to be connected to recievers.
"Edit by Layer" brings up the tile edtor setup for the clicked tile.

The VIEW MENU has the following items:
"Layer" brings up a screen for viewing data one layer at a time.
"Statistics" gives general info on the visible puzzle on the active 
page.
"Tool Bar" shows the buttons arrayed at the top of the main window.
"Status Bar" shows the status bar and help messages at the bottom of 
main window
"Grid" places a grid around all of the tiles.
"Show Players" displays the players (Jake, Wes, and monks).
"Full Boundries" shows the entire puzzle file.  I suspect that this 
was placed here to prevent an explosion on one side from causing 
problems on the left side.  I have not discovered anything with the 
boundry tiles.
"Hooks" shows the interconnects on transporters and doors as well as 
bomb settings.
"Links" shows the paths between transporters.
"True Tiles" shows a tile as it's base type.  Layer 10 is ignored.

The SETTINGS MENU sets states for individual puzzles as well as the 
puzzle set.
"Music" allows normal music selection and non-standard music codes.  
The non-standard values probably do nothing.
"World" allows setting of the background scenery.  Non-standard values 
in world number will make everything invisible except Jake, Wes and 
monks.  Non-standard values in background segment will cause the 
background to be partially or completely black.  There is only one tile 
set loaded into the program.  Changes of the world will not be reflected 
in the appearance of the tiles.
"Play Only" allows setting or clearing of the bit that prevents the 
LR editor from loading the file.  This bit has no effect on the Hacker's 
Editor.
"Version" is used by Lode Runner to diffentiate between versions.  
I believe that you can convert a 
Mad Monk's Revenge (code 4) puzzle set to The Legend Returns (code 3) 
puzzle set and load it with The Legend Returns.  It will likely cause 
problems.
"Monk Fix" seems to solve a problem where puzzles with 10 monks are 
shorter than puzzles with fewer monks.
"Warn of Delete" enables or disables the warning message if a puzzle is about 
to be deleted.

The EFFECTS MENU allows access to some manipulation routines.
"Effects" brings up a dialog box with a few effect functions.
"Flip Puzzle" flips a puzzle from right to left and adjusts turf and transporters.
"Smooth Tiles" adjusts the tile appearance (Layer 10) to appear as it would with the 
Lode Runner Editor.
"Setup Transporters" gives each transporter receiver a unique number starting with 1.
The SET PUZZLE MENU allows selection of the viewed puzzle.  This function was removed from 
the scroll bar.
"Many" is approximately the square root of the total number of puzzles.
The WINDOWS MENU is standard.
The ABOUT MENU contains the About Box, What's New Box and this The Scoop Box.

I have only included one tile set.  Adding other sets would requre 
20-40 hours of work or more and increase the executable size by 
about 4 mega bytes.  Too much for a down loadable program.

Other information can be found by clicking on the "info" button found 
in most dialog boxes.

%%%% For Serious Hackers

The following is for serious hackers.  The Hacker's Editor takes care of 
most of it.
The puzzle body uses a simple RLL (Run lenght limited) encoding.  
There are two types of data blocks: Strings and repeats.  Strings are 
encoded as with a header: 0xFF, a length: 1-253, and the string.  The 
string may have any charactor 0-255.  Repeats consist of only a repeat 
count which has a valid range of 1-253 (0xfe) and a single byte of data.

If you have any interesting discoveries that are of general interest, 
please notify Jason Summers.
Please notify me if you want to say about this software, please send 
it to jwinkler@san.rr.com.
Good luck and happy hacking! -Jim;

%%%% What's new

Selecting a puzzle:  Using the scroll bar on the right side to select a puzzle seems 
nice.  However, the puzzle must be full sized.  I changed the scroll bars to move the 
view of the puzzle and added three ways to select the puzzle: tool bar, right click, 
and pull down menu.  I probably should figure out how to do a third scroll bar.  

Erase Turf and Tool in the Edit menu has been implemented.

View puzzle data:  I added the ability to save the puzzle in a byte format.  This will 
show all of the data in the puzzle.  Use Edit / Save Puzzle.  There is no way currently 
to load the data back after editing.  One might be able to use this kind of format 
to do computer generated puzzles.

Viewing Transporter Links:  Click on View / Links to view where a transporter's 
destination is.  This shows the layer 5/6 data which is where the transporter 
sends to.  The transporter number is only used by the editor.  The screen is more 
complex, so much more repainting is done.  Turn this off if you are doing alot of 
editing.

Transporter Setup:  Tired of clicking on transporters to get their number set?  
Click on Effects/Setup Transporters will number all transporter receivers with a 
unique number from 1 to 255.

Transporter Hookups:  Edit / Hookup Transporters to select where the transporters 
will transport to.  The cursor will indicate where to click.  Also you can right 
click on a transporter then select Hookup Transporter, then left click on the destination.  

Turf smoothing:  Turf all torn up?  Click on Effects / Smooth turf.  All the turf 
should be joined together smoothly just like the real editor.  Be careful: this 
function will erase all changes to layer 10.  There is no undo...

True Tiles:  Don't know if that is really a liquid tile or just disguised bedrock? 
click on View / True Tiles.  All tiles will be shown as their base type. 

Flip Puzzle:  Always start from the left side like I do?  Click on Effects / Flip Puzzle. 
This will flip the puzzle from right to left, smooth out the turf and reconnect the transporter 
links so that they will work as before.
