Map mode

Tools, assembly, and file formats.
Post Reply
Draik
Posts: 117
Joined: Sat Jul 26, 2008 8:52 am
Contact:

Map mode

Post by Draik »

I finally got fed up with Mindbelt's "map mode" editing, and dived headfirst into the source code to do something about it. So now I just need a comprehensive guide to the sprite numbers etc. in map mode.

Information I have:
Level entrances - sprite number is same as level number
Level blockers - 32768 + level number

Information I don't have:
Teleporters - I am aware that these are handled differently in Keen 1 and 3, and not at all in Keen 2.
Messie - Not really important for me, but hey.

Help would be appreciated.
User avatar
Tulip
Posts: 394
Joined: Mon Jun 16, 2008 2:40 pm
Location: Heidelberg, Germany
Contact:

Post by Tulip »

Sprite 20 is the BwB by the way.

The placing of teleporters works nicely in Mindbelt, I don't think you have to do anything about that... (unless you need the information to change the rest)
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Oh please oh please oh PLEASE add connections for Keen 3 map teleporters like we have for bridges and switches!

Keen 1's teleporters are fixed locations. That is, each teleporter sprite goes to a preset location on the map. Aside from patching, they cannot be altered at all, so there's not much to do there.

Keen 3 is more complex. From http://levellord.rewound.net/Index/Keen ... orters.txt :

First we should define each teleporter's type and the sprite it has (By default
only!) Teleporters have no fixed location (And indeed their sprites can change
too.) Here are the teleport types, their sprites and their hex sprites:

# Dec Hex
0: 3842 [F02]
1: 3859 [F13]
2: 3877 [F25]
3: 3889 [F31]
4: 3911 [F47]
5: 3922 [F52]
6: 3947 [F6B]
7: 3955 [F73]
8: 3980 [F8C]
9: 3988 [F94]
10: 4014 [FAE]
11: 4025 [FB9]
12: 4032 [FC0]
13: 4063 [FDF]
14: 4072 [FE8]
15: 4094 [FFE]



Now, look at those hex sprites; notice anything? Well, they're really a subtle
code; the 'F' tells Keen that this is a teleporter; the second digit tells Keen
what type the teleporter is [Teleport 1,2,3...] and the final digit tells Keen
what teleporter he will teleport to.

By default the game uses 16 different types of teleporter (0-F) so the SECOND
digits of all the teleporters are different. You shouldn't mess with these. If
you do have two teleporters of the same type, only the bottom rightmost one in a
level will animate when Keen teleports, and Keen will teleport to that same one
from other teleporters.

You will be interested in changing the last digit of the sprite since this
defines where Keen is teleported to. NEVER try to make Keen teleport to a
teleport type that hasn't been placed on the map.
In summary:

* Teleporter sprites are 3840 ($F00) to 4095 ($FFF)
* A teleporter's 'identity' is ([sprite] - [sprite] mod 16) mod 256
* A teleporter's destination is [sprite] mod 16
Draik
Posts: 117
Joined: Sat Jul 26, 2008 8:52 am
Contact:

Post by Draik »

LL: I'll see what I can do. Thx for the info.

BTW, still looking for Nessie information if anyone cares.

EDIT: Of course, if no-one cares, that's fine too. I don't.

ANOTHER EDIT: I should stop doing that. I just felt like yelling about how Euphoria in its quest for simplicity and power somehow overlooked the switch statement. I'm drowning in "elsif"s.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Messie? What do you want to know about Messie?
Draik
Posts: 117
Joined: Sat Jul 26, 2008 8:52 am
Contact:

Post by Draik »

Well, what sprite numbers are used for defining Messie's path, etc.

I don't really need that urgently, though.
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Here's some patch adurdin made for me when I did A New Dope which required an entirely different route for Messie. Here's copied directly from the mod's patch file:

Code: Select all

# Messie patch, big thanks to adurdin for making this.
%patch $893B $90 $90 $90
%patch $895F $90 $90
%patch $896F $B8 $52 $00
%patch $8975 $B8 $25 $00
%patch $89C1 $90 $90 $90 $90 $90 $90 $90 $90 $90 $90 $90 $90 $90 $90 $90
I think, but am not sure, those $52 and $25 are the X and Y coordinates where Messie first appears when the map is loaded. Can't remember how its route is built, but it was simple, done with sprites (check the original Keen 3 map for their values, or my AND map).
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

*Rubs hands*

Like KR says, it's simple enough!


Path: Messie checks the 9 tiles around it (In a 3x3 square) for its sprite values, starting from top left and moving right and down. The first it encounters it will move to. (This means a dead end WILL reverse its direction)

The following values are used:

8192 ($2000) Normal path
8448 ($2100) Weed (Messie pause movement for a bit
8704 ($2200) Land (Messie can lose Keen if he moves away while Messie is on this square)


Start position:

Messie appears each time the map is loaded. Default is 33,7 on map. (In code 35,9) If no path tile is present, there is no Messie. If there is a path tile but no path tiles connected to it, Messie will move left until it either leaves the map or hits a path. (This can be used for a short 'one time only' stretch for Messie to move to.)

KR's patch changes the start position of Messie, but I'm not sure what else it does. (The new start position values are not where the default ones are.) A pity Andy isn't here to explain it.
Draik
Posts: 117
Joined: Sat Jul 26, 2008 8:52 am
Contact:

Post by Draik »

Thanks for the Messie info.

This would be easier if CK Guy were around, but in his absence, I'll just have to fudge the code around. The "show links" code is mildly nauseating (but not as bad as what I've written before actually thinking the code through. also euphoria is a strange language.)
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

No problem! I hope that we can see a tweaked version in a forum near us soon?
gerstrong
Posts: 63
Joined: Sun Jan 25, 2009 3:21 pm

Post by gerstrong »

I see, I come a bit too late.

I hope you solved your problem.

In the new version of CG we have been meddling around with the Messie algorithm. It is working like in the original...
Post Reply