DireXt 9.0c moving Sprites not Loading unlike statics one. Why? Async position-SpriteLoad time maybe?

Please somebody explains me or if at least has any idea why this happens.

http://img687.imageshack.us/img687/9176/tempbugdirext.jpg

The code cant be more clear and straight, I look and re look and cant find something.
Sometimes, the stone sprite may load, but (!) simoultanousley its BLACK one is loaded, AND (!) the black one its the real that gives victory, if u go to the sprite one it simply disapears and nothings happens (!) What the hell "Ghosts in the machine"?!!
Could it be an asynchronized called of the Painter compared to position changing? However I call the painter after all position changes are done

Also the 2 static spritsew down right dont load however u can go there its an active location. That though not of my interest it EVEN MOST crazy

Please give an idea at least I've made this problem as more analysed and easy to understand I could even by making that Photoshop illustration.

DIRECT SCENE PAINTING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
void Labyrinth_Painter()
{
	int i=0, j=0, NewX=0, NewY=0;
    RECT rectObst, rectPath, rectM, rectL, rectO, rectMWon;
	if (d3ddev->BeginScene())
        {
			
            //erase the entire background
            d3ddev->ColorFill(backbuffer, NULL, D3DCOLOR_XRGB(0,0,0));
		
            //d3ddev->StretchRect(back, NULL, backbuffer, NULL, D3DTEXF_NONE);
	

            //draw the sprite
            //d3ddev->StretchRect(kitty_image[kitty.curframe], NULL, backbuffer, &rect, D3DTEXF_NONE);

			for (i = 0; i <20; i++)
			{
              for(j = 0; j < 50; j++)
              {
                if (Labyrinth[i][j]=='*')
                {
				 d3ddev->StretchRect(Obstacle_Image, NULL, backbuffer, &rectObst, D3DTEXF_NONE);
				 rectObst.left = Obstacle.x+NewX ;
				 rectObst.right = Obstacle.x + Obstacle.width+NewX;
				 rectObst.top = Obstacle.y+NewY;
			     rectObst.bottom = Obstacle.y + Obstacle.height+NewY;
				}
				if (Labyrinth[i][j]=='.')
                {
				 d3ddev->StretchRect(PathImage, NULL, backbuffer, &rectPath, D3DTEXF_NONE);
				 rectPath.left = PathBlock.x+NewX ;
				 rectPath.right = PathBlock.x + PathBlock.width+NewX;
				 rectPath.top = PathBlock.y+NewY;
			     rectPath.bottom = PathBlock.y + PathBlock.height+NewY;
				}
				
				if (Labyrinth[i][j]=='M')
                {
				 d3ddev->StretchRect(MpamphsImage, NULL, backbuffer, &rectM, D3DTEXF_NONE);
				 rectM.left = Mpamphs.x+NewX ;
				 rectM.right = Mpamphs.x + Mpamphs.width+NewX;
				 rectM.top = Mpamphs.y+NewY;
			     rectM.bottom = Mpamphs.y + Mpamphs.height+NewY;
				}
				
				if (Labyrinth[i][j]=='L')
                {
				 d3ddev->StretchRect(LuciusImage, NULL, backbuffer, &rectL, D3DTEXF_NONE);
				 rectL.left = Lucius.x+NewX ;
				 rectL.right = Lucius.x + Lucius.width+NewX;
				 rectL.top = Lucius.y+NewY;
			     rectL.bottom = Lucius.y + Lucius.height+NewY;
				}
				if (Labyrinth[i][j]=='O')
                {
				 d3ddev->StretchRect(PetradiImage, NULL, backbuffer, &rectO, D3DTEXF_NONE);
				 rectO.left = Petradi.x+NewX ;
				 rectO.right = Petradi.x + Petradi.width+NewX;
				 rectO.top = Petradi.y+NewY;
			     rectO.bottom = Petradi.y + Petradi.height+NewY;
				}
				
				NewX=NewX+21;
              }
			  NewY=NewY+21;
			  NewX=0;
			}          
			//if (MpamphsWon==true || LuciusWon==true)
			//{
				 d3ddev->StretchRect(MpamphsWonImage, NULL, backbuffer, &rectMWon, D3DTEXF_NONE);
				 rectMWon.left = 0 ;
				 rectMWon.right = 1046;
				 rectMWon.top = 400;
			     rectMWon.bottom = 460;
			//}
			//stop rendering
			d3ddev->EndScene();
		}
}



FILE READ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void File_Reader(char **Array)
{
     int i=0,j=0;
     char *mystring;
     mystring=(char*) malloc (52* sizeof(int));
     FILE * pFile;
     pFile = fopen ("LavirintosNDE.txt" , "r");
     
     while (  (fgets (mystring , 52 , pFile) != NULL) && i<20 ) 
     {
        for(j = 0; j < 50; j++)
        {
                Labyrinth[i][j] = mystring[j];
        }
        i++;          
     }
}


SPRITES INITIALIZATION
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Obstacle_Image = LoadSurface ("Wall2.bmp", NULL);
	PathImage = LoadSurface ("Path2.bmp", NULL);
	MpamphsImage = LoadSurface ("Mpamphs.bmp", NULL);
	LuciusImage = LoadSurface ("L.bmp", NULL);
	PetradiImage = LoadSurface ("O.bmp", NULL);
        back = LoadSurface("Menu.bmp", NULL );
	BackMpamphsWon = LoadSurface("bcgkMPAMPHS.bmp", NULL );
	BackLuciusWon = LoadSurface("bcgkLUCIUS.bmp", NULL );


	Obstacle.x = 0;
	Obstacle.y = 0;
	Obstacle.width = 21;
	Obstacle.height = 21;
	Obstacle.curframe = 0;
	Obstacle.lastframe = 0;
	Obstacle.animdelay = 2;
	Obstacle.animcount = 0;
	Obstacle.movex = 0;
	Obstacle.movey = 0;

	PathBlock.x = 0;
	PathBlock.y = 0;
	PathBlock.width = 21;
	PathBlock.height = 21;
	PathBlock.curframe = 0;
	PathBlock.lastframe = 0;
	PathBlock.animdelay = 2;
	PathBlock.animcount = 0;
	PathBlock.movex = 0;
	PathBlock.movey = 0;

	Mpamphs.x = 0;
	Mpamphs.y = 0;
	Mpamphs.width = 21;
	Mpamphs.height = 21;
	Mpamphs.curframe = 0;
	Mpamphs.lastframe = 0;
	Mpamphs.animdelay = 2;
	Mpamphs.animcount = 0;
	Mpamphs.movex = 0;
	Mpamphs.movey = 0;

	Lucius.x = 0;
	Lucius.y = 0;
	Lucius.width = 21;
	Lucius.height = 21;
	Lucius.curframe = 0;
	Lucius.lastframe = 0;
	Lucius.animdelay = 2;
	Lucius.animcount = 0;
	Lucius.movex = 0;
	Lucius.movey = 0;

	Petradi.x = 0;
	Petradi.y = 0;
	Petradi.width = 21;
	Petradi.height = 21;
	Petradi.curframe = 0;
	Petradi.lastframe = 0;
	Petradi.animdelay = 2;
	Petradi.animcount = 0;
	Petradi.movex = 0;
	Petradi.movey = 0;

    //initialize the sprite's properties


    //return okay
    return 1;

Last edited on
Topic archived. No new replies allowed.