Very juicy! I didn't think the level had a y-variable! Now all we need is to be able to change gravity on certain levels.
EDIT: You should also indicate if your patches are incompatible with others you have made. (For example the custom palette patch is incompatible with the status box patch, if I recall.)
However, every time a sprite hits the ground, it jumps, and sprites get stuck on the ceiling, similar to how they get stuck on the wall if the "breeze" is too strong, even if their maximum speed is faster than the breeze.[/code]
That's interesting; I wonder why? I do know some sprites have a zero speed if they hit tiles (This results in the Vorticons sometimes getting 'stuck' in a wall.
Hmm, maybe there's a loop that detects the ground by checking where Keen would theoretically fall next using the current velocity, and then subtracts from that value until it's not inside a tile? I don't know anything about how the game handles gravity, but this is a possible scenario.
At any rate there's evidently something else that needs to be patched besides a gravitational constant.
Well, I do know that the gravity/falling is separate from checking for floors/ceilings, since I've turned off the gravity for various sprites. (Or at least a small subroutine that when unpatched,, makes them fall.) so who knows? This is getting interesting.
UPDATE: look at the original post. This was actually an incredibly easy patch :p
What I was doing before was altering the map-positions of all sprites AFTER the collision detection etc had been calculated, so that's why the game was screwing up. This patch just modifies the acceleration and the maximum speed. In fact the gravitational constant WAS the only thing that needed patching ;-).
Levellass, you are right, there are two subroutines. This patch modifies the relatively straightforward do_fall() subroutine (0x2C2A). The other subroutine is check_keen_ground() (3f8b), which does the tile collisions by calling another subroutine and is horribly complicated and probably not a good idea to mess with.
There is also a check_ceiling() (0x3365), but I think this just deals with checking the invisible map ceiling as I don't see any references to the tile data.
Finally, if you are wondering about the game loop, I am starting another thread right now in K:V discussion.
Hmm, any idea on how to do this for specific sprites? I managed it with the gargs recently, with similar issues that you described with the previous version of this patch. But I don't quite recall how.
At the end of each think function for that sprite, right before the call to do_fall(), add a value to ds:8240, which is the y_velocity for the current sprite being modified.
Lem, Check_Ceiling does indeed push Keen down if he tries to exit non-map levels through the top. If you remove the push-down-ness of it, Keen dies by falling off the top of the level. Lol.
I have kept the breeze patch, but also added this new gravity patch; oddly enough it's been stumbled on before, by me, LL and Andy while trying to do other things. (I KNEW I recognized that line!) But this is the first time something functioning has been made.
Spleen: If you get precise patches, post them here!