Posted By: Razoron
Radarsystem - 06/27/10 11:50
I'm currently working on a Radarsystem.
Note, that this is a multiplayer project.
If create a game with 2 players (2 planes), the Radarsystem is working correctly.
But if I create a game with 3 players, just one plane is shown correctly, the others are shown somewhere wrong.
Here is the code:
Note, that this is a multiplayer project.
If create a game with 2 players (2 planes), the Radarsystem is working correctly.
But if I create a game with 3 players, just one plane is shown correctly, the others are shown somewhere wrong.
Here is the code:
Code:
#define PROP_X (screen_size.x/1280) #define PROP_Y (screen_size.y/1024) void RadarMainLoop() { int i; VECTOR draw; VECTOR drawoffset; PANEL*radarplanepan[30]; while(ent_MyPlane==NULL) { wait(1); } while(enet_ent_globpointer(ent_MyPlane)==ANET_ERROR) { wait(30); } wait(-1); for(i=0;i<20;i++) { if(ent_Plane[i]!=NULL) { if(enet_ent_globpointer(ent_Plane[i])!=ANET_ERROR) { radarplanepan[i]=pan_create(NULL,51); radarplanepan[i].bmap=img_hud_radarplane; } } } while(s_radar_active==TRUE) { for(i=0;i<20;i++) { if(ent_Plane[i]!=NULL) { if((abs(ent_Plane[i].x)+abs(ent_Plane[i].y)<=5000) && enet_ent_globpointer(ent_Plane[i])!=ANET_ERROR && ent_Plane[i]!=ent_MyPlane) { draw.x=ent_MyPlane.x-ent_Plane[i].x; draw.x=draw.x/19.53; draw.y=ent_MyPlane.y-ent_Plane[i].y; draw.y=draw.y/19.53; draw.z=0; vec_set(drawoffset,vector(-8,-8,0)); vec_rotate(drawoffset,ent_MyPlane.pan+180); vec_rotate(draw,ent_MyPlane.pan+180); draw.x+=(1024-8*PROP_X)*PROP_X; draw.y+=(768-8*PROP_Y)*PROP_Y; radarplanepan[i].pos_x=draw.x; radarplanepan[i].pos_y=draw.y; radarplanepan[i].angle=ent_Plane[i].pan; mgs=draw.x; parachutes=draw.y; set(radarplanepan[i],SHOW); } } } wait(1); } }