/* non-zero flag indicates the pixels needing EXCHG back. */ void plot(int x,int y,int flag) { if (flag) gr_upixel(y, x); else gr_upixel(x, y); }
void gr_ubox12(int left,int top,int right,int bot) { int i; for (i=top; i<=bot; i++ ) { gr_upixel( left, i ); gr_upixel( right, i ); } for (i=left; i<=right; i++ ) { gr_upixel( i, top ); gr_upixel( i, bot ); } }
int gr_vline(int y1, int y2, int x) { int i; if (y1 > y2) EXCHG(y1,y2); for (i=y1; i<=y2; i++ ) gr_upixel( x, i ); return 0; }
int gr_hline(int x1, int x2, int y) { int i; if (x1 > x2) EXCHG(x1,x2); for (i=x1; i<=x2; i++ ) gr_upixel( i, y ); return 0; }
void gr_ubitmapGENERIC(int x, int y, grs_bitmap * bm) { register int x1, y1; for (y1=0; y1 < bm->bm_h; y1++ ) { for (x1=0; x1 < bm->bm_w; x1++ ) { gr_setcolor( gr_gpixel(bm,x1,y1) ); gr_upixel( x+x1, y+y1 ); } } }
void gr_ubox12(int left,int top,int right,int bot) { #if 0 // the following shifts the box up 1 unit in OpenGL int i; for (i=top; i<=bot; i++ ) { gr_upixel( left, i ); gr_upixel( right, i ); } for (i=left; i<=right; i++ ) { gr_upixel( i, top ); gr_upixel( i, bot ); } #endif gr_uline(i2f(left), i2f(top), i2f(right), i2f(top)); gr_uline(i2f(right), i2f(top), i2f(right), i2f(bot)); gr_uline(i2f(left), i2f(top), i2f(left), i2f(bot)); gr_uline(i2f(left), i2f(bot), i2f(right), i2f(bot)); }
void gr_ubitmap012( int x, int y, grs_bitmap *bm ) { register int x1, y1; unsigned char * src; src = bm->bm_data; for (y1=y; y1 < (y+bm->bm_h); y1++ ) { for (x1=x; x1 < (x+bm->bm_w); x1++ ) { gr_setcolor( *src++ ); gr_upixel( x1, y1 ); } } }
void gr_ubitmapGENERICm(int x, int y, grs_bitmap * bm) { register int x1, y1; ubyte c; for (y1=0; y1 < bm->bm_h; y1++ ) { for (x1=0; x1 < bm->bm_w; x1++ ) { c = gr_gpixel(bm,x1,y1); if ( c != 255 ) { gr_setcolor( c ); gr_upixel( x+x1, y+y1 ); } } } }
void Vline(short y1, short y2, short x ) { for ( ; y1 <= y2; y1++ ) gr_upixel( x, y1 ); }
int gr_ucircle(fix xc1,fix yc1,fix r1) { int p,x, y, xc, yc, r; r = f2i(r1); xc = f2i(xc1); yc = f2i(yc1); p=3-(r*2); x=0; y=r; while(x<y) { // Draw the first octant gr_upixel( xc-y, yc-x ); gr_upixel( xc+y, yc-x ); gr_upixel( xc-y, yc+x ); gr_upixel( xc+y, yc+x ); if (p<0) p=p+(x<<2)+6; else { // Draw the second octant gr_upixel( xc-x, yc-y ); gr_upixel( xc+x, yc-y ); gr_upixel( xc-x, yc+y ); gr_upixel( xc+x, yc+y ); p=p+((x-y)<<2)+10; y--; } x++; } if(x==y) { gr_upixel( xc-x, yc-y ); gr_upixel( xc+x, yc-y ); gr_upixel( xc-x, yc+y ); gr_upixel( xc+x, yc+y ); } return 0; }
void radar_render_frame() { int i,color; object * objp; // added 7/5/99 - Owen Evans - radar resizes with screen size switch (Cockpit_mode) { case CM_FULL_SCREEN: Hostage_monitor_size = Game_window_w / 6; Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2; Hostage_monitor_y = (grd_curscreen->sc_h - Game_window_h) / 2; break; case CM_FULL_COCKPIT: Hostage_monitor_size = 40; Hostage_monitor_x = 0; Hostage_monitor_y = 80; break; case CM_STATUS_BAR: Hostage_monitor_size = Game_window_w / 6; Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2; Hostage_monitor_y = (max_window_h - Game_window_h) / 2; break; case CM_REAR_VIEW: //no radar in rear view or letterbox! case CM_LETTERBOX: return; } //end added - OE if (hostage_is_vclip_playing()) return; gr_set_current_canvas(NULL); gr_setcolor( BM_XRGB( 0, 31, 0 ) ); gr_ucircle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size)/2); //other stuff added 9/14/98 by Victor Rachels for fun. gr_circle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size) / 8 ); gr_upixel((Hostage_monitor_x+Hostage_monitor_size/2), (Hostage_monitor_y+Hostage_monitor_size/2) ); gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2)); gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2)); //killed 7/5/99 - Owen Evans - make radar much more useable // // Erase old blips // for (i=0; i<N_blips; i++ ) { // gr_setcolor(gr_gpixel( &GameBitmaps[cockpit_bitmap[0].index], Blips[i].x, Blips[i].y )); // gr_upixel( Blips[i].x, Blips[i].y ); // } //end killed - OE N_blips = 0; // if ( !(Players[Player_num].flags & (PLAYER_FLAGS_RADAR_ENEMIES | PLAYER_FLAGS_RADAR_POWERUPS )) ) return; radx = i2f(Hostage_monitor_size*4)/2; rady = i2f(Hostage_monitor_size*4)/2; cenx = i2f(Hostage_monitor_x)+i2f(Hostage_monitor_size)/2; ceny = i2f(Hostage_monitor_y)+i2f(Hostage_monitor_size)/2; rox = fixdiv( cenx, radx ); roy = fixdiv( ceny, rady ); objp = Objects; for (i=0;i<=Highest_object_index;i++) { switch( objp->type ) { case OBJ_PLAYER: if ( i != Players[Player_num].objnum ) { #ifdef NETWORK if (Game_mode & GM_TEAM) color = get_team(i); else #endif color = i; radar_plot_object( objp, gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b) ); } break; case OBJ_HOSTAGE: radar_plot_object( objp, BM_XRGB(0,31,0) ); break; case OBJ_POWERUP: //if ( Players[Player_num].flags & PLAYER_FLAGS_RADAR_POWERUPS ) if(!(Game_mode & GM_MULTI)) radar_plot_object( objp, BM_XRGB(0,0,31) ); break; case OBJ_ROBOT: // //if ( Players[Player_num].flags & PLAYER_FLAGS_RADAR_ENEMIES ) radar_plot_object( objp, BM_XRGB(31,0,0) ); break; // added 7/5/99 - Owen Evans - reactor is now shown on radar case OBJ_CNTRLCEN: radar_plot_object( objp, BM_XRGB(31,31,31) ); break; // end added - OE default: break; } objp++; } // Draw new blips... for (i=0; i<N_blips; i++ ) { gr_setcolor( Blips[i].c ); gr_upixel( Blips[i].x, Blips[i].y ); } }