home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / documentation / documents / a252spr1 < prev    next >
Internet Message Format  |  1999-04-27  |  2KB

  1. From: RWilson@acorn.co.uk
  2. Subject: Faster sprite plotting
  3. Date: 6 Jun 91 10:37:05 GMT
  4.  
  5. How to display a sprite (a) mode independently and (b) quickly
  6. --------------------------------------------------------------
  7.  
  8. The key to doing this is to observe that the pixmap compiler which
  9. is driven by the put_sprite_scaled call (OS_SpriteOp 52) can do several
  10. clever things:
  11.  
  12. a) omit colour remapping
  13.  
  14. b) omit x and/or y size remapping
  15.  
  16. c) omit itself entirely and call put_sprite (OS_SpriteOp 34) (only
  17.    when a) and b) completely omitted)
  18.  
  19. BUT it can only do these things if given some helpful hints.
  20.  
  21. In order to provoke action a), you need to tell it that the pixel
  22. translation table should not be used - this can be done in the 1-1
  23. map situation by using code such as:
  24.  
  25. FORQ%=0TO255:pixtrans%?Q%=Q%:NEXT
  26. SYS "ColourTrans_SelectTable",m,palptr%,-1,-1,pixtrans%
  27. spx%=-1:FORQ%=0TO255:IFpixtrans%?Q%<>Q% spx%=pixtrans%
  28. NEXT
  29.  
  30. and then using spx% as the pixel translation table (r7) value for
  31. op 52. When spx% is -1 the pixel translation step will be omitted
  32. and this at least doubles the speed of the sprite plot.
  33.  
  34. Action b) comes from correctly specified scale factors: reduce them
  35. to the lowest terms and its happy.
  36.  
  37. Then action c) happens "as if by magic" and your sprites are plotted
  38. faster when the wind is behind them. And in any mode when it isn't.
  39. Action c) can be sped up by calling op 34 yourself having recognised
  40. that op 52 will be doing this - this avoids op 52 making several
  41. read mode variable calls.
  42.  
  43. --Roger Wilson
  44.  
  45.  
  46.