Path: utzoo!mnetor!uunet!husc6!linus!gatech!gitpyr!yak!davidc From: davidc%yak@gatech.edu (Dave Corbin) Newsgroups: comp.sys.amiga Subject: Looking for help with Gels Animation. Message-ID: <5074@pyr.gatech.EDU> Date: 23 Feb 88 21:31:08 GMT Sender: news@pyr.gatech.EDU Reply-To: davidc%yak@gatech.edu (Dave Corbin) Organization: Office of Computing Services, Georgia Tech Lines: 272 I'm trying to dip my toe into the Animation waters. Unfortunately, I seem to have a problem. A copy of my program follows, and any help that anybody can give me is apprciated. What the program is supposed to do: move a rectangle from one corner of the screen{_ down a diagonal line, pause, and then cleanup. Problems: 1- The square seems to be a color that I don't think is in my screen's pallette. Confusing, but not serious. 2- When WIDTH is defined as 3L (test.h), I get the big guru during my call to InitMasks. If it is 1L or 2L, no guru. 3- When WIDTH is 2L, SOMETHING seems to be trashing 0000. (ThankYou, MemWatch). (LongWord 0 gets filled with my BoB pattern). Please excuse all the kputs, etc. They're left over from trying to figure out where things are going South. I presume that 2 & 3 are related. Oh yeah. I use Manx 3.4b with short ints. Again, thanks for any help. David Corbin #-----Cut Here----- echo Extracting ball.c... cat >ball.c < #include "geltools.h" #include "test.h" struct Bob *Bball = NULL; struct VSprite *Vball = NULL; StartBall(rp) struct RastPort *rp; { int i,d; Bball = AllocBob(); if (!Bball) Quit(-1); Vball = AllocSprite(); if (!Vball) Quit(-1); Bball->BobVSprite = Vball; Vball->VSBob = Bball; Vball->Height = HEIGHT; Vball->Width = WIDTHW; Vball->Depth = DEPTH; Vball->X = 0; Vball->Y = 0; kputs("A"); Vball->ImageData = AllocMem(WIDTHB*HEIGHT*DEPTH,MEMF_CHIP|MEMF_CLEAR); if (!Vball->ImageData) Quit(-1); kputs("B"); for (i=0; iImageData[i*DEPTH+d] = 0xffff; Vball->PlanePick = 0x0f; Vball->PlaneOnOff = 0x00; kputs("C"); Bball->ImageShadow = AllocMem(DEPTH*HEIGHT*WIDTHB,MEMF_CHIP); Vball->CollMask = Bball->ImageShadow; if (!Vball->CollMask) Quit(-1); mprintf("'%08lx",Vball->CollMask); #ifdef LATER kputs("D"); /* SaveBackground */ Vball->Flags |= SAVEBACK; Bball->SaveBuffer = AllocRaster(WIDTH,HEIGHT*DEPTH); if (!Bball->SaveBuffer) Quit(-1); #endif Bball->DBuffer = NULL; kputs("E"); InitMasks(Vball); kputs("F"); AddBob(Bball,rp); kputs("G"); } MoveBall() { Vball->Y++; return (Vball->X++ < 180); } RemoveBall() { if (Bball) { if (Bball->ImageShadow) FreeMem(Bball->ImageShadow,DEPTH*WIDTHB*HEIGHT); if (Bball->SaveBuffer) FreeRaster(Bball->SaveBuffer,WIDTH,HEIGHT*DEPTH); FreeBob(Bball); } if (Vball) { if (Vball->ImageData) FreeMem(Vball->ImageData,WIDTHB*HEIGHT*DEPTH); FreeSprite(Vball); } } END_OF_FILE echo Extracting main.c... cat >main.c < #include #include "geltools.h" #include "test.h" extern struct NewScreen NewScreenStructure; extern USHORT Palette[]; struct Screen *Screen = NULL; struct RastPort *rp; struct ViewPort *vp; struct IntutionBase *IntuitionBase = NULL; struct GfxBase *GfxBase = NULL; struct VSprite *head=NULL,*tail=NULL; struct GelsInfo GInfo; main() { int i; IntuitionBase = (void *)OpenLibrary("intuition.library",0L); if (!IntuitionBase) Quit(-1); GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0L); if (!GfxBase) Quit(-1); NewScreenStructure.Depth = DEPTH; Screen = OpenScreen(&NewScreenStructure); if (!Screen) Quit(-1); rp = &Screen->RastPort; vp = &Screen->ViewPort; LoadRGB4(vp,Palette,(long)sizeof(Palette)/sizeof(USHORT)); head = AllocSprite(); if (!head) Quit(-1); tail = AllocSprite(); if (!tail) Quit(-1); rp->GelsInfo = AllocMem((long)sizeof(struct GelsInfo),MEMF_CHIP|MEMF_CLEAR); if (!rp->GelsInfo) Quit(-1); InitGels(head,tail,rp->GelsInfo); StartBall(rp); #define MOVE #ifdef MOVE for (i=0; i<100; i++) { SortGList(rp); DrawGList(rp,vp); MoveBall(); } Delay(100L); #else SortGList(rp); DrawGList(rp,vp); Delay(100L); #endif Quit(0); } Quit(n) int n; { RemoveBall(); if (head) FreeSprite(head); if (tail) FreeSprite(tail); if (Screen) { if (Screen->RastPort.GelsInfo) FreeMem(Screen->RastPort.GelsInfo,(long)sizeof(struct GelsInfo)); CloseScreen(Screen); } if (GfxBase) CloseLibrary(GfxBase); if (IntuitionBase) CloseLibrary(IntuitionBase); exit(n); } END_OF_FILE echo Extracting pwwin.c... cat >pwwin.c <geltools.h <test.h <makefile <