diff --git a/common/include/fwd-gr.h b/common/include/fwd-gr.h index 86a0c1487..32b76b11e 100644 --- a/common/include/fwd-gr.h +++ b/common/include/fwd-gr.h @@ -278,7 +278,7 @@ template void gr_printt(grs_canvas &, int x, int y, const char *format, ...) __attribute_format_printf(4, 5); #define gr_printfs(...) gr_printt(__VA_ARGS__) #define gr_printfus(...) gr_printt(__VA_ARGS__) -#define gr_printf(A1,A2,F,...) dxx_call_printf_checked(gr_printfs,gr_string,(*grd_curcanv,A1,A2),(F),##__VA_ARGS__) +#define gr_printf(A1,A2,A3,F,...) dxx_call_printf_checked(gr_printfs,gr_string,(A1,A2,A3),(F),##__VA_ARGS__) #define gr_uprintf(A1,A2,A3,F,...) dxx_call_printf_checked(gr_printfus,gr_ustring,(A1,A2,A3),(F),##__VA_ARGS__) std::pair gr_get_string_wrap(const char *s, unsigned limit); void gr_get_string_size(const grs_font &, const char *s, int *string_width, int *string_height, int *average_width); diff --git a/similar/arch/ogl/ogl.cpp b/similar/arch/ogl/ogl.cpp index 8aec4297b..d99b1d054 100644 --- a/similar/arch/ogl/ogl.cpp +++ b/similar/arch/ogl/ogl.cpp @@ -329,10 +329,10 @@ static void ogl_texture_stats(void) const auto &&fspacx2 = FSPACX(2); const auto &&fspacy1 = FSPACY(1); const auto &&line_spacing = LINE_SPACING; - gr_printf(fspacx2, fspacy1, "%i flat %i tex %i bitmaps", r_polyc, r_tpolyc, r_bitmapc); - gr_printf(fspacx2, fspacy1 + line_spacing, "%i(%i,%i,%i,%i) %iK(%iK wasted) (%i postcachedtex)", used, usedrgba, usedrgb, usedidx, usedother, truebytes / 1024, (truebytes - databytes) / 1024, r_texcount - r_cachedtexcount); - gr_printf(fspacx2, fspacy1 + (line_spacing * 2), "%ibpp(r%i,g%i,b%i,a%i)x%i=%iK depth%i=%iK", idx, r, g, b, a, dbl, colorsize / 1024, depth, depthsize / 1024); - gr_printf(fspacx2, fspacy1 + (line_spacing * 3), "total=%iK", (colorsize + depthsize + truebytes) / 1024); + gr_printf(*grd_curcanv, fspacx2, fspacy1, "%i flat %i tex %i bitmaps", r_polyc, r_tpolyc, r_bitmapc); + gr_printf(*grd_curcanv, fspacx2, fspacy1 + line_spacing, "%i(%i,%i,%i,%i) %iK(%iK wasted) (%i postcachedtex)", used, usedrgba, usedrgb, usedidx, usedother, truebytes / 1024, (truebytes - databytes) / 1024, r_texcount - r_cachedtexcount); + gr_printf(*grd_curcanv, fspacx2, fspacy1 + (line_spacing * 2), "%ibpp(r%i,g%i,b%i,a%i)x%i=%iK depth%i=%iK", idx, r, g, b, a, dbl, colorsize / 1024, depth, depthsize / 1024); + gr_printf(*grd_curcanv, fspacx2, fspacy1 + (line_spacing * 3), "total=%iK", (colorsize + depthsize + truebytes) / 1024); } static void ogl_bindbmtex(grs_bitmap &bm, bool edgepad){ diff --git a/similar/main/automap.cpp b/similar/main/automap.cpp index b6d4442b7..f25230345 100644 --- a/similar/main/automap.cpp +++ b/similar/main/automap.cpp @@ -749,7 +749,7 @@ static void draw_automap(automap *am) #if defined(DXX_BUILD_DESCENT_II) if (HighlightMarker>-1 && MarkerMessage[HighlightMarker][0]!=0) { - gr_printf((SWIDTH/64),(SHEIGHT/18), "Marker %d: %s",HighlightMarker+1,&MarkerMessage[(Player_num*2)+HighlightMarker][0]); + gr_printf(*grd_curcanv, (SWIDTH/64),(SHEIGHT/18), "Marker %d: %s",HighlightMarker+1,&MarkerMessage[(Player_num*2)+HighlightMarker][0]); } #endif diff --git a/similar/main/console.cpp b/similar/main/console.cpp index 5297e8b54..fa19bd986 100644 --- a/similar/main/console.cpp +++ b/similar/main/console.cpp @@ -190,7 +190,7 @@ static void con_draw(void) } gr_rect(*grd_curcanv, 0, 0, SWIDTH, line_spacing, color); gr_set_fontcolor(BM_XRGB(255,255,255),-1); - gr_printf(fspacx1, fspacy1, "%s LOG", DESCENT_VERSION); + gr_printf(*grd_curcanv, fspacx1, fspacy1, "%s LOG", DESCENT_VERSION); gr_string(*grd_curcanv, SWIDTH - fspacx(110), fspacy1, "PAGE-UP/DOWN TO SCROLL"); } diff --git a/similar/main/gamerend.cpp b/similar/main/gamerend.cpp index 8260257fa..11aa371df 100644 --- a/similar/main/gamerend.cpp +++ b/similar/main/gamerend.cpp @@ -82,7 +82,7 @@ static void game_draw_marker_message() { gr_set_curfont(GAME_FONT); gr_set_fontcolor(BM_XRGB(0,63,0),-1); - gr_printf(0x8000, (LINE_SPACING*5)+FSPACY(1), "Marker: %s%c", &Marker_input[0], Marker_input[Marker_input.size() - 2] ? 0 : '_'); + gr_printf(*grd_curcanv, 0x8000, (LINE_SPACING*5)+FSPACY(1), "Marker: %s%c", &Marker_input[0], Marker_input[Marker_input.size() - 2] ? 0 : '_'); } } #endif @@ -102,9 +102,9 @@ static void game_draw_multi_message() gr_set_fontcolor(BM_XRGB(0,63,0),-1); const auto &&y = (LINE_SPACING * 5) + FSPACY(1); if (sending) - gr_printf(0x8000, y, "%s: %s_", TXT_MESSAGE, Network_message.data()); + gr_printf(*grd_curcanv, 0x8000, y, "%s: %s_", TXT_MESSAGE, Network_message.data()); else - gr_printf(0x8000, y, "%s #%d: %s_", TXT_MACRO, defining, Network_message.data()); + gr_printf(*grd_curcanv, 0x8000, y, "%s #%d: %s_", TXT_MACRO, defining, Network_message.data()); } static void show_framerate() @@ -125,9 +125,9 @@ static void show_framerate() const auto &&fspacx2 = FSPACX(2); const auto &&y = LINE_SPACING * 16; if (CGameArg.DbgVerbose) - gr_printf(fspacx2, y, "%iFPS (%.2fms)", fps_rate, (static_cast(1000) / (F1_0 / FrameTime))); + gr_printf(*grd_curcanv, fspacx2, y, "%iFPS (%.2fms)", fps_rate, (static_cast(1000) / (F1_0 / FrameTime))); else - gr_printf(fspacx2, y, "%iFPS", fps_rate); + gr_printf(*grd_curcanv, fspacx2, y, "%iFPS", fps_rate); } } @@ -158,22 +158,22 @@ static void show_netplayerinfo() y += line_spacing; gr_string(*grd_curcanv, 0x8000, y, Netgame.game_name.data()); y += line_spacing; - gr_printf(0x8000, y, "%s - lvl: %i", Netgame.mission_title.data(), Netgame.levelnum); + gr_printf(*grd_curcanv, 0x8000, y, "%s - lvl: %i", Netgame.mission_title.data(), Netgame.levelnum); const auto &&fspacx8 = fspacx(8); x += fspacx8; y += line_spacing * 2; unsigned gamemode = Netgame.gamemode; - gr_printf(x, y, "game mode: %s", gamemode < GMNames.size() ? GMNames[gamemode] : "INVALID"); + gr_printf(*grd_curcanv, x, y, "game mode: %s", gamemode < GMNames.size() ? GMNames[gamemode] : "INVALID"); y += line_spacing; - gr_printf(x,y,"difficulty: %s",MENU_DIFFICULTY_TEXT(Netgame.difficulty)); + gr_printf(*grd_curcanv, x,y,"difficulty: %s",MENU_DIFFICULTY_TEXT(Netgame.difficulty)); y += line_spacing; - gr_printf(x,y,"level time: %i:%02i:%02i", get_local_player().hours_level, f2i(get_local_player().time_level) / 60 % 60, f2i(get_local_player().time_level) % 60); + gr_printf(*grd_curcanv, x,y,"level time: %i:%02i:%02i", get_local_player().hours_level, f2i(get_local_player().time_level) / 60 % 60, f2i(get_local_player().time_level) % 60); y += line_spacing; - gr_printf(x,y,"total time: %i:%02i:%02i", get_local_player().hours_total, f2i(get_local_player().time_total) / 60 % 60, f2i(get_local_player().time_total) % 60); + gr_printf(*grd_curcanv, x,y,"total time: %i:%02i:%02i", get_local_player().hours_total, f2i(get_local_player().time_total) / 60 % 60, f2i(get_local_player().time_total) % 60); y += line_spacing; if (Netgame.KillGoal) - gr_printf(x,y,"Kill goal: %d",Netgame.KillGoal*5); + gr_printf(*grd_curcanv, x,y,"Kill goal: %d",Netgame.KillGoal*5); // player information (name, kills, ping, game efficiency) y += line_spacing * 2; @@ -196,20 +196,20 @@ static void show_netplayerinfo() const auto color = get_player_or_team_color(i); auto &prgb = player_rgb[color]; gr_set_fontcolor(BM_XRGB(prgb.r, prgb.g, prgb.b), -1); - gr_printf(x,y,"%s\n",static_cast(Players[i].callsign)); + gr_printf(*grd_curcanv, x,y,"%s\n",static_cast(Players[i].callsign)); { auto &plrobj = *vcobjptr(Players[i].objnum); auto &player_info = plrobj.ctype.player_info; auto v = ((Game_mode & GM_MULTI_COOP) ? player_info.mission.score - : (gr_printf(x + fspacx8 * 12, y,"%-6d", player_info.net_killed_total), player_info.net_kills_total) + : (gr_printf(*grd_curcanv, x + fspacx8 * 12, y,"%-6d", player_info.net_killed_total), player_info.net_kills_total) ); - gr_printf(x + fspacx8 * 7, y, "%-6d", v); + gr_printf(*grd_curcanv, x + fspacx8 * 7, y, "%-6d", v); } - gr_printf(x + fspacx8 * 18, y,"%-6d", Netgame.players[i].ping); + gr_printf(*grd_curcanv, x + fspacx8 * 18, y,"%-6d", Netgame.players[i].ping); if (i != Player_num) - gr_printf(x + fspacx8 * 23, y, "%hu/%hu", kill_matrix[Player_num][i], kill_matrix[i][Player_num]); + gr_printf(*grd_curcanv, x + fspacx8 * 23, y, "%hu/%hu", kill_matrix[Player_num][i], kill_matrix[i][Player_num]); } y += (line_spacing * 2) + (line_spacing * (MAX_PLAYERS - N_players)); @@ -222,12 +222,12 @@ static void show_netplayerinfo() gr_string(*grd_curcanv, x + fspacx8 * 8, y, "score"); y += line_spacing; gr_set_fontcolor(BM_XRGB(player_rgb[0].r,player_rgb[0].g,player_rgb[0].b),-1 ); - gr_printf(x,y,"%s:",static_cast(Netgame.team_name[0])); - gr_printf(x + fspacx8 * 8, y, "%i", team_kills[0]); + gr_printf(*grd_curcanv, x,y,"%s:",static_cast(Netgame.team_name[0])); + gr_printf(*grd_curcanv, x + fspacx8 * 8, y, "%i", team_kills[0]); y += line_spacing; gr_set_fontcolor(BM_XRGB(player_rgb[1].r,player_rgb[1].g,player_rgb[1].b),-1 ); - gr_printf(x,y,"%s:",static_cast(Netgame.team_name[1])); - gr_printf(x + fspacx8 * 8, y, "%i", team_kills[1]); + gr_printf(*grd_curcanv, x,y,"%s:",static_cast(Netgame.team_name[1])); + gr_printf(*grd_curcanv, x + fspacx8 * 8, y, "%i", team_kills[1]); y += line_spacing * 2; } else @@ -243,7 +243,7 @@ static void show_netplayerinfo() if (PhallicMan==-1) gr_string(*grd_curcanv, 0x8000, y, "There is no record yet for this level."); else - gr_printf(0x8000,y,"%s has the record at %d points.", static_cast(Players[PhallicMan].callsign), PhallicLimit); + gr_printf(*grd_curcanv, 0x8000,y,"%s has the record at %d points.", static_cast(Players[PhallicMan].callsign), PhallicLimit); } else #endif @@ -257,14 +257,14 @@ static void show_netplayerinfo() ) * 100.0 ); const unsigned eff = ieff < 0 ? 0 : static_cast(ieff); - gr_printf(0x8000,y,"Your lifetime efficiency of %d%% (%d/%d)",eff,PlayerCfg.NetlifeKills,PlayerCfg.NetlifeKilled); + gr_printf(*grd_curcanv, 0x8000,y,"Your lifetime efficiency of %d%% (%d/%d)",eff,PlayerCfg.NetlifeKills,PlayerCfg.NetlifeKilled); y += line_spacing; if (eff<60) - gr_printf(0x8000,y,"is %s your ranking.",eff_strings[eff/10]); + gr_printf(*grd_curcanv, 0x8000,y,"is %s your ranking.",eff_strings[eff/10]); else gr_string(*grd_curcanv, 0x8000, y, "is serving you well."); y += line_spacing; - gr_printf(0x8000,y,"your rank is: %s",RankStrings[GetMyNetRanking()]); + gr_printf(*grd_curcanv, 0x8000,y,"your rank is: %s",RankStrings[GetMyNetRanking()]); } } } @@ -315,7 +315,7 @@ static void draw_window_label() gr_set_curfont(GAME_FONT); gr_set_fontcolor(BM_XRGB(31,0,0),-1); - gr_printf(0x8000, (SHEIGHT/10), "%hu: %s [%s] View - %s", static_cast(vcobjptridx(Viewer)), viewer_name, viewer_id, control_name); + gr_printf(*grd_curcanv, 0x8000, (SHEIGHT/10), "%hu: %s [%s] View - %s", static_cast(vcobjptridx(Viewer)), viewer_name, viewer_id, control_name); } } @@ -340,7 +340,7 @@ static void render_countdown_gauge() #endif gr_set_curfont(GAME_FONT); gr_set_fontcolor(BM_XRGB(0,63,0),-1); - gr_printf(0x8000, (LINE_SPACING*6)+FSPACY(1), "T-%d s", Countdown_seconds_left ); + gr_printf(*grd_curcanv, 0x8000, (LINE_SPACING*6)+FSPACY(1), "T-%d s", Countdown_seconds_left ); } } } @@ -367,10 +367,10 @@ static void game_draw_hud_stuff() y = grd_curcanv->cv_bitmap.bm_h / 1.2 ; if (Newdemo_state == ND_STATE_PLAYBACK) { if (Newdemo_show_percentage) { - gr_printf(0x8000, y, "%s (%d%% %s)", TXT_DEMO_PLAYBACK, newdemo_get_percent_done(), TXT_DONE); + gr_printf(*grd_curcanv, 0x8000, y, "%s (%d%% %s)", TXT_DEMO_PLAYBACK, newdemo_get_percent_done(), TXT_DONE); } } else { - gr_printf(0x8000, y, "%s (%dK)", TXT_DEMO_RECORDING, (Newdemo_num_written / 1024)); + gr_printf(*grd_curcanv, 0x8000, y, "%s (%dK)", TXT_DEMO_RECORDING, (Newdemo_num_written / 1024)); } } diff --git a/similar/main/gauges.cpp b/similar/main/gauges.cpp index dccb113f2..384c7e360 100644 --- a/similar/main/gauges.cpp +++ b/similar/main/gauges.cpp @@ -764,7 +764,7 @@ static void sb_show_score(const player_info &player_info, const local_multires_g gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,20,0),-1 ); - gr_printf(HUD_SCALE_X(SB_SCORE_LABEL_X), HUD_SCALE_Y(SB_SCORE_Y), "%s:", (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ? TXT_KILLS : TXT_SCORE); + gr_printf(*grd_curcanv, HUD_SCALE_X(SB_SCORE_LABEL_X), HUD_SCALE_Y(SB_SCORE_Y), "%s:", (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ? TXT_KILLS : TXT_SCORE); gr_set_curfont( GAME_FONT ); snprintf(score_str, sizeof(score_str), "%5d", @@ -954,7 +954,7 @@ static void hud_show_orbs(const player_info &player_info, const local_multires_g gr_set_fontcolor(BM_XRGB(0,31,0),-1 ); auto &bm = Orb_icons[multires_gauge_graphic.is_hires()]; hud_bitblt_free(x, y, HUD_SCALE_Y_AR(bm.bm_w), HUD_SCALE_Y_AR(bm.bm_h), bm); - gr_printf(x + HUD_SCALE_X_AR(bm.bm_w), y, " x %d", player_info.secondary_ammo[PROXIMITY_INDEX]); + gr_printf(*grd_curcanv, x + HUD_SCALE_X_AR(bm.bm_w), y, " x %d", player_info.secondary_ammo[PROXIMITY_INDEX]); } } @@ -997,7 +997,7 @@ static void hud_show_energy(const player_info &player_info) gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,31,0),-1 ); const auto &&line_spacing = LINE_SPACING; - gr_printf(FSPACX(1), grd_curcanv->cv_bitmap.bm_h - ((Game_mode & GM_MULTI) ? (line_spacing * (5 + (N_players > 3))) : line_spacing),"%s: %i", TXT_ENERGY, f2ir(energy)); + gr_printf(*grd_curcanv, FSPACX(1), grd_curcanv->cv_bitmap.bm_h - ((Game_mode & GM_MULTI) ? (line_spacing * (5 + (N_players > 3))) : line_spacing),"%s: %i", TXT_ENERGY, f2ir(energy)); } if (Newdemo_state == ND_STATE_RECORDING) @@ -1022,7 +1022,7 @@ static void hud_show_afterburner(const player_info &player_info) const auto &&line_spacing = LINE_SPACING; y = (Game_mode & GM_MULTI) ? (-7 * line_spacing) : (-3 * line_spacing); - gr_printf(FSPACX(1), grd_curcanv->cv_bitmap.bm_h+y, "burn: %d%%" , fixmul(Afterburner_charge,100)); + gr_printf(*grd_curcanv, FSPACX(1), grd_curcanv->cv_bitmap.bm_h+y, "burn: %d%%" , fixmul(Afterburner_charge,100)); if (Newdemo_state==ND_STATE_RECORDING ) newdemo_record_player_afterburner(Afterburner_charge); @@ -1223,7 +1223,7 @@ static void hud_printf_vulcan_ammo(const player_info &player_info, const int x, ? 'V' : 'A' ; - gr_printf(x, y, "%c:%u", c, fmt_vulcan_ammo); + gr_printf(*grd_curcanv, x, y, "%c:%u", c, fmt_vulcan_ammo); } static void hud_show_primary_weapons_mode(const player_info &player_info, const int vertical, const int orig_x, const int orig_y) @@ -1475,9 +1475,9 @@ static void hud_show_weapons(const object &plrobj) hud_show_primary_weapons_mode(player_info, 1, x1, y); hud_show_secondary_weapons_mode(player_info, 1, x2, y); gr_set_fontcolor(BM_XRGB(14,14,23),-1 ); - gr_printf(x2, y - (line_spacing * 4),"%i", f2ir(plrobj.shields)); + gr_printf(*grd_curcanv, x2, y - (line_spacing * 4),"%i", f2ir(plrobj.shields)); gr_set_fontcolor(BM_XRGB(25,18,6),-1 ); - gr_printf(x1, y - (line_spacing * 4),"%i", f2ir(player_info.energy)); + gr_printf(*grd_curcanv, x1, y - (line_spacing * 4),"%i", f2ir(player_info.energy)); } else { @@ -1560,7 +1560,7 @@ static void hud_show_cloak_invuln(const player_flags player_flags, const fix64 c const auto cloak_invul_timer = show_cloak_invul_timer(); const auto a = [&](const fix64 effect_end, int y, const char *txt) { if (cloak_invul_timer) - gr_printf(fspacx1, y, "%s: %lu", txt, static_cast(effect_end / F1_0)); + gr_printf(*grd_curcanv, fspacx1, y, "%s: %lu", txt, static_cast(effect_end / F1_0)); else gr_string(*grd_curcanv, fspacx1, y, txt); }; @@ -1598,7 +1598,7 @@ static void hud_show_shield(const object &plrobj) const auto &&line_spacing = LINE_SPACING; const auto shields = plrobj.shields; - gr_printf(FSPACX(1), grd_curcanv->cv_bitmap.bm_h - ((Game_mode & GM_MULTI) ? line_spacing * (6 + (N_players > 3)) : line_spacing * 2), "%s: %i", TXT_SHIELD, shields >= 0 ? f2ir(shields) : 0); + gr_printf(*grd_curcanv, FSPACX(1), grd_curcanv->cv_bitmap.bm_h - ((Game_mode & GM_MULTI) ? line_spacing * (6 + (N_players > 3)) : line_spacing * 2), "%s: %i", TXT_SHIELD, shields >= 0 ? f2ir(shields) : 0); } if (Newdemo_state==ND_STATE_RECORDING ) @@ -1621,7 +1621,7 @@ static void hud_show_lives(const player_info &player_info, const local_multires_ if (Game_mode & GM_MULTI) { gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,31,0),-1 ); - gr_printf(x, FSPACY(1), "%s: %d", TXT_DEATHS, player_info.net_killed_total); + gr_printf(*grd_curcanv, x, FSPACY(1), "%s: %d", TXT_DEATHS, player_info.net_killed_total); } else if (get_local_player().lives > 1) { gr_set_curfont( GAME_FONT ); @@ -1630,7 +1630,7 @@ static void hud_show_lives(const player_info &player_info, const local_multires_ auto &bm = GameBitmaps[GET_GAUGE_INDEX(GAUGE_LIVES)]; const auto &&fspacy1 = FSPACY(1); hud_bitblt_free(x, fspacy1, HUD_SCALE_X_AR(bm.bm_w), HUD_SCALE_Y_AR(bm.bm_h), bm); - gr_printf(HUD_SCALE_X_AR(bm.bm_w) + x, fspacy1, " x %d", get_local_player().lives - 1); + gr_printf(*grd_curcanv, HUD_SCALE_X_AR(bm.bm_w) + x, fspacy1, " x %d", get_local_player().lives - 1); } } @@ -1642,7 +1642,7 @@ static void sb_show_lives(const player_info &player_info, const local_multires_g gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,20,0),-1 ); - gr_printf(HUD_SCALE_X(SB_LIVES_LABEL_X), HUD_SCALE_Y(y), "%s:", (Game_mode & GM_MULTI) ? TXT_DEATHS : TXT_LIVES); + gr_printf(*grd_curcanv, HUD_SCALE_X(SB_LIVES_LABEL_X), HUD_SCALE_Y(y), "%s:", (Game_mode & GM_MULTI) ? TXT_DEATHS : TXT_LIVES); const uint8_t color = BM_XRGB(0,0,0); if (Game_mode & GM_MULTI) @@ -1668,7 +1668,7 @@ static void sb_show_lives(const player_info &player_info, const local_multires_g gr_set_curfont( GAME_FONT ); PAGE_IN_GAUGE(GAUGE_LIVES, multires_gauge_graphic); hud_bitblt_free(HUD_SCALE_X(x), HUD_SCALE_Y(y), HUD_SCALE_X_AR(bm.bm_w), HUD_SCALE_Y_AR(bm.bm_h), bm); - gr_printf(HUD_SCALE_X(x) + HUD_SCALE_X_AR(bm.bm_w), HUD_SCALE_Y(y), " x %d", get_local_player().lives - 1); + gr_printf(*grd_curcanv, HUD_SCALE_X(x) + HUD_SCALE_X_AR(bm.bm_w), HUD_SCALE_Y(y), " x %d", get_local_player().lives - 1); } } @@ -1684,7 +1684,7 @@ static void show_time() Color_0_31_0 = BM_XRGB(0,31,0); gr_set_fontcolor(Color_0_31_0, -1 ); - gr_printf(FSPACX(2),(LINE_SPACING*15),"%d:%02d", mins, secs); + gr_printf(*grd_curcanv, FSPACX(2),(LINE_SPACING*15),"%d:%02d", mins, secs); } #endif @@ -2152,7 +2152,7 @@ static void draw_numerical_display(int shield, int energy, const local_multires_ const auto a = [](int xb, int v, int y) { int w; gr_get_string_size(*grd_curcanv->cv_font, get_gauge_width_string(v), &w, nullptr, nullptr); - gr_printf(xb - (w / 2), y, "%d", v); + gr_printf(*grd_curcanv, xb - (w / 2), y, "%d", v); }; gr_set_fontcolor(BM_XRGB(14,14,23),-1 ); const auto xb = grd_curscreen->get_screen_width() / 1.951; @@ -2208,7 +2208,7 @@ static void draw_weapon_info_sub(const player_info &player_info, const int info_ #endif { const auto &&line_spacing = LINE_SPACING; - gr_printf(text_x, text_y + line_spacing, "%s: %i", TXT_LVL, player_info.laser_level + 1); + gr_printf(*grd_curcanv, text_x, text_y + line_spacing, "%s: %i", TXT_LVL, player_info.laser_level + 1); if (player_info.powerup_flags & PLAYER_FLAGS_QUAD_LASERS) gr_string(*grd_curcanv, text_x, text_y + (line_spacing * 2), TXT_QUAD); } @@ -2319,7 +2319,7 @@ static void draw_ammo_info(int x,int y,int ammo_count) if (PlayerCfg.HudMode == HudType::Standard) { gr_set_fontcolor(BM_XRGB(20,0,0),-1 ); - gr_printf(x,y,"%03d",ammo_count); + gr_printf(*grd_curcanv, x,y,"%03d",ammo_count); } } @@ -2536,7 +2536,7 @@ static void sb_draw_energy_bar(int energy, const local_multires_gauge_graphic mu #elif defined(DXX_BUILD_DESCENT_II) unsigned y = SB_ENERGY_GAUGE_Y + SB_ENERGY_GAUGE_H - GAME_FONT->ft_h - (GAME_FONT->ft_h / 4); #endif - gr_printf((grd_curscreen->get_screen_width() / 3) - (ew / 2), HUD_SCALE_Y(y), "%d", energy); + gr_printf(*grd_curcanv, (grd_curscreen->get_screen_width() / 3) - (ew / 2), HUD_SCALE_Y(y), "%d", energy); gr_set_current_canvas(NULL); } @@ -2583,7 +2583,7 @@ static void sb_draw_shield_num(int shield, const local_multires_gauge_graphic mu gr_set_fontcolor(BM_XRGB(14,14,23),-1 ); gr_get_string_size(*grd_curcanv->cv_font, get_gauge_width_string(shield), &sw, nullptr, nullptr); - gr_printf((grd_curscreen->get_screen_width() / 2.266) - (sw / 2), HUD_SCALE_Y(SB_SHIELD_NUM_Y), "%d", shield); + gr_printf(*grd_curcanv, (grd_curscreen->get_screen_width() / 2.266) - (sw / 2), HUD_SCALE_Y(SB_SHIELD_NUM_Y), "%d", shield); } static void sb_draw_shield_bar(int shield, const local_multires_gauge_graphic multires_gauge_graphic) @@ -3003,16 +3003,16 @@ static void hud_show_kill_list() static_cast(player_info.net_killed_total) + static_cast(player_info.net_kills_total) ) * 100.0 ); - gr_printf(x1, y, "%i%%", eff <= 0 ? 0 : eff); + gr_printf(*grd_curcanv, x1, y, "%i%%", eff <= 0 ? 0 : eff); } else if (Show_kill_list == 3) - gr_printf(x1,y,"%3d",team_kills[i]); + gr_printf(*grd_curcanv, x1,y,"%3d",team_kills[i]); else if (Game_mode & GM_MULTI_COOP) - gr_printf(x1, y, "%-6d", vcobjptr(Players[player_num].objnum)->ctype.player_info.mission.score); + gr_printf(*grd_curcanv, x1, y, "%-6d", vcobjptr(Players[player_num].objnum)->ctype.player_info.mission.score); else if (Netgame.PlayTimeAllowed || Netgame.KillGoal) - gr_printf(x1,y,"%3d(%d)", player_info.net_kills_total, player_info.KillGoalCount); + gr_printf(*grd_curcanv, x1,y,"%3d(%d)", player_info.net_kills_total, player_info.KillGoalCount); else - gr_printf(x1,y,"%3d", player_info.net_kills_total); + gr_printf(*grd_curcanv, x1,y,"%3d", player_info.net_kills_total); if (PlayerCfg.MultiPingHud && Show_kill_list != 3) { @@ -3020,7 +3020,7 @@ static void hud_show_kill_list() x2 = SWIDTH - (fspacx64/2); else x2 = x0 + fspacx64; - gr_printf(x2,y,"%4dms",Netgame.players[player_num].ping); + gr_printf(*grd_curcanv, x2,y,"%4dms",Netgame.players[player_num].ping); } y += line_spacing; @@ -3226,7 +3226,7 @@ void draw_hud(const object &plrobj) y -= line_spacing * 2; } - gr_printf( x, y, "%s %2d%%", TXT_CRUISE, f2i(Cruise_speed) ); + gr_printf(*grd_curcanv, x, y, "%s %2d%%", TXT_CRUISE, f2i(Cruise_speed) ); } } diff --git a/similar/main/kmatrix.cpp b/similar/main/kmatrix.cpp index b354a1672..da208ae71 100644 --- a/similar/main/kmatrix.cpp +++ b/similar/main/kmatrix.cpp @@ -94,13 +94,13 @@ static void kmatrix_draw_item(int i, playernum_array_t &sorted) else { gr_set_fontcolor(rgb25, -1); - gr_printf(x, y, "-%hu", kmij); + gr_printf(*grd_curcanv, x, y, "-%hu", kmij); } } else { gr_set_fontcolor(kmij <= 0 ? rgb10 : rgb25, -1); - gr_printf(x, y, "%hu", kmij); + gr_printf(*grd_curcanv, x, y, "%hu", kmij); } } @@ -116,7 +116,7 @@ static void kmatrix_draw_item(int i, playernum_array_t &sorted) x = fspacx(60 + CENTERING_OFFSET(N_players) + N_players * 25); gr_set_fontcolor(rgb25, -1); - gr_printf(x, y, "%4d/%i%%", player_info.net_kills_total, eff <= 0 ? 0 : eff); + gr_printf(*grd_curcanv, x, y, "%4d/%i%%", player_info.net_kills_total, eff <= 0 ? 0 : eff); } static void kmatrix_draw_names(playernum_array_t &sorted) @@ -140,7 +140,7 @@ static void kmatrix_draw_names(playernum_array_t &sorted) c = BM_XRGB(rgb.r, rgb.g, rgb.b); } gr_set_fontcolor(c, -1); - gr_printf(x, fspacy(40), "%c", Players[sorted[j]].callsign[0u]); + gr_printf(*grd_curcanv, x, fspacy(40), "%c", Players[sorted[j]].callsign[0u]); } x = fspacx(72 + CENTERING_OFFSET(N_players) + N_players * 25); @@ -163,9 +163,9 @@ static void kmatrix_status_msg (fix time, int reactor) gr_set_fontcolor(gr_find_closest_color(255,255,255),-1); if (reactor) - gr_printf(0x8000, SHEIGHT-LINE_SPACING, "Waiting for players to finish level. Reactor time: T-%d", time); + gr_printf(*grd_curcanv, 0x8000, SHEIGHT-LINE_SPACING, "Waiting for players to finish level. Reactor time: T-%d", time); else - gr_printf(0x8000, SHEIGHT-LINE_SPACING, "Level finished. Wait (%d) to proceed or ESC to Quit.", time); + gr_printf(*grd_curcanv, 0x8000, SHEIGHT-LINE_SPACING, "Level finished. Wait (%d) to proceed or ESC to Quit.", time); } namespace { @@ -267,8 +267,8 @@ static void kmatrix_redraw_coop() gr_string(*grd_curcanv, x_callsign, y, static_cast(plr.callsign)); gr_set_fontcolor(rgb60_40_10, -1); auto &player_info = vcobjptr(plr.objnum)->ctype.player_info; - gr_printf(x_centerscreen, y, "%d", player_info.mission.score); - gr_printf(x_centerscreen + fspacx50, y, "%d", player_info.net_killed_total); + gr_printf(*grd_curcanv, x_centerscreen, y, "%d", player_info.mission.score); + gr_printf(*grd_curcanv, x_centerscreen + fspacx50, y, "%d", player_info.net_killed_total); } gr_palette_load(gr_palette); diff --git a/similar/main/menu.cpp b/similar/main/menu.cpp index 84e6be84a..19d9cb470 100644 --- a/similar/main/menu.cpp +++ b/similar/main/menu.cpp @@ -2385,7 +2385,7 @@ static window_event_result polygon_models_viewer_handler(window *, const d_event draw_model_picture(view_idx, &ang); gr_set_curfont(GAME_FONT); gr_set_fontcolor(BM_XRGB(255,255,255), -1); - gr_printf(FSPACX(1), FSPACY(1), "ESC: leave\nSPACE/BACKSP: next/prev model (%i/%i)\nA/D: rotate y\nW/S: rotate x\nQ/E: rotate z\nR: reset orientation",view_idx,N_polygon_models-1); + gr_printf(*grd_curcanv, FSPACX(1), FSPACY(1), "ESC: leave\nSPACE/BACKSP: next/prev model (%i/%i)\nA/D: rotate y\nW/S: rotate x\nQ/E: rotate z\nR: reset orientation",view_idx,N_polygon_models-1); break; case EVENT_WINDOW_CLOSE: load_palette(MENU_PALETTE,0,1); @@ -2463,7 +2463,7 @@ static window_event_result gamebitmaps_viewer_handler(window *, const d_event &e #endif gr_set_curfont(GAME_FONT); gr_set_fontcolor(BM_XRGB(255,255,255), -1); - gr_printf(FSPACX(1), FSPACY(1), "ESC: leave\nSPACE/BACKSP: next/prev bitmap (%i/%i)",view_idx,Num_bitmap_files-1); + gr_printf(*grd_curcanv, FSPACX(1), FSPACY(1), "ESC: leave\nSPACE/BACKSP: next/prev bitmap (%i/%i)",view_idx,Num_bitmap_files-1); break; case EVENT_WINDOW_CLOSE: load_palette(MENU_PALETTE,0,1); diff --git a/similar/main/scores.cpp b/similar/main/scores.cpp index b825cfcfe..1738e4173 100644 --- a/similar/main/scores.cpp +++ b/similar/main/scores.cpp @@ -421,7 +421,7 @@ static window_event_result scores_handler(window *wind,const d_event &event, sco gr_set_fontcolor( BM_XRGB(28,28,28), -1 ); - gr_printf(0x8000, fspacy(31), "%c%s%c - %s", 34, menu->scores.cool_saying, 34, static_cast(menu->scores.stats[0].name)); + gr_printf(*grd_curcanv, 0x8000, fspacy(31), "%c%s%c - %s", 34, menu->scores.cool_saying, 34, static_cast(menu->scores.stats[0].name)); for (int i=0; i