/*This file must only me included after the file "viewport.h"

  Contents:  exec/memory.h
              exec/devices.h
              exec/io.h
              exec/semaphores.h
             (exec/exec.h       All files within this one are now included)
              graphics/gels.h
              graphics/regions.h
              graphics/clip.h
              graphics/sprite.h
*/

#ifndef ANIMATION_H
#define ANIMATION_H

#ifndef VIEWPORT_H
#include "viewport.h"
#endif

#ifndef EXEC_MEMORY_H
#define EXEC_MEMORY_H

struct MemChunk {
struct MemChunk *mc_Next;
ULONG mc_Bytes;
};
struct MemHeader {
struct Node mh_Node;
UWORD mh_Attributes;
struct MemChunk *mh_First;
APTR mh_Lower;
APTR mh_Upper;
ULONG mh_Free;
};
struct MemEntry {
union {
ULONG meu_Reqs;
APTR meu_Addr;
} me_Un;
ULONG me_Length;
};
#define me_un me_Un
#define me_Reqs me_Un.meu_Reqs
#define me_Addr me_Un.meu_Addr
struct MemList {
struct Node ml_Node;
UWORD ml_NumEntries;
struct MemEntry ml_ME[1];
};
#define ml_me ml_ME
#define MEMF_PUBLIC (1L<<0)
#define MEMF_CHIP (1L<<1)
#define MEMF_FAST (1L<<2)
#define MEMF_CLEAR (1L<<16)
#define MEMF_LARGEST (1L<<17)
#define MEM_BLOCKSIZE 8L
#define MEM_BLOCKMASK 7L
#endif





#ifndef EXEC_DEVICES_H
#define EXEC_DEVICES_H
#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif !EXEC_TYPES_H
#ifndef EXEC_LIBRARIES_H
#include "exec/libraries.h"
#endif !EXEC_LIBRARIES_H
#ifndef EXEC_PORTS_H
#include "exec/ports.h"
#endif !EXEC_PORTS_H
struct Device {
struct Library dd_Library;
};
struct Unit {
struct MsgPort *unit_MsgPort;
UBYTE unit_flags;
UBYTE unit_pad;
UWORD unit_OpenCnt;
};
#define UNITF_ACTIVE (1L<<0)
#define UNITF_INTASK (1L<<1)
#endif





#ifndef EXEC_IO_H
#define EXEC_IO_H

struct IORequest {
struct Message io_Message;
struct Device *io_Device;
struct Unit *io_Unit;
UWORD io_Command;
UBYTE io_Flags;
BYTE io_Error;
};
struct IOStdReq {
struct Message io_Message;
struct Device *io_Device;
struct Unit *io_Unit;
UWORD io_Command;
UBYTE io_Flags;
BYTE io_Error;
ULONG io_Actual;
ULONG io_Length;
APTR io_Data;
ULONG io_Offset;
};
#define DEV_BEGINIO (-30L)
#define DEV_ABORTIO (-36L)
#define IOB_QUICK 0L
#define IOF_QUICK (1L<<0)
#define CMD_INVALID 0L
#define CMD_RESET 1L
#define CMD_READ 2L
#define CMD_WRITE 3L
#define CMD_UPDATE 4L
#define CMD_CLEAR 5L
#define CMD_STOP 6L
#define CMD_START 7L
#define CMD_FLUSH 8L
#define CMD_NONSTD 9L
#endif





#ifndef EXEC_SEMAPHORES_H
#define EXEC_SEMAPHORES_H

struct Semaphore {
struct MsgPort sm_MsgPort;
WORD sm_Bids;
};
#define sm_LockMsg mp_SigTask
struct SemaphoreRequest {
struct MinNode sr_Link;
struct Task *sr_Waiter;
};
struct SignalSemaphore {
struct Node ss_Link;
SHORT ss_NestCount;
struct MinList ss_WaitQueue;
struct SemaphoreRequest ss_MultipleLink;
struct Task *ss_Owner;
SHORT ss_QueueCount;
};
#endif





#ifndef GRAPHICS_GELS_H
#define GRAPHICS_GELS_H
#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif
#define SUSERFLAGS 0x00FFL
#define VSPRITE 0x0001L
#define SAVEBACK 0x0002L
#define OVERLAY 0x0004L
#define MUSTDRAW 0x0008L
#define BACKSAVED 0x0100L
#define BOBUPDATE 0x0200L
#define GELGONE 0x0400L
#define VSOVERFLOW 0x0800L
#define BUSERFLAGS 0x00FFL
#define SAVEBOB 0x0001L
#define BOBISCOMP 0x0002L
#define BWAITING 0x0100L
#define BDRAWN 0x0200L
#define BOBSAWAY 0x0400L
#define BOBNIX 0x0800L
#define SAVEPRESERVE 0x1000L
#define OUTSTEP 0x2000L
#define ANFRACSIZE 6L
#define ANIMHALF 0x0020L
#define RINGTRIGGER 0x0001L
#ifndef VUserStuff
#define VUserStuff SHORT
#endif
#ifndef BUserStuff
#define BUserStuff SHORT
#endif
#ifndef AUserStuff
#define AUserStuff SHORT
#endif
struct VSprite
{
struct VSprite *NextVSprite;
struct VSprite *PrevVSprite;
struct VSprite *DrawPath;
struct VSprite *ClearPath;
WORD OldY, OldX;
WORD Flags;
WORD Y, X;
WORD Height;
WORD Width;
WORD Depth;
WORD MeMask;
WORD HitMask;
WORD *ImageData;
WORD *BorderLine;
WORD *CollMask;
WORD *SprColors;
struct Bob *VSBob;
BYTE PlanePick;
BYTE PlaneOnOff;
VUserStuff VUserExt;
};
struct Bob
{
WORD Flags;
WORD *SaveBuffer;
WORD *ImageShadow;
struct Bob *Before;
struct Bob *After;
struct VSprite *BobVSprite;
struct AnimComp *BobComp;
struct DBufPacket *DBuffer;
BUserStuff BUserExt;
};
struct AnimComp
{
WORD Flags;
WORD Timer;
WORD TimeSet;
struct AnimComp *NextComp;
struct AnimComp *PrevComp;
struct AnimComp *NextSeq;
struct AnimComp *PrevSeq;
WORD (*AnimCRoutine)();
WORD YTrans;
WORD XTrans;
struct AnimOb *HeadOb;
struct Bob *AnimBob;
};
struct AnimOb
{
struct AnimOb *NextOb, *PrevOb;
LONG Clock;
WORD AnOldY, AnOldX;
WORD AnY, AnX;
WORD YVel, XVel;
WORD YAccel, XAccel;
WORD RingYTrans, RingXTrans;
WORD (*AnimORoutine)();
struct AnimComp *HeadComp;
AUserStuff AUserExt;
};
struct DBufPacket
{
WORD BufY, BufX;
struct VSprite *BufPath;
WORD *BufBuffer;
};
#define InitAnimate(animKey) {*(animKey) = NULL;}
#define RemBob(b) {(b)->Flags |= BOBSAWAY;}
#define B2NORM 0L
#define B2SWAP 1L
#define B2BOBBER 2L
struct collTable
{
int (*collPtrs[16])();
};
#endif





#ifndef GRAPHICS_REGIONS_H
#define GRAPHICS_REGIONS_H

struct RegionRectangle
{
struct RegionRectangle *Next,*Prev;
struct Rectangle bounds;
};
struct Region
{
struct Rectangle bounds;
struct RegionRectangle *RegionRectangle;
};
#endif





#ifndef GRAPHICS_CLIP_H
#define GRAPHICS_CLIP_H

#define NEWLOCKS
struct Layer
{
struct Layer *front,*back;
struct ClipRect *ClipRect;
struct RastPort *rp;
struct Rectangle bounds;
UBYTE reserved[4];
UWORD priority;
UWORD Flags;
struct BitMap *SuperBitMap;
struct ClipRect *SuperClipRect;
APTR Window;
SHORT Scroll_X,Scroll_Y;
struct ClipRect *cr,*cr2,*crnew;
struct ClipRect *SuperSaveClipRects;
struct ClipRect *_cliprects;
struct Layer_Info *LayerInfo;
struct SignalSemaphore Lock;
UBYTE reserved3[8];
struct Region *ClipRegion;
struct Region *saveClipRects;
UBYTE reserved2[22];
struct Region *DamageList;
};
struct ClipRect
{
struct ClipRect *Next;
struct ClipRect *prev;
struct Layer *lobs;
struct BitMap *BitMap;
struct Rectangle bounds;
struct ClipRect *_p1,*_p2;
LONG reserved;
#ifdef NEWCLIPRECTS_1_1
LONG Flags;
#endif
};
#define CR_NEEDS_NO_CONCEALED_RASTERS 1L
#define ISLESSX 1L
#define ISLESSY 2L
#define ISGRTRX 4L
#define ISGRTRY 8L
#endif





#ifndef GRAPHICS_SPRITE_H
#define GRAPHICS_SPRITE_H

#define SPRITE_ATTACHED 0x80L
struct SimpleSprite
{
UWORD *posctldata;
UWORD height;
UWORD x,y;
UWORD num;
};
#endif

#endif ! ANIMATION_H
