Expand GWIDTH

As a macro, it always refers to the global grd_curcanv.  This interferes
with converting canvas handling to be an argument.  Expand GWIDTH so
that uses of grd_curcanv can be changed individually.
This commit is contained in:
Kp 2017-02-11 21:42:42 +00:00
parent 0d5d2e77a8
commit 03c43b1d7f
7 changed files with 13 additions and 7 deletions

View file

@ -33,7 +33,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define GR_BLEND_ADDITIVE_A 1 // additive alpha blending
#define GR_BLEND_ADDITIVE_C 2 // additive color blending
#define GWIDTH grd_curcanv->cv_bitmap.bm_w
#define GHEIGHT grd_curcanv->cv_bitmap.bm_h
#define SWIDTH (grd_curscreen->get_screen_width())
#define SHEIGHT (grd_curscreen->get_screen_height())

View file

@ -25,7 +25,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define MINX 0
#define MINY 0
#define MAXX (GWIDTH-1)
#define MAXY (GHEIGHT-1)
#define TYPE grd_curcanv->cv_bitmap.get_type()
#define DATA grd_curcanv->cv_bitmap.get_bitmap_data()

View file

@ -188,7 +188,7 @@ unsigned CLIState::draw(unsigned y, unsigned line_spacing)
int prompt_width, h;
gr_get_string_size(*grd_curcanv->cv_font, prompt_string, &prompt_width, &h, nullptr);
y -= line_spacing;
const auto canvas_width = GWIDTH;
const auto canvas_width = grd_curcanv->cv_bitmap.bm_w;
const unsigned max_pixels_per_line = canvas_width - (margin_width * 2) - prompt_width;
const unsigned unknown_cursor_line = ~0u;
const auto line_position = m_line_position;

View file

@ -754,7 +754,11 @@ static void draw_automap(automap *am)
#endif
if (PlayerCfg.MouseFlightSim && PlayerCfg.MouseFSIndicator)
show_mousefs_indicator(am->controls.raw_mouse_axis[0], am->controls.raw_mouse_axis[1], am->controls.raw_mouse_axis[2], GWIDTH-(GHEIGHT/8), GHEIGHT-(GHEIGHT/8), GHEIGHT/5);
{
const auto gwidth = grd_curcanv->cv_bitmap.bm_w;
auto &raw_mouse_axis = am->controls.raw_mouse_axis;
show_mousefs_indicator(raw_mouse_axis[0], raw_mouse_axis[1], raw_mouse_axis[2], gwidth - (GHEIGHT / 8), GHEIGHT - (GHEIGHT / 8), GHEIGHT / 5);
}
am->t2 = timer_query();
const auto vsync = CGameCfg.VSync;

View file

@ -3285,7 +3285,11 @@ void draw_hud(const object &plrobj)
if (PlayerCfg.CockpitMode[1] != CM_LETTERBOX)
show_reticle(player_info, PlayerCfg.ReticleType, 1);
if (PlayerCfg.CockpitMode[1] != CM_LETTERBOX && Newdemo_state != ND_STATE_PLAYBACK && PlayerCfg.MouseFlightSim && PlayerCfg.MouseFSIndicator)
show_mousefs_indicator(Controls.raw_mouse_axis[0], Controls.raw_mouse_axis[1], Controls.raw_mouse_axis[2], GWIDTH/2, GHEIGHT/2, GHEIGHT/4);
{
const auto gwidth = grd_curcanv->cv_bitmap.bm_w;
auto &raw_mouse_axis = Controls.raw_mouse_axis;
show_mousefs_indicator(raw_mouse_axis[0], raw_mouse_axis[1], raw_mouse_axis[2], gwidth / 2, GHEIGHT / 2, GHEIGHT / 4);
}
}
if (Rear_view && PlayerCfg.CockpitMode[1]!=CM_REAR_VIEW) {

View file

@ -1370,7 +1370,7 @@ static void newmenu_create_structure( newmenu *menu )
menu->w += BORDERX*2;
menu->h += BORDERY*2;
menu->x = (GWIDTH-menu->w)/2;
menu->x = (grd_curcanv->cv_bitmap.bm_w - menu->w) / 2;
menu->y = (GHEIGHT-menu->h)/2;
if ( menu->x < 0 ) menu->x = 0;

View file

@ -90,7 +90,7 @@ static color_t Erase_color;
// added by Jan Bobrowski for variable-size menu screen
static int rescale_x(int x)
{
return x * GWIDTH / 320;
return x * grd_curcanv->cv_bitmap.bm_w / 320;
}
static int rescale_y(int y)