Sloped Tiles

Completed patches for Keen1.
Post Reply
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Sloped Tiles

Post by lemm » Thu Oct 15, 2009 9:49 am

http://files.commanderkeen.org/users/omp/Slopes.zip


Now sprites can run up and down slopes.

Requires the xtratile patch to function. The old animation plane now contains parameters y=mx+b, where m is the slope: rise in pixels per tile. b is the offset of the leftmost pixel from the top of the tile. So a tile sloping \ at 45 degrees would have m = 16 =, b = 0. A tile sloping / at 45 degrees would have m = -16, b = 16. It works pretty much with any angle under 45 degrees, although I haven't tested it for higher yet. You can take a look at the first bytes of level01.tls and compare it to 1til0001.bmp


I included a demo level, you can let the yorps chase you over the hills, which are run over rise = 1:1, 2:1, 3:1 and 4:1.

Notice also that (for now) you must have the non-sloped sides protected by a blocking tile. Also, you can't have different slopes really close to each other, nor can you have a slope end in a vertical wall (keen will just go through it).


Please also note that this invalidates any of my other patches that used "cg.bin", (but I don't think anyone was using the anyway). The new file "cgslope.bin" actually writes over the normal check_ground procedure and then extends into some mystery procedure which seems to have something to do with the sprite array, but I don't know what, because it never seems to get called. It isn't identified in the keen1 reverse engineering either, so maybe it's keen2 or keen3 specific. Anyways, if the game crashes, that may be why.

Anyways, just thought I'd let ppl test it out. Top sloping tiles will be coming shortly.

levellass
Posts: 2895
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass » Mon Oct 19, 2009 7:36 am

Hmmmn... by the looks of it, it may just be Keen 2-3. Wish I was better at poking.


I think I'll let you do more patching before trying to make an importer for this. (You should talk to Mink, see if he can't make some modifications to tileinfo.) I assume that each tile uses two bytes of the animation plane, the first the slope start, the second the slope itself? It is rather complicated though, Keen 4-6 uses only 45 and 23.5 degree slopes and that seems to suffice it pretty good, is there a reason for this being so flexible?

lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm » Mon Oct 19, 2009 1:45 pm

It was just easier that way.

Levack
Posts: 38
Joined: Sat Apr 21, 2012 1:20 pm

Post by Levack » Thu Nov 29, 2012 6:42 pm

This is cool! but how do I fix the graphics? They are messed up. ???

Post Reply