| View previous topic :: View next topic |
| Author |
Message |
lemm
Joined: 05 Jul 2009 Posts: 532
|
Posted: Sat Aug 29, 2009 10:17 am Post subject: The IMPROVED Gravity Patch |
|
|
EDIT: Sep. 2, 2009. Now it modifies the actual gravity.
| Code: |
%ext ck1
%version 1.31
%patch $2C37 $03 #acceleration
%patch $2C3C $C8 $00 #max gravity
%patch $2C44 $C8 $00
%end
|
Last edited by lemm on Wed Sep 02, 2009 2:57 pm; edited 1 time in total |
|
| Back to top |
|
 |
levellass
Joined: 11 Oct 2006 Posts: 2053 Location: Ngaruawahia New Zealand
|
Posted: Sun Aug 30, 2009 1:35 pm Post subject: |
|
|
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.) |
|
| Back to top |
|
 |
lemm
Joined: 05 Jul 2009 Posts: 532
|
Posted: Sun Aug 30, 2009 5:29 pm Post subject: |
|
|
You get a buggy zero-gravity if you replace the relevant line with:
| Code: |
%patch $55F1 $B8 $F780W # mov ax, $0000W
|
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] |
|
| Back to top |
|
 |
levellass
Joined: 11 Oct 2006 Posts: 2053 Location: Ngaruawahia New Zealand
|
Posted: Mon Aug 31, 2009 6:23 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
CommanderSpleen

Joined: 31 Aug 2003 Posts: 965 Location: The Land of Sparkly Things
|
Posted: Mon Aug 31, 2009 7:01 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
levellass
Joined: 11 Oct 2006 Posts: 2053 Location: Ngaruawahia New Zealand
|
Posted: Tue Sep 01, 2009 12:20 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
lemm
Joined: 05 Jul 2009 Posts: 532
|
Posted: Wed Sep 02, 2009 3:08 pm Post subject: The IMPROVED, ERROR FREE gravity patch |
|
|
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. |
|
| Back to top |
|
 |
CommanderSpleen

Joined: 31 Aug 2003 Posts: 965 Location: The Land of Sparkly Things
|
Posted: Wed Sep 02, 2009 3:17 pm Post subject: |
|
|
| Sveet. Applause to thee! |
|
| Back to top |
|
 |
CommanderSpleen

Joined: 31 Aug 2003 Posts: 965 Location: The Land of Sparkly Things
|
Posted: Fri Sep 04, 2009 2:45 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
lemm
Joined: 05 Jul 2009 Posts: 532
|
Posted: Fri Sep 04, 2009 8:06 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
levellass
Joined: 11 Oct 2006 Posts: 2053 Location: Ngaruawahia New Zealand
|
Posted: Fri Sep 04, 2009 9:24 am Post subject: |
|
|
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! |
|
| Back to top |
|
 |
|