#include "fishes.h" #include #define DEPTH 3 #define ALLSTART 0 #define TEST extern short color[8]; extern short color1[8]; extern short color2[8]; short color92[] = { 0x28f, 0xffc, 0xfbf, 0xfd0, 0xf30, 0x90d, 0xff, 0xd9, }; extern struct AnimOb fishOb; extern struct Bob fish1Bob; extern struct AnimComp fish1Comp; extern struct GelsInfo *GInfo; extern struct VSprite *head, *tail; extern struct collTable *boom; SHORT timers[] = { /* fish's */ 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1, 1, 1, 1, 1, }; SHORT Index = 0; SHORT xtranslations[] = { /* fish's */ 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, }; SHORT ytranslations[] = { /* fish's */ 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, 0 << ANFRACSIZE, }; SHORT XVel[] = { /* fish's */ 4 << ANFRACSIZE, }; SHORT YVel[] = { /* fish's */ 0 << ANFRACSIZE, }; /* !!! define an animCRoutine here */ /* !!! define an animORoutine here */ fishMRoutine(anOb) struct AnimOb *anOb; { register struct AnimComp *acptr, *seqptr; acptr = anOb->HeadComp; while (acptr) { seqptr = acptr; do { if (seqptr->AnimBob->BobVSprite->Flags & GELGONE) { seqptr->AnimBob->BobVSprite->Flags &= ~GELGONE; fishOb.AnX = 0 << ANFRACSIZE; } seqptr = seqptr->NextSeq; } while (seqptr != acptr && (seqptr)); acptr = acptr->NextComp; } } fish1Routine(comp) struct AnimComp *comp; { /* if (fish1Comp.Timer == 1) fishOb.AnX += (87 << ANFRACSIZE); */ return(TRUE); } short startFlag = 4; animinit(animKey,vp, wR) struct AnimOb **animKey; struct ViewPort *vp; struct RastPort *wR; { SHORT i; Index = 0; fishOb.XVel = XVel[0]; fishOb.YVel = YVel[0]; fishOb.HeadComp = &fish1Comp; fish1Bob.Before = NULL; fish1Bob.After = NULL; InitAnimate(animKey); extrainit(&fishOb, TRUE, wR); AddAnimOb(&fishOb, animKey,wR); for (i = 0; i < 8; i++) SetRGB4(vp,i , (color92[i] >> 8) & 0x00F, (color92[i] >> 4) & 0x00F, (color92[i] >> 0) & 0x00F); } extrainit(animKey, addFlag,wR) struct AnimOb *animKey; BOOL addFlag; struct RastPort *wR; { struct AnimOb *anOb; struct AnimComp *acptr; struct AnimComp *seqptr, *sseqptr; struct Bob *bptr; struct Sprite *sptr; short i, depth, sw, sh; UBYTE *iptr, *i2ptr, *pptr; short ibufsize, pbufsize; /* animOb inits */ anOb = animKey; anOb->AnX = ALLSTART << ANFRACSIZE; anOb->AnY = 0; anOb->XAccel = 0; anOb->YAccel = 0; anOb->Clock = 0; acptr = anOb->HeadComp; while (acptr) { acptr->AnimBob->BobVSprite->X = (anOb->AnX + xtranslations[Index] + ANIMHALF) >> ANFRACSIZE; acptr->AnimBob->BobVSprite->Y = (anOb->AnY + ytranslations[Index] + ANIMHALF) >> ANFRACSIZE; sseqptr = seqptr = acptr; do { seqptr->AnimBob->Flags = BOBISCOMP; seqptr->AnimBob->BobVSprite->Flags = SAVEBACK|OVERLAY; seqptr->TimeSet = timers[Index]; seqptr->XTrans = xtranslations[Index]; seqptr->YTrans = ytranslations[Index]; seqptr->AnimBob->BobVSprite->PlaneOnOff= 0x10; Index++; seqptr = seqptr->NextSeq; } while (seqptr != sseqptr && (seqptr)); acptr = acptr->NextComp; } if (! (GetGBuffers(anOb, wR, TRUE))) { exit(3); } InitGMasks(anOb); } free_anim_obj(RPort) struct RastPort *RPort; { FreeGBuffers(&fishOb,RPort,TRUE); }