Advertisement
LilPinkus

Fire rod, spooky action at a distance

May 14th, 2018
1,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. Edit: Here's a non-technical explanation: https://gist.github.com/helgefmi/c105acfc617b3701f5e902e13b4df185
  2.  
  3. Pinkus - Today at 12:43 PM
  4. Found the culprit. The practice hack method just sets up memory in a way where it happens, it does not cause it I think.
  5.  
  6. When the fire rod charge (called an ancilla in the disassembly) hits the wall, it will look to see if it damaged an enemy (called a sprite) every 4th frame or so. It does this in Ancilla_CheckSingleBasicSpriteCollision in the disassembly. Basically it puts Ancilla hitboxes/size and Sprite hitboxes/size into $00-$0A in memory, then call a magic routine Utility_CheckIfHitBoxesOverlapLong which does some fancy math in only 20 instructions to decide if the two (sprite & ancilla in this case) overlaps or not.
  7.  
  8. The problem happens in Ancilla_SetupBasicHitBox. This method does something weird when it calculates the low byte of the Y coordinate - it basically does low_y = ancilla_low_y - 8 - altitude. The minus 8 is just to point to the center of the ancilla (since it's 0x10 in size), and the Minus altitude part is probably for objects like the Somaria block which can be thrown (and should be considered "higher up on the screen" when it has a height > 0.
  9.  
  10. The problem is that fire rod charges has no altitude, and the code does not reset the altitude to 0. So the altitude part is uninitialized, and you get random memory from previous ancilla. So you might end up damaging things from 0 to 16 tiles above where it appears to hit.
  11.  
  12. In the instance of arming the state with the practice hack method mentioned above, the crystal is an ancilla, and the altitude is set to 0x80 as you pick up the heart container. By reloading the preset, it stays in RAM. It's just happenstance that in that room, the first rod charge will take up ancilla spot 4, and the next takes up spot 3, which is shared by the spot the crystal uses (hence needing to have at least one ancilla on the screen first, before the tricks works).
  13. Items that will set altitude (array found at $029E[0xA])
  14. - Bombs. It's set to 0x11 when above head. With good throw you can set it to 0x19.
  15. - Somaria block. Same as bombs.
  16.  
  17. Must be more though, since Blunt got it to work on Arrghus by half a screen (0x19 would not be enough). The array doesn't seem to reset much, so could be something weird he did many screens before..
  18. Looks like different things generally use different slots. So bomb usese slot 1, then the next one slot 0. Fire rod seems to use slot 4 then slot 3. Of course if you already have 2 bombs and a somaria block on the screen you can manipulate which slot it will use.
  19.  
  20. Myramong - Today at 1:03 PM
  21. looks like swag duck uses the same slot as bombs/somaria, and leaves a much higher value, 0xA8
  22.  
  23. Pinkus - Today at 1:06 PM
  24. Also this bug does not seem to be in effect except for fire rod charges that hits the wall.. I guess it would be a fairly regular thing if arrow hits enemies before/after it hits them etc.
  25. I tried to light a torch with it too (gtower torches 2 could get a framesave from this) but couldn't get it to fire no matter what I put as altitude(edited)
  26. finally I can probably fix the practice hack bug for gauntlet 5 & mire 2 at least :>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement