The tile-checking (and/or drawing) function is a 32-bit (far) pointer to code that instructs the sprite based on its collisions with tiles (top, left, bottom, or right blocking). The tile checking function is also responsible for directing the game to draw the sprite. Unlike the sprite behavior functions, which might be called sporadically, the tile checking function is always called, every animation frame.
This page provides a section that lists of the default values of tile collision pointers used in Keen Galaxy and Dreams. Following that section is a section that lists general tile interaction codes, that is, codes used by more than one sprite. (These are usually quite simple.) patches relating to the tile interaction codes of specific sprites will be found on their pages.
Note that the code responsible for keeping things out of solid tiles (That is walking through walls or falling through floors.) is separate and is known as 'clipping code' This will depend on a sprite's clipping value, and is the same for all sprites, the player included.
Related pages are Patch:Sprite behavior and Patch:Sprite collision. Patching tile check is simple enough, a four-byte pointer for every sprite action that you wish to change. Interestingly, sprite tile checks and drawing are rather simpler and different in Keen Vorticons, integrated with the main sprite code, and as such there are no patches for Vorticons on this page. Patches do however tend to be more difficult and only really useful when copying a value to increase the number of actions a sprite has.
Values in games
Keen 4: $00000000L #Nothing $04EC0FA8RL #Display 'Not enough memory to save game' window, restart level $0D8F0E32RL #Keen's shot (Hit walls, floors, ceilings and go zap.) $0E8F112FRL #Swimming Keen (Hit walls, ceilings and floor 'softly') $09DC1795RL #Walk back and forth, turn around at walls or edges $09DC176ERL #Sit (Ignore all tiles unless clipped to notice them) $09DC1847RL #Crawling Poison Slug $09DC1913RL #Used by shot sprites (Fall until hit ground) $0B801A7BRL #Floating Keen (Ignore all tiles, but stay in one place, e.g on poles.) $0B801AA2RL #Standing Keen $0B801B5FRL #Walking Keen $0B801C48RL #Jumping Keen $0B801F81RL #Pogoing Keen $0B802071RL #Going down poles Keen $0FA804ECRL #Mad Mushroom (Bounce like Mushroom off floors and ceilings) $0FA808A1RL #Walking Bird (Walk on ground) $0FA80945RL #Landing Bird (Check for gorund, if found become walking Bird) $0FA8097FRL #Eggshell fragment (Move until hit ground) $0FA809B4RL #Flying Bird (Hit walls, get stuck or go to landing Bird) $0FA80D0BRL #Flying Skypest (Bounce off stuff, land sometimes) $108002E1RL #Cloud (Float, reverse when hitting walls) $1080055ERL #Berkeloid flame (Fly through air, become landed flame after hitting ground) $108005B5RL #Flaming Berkeloid (Float above ground) $10800610RL #Berkeloid (Float above gound and 'walk' along it) $1080097ERL #Bounder (Bounce off ground) $10800C71RL #Lick on ground (Wait then jump) $10800F56RL #Controllable Airboard (Ignore tiles, look for B sprites) $11A203DERL #Jumping Smirky (Hit ceilings and stick, land on floors) $11A205C1RL #Jumping Mimrock (Hit ceilings, walls and floors) $11A2062ERL #Bouncing Mimrock (Hit floors) $11A20A3CRL #Swimming Dopefish and Schoolfish (Mind walls) $11A20CA1RL #Enemy shot (Darts, Sprite's shot; shoot into walls and vanish
Keen 5: $00000000L #Nothing $090B17B5RL #Solid (Default 'blocked by solid stuff collision used by many things) $090B17DCRL #Move l/r and down slopes $090B195ARL #Stunned $0AAF1A9FRL #Keen sit ('Sit in air'; similar to normal Keen) $0AAF1AC6RL #Keen (Blocked by blocking tiles, killed by deadly, etc, complex.) $0AAF1B83RL #Keen walk $0AAF1C6CRL #Keen in air (Fall, hit ground and walls) $0AAF200BRL #Keen pogo (Can break fuses!) $0AAF2145RL #Keen go down poles (If no pole left, fall) $0CCB11A2RL #Keen's shot $0F920119RL #Explosion fragments $0F9200A8RL #Master teleport $0F9216ACRL #Enemy shot $11020188RL #Sparky $11020679RL #Ampton walk (Check for poles and switches too) $11020897RL #Bouncy Slicestar $11020B2FRL #Shelley walk $11020BA1RL #Shelley fall $11C4090ERL #Shikadi mine $11C40B09RL #Robo red's shoot $11C40C03RL #Spirogrip slam $11C40D86RL #Spindred $11C411B0RL #Mater's shot $11C41248RL #Master's sparks $11C41538RL #Shikadi (Check for poles) $11C4179FRL #Shocksund $11C418CBRL #Shocksund jump $11C41980RL #Shocksund's shot $11C41AC4RL #Sphereful
Keen 6: TODO
Keen Dreams: TODO
General interaction codes
As mentioned above these are tile interaction codes that affect more than one sprite. Altering them will affect the game as a whole, but copying them may be useful.
This is the simplest interaction code, it does nothing but draw the sprite. Tile clipping is handled automatically by the clipping code. This code is used by anything that just needs to appear in-level and not worry about hills or walking. (E.g. Clouds.)
|Patch: Keen 4|