Combine gauges left/right window boxes
This commit is contained in:
parent
b1c112d121
commit
888cfddabd
|
@ -44,6 +44,11 @@ static inline partial_range_t<I> partial_const_range(const char (&file)[NF], uns
|
|||
template <typename T, typename UL, std::size_t NF, std::size_t NE, typename I = decltype(begin(std::declval<T &&>()))>
|
||||
static inline partial_range_t<I> partial_const_range(const char (&file)[NF], unsigned line, const char (&estr)[NE], T &&t, const UL &l) = delete;
|
||||
|
||||
template <typename T, std::size_t NF, std::size_t NE, typename I = decltype(begin(std::declval<T>()))>
|
||||
__attribute_warn_unused_result
|
||||
static inline partial_range_t<I> make_range(const char (&file)[NF], unsigned line, const char (&estr)[NE], T &t);
|
||||
|
||||
#define unchecked_partial_range(T,...) unchecked_partial_range(__FILE__, __LINE__, #T, T, ##__VA_ARGS__)
|
||||
#define partial_range(T,...) partial_range(__FILE__, __LINE__, #T, T, ##__VA_ARGS__)
|
||||
#define partial_const_range(T,...) partial_const_range(__FILE__, __LINE__, #T, T, ##__VA_ARGS__)
|
||||
#define make_range(T,...) make_range(__FILE__, __LINE__, #T, T, ##__VA_ARGS__)
|
||||
|
|
|
@ -285,3 +285,11 @@ static inline partial_range_t<I> (partial_const_range)(const char (&file)[NF], u
|
|||
{
|
||||
return partial_range<const T, UL, NF, NE, I>(file, line, estr, t, l);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t NF, std::size_t NE, typename I>
|
||||
__attribute_warn_unused_result
|
||||
static inline partial_range_t<I> (make_range)(const char (&file)[NF], unsigned line, const char (&estr)[NE], T &t)
|
||||
{
|
||||
auto range_begin = begin(t);
|
||||
return unchecked_partial_range<I, std::size_t, std::size_t>(file, line, estr, range_begin, 0, partial_range_detail::get_range_size(t));
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "args.h"
|
||||
|
||||
#include "compiler-exchange.h"
|
||||
#include "compiler-range_for.h"
|
||||
#include "partial_range.h"
|
||||
|
||||
using std::min;
|
||||
|
||||
|
@ -435,323 +437,168 @@ struct span
|
|||
unsigned l, r;
|
||||
};
|
||||
|
||||
//store delta x values from left of box
|
||||
const span weapon_window_left[] = {
|
||||
{71,114},
|
||||
{69,116},
|
||||
{68,117},
|
||||
{66,118},
|
||||
{66,119},
|
||||
{66,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{65,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{64,119},
|
||||
{63,119},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,118},
|
||||
{63,117},
|
||||
{63,117},
|
||||
{64,116},
|
||||
{65,115},
|
||||
{66,113},
|
||||
{68,111},
|
||||
};
|
||||
|
||||
|
||||
//store delta x values from left of box
|
||||
const span weapon_window_right[] = {
|
||||
{208,255},
|
||||
{206,257},
|
||||
{205,258},
|
||||
{204,259},
|
||||
{203,260},
|
||||
{203,260},
|
||||
{203,260},
|
||||
{203,260},
|
||||
{203,260},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,261},
|
||||
{203,262},
|
||||
{203,262},
|
||||
{203,262},
|
||||
{203,262},
|
||||
{203,262},
|
||||
{203,262},
|
||||
{203,262},
|
||||
{203,262},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{204,263},
|
||||
{205,263},
|
||||
{206,262},
|
||||
{207,261},
|
||||
{208,260},
|
||||
{211,255},
|
||||
struct dspan
|
||||
{
|
||||
span l, r;
|
||||
};
|
||||
|
||||
//store delta x values from left of box
|
||||
const span weapon_window_left_hires[] = {
|
||||
{141,231},
|
||||
{139,234},
|
||||
{137,235},
|
||||
{136,237},
|
||||
{135,238},
|
||||
{134,239},
|
||||
{133,240},
|
||||
{132,240},
|
||||
{131,241},
|
||||
{131,241},
|
||||
{130,242},
|
||||
{129,242},
|
||||
{129,242},
|
||||
{129,243},
|
||||
{128,243},
|
||||
{128,243},
|
||||
{128,243},
|
||||
{128,243},
|
||||
{128,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{127,243},
|
||||
{126,243},
|
||||
{126,243},
|
||||
{126,243},
|
||||
{126,243},
|
||||
{126,242},
|
||||
{126,242},
|
||||
{126,242},
|
||||
{126,242},
|
||||
{126,242},
|
||||
{126,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{125,242},
|
||||
{124,242},
|
||||
{124,242},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{124,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{123,241},
|
||||
{122,241},
|
||||
{122,241},
|
||||
{122,240},
|
||||
{122,240},
|
||||
{122,240},
|
||||
{122,240},
|
||||
{122,240},
|
||||
{122,240},
|
||||
{122,240},
|
||||
{122,240},
|
||||
{121,240},
|
||||
{121,240},
|
||||
{121,240},
|
||||
{121,240},
|
||||
{121,240},
|
||||
{121,240},
|
||||
{121,240},
|
||||
{121,239},
|
||||
{121,239},
|
||||
{121,239},
|
||||
{121,238},
|
||||
{121,238},
|
||||
{121,238},
|
||||
{122,237},
|
||||
{122,237},
|
||||
{123,236},
|
||||
{123,235},
|
||||
{124,234},
|
||||
{125,233},
|
||||
{126,232},
|
||||
{126,231},
|
||||
{128,230},
|
||||
{130,228},
|
||||
{131,226},
|
||||
{133,223},
|
||||
};
|
||||
|
||||
const array<dspan, 43> weapon_windows_lowres = {{
|
||||
{{71,114}, {208,255}},
|
||||
{{69,116}, {206,257}},
|
||||
{{68,117}, {205,258}},
|
||||
{{66,118}, {204,259}},
|
||||
{{66,119}, {203,260}},
|
||||
{{66,119}, {203,260}},
|
||||
{{65,119}, {203,260}},
|
||||
{{65,119}, {203,260}},
|
||||
{{65,119}, {203,260}},
|
||||
{{65,119}, {203,261}},
|
||||
{{65,119}, {203,261}},
|
||||
{{65,119}, {203,261}},
|
||||
{{65,119}, {203,261}},
|
||||
{{65,119}, {203,261}},
|
||||
{{65,119}, {203,261}},
|
||||
{{64,119}, {203,261}},
|
||||
{{64,119}, {203,261}},
|
||||
{{64,119}, {203,261}},
|
||||
{{64,119}, {203,262}},
|
||||
{{64,119}, {203,262}},
|
||||
{{64,119}, {203,262}},
|
||||
{{64,119}, {203,262}},
|
||||
{{64,119}, {203,262}},
|
||||
{{64,119}, {203,262}},
|
||||
{{63,119}, {203,262}},
|
||||
{{63,118}, {203,262}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,118}, {204,263}},
|
||||
{{63,117}, {204,263}},
|
||||
{{63,117}, {205,263}},
|
||||
{{64,116}, {206,262}},
|
||||
{{65,115}, {207,261}},
|
||||
{{66,113}, {208,260}},
|
||||
{{68,111}, {211,255}},
|
||||
}};
|
||||
|
||||
//store delta x values from left of box
|
||||
const span weapon_window_right_hires[] = {
|
||||
{416,509},
|
||||
{413,511},
|
||||
{412,513},
|
||||
{410,514},
|
||||
{409,515},
|
||||
{408,516},
|
||||
{407,517},
|
||||
{407,518},
|
||||
{406,519},
|
||||
{406,519},
|
||||
{405,520},
|
||||
{405,521},
|
||||
{405,521},
|
||||
{404,521},
|
||||
{404,522},
|
||||
{404,522},
|
||||
{404,522},
|
||||
{404,522},
|
||||
{404,522},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,523},
|
||||
{404,524},
|
||||
{404,524},
|
||||
{404,524},
|
||||
{404,524},
|
||||
{405,524},
|
||||
{405,524},
|
||||
{405,524},
|
||||
{405,524},
|
||||
{405,524},
|
||||
{405,524},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,525},
|
||||
{405,526},
|
||||
{405,526},
|
||||
{406,526},
|
||||
{406,526},
|
||||
{406,526},
|
||||
{406,526},
|
||||
{406,526},
|
||||
{406,526},
|
||||
{406,526},
|
||||
{406,526},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,527},
|
||||
{406,528},
|
||||
{406,528},
|
||||
{407,528},
|
||||
{407,528},
|
||||
{407,528},
|
||||
{407,528},
|
||||
{407,528},
|
||||
{407,528},
|
||||
{407,528},
|
||||
{407,529},
|
||||
{407,529},
|
||||
{407,529},
|
||||
{407,529},
|
||||
{407,529},
|
||||
{407,529},
|
||||
{407,529},
|
||||
{407,529},
|
||||
{408,529},
|
||||
{408,529},
|
||||
{408,529},
|
||||
{409,529},
|
||||
{409,529},
|
||||
{409,529},
|
||||
{410,529},
|
||||
{410,528},
|
||||
{411,527},
|
||||
{412,527},
|
||||
{413,526},
|
||||
{414,525},
|
||||
{415,524},
|
||||
{416,524},
|
||||
{417,522},
|
||||
{419,521},
|
||||
{422,519},
|
||||
{424,518},
|
||||
};
|
||||
const array<dspan, 107> weapon_windows_hires = {{
|
||||
{{141,231}, {416,509}},
|
||||
{{139,234}, {413,511}},
|
||||
{{137,235}, {412,513}},
|
||||
{{136,237}, {410,514}},
|
||||
{{135,238}, {409,515}},
|
||||
{{134,239}, {408,516}},
|
||||
{{133,240}, {407,517}},
|
||||
{{132,240}, {407,518}},
|
||||
{{131,241}, {406,519}},
|
||||
{{131,241}, {406,519}},
|
||||
{{130,242}, {405,520}},
|
||||
{{129,242}, {405,521}},
|
||||
{{129,242}, {405,521}},
|
||||
{{129,243}, {404,521}},
|
||||
{{128,243}, {404,522}},
|
||||
{{128,243}, {404,522}},
|
||||
{{128,243}, {404,522}},
|
||||
{{128,243}, {404,522}},
|
||||
{{128,243}, {404,522}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{127,243}, {404,523}},
|
||||
{{126,243}, {404,524}},
|
||||
{{126,243}, {404,524}},
|
||||
{{126,243}, {404,524}},
|
||||
{{126,243}, {404,524}},
|
||||
{{126,242}, {405,524}},
|
||||
{{126,242}, {405,524}},
|
||||
{{126,242}, {405,524}},
|
||||
{{126,242}, {405,524}},
|
||||
{{126,242}, {405,524}},
|
||||
{{126,242}, {405,524}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{125,242}, {405,525}},
|
||||
{{124,242}, {405,526}},
|
||||
{{124,242}, {405,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,526}},
|
||||
{{124,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{123,241}, {406,527}},
|
||||
{{122,241}, {406,528}},
|
||||
{{122,241}, {406,528}},
|
||||
{{122,240}, {407,528}},
|
||||
{{122,240}, {407,528}},
|
||||
{{122,240}, {407,528}},
|
||||
{{122,240}, {407,528}},
|
||||
{{122,240}, {407,528}},
|
||||
{{122,240}, {407,528}},
|
||||
{{122,240}, {407,528}},
|
||||
{{122,240}, {407,529}},
|
||||
{{121,240}, {407,529}},
|
||||
{{121,240}, {407,529}},
|
||||
{{121,240}, {407,529}},
|
||||
{{121,240}, {407,529}},
|
||||
{{121,240}, {407,529}},
|
||||
{{121,240}, {407,529}},
|
||||
{{121,240}, {407,529}},
|
||||
{{121,239}, {408,529}},
|
||||
{{121,239}, {408,529}},
|
||||
{{121,239}, {408,529}},
|
||||
{{121,238}, {409,529}},
|
||||
{{121,238}, {409,529}},
|
||||
{{121,238}, {409,529}},
|
||||
{{122,237}, {410,529}},
|
||||
{{122,237}, {410,528}},
|
||||
{{123,236}, {411,527}},
|
||||
{{123,235}, {412,527}},
|
||||
{{124,234}, {413,526}},
|
||||
{{125,233}, {414,525}},
|
||||
{{126,232}, {415,524}},
|
||||
{{126,231}, {416,524}},
|
||||
{{128,230}, {417,522}},
|
||||
{{130,228}, {419,521}},
|
||||
{{131,226}, {422,519}},
|
||||
{{133,223}, {424,518}},
|
||||
}};
|
||||
|
||||
static inline void hud_bitblt_free (unsigned x, unsigned y, unsigned w, unsigned h, grs_bitmap &bm)
|
||||
{
|
||||
|
@ -1870,20 +1717,19 @@ static void cockpit_decode_alpha(grs_bitmap *const bm, const local_multires_gaug
|
|||
|
||||
// add alpha color to the pixels which are inside the window box spans
|
||||
const unsigned lower_y = ((multires_gauge_graphic.get(364, 151)));
|
||||
const unsigned upper_y = ((multires_gauge_graphic.get(469, 193))) - lower_y;
|
||||
const unsigned bm_w = bm->bm_w;
|
||||
unsigned i = bm_w * lower_y;
|
||||
const auto *wbl = (multires_gauge_graphic.is_hires() ? weapon_window_left_hires : weapon_window_left);
|
||||
const auto *wbr = (multires_gauge_graphic.is_hires() ? weapon_window_right_hires : weapon_window_right);
|
||||
const auto fill_alpha_one_line = [](unsigned o, const span &s) {
|
||||
std::fill_n(&cockpitbuf[o + s.l], s.r - s.l + 1, TRANSPARENCY_COLOR);
|
||||
};
|
||||
for (unsigned y=0;y < upper_y;y++)
|
||||
range_for (auto &s,
|
||||
multires_gauge_graphic.is_hires()
|
||||
? make_range(weapon_windows_hires)
|
||||
: make_range(weapon_windows_lowres)
|
||||
)
|
||||
{
|
||||
const auto &wbly = wbl[y];
|
||||
const auto &wbry = wbr[y];
|
||||
fill_alpha_one_line(i, wbly);
|
||||
fill_alpha_one_line(i, wbry);
|
||||
fill_alpha_one_line(i, s.l);
|
||||
fill_alpha_one_line(i, s.r);
|
||||
i += bm_w;
|
||||
}
|
||||
#ifdef OGL
|
||||
|
|
Loading…
Reference in a new issue