Log In  

Cart #57362 | 2018-10-01 | Code ▽ | Embed ▽ | No License
4

While I don't have any immediate plans for a mapper myself, a great many of you out there do. And that's construction work that could be made easier with this cart.

For this is not only a mapper creator and editor, it also has an in-board function quite similar to the MAP() routine - with the unique exception instead of reading the mapper memory, it reads a single string which contains the size of the map its edges, bits of other data, and the actual mapper data itself.

use import {image}.png to import your own 256-character tile/sprite set to use in the mapper.

Commands follow:

Hold (Z) key to bypass logo.

If you are creating a new map, you will have a very small input routine active.

Use the LEFT and RIGHT arrow keys to navigate by 1-character.
Use the UP and DOWN arrow keys to navigate by 3-characters.
Press (O) to type that character.
Press (X) or have the key select on "<" to erase the last typed character.
Have the key select on ">" to accept that input.

At this time NAME OF MAP is not being used or even recorded. I just put it there to test the input routine, you can skip it by selecting the ">" key.

In editor, tap (X) to do three things. One, change keyboard mode to four. Nice delays and speed, no increase with repeat. Two is select the tile beneath the cursor. Three is you will have an option of selecting any of the 256-sprites to draw on the map, but the cursor initially starts on the last tile you had highlighted back in the editor.

Press (O) to select that sprite/tile. (X) to cancel.

In editor, tap (O) to plot that tile/sprite.

Use arrow keys to scroll. If you choose an area that is bigger than the screen, it will scroll to reveal it.

Press both LEFT and RIGHT to see a demo of the Map-player. Use arrow keys to navigate. Use this function, DRAWMAP() in your code.

The function DRAWMAP() can be used directly in your own code. These are the arguments for it.

DRAWMAP (T,H,V,X,Y,DX,DY)
  T ... ( Map itself, a text string created from this program ,
  H ... the horizontal position to plot on the screen ,
  V ... the vertical position to plot on the screen ,
  X ... the size across to plot the map on the screen ,
  Y ... the size down to plot the map on the screen ,
 DX ... the starting position (top-left LEFT corner) of the map contents to draw ,
 DY ... the starting position (top-left TOP corner) of the map contents to draw )

As the actual code does not draw the entire cropped map, only the visible part, it should be plenty fast for you.

Back to the editor, press both (O) and (X) to save your map as a string to the clipboard.
Replace with the MAPP line near the top of the code to both save and continue working on your code.

Feel free to make changes or updates, especially optimizing code, these are always welcome !

If you have any questions or suggestions for improving the code, please let me know !

P#57363 2018-10-01 18:24 ( Edited 2018-11-19 23:33)

I have a question. Is it possible to have the map string hold a map bigger than 128x128? and is the DRAWMAP H and V measured in pixels or multiples of eight, like MAP? Thanks!

P#58150 2018-10-19 06:51 ( Edited 2018-10-19 10:51)

Yes, you can definitely exceed 128x128 PROVIDED you use my program. Default Mapper provided internally by PICO I believe is set to 128x128.

Would be nice if ZEP would allow for you to resize your map accordingly:

128x128
256x64
512x32
64x256
32x512

But no, you can use my program to exceed 128x128 in any direction. Another added advantage of using this is you can use up all 256-sprites and not need to worry about overwriting the true mapper space as both sprites and mapper share the same memory near the end.

P#58158 2018-10-19 11:38 ( Edited 2018-10-19 15:38)

So, how would I set a map tile in the code, it seems that Drawmap can draw it and do whatever I would need, but I need to edit the map from the code while it is running, and I cannot find witch function(s) do that here.
And what does that data decompressor function do? I am curious. Thanks for your patience.

P#59139 2018-11-18 13:30 ( Edited 2018-11-18 18:30)

Morning, HWD. Let's see ... You want to edit the map from the code while it is running ?

I'm not understanding - you can edit the map - while it's running - that's what the code does ?

The decompressor is an old compression algorithm to store the logo. I'm always interested in some sort of compression code.

I'm making use of it for the logo so it will not interfere with any tiles you want to IMPORT for your map work.

P#59176 2018-11-19 12:09 ( Edited 2018-11-19 17:09)

Oh, that makes sense.
About editing the map, I am looking for something like MSET(). I can see your program is made for editing the map data but not where in the code it happens. I am working on a very rudimentary(so far) terrain generator that will make the map itself, if that information helps.

P#59179 2018-11-19 12:33 ( Edited 2018-11-19 17:33)

The MSET occurs with the (Z) key being tapped. Let me check.

You need to look over 3-lines if you want to manually change the virtual map cel.

Line # 233 and Line # 249.

Line # 250 actually sets the map cel to the sprite you selected.

P#59180 2018-11-19 12:42 ( Edited 2018-11-19 17:42)

Thanks, I got it working now. Your help is greatly appreciated.

P#59196 2018-11-19 18:33 ( Edited 2018-11-19 23:33)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 10:59:22 | 0.012s | Q:23