Patch:Sprite shifts

From KeenWiki
Jump to navigation Jump to search

Sprite shifts are the number of copies of a sprite held in game memory. This is necessary because EGA graphics divide the horizontal dimension of the screen into 8 pixel blocks. A single sprite image can only appear in half multiples of these, or every 4 pixels.

In the earliest EGA games this was overcome by all sprites having four graphics for each frame, each graphic being identical but shifted right by one pixel. (Hence the term 'shifts.') This meant that for every animation visible onscreen four times as much memory had to be set aside to house the shifts.

In the Keen Vorticon series this was simplified somewhat. Instead of four graphics per frame only one graphic was used. However the game would automatically generate shifts from this single frame, still requiring four times the memory requirement. (And having four entries in the EGAHEAD.CKx file.)

In the Keen Dreams and Galaxy series this was simplified even further. Each sprite frame could have a varying number of shifts depending on how smoothly it had to move (if it moved at all). This saved on memory as sprites that had naturally jerky motion or did not move could be kept to a single shift, taking only as much memory as needed to store the sprite. Smooth moving sprites on the other hand could have more shifts and use more memory when needed.

In Keen galaxy and Dreams the number of shifts each sprite has is stored in the graphics files, SPRITES.TXT (Modkeen) or LIST.TXT (Keengraph). It can thus be adjusted when graphics are edited and errors can occur (See below).


Bad shifts number

This is a graphics error that occurs when the modder has written an incorrect entry in SPRITES.TXT (Modkeen) or LIST.TXT (Keengraph) and imported it. This relates to the number of sprite shifts which can be 1, 2 or 4, but no other number. This number is the last number in every sprite entry in the text file. This error will only occur when an incorrect sprite animation is called, which will help narrow down the search.

See also Game errors.

Keen Galaxy and Dreams shifts errors

#Keen 4 :
%patch $13954  [$3B28W] #Text called from
%patch $32998 "CAL_CacheSprite: Bad shifts number!" $00

#Keen 5 :
%patch $148F1  [$327EW] #Text called from
%patch $335BE "CAL_CacheSprite: Bad shifts number!" $00

#Keen 6 :
%patch $13485  [$3528W] #Text called from
%patch $34258 "CAL_CacheSprite: Bad shifts number!" $00

#Keen 7 :
%patch $BEFC  [$2876W] #Text called from
%patch $262E6 "CAL_CacheSprite: Bad shifts number!" $00