GameHeaders/xthing.h

#pragma once
#include <Timer.h>
 
#define TaskActiveFlag 0x8000
 
typedef struct xQHdr {      
    long            qFlags;
    struct xthing   *qHead;
    struct xthing   *qTail;
    short           qEntries;
} xQHdr;
 
typedef Boolean (*updateProc)(struct xthing *xtp, long dataRef);
 
typedef struct xthing {
    TMTask          timer;          /* update time */
    struct xthing   *next;          /* link in xthing queue */
    long            prime;          /* number of miliseconds between runs */
    Boolean         taskFlag;       /* flag set when task is ready to fire */
    Boolean         waiting;        /* true if put in list with a task launched */
    Boolean         inList;         /* set after task is first added */
    long            dataRef;        /* handy place to put your gum */
    long            interval;       /* the interval between runs */
    updateProc      actionProc;     /* pointer to task service routine */
} xthing;
 
 
void xInitQueueHeader(xQHdr *queue);
void xEnqueue(xthing *qel, xQHdr *queue);
void xDequeue(xthing *qel, xQHdr *queue);
 
xthing *StartXThing(xthing *xtp, long prime, updateProc updtProc, long dataRef);
void ProcessXThingTask(short numTasksToProcess);
void InitXThingTask(void);
void KillAllXThingTasks(void);
 
void AddXThing(xthing *xtp, long prime, updateProc updtProc, long dataRef);
void EnqueueXThing(xthing *xtp);