www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/02/16:15:26

From: "Evan" <mec_manREMOVETHIS AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Sprite Trouble
Date: Tue, 2 Jun 1998 15:03:30 -0500
Organization: OnTheNet www.getonthe.net
Lines: 79
Message-ID: <6l1m0g$rqs$1@news.getonthe.net>
NNTP-Posting-Host: max22.ctg146.getonthe.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I Have this function:

void SpriteInit(sprite *sprite,int x,int y,int height, int width, int ac,int
as,int mc,int ms)
{
// this function initializes a sprite with the sent data

int index;

sprite->x            = x;
sprite->y            = y;
sprite->oldX        = x;
sprite->oldY        = y;
sprite->width        = width;
sprite->height       = height;
sprite->aClock   = ac;
sprite->aSpeed   = as;
sprite->mClock = mc;
sprite->mSpeed = ms;
sprite->currFrame   = 0;
sprite->state        = 0;
sprite->numFrames   = 0;
sprite->background   = (char *)malloc(width * height+1);

// set all bitmap pointers to null

for (index=0; index<30; index++)
    sprite->frames[index] = NULL;

} // end Sprite_Init

and this structure:

typedef struct sprite_type
        {
         int x, y;
         int width, height;
         int oldX, oldY;
         int aClock, aSpeed;
         int mClock, mSpeed;
         char *frames[30];
         int currFrame;
         int numFrames;
         int state;
         char *background;
         void *extraData;
        } sprite;

and when I do this:

sprite *MySprite
SpriteInit(MySprite, 20, 20, 10, 10, 0, 0, 0, 0);

I get this:

General Protection Fault at eip=00000020
eax=00000000 ebx=00051180 ecx=00000007 edx=0000ffff esi=00000054
edi=0000f8dc
ebp=0004f8a4 esp=0004f8a4 program=c:/djgpp/Graph.exe
cs: sel=021f  base=8513b000  limit=0007ffff
ds: sel=0227  base=8513b000  limit=0007ffff
es: sel=0227  base=8513b000  limit=0007ffff
fs: sel=01f7  base=0000f310  limit=0000ffff
gs: sel=0237  base=00000000  limit=ffffffff
ss: sel=0227  base=8513b000  limit=0007ffff

Call frame traceback EIPs:
  0x00000020
  0x00000000

please help!!








- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019