MZX 2.69c new features

Please note that despite the version name shift may seem minor this is a fairly major update. Actually internally the version is MZX 2.72, but shhh :D

The following new features have been added from version 2.69b to 2.69c:

- sprite additions
- vlayer
- several minor additions
- bug fixes

-- Sprite Additions --

Sprites have been extended from 64 available to 256 available. You should access them with a number 0 through 3 characters in base 10. That means that you should use sprN_(function) where N is a number 0 through 255.

Note that with 3 digit numbers (100 through 255) the counter name has become too large to correctly process the "sprN_overlaid" counter. For this reason you should use the alternative "sprN_overlay" counter in such a case.

A new sprite flag has been added - sprN_ccheck mode 2. To activate this mode you should set sprN_ccheck to 2 for sprite N. When this mode is activated blank chars are neither drawn nor do they cause collisions. Blank chars are any characters that have no pixels in them, and not simply char 32 like with ccheck mode 1.

Another sprite mode has been added, sprN_vlayer, which will allow the sprite to be referenced from the vlayer. More on the vlayer below.

-- Vlayer --

The vlayer, or "virtual layer", is an MZX graphical space like the overlay, but not actually actively drawn on the screen. It's quite large, 32768 characters to be exact, but is only made up of graphical material (characters and colors). That is to say, you cannot have robots or any kind of builtins in it, so in this way it's identical to the overlay. You can copy blocks from the board or overlay to the vlayer, and also vice-versa. In addition you may copy from the vlayer to the vlayer, load MZM imagefiles to the vlayer, save MZM's from the vlayer, read strings from the vlayer, and read/write individual characters/colors to/from the vlayer.

Again, note that the vlayer is never actively drawn on the screen, so you can't directly see it. However, if you reference a sprite to it, and display the sprite on the screen, then it can show a section of the vlayer. Using this technique you can use sprites to create extra overlays, so to speak.

The vlayer commands work in the following way:

Use copy block x1 y1 w h "#x2" "#y2" to copy from the board to the vlayer. For example:
 copy block 0 0 5 5 "#10" "#10" will copy a 5 by 5 block from the board at 0, 0 to the vlayer at 10, 10.

All basic copy block forms work this way:

copy overlay block x1 y1 w h "#x2" "#y2" will copy from the overlay to the vlayer.
copy block "#x1" "#y1" w h x2 y2 will copy from the vlayer to the board.
copy overlay block "#x1" "#y1" w h x2 y2 will copy from the vlayer to the overlay.

The following will work the same way if you use copy block or copy overlay block:

copy (overlay) block "#x1" "#y1" w h "@name.mzm" m will copy from the vlayer to an MZM (see 268_info.txt for  more details regarding functionality)
copy (overlay) block "#x1" "#y1" w h "$stringN" c will copy from the vlayer to a string (see 268_info.txt for  more details regarding functionality)
copy (overlay) block "#x1" "#y1" w h "#x2" "#y2" will copy one section of the vlayer to another section of the  vlayer.

Note that for any area where a string is used to indicate a coordinate a straight number may be used, or a counter may be interpolated. This works in the following ways:

"#100" - straight number
"#&counter&" - direct counter interpolation; use the value of "counter."
"#('counter' + 10)" - expression interpolation; use the value of the expression (counter + 10 in this case).

You may load an MZM to the vlayer by supplying the parameter p02 in the following fashion:

put "@name.mzm" image_file p02 x y

The vlayer has a default width/height of 256x128, but you may change it through the counters vlayer_width and vlayer_height. Note that changing one will recongifure the other to make it as large as it can be. So if you set vlayer_width to 100, vlayer_height will be set to 327.

You may read or write single characters or colors from the vlayer using the vch/vco counters in the following way:

vchX,Y will read/write a character
vcoX,Y will read/write a color

For example:

set "vch10,10" '+' will set the vlayer character at 10, 10 to a plus sign.
set "vco10,10" 15 will set the vlayer color at 10, 10 to white on black.
set "temp" "vch10,10" will set temp to whatever the character at 10, 10 of the vlayer is.

Note that the vlayer is global, meaning that there's only one for the entire game, and not a unique one for every board. If you want to have a unique one for every board you should save/restore an MZM of it, although you may need multiple ones because an MZM may only be up to 256 large in either direction (so it may be up to 256x256).

Stay tuned for demos and tutorials on how to make the most use of the vlayer...

-- Other Additions --

- Char set offsets

Now when saving charsets in the editor you may supply an offset from where to save from in addition to a partial charset size. Note that in this version both are supplied in decimal, not hexidecimal (so they should be a number from 0 to 255, not 0 to FF). You don't need to supply a full 3 characters in all situations (ie, pad the beginning with trailing zeros), but you must do this if the first letter of the charset is a number, so that it doesn't think that it's still reading numbers for the offset/size.

You may give an offset alone, a size alone, or both. It works the same way it does with strings:

+X gives an offset. Example: +10blah.chr will read blah.chr from the 10th char.
#W gives a size. Example: #20blah.chr will read blah.chr from the beginning of the set, for 20 chars.
+X#W gives both. Example: +10#20blah.chr will read a 20 char set into blah.chr starting at the 10th char.

Also, now in Robotic you may import a char set with an offset given in decimal if you proceed it with an atsign (@).

load char set "@170blah.chr" will load blah.chr into the position of the 170th character. Note that the same padding rules for the editor also apply.

- File seeking in the editor

Now when selecting a file in MZX's file selector, you may press a letter or number to seek the first file beginning with that letter/number. If you press shift as well, it will seek the first directory starting with that letter/number. Note that 2 and 8 don't work because these already move the selector up/down.

- Save world counter

Now you may save the current MZX world (not save file, but world itself, a .mzx) with the save world counter:

set "temp.mzx" "save_world"

This is useful for saving what's changed in an MZX world without saving the counters as well; the saved world can then be loaded when MZX starts or using the swap world command.

- Fwrite_modify

Now you may open a file for reading as "fwrite_modify"; this will open an existing file without overwriting it and position the file pointers at the beginning of the file.

- File end seeking

You may now set fwrite_pos or fread_pos to -1 to make it seek the end of a file. This is useful for finding out the size of a file and for appending things to the end of it.

- Overlay to board and vice-versa

This was added a few versions ago, but it was done incorrectly so it didn't really work. However the methodology behind it has changed entirely so it's not simply a bug fix; this works very similarly to vlayer access.

To go from board to overlay:
copy block x1 y1 w h "+x1" "+y1"

To go from overlay to board:

copy overlay block x1 y1 w h "+x1" "+y1"

I'm not sure what happens if you use + destinations with the vlayer, but it's probably better not to try...

-- Bug fixes --

Charset/board/palette synchronization has been improved. Now there should be less flicker problems when any of these three are changed at the same time.

-- Known Issues --

Same other bugs as usual; swap world might cause crashes, so use it with care. Also the #/+ prefixes MAY cause very slightly incompatability with older games. If some things stop working, look for this, but it's unlikely that anyone really used anything like that.

That's all I can really think of right now, of course there might be more. I'd like to take this opportunity to send out a few thanks to those who have given me ideas, tested for me, and basically shown there general support:

Lipid - If it wasn't for your nagging I probably wouldn't have bothered to add file seeking. ^_^
Es - TNW motivated me to add save world, and besides that you've given a pretty good amount of feedback.
Lancer-X - LOTS of beta testing. Very helpful. Thanks a lot.
Apollyon - Some testing and ideas. Originally bounced the vlayer stuff on him, based off of an idea he had.
Wervyn - Testing, ideas, feedback, and most importantly of all, showing his appreciation.
Quasar84 - Testing and ideas and all that too. For being a workhorse ;)

And any others I forgot.. uh.. sorry.

If you encounter any bugs nag me about it on AIM (Exophase) or e-mail me (exophase@adelphia.net). Bother me with new feature ideas and I'll gun you down. :D

If you need your MZX fix or want to nag me over a FORUM then try these:

http://www.digitalmzx.net/
http://www.zeuxworld.com/

- Exophase








