delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/09/07:37:12

From: "Stefan Viljoen" <rylan AT intekom DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Distroy_Bitmap
Date: 9 Mar 1999 12:17:04 GMT
Organization: The South African Internet Exchange
Lines: 46
Message-ID: <01be6a77$d4d16de0$LocalHost@default>
References: <7bd1t7$es9 AT chronicle DOT concentric DOT net> <S41F2.5561$UL DOT 233 AT newsr1 DOT elp DOT rr DOT com>
NNTP-Posting-Host: pc25-02-p15.saix.net
X-Trace: news3.saix.net 920981824 20041 196.25.111.185 (9 Mar 1999 12:17:04 GMT)
X-Complaints-To: abuse AT saix DOT net
NNTP-Posting-Date: 9 Mar 1999 12:17:04 GMT
X-Newsreader: Microsoft Internet News 4.70.1155
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

@elp.rr.com wrote in article <S41F2.5561$UL DOT 233 AT newsr1 DOT elp DOT rr DOT com>...
> 
> Paradox wrote in message <7bd1t7$es9 AT chronicle DOT concentric DOT net>...
> >I'm having a problem with destroy_bitmap(). The compiler seems to not
like
> >it when I do the following
> >
> >void dest_proj(void) {
> >  int x;
> >  for(x = 0; x <MAXPROJ; x++) {
> >    if(player_ship.PROJ[x].proj_x > 575) {
> >      destroy_bitmap(player_ship.PROJ[x].proj);
> >      player_ship.PROJ[x].alive = 0;
> >    }
> >  }
> >}
> >
> >When the projectile exceeds 575, the program barfs and I get a GPF
error.
> >Proj is a bitmap of sprite_data[BASIC_BULLET].dat. FYI, 575 is the end
of
> >the screen, and I want to destroy the bitmap as it leaves the screen to
> >preserve memory.
> >
> >Thanks
> >Paradox.

I.ve ran into this too - check that MAXPROJ is actually one LESS than the
amount of sprites you have - this is what tripped me up seriously when I
started playing with DJGPP recently. (Experienced guys don't laugh please!)

If you have, say, and array of 50 bitmap pointers

BITMAP *proj_bmp[50];

You must refer to ths bitmap pointer array by looping from 0 to 49, NOT
from 1 to 50, or 0 to 50. Are you sure you are doing this?


-- 
Spawned By Rylan
Rylan AT intekom DOT co DOT za
http://home.intekom.com/rylan/

Power Overwhelming

- Raw text -


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