//Globals For Moving float Radar_X_Diff, Radar_Y_Diff; bool IsMoving = false; bool BeenMoved = false; VOID DrawRadar( ) { //Radar Width And Height if( !BeenMoved ) { float Radar_X = ( ScreenW / 6.0f ) * 4.75f; float Radar_Y = ( ScreenH / 6.0f ) / 3.0f; } float Radar_W = ( ScreenW / 5.0f ); float Radar_H = ( ScreenH / 4.5f ); //If It's Not Moving, Get The Coords if( IsMoving ) { Radar_X = CursorX - Radar_X_Diff; Radar_Y = CursorY - Radar_Y_Diff; } //Draw The Radar box orig_DrawStretchPic( Radar_X, Radar_Y, Radar_W, Radar_H, 0.0f, 0.0f, 0.0f, 0.0f, colorBar, White ); DrawRect( Radar_X, Radar_Y, Radar_W, Radar_H, 2.0f, colorWhite ); for( UINT dH = 0; dH < 2; dH++ ) { for( UINT dW = 0; dW < 2; dW++ ) { DrawRect( Radar_X + ( dW * ( Radar_W / 2.0f ) ), Radar_Y + ( dH * ( Radar_H / 2.0f ) ), ( Radar_W / 2.0f ), ( Radar_H / 2.0f ), 1.0f, colorWhite ); } } for( int i = 0; i < 64; i++ ) { float * TargetOrigin = Game->cg_entities[i].lerpOrigin; vec4_t res; VectorSubtract( TargetOrigin, Game->cg->refdef.vieworg, res ); float dx = DotProduct( res, Game->cg->refdef.viewaxis[1] ); float dy = DotProduct( res, Game->cg->refdef.viewaxis[0] ); float Xpos = ( Radar_X + ( Radar_W / 2.0f ) ) - ( dx * ( ( Radar_W / 2 ) / 5000 ) ); float Ypos = ( Radar_Y + ( Radar_H / 2.0f ) ) - ( dy * ( ( Radar_H / 2 ) / 5000 ) ); if( Xpos >= ( Radar_X + Radar_W - 1.0f ) || Xpos <= ( Radar_X + 1.0f ) || Ypos >= ( Radar_Y + Radar_H - 1.0f ) || Ypos <= ( Radar_Y + 1.0f ) ) { continue; } //Player Check if( Game->cg_entities[i].currentValid == 1 && Game->clientInfo[ Game->cg_entities[i].currentState.clientNum ].infoValid && Game->clientInfo[ Game->cg_entities[i].currentState.clientNum ].clientNum != Game->cg->clientNum && Game->clientInfo[ Game->cg_entities[i].currentState.clientNum ].team != TEAM_SPECTATOR ) { if( Game->cg_entities[i].currentState.clientNum != Game->cg->clientNum && Game->clientInfo[ Game->cg_entities[i].currentState.clientNum ].team != Game->clientInfo[ Game->cg->clientNum ].team ) { orig_DrawStretchPic( Xpos - 1.0f, Ypos - 1.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, colorRed, White ); } if( Game->cg_entities[i].currentState.clientNum != Game->cg->clientNum && Game->clientInfo[ Game->cg_entities[i].currentState.clientNum ].team == Game->clientInfo[ Game->cg->clientNum ].team ) { orig_DrawStretchPic( Xpos - 1.0f, Ypos - 1.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, colorGreen, White ); } } } //Set It To Not Moving IsMoving = false; //Is The Radar Clicked on if( CursorOnButton( CursorX, CursorY, Radar_X, Radar_Y, Radar_W, Radar_H ) && GetAsyncKeyState( VK_LBUTTON ) ) { Radar_X_Diff = CursorX - Radar_X; Radar_Y_Diff = CursorY - Radar_Y; IsMoving = true; BeenMoved = true; } }