QAV.H 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef __QAV_H
  2. #define __QAV_H
  3. #include "typedefs.h"
  4. #include "gfx.h"
  5. #define kQAVSig "QAV\x1A"
  6. #define kQAVVersion 0x0200
  7. #define kMaxLayers 8
  8. enum
  9. {
  10. // begin rotatesprite compatible flags
  11. kQFrameNormal = 0, // no flags
  12. kQFrameTranslucent = 0x01, // frame is translucent
  13. kQFrameScale = 0x02, // frame is scaled to viewing window
  14. kQFrameYFlip = 0x04, // frame is y-flipped
  15. kQFrameUnclipped = 0x08, // frame is not clipped to umost/dmost
  16. kQFrameStatus = 0x0A, // frame is not masked (used for status bar)
  17. kQFrameCorner = 0x10, // frame is positioned by top left corner instead of origin
  18. kQFrameTranslucentR = 0x20, // frame is translucent, using reverse translucency table
  19. kQFrameNoMask = 0x40,
  20. kQFrameAllPages = 0x80,
  21. // begin internal flags
  22. kQFrameXFlip = 0x100, // frame is x-flipped
  23. };
  24. struct TRIGGER_FRAME
  25. {
  26. int id;
  27. };
  28. struct SOUND_FRAME
  29. {
  30. int id;
  31. uchar priority;
  32. uchar volume;
  33. ushort soundAngle;
  34. };
  35. struct TILE_FRAME
  36. {
  37. int id;
  38. int x, y;
  39. int zoom; // zoom in 16:16 fixed format
  40. int flags;
  41. schar shade;
  42. uchar pal;
  43. ushort angle; // angle in Build units (0 is straight up)
  44. };
  45. struct FRAME
  46. {
  47. TRIGGER_FRAME trigger;
  48. SOUND_FRAME sound;
  49. TILE_FRAME layer[kMaxLayers];
  50. };
  51. typedef void (*QAVCALLBACK)( int triggerId, void *data );
  52. struct QAV
  53. {
  54. char signature[4];
  55. short version;
  56. char dummy[2];
  57. int nFrames;
  58. int ticksPerFrame; // inverted play rate
  59. int duration; // length in ticks
  60. Point origin;
  61. char reserved[8];
  62. FRAME frame[];
  63. void Draw( long t, int shade, int flags );
  64. void Play( long t0, long t1, QAVCALLBACK callback = NULL, void *data = NULL );
  65. void Preload( void );
  66. };
  67. #endif