Mail Archives: djgpp/1999/01/20/11:27:16
david bryant wrote:
[sippety snip snip]
> I allocate memory to *background by the statement
> background=(char *)malloc(sprite_width * sprite_height);
You shouldn't cast the return of malloc, it was orig used
to silence compiler warning messages but since ANSI/ISO and
the void * type it has become redundant and sometimes masks
errors.
Ok, make sure you have #include <stdlib.h>, I've forgotten this
before and the cast will mask this.
> A similar method is used to allocate memory for the sprite frames.
> The problem is this :
> When I read the background of the sprite from the virtual screen like
> this EXAMPLE : source->background[x]=virtual_screen[(y<<6)+(y<<8)+x]
> with my blit engine
> and try to blit it back with the line EXAMPLE :
> virtual_screen[(y<<6)+(y<<8)+x)=background[x],
> and blit the virtual screen to video memory with the _dosmemputl()
> function, I don't see my blit.
> I've debugged and according to all my variable checking, the data is
> going where it's supposed to go and the proper values are being
> assigned.
[chop]
going where it's supposed to go? could you elabourate on this,
is the background updated correctly with BACKGROUND = VIRT
is the virtual screen updated correctly with VIRT = BACKGROUND
what do you see when you blit to the vid mem? blank? garbage?
the background? half a frame?
perhaps if you included with this information some sample code,
your blit function for a start and the relavent malloc sections for
the background and sprite.
Do you test the return of malloc?
Ed Hill
- Raw text -