Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » i have a problem with the grabframe and draw_sprite

This thread is locked; no one can reply to it. rss feed Print
i have a problem with the grabframe and draw_sprite
chin jeong
Member #6,976
March 2006

this is an debug errors

buffer 0x05457658 {w=800 h=600 clip=-1 ...} BITMAP *
w 800 int
h 600 int
clip -1 int
cl 0 int
cr 800 int
ct 0 int
cb 600 int
+ vtable 0x10085258 {color_depth=16 mask_color=63519 unwrite_bank=0x10060548 ...} GFX_VTABLE *
write_bank 0x10060540 void *
read_bank 0x10060540 void *
dat 0x05bc0020 void *
id 0 unsigned long
extra 0x00000000 void *
x_ofs 0 int
y_ofs 0 int
seg 35 int
line 0x05457698 unsigned char * [?]
- dice_image 0x0040c6c0 _dice_image BITMAP * [8]
+ [0] 0x00000001 {w=??? h=??? clip=??? ...} BITMAP *
+ [1] 0x0546f160 {w=64 h=64 clip=-1 ...} BITMAP *
+ [2] 0x0546f2b8 {w=64 h=64 clip=-1 ...} BITMAP *
+ [3] 0x0546f410 {w=64 h=64 clip=-1 ...} BITMAP *
- [4] 0x0546f568 {w=64 h=64 clip=-1 ...} BITMAP *
w 64 int
h 64 int
clip -1 int
cl 0 int
cr 64 int
ct 0 int
cb 64 int
+ vtable 0x10085258 {color_depth=16 mask_color=63519 unwrite_bank=0x10060548 ...} GFX_VTABLE *
write_bank 0x10060540 void *
read_bank 0x10060540 void *
dat 0x05453050 void *
id 0 unsigned long
extra 0x00000000 void *
x_ofs 0 int
y_ofs 0 int
seg 35 int
line 0x0546f5a8 unsigned char * [?]
+ [5] 0x054817f8 {w=64 h=64 clip=-1 ...} BITMAP *
+ [6] 0x05481950 {w=64 h=64 clip=-1 ...} BITMAP *
+ [7] 0x05481aa8 {w=64 h=64 clip=-1 ...} BITMAP *
- dice_image[n] 0x00000001 {w=??? h=??? clip=??? ...} BITMAP *
w CXX0030: Error: expression cannot be evaluated int
h CXX0030: Error: expression cannot be evaluated int
clip CXX0030: Error: expression cannot be evaluated int
cl CXX0030: Error: expression cannot be evaluated int
cr CXX0030: Error: expression cannot be evaluated int
ct CXX0030: Error: expression cannot be evaluated int
cb CXX0030: Error: expression cannot be evaluated int
+ vtable CXX0017: Error: symbol "" not found GFX_VTABLE *
write_bank CXX0030: Error: expression cannot be evaluated void *
read_bank CXX0030: Error: expression cannot be evaluated void *
dat CXX0030: Error: expression cannot be evaluated void *
id CXX0030: Error: expression cannot be evaluated unsigned long
extra CXX0030: Error: expression cannot be evaluated void *
x_ofs CXX0030: Error: expression cannot be evaluated int
y_ofs CXX0030: Error: expression cannot be evaluated int
seg CXX0030: Error: expression cannot be evaluated int
line 0x00000041 unsigned char * [?]
mapxoff 0 int
n 0 int

and this is the code

1int n;
2
3 temp = load_bitmap("walk.pcx", NULL);
4 if (!temp)
5 {
6 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
7 allegro_message("Error loading bmp");
8 exit(0);
9 }
10 for (n = 0; n < 8; n++)
11 player_image[n] = grabframe(temp,32,64,0,0,8,n);
12 destroy_bitmap(temp);
13
14 player = malloc(sizeof(SPRITE));
15 player->x = 16;
16 player->y = 490;
17 player->curframe=0;
18 player->framecount=0;
19 player->framedelay=6;
20 player->maxframe=7;
21 player->width=player_image[0]->w;
22 player->height=player_image[0]->h;
23
24 temp = load_bitmap("dice.pcx", NULL);
25 if (!temp)
26 {
27 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
28 allegro_message("Error loading bmp");
29 exit(0);
30 }
31 for (n = 0; n < 8; n++)
32 dice_image[n] = grabframe(temp,64,64,0,0,8,n);
33 destroy_bitmap(temp);
34 
35for(n = 0; n < 8 ; n++)
36{
37
38 //draw the background tiles
39MapDrawBG(buffer, mapxoff, 0, 0, 0, WIDTH-1, HEIGHT-1);
40 //draw the player's sprite
41draw_sprite(buffer, dice_image[n],386,420);
42draw_sprite(buffer, player_image[n],player->x-mapxoff,player->y);
43 //blit the double buffer
44vsync();
45acquire_screen();
46blit(buffer, screen, 0, 0, 0, 0, WIDTH-1, HEIGHT-1);
47release_screen();
48clear_bitmap(buffer);
49}//for

there is no problem on the player_image[n] when i run the program
but will get error from the dice_image[n]...and the error appear when it run over the game loop cycle.

gnolam
Member #2,030
March 2002
avatar

1) Edit your post to use the code tags. :P
2) Post the code to your grabframe function.
3)

Quote:

draw_sprite(buffer, dice_image[n],386,420);
draw_sprite(buffer, player_image[n],player->x-mapxoff,player->y);

Aren't you supposed to have a for loop around that?

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Go to: