mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Add translingual map legend code + border8
This commit is contained in:
parent
7840f72389
commit
3a3ec659d6
3 changed files with 38 additions and 8 deletions
|
@ -78,6 +78,7 @@ struct PrintFlags
|
||||||
Font* font_sel;
|
Font* font_sel;
|
||||||
uint8_t brightness;
|
uint8_t brightness;
|
||||||
bool border;
|
bool border;
|
||||||
|
bool border8;
|
||||||
bool align_cen;
|
bool align_cen;
|
||||||
bool align_right;
|
bool align_right;
|
||||||
bool cjk_low;
|
bool cjk_low;
|
||||||
|
@ -768,11 +769,17 @@ static PrintFlags decode_print_flags(uint32_t flags)
|
||||||
pf.font_sel = fontsel_to_font(FLAG_PART(3, 5));
|
pf.font_sel = fontsel_to_font(FLAG_PART(3, 5));
|
||||||
pf.brightness = ~FLAG_PART(8, 8) & 0xff;
|
pf.brightness = ~FLAG_PART(8, 8) & 0xff;
|
||||||
pf.border = flags & PR_BOR;
|
pf.border = flags & PR_BOR;
|
||||||
|
pf.border8 = flags & PR_BOR8;
|
||||||
pf.align_cen = flags & PR_CEN;
|
pf.align_cen = flags & PR_CEN;
|
||||||
pf.align_right = flags & PR_RIGHT;
|
pf.align_right = flags & PR_RIGHT;
|
||||||
pf.cjk_low = flags & PR_CJK_LOW;
|
pf.cjk_low = flags & PR_CJK_LOW;
|
||||||
pf.cjk_high = flags & PR_CJK_HIGH;
|
pf.cjk_high = flags & PR_CJK_HIGH;
|
||||||
|
|
||||||
|
if (pf.border8)
|
||||||
|
{
|
||||||
|
pf.border = false;
|
||||||
|
}
|
||||||
|
|
||||||
return pf;
|
return pf;
|
||||||
}
|
}
|
||||||
#undef FLAG_PART
|
#undef FLAG_PART
|
||||||
|
@ -1223,6 +1230,22 @@ void print(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pf.border8)
|
||||||
|
{
|
||||||
|
static const int offsets[8][2] = { {0,-1}, {-1,0}, {1,0}, {0,1}, {-1,-1}, {1,1}, {-1,1}, {1,-1} };
|
||||||
|
|
||||||
|
for (int offset = 0; offset < 8; offset++)
|
||||||
|
{
|
||||||
|
print(
|
||||||
|
flags & ~PR_BOR8 & ~PR_CEN & ~PR_RIGHT,
|
||||||
|
x + offsets[offset][0] * pf.scale,
|
||||||
|
y + offsets[offset][1] * pf.scale,
|
||||||
|
text,
|
||||||
|
0, 0, 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int h_diff_8 = (pf.font_sel->glyph_h-8)*pf.scale;
|
int h_diff_8 = (pf.font_sel->glyph_h-8)*pf.scale;
|
||||||
if (h_diff_8 < 0)
|
if (h_diff_8 < 0)
|
||||||
{
|
{
|
||||||
|
@ -1306,6 +1329,12 @@ int print_wrap(
|
||||||
flags &= ~PR_BOR;
|
flags &= ~PR_BOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pf.border8 && (r | g | b) != 0)
|
||||||
|
{
|
||||||
|
print_wrap(flags, x, y, text, 0, 0, 0, linespacing, maxwidth);
|
||||||
|
flags &= ~PR_BOR8;
|
||||||
|
}
|
||||||
|
|
||||||
// This could fit 64 non-BMP characters onscreen, should be plenty
|
// This could fit 64 non-BMP characters onscreen, should be plenty
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#define PR_FONT_IDX(idx) ((SDL_clamp(idx, 0, 28) + 3) << 3) /* use given font index */
|
#define PR_FONT_IDX(idx) ((SDL_clamp(idx, 0, 28) + 3) << 3) /* use given font index */
|
||||||
#define PR_BRIGHTNESS(value) /* use this brightness 0-255 for the text (accounts for button glyphs correctly) */\
|
#define PR_BRIGHTNESS(value) /* use this brightness 0-255 for the text (accounts for button glyphs correctly) */\
|
||||||
(((~SDL_clamp((int)(value), 0, 255) & 0xff) << 8))
|
(((~SDL_clamp((int)(value), 0, 255) & 0xff) << 8))
|
||||||
|
#define PR_BOR8 (1 << 16) /* draw a black border around the text, filling in the corners (for the map legend) */
|
||||||
#define PR_BOR (1 << 17) /* draw a black border around the text (was bprint/bigbprint) */
|
#define PR_BOR (1 << 17) /* draw a black border around the text (was bprint/bigbprint) */
|
||||||
#define PR_LEFT (0 << 18) /* default, left-align text/place at x coordinate */
|
#define PR_LEFT (0 << 18) /* default, left-align text/place at x coordinate */
|
||||||
#define PR_CEN (1 << 18) /* center-align text relative to X (X is center) or to screen if X == -1 */
|
#define PR_CEN (1 << 18) /* center-align text relative to X (X is center) or to screen if X == -1 */
|
||||||
|
|
|
@ -2512,15 +2512,15 @@ static MapRenderData getmaprenderdata(void)
|
||||||
switch (data.zoom)
|
switch (data.zoom)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
data.legendxoff += 21;
|
data.legendxoff += 20;
|
||||||
data.legendyoff += 16;
|
data.legendyoff += 14;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
data.legendxoff += 9;
|
data.legendxoff += 8;
|
||||||
data.legendyoff += 5;
|
data.legendyoff += 5;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
data.legendxoff += 3;
|
data.legendxoff += 2;
|
||||||
data.legendyoff += 1;
|
data.legendyoff += 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2576,11 +2576,11 @@ static void rendermaplegend(void)
|
||||||
{
|
{
|
||||||
if (map.showteleporters && map.isexplored(map.teleporters[i].x, map.teleporters[i].y))
|
if (map.showteleporters && map.isexplored(map.teleporters[i].x, map.teleporters[i].y))
|
||||||
{
|
{
|
||||||
graphics.drawtile(data.legendxoff + (map.teleporters[i].x * 12 * data.zoom), data.legendyoff + (map.teleporters[i].y * 9 * data.zoom), 1127 + tile_offset);
|
font::print(PR_FONT_8X8 | PR_BOR8, data.legendxoff + (map.teleporters[i].x * 12 * data.zoom), data.legendyoff + (map.teleporters[i].y * 9 * data.zoom), "💿", 171, 255, 252);
|
||||||
}
|
}
|
||||||
else if (map.showtargets && !map.isexplored(map.teleporters[i].x, map.teleporters[i].y))
|
else if (map.showtargets && !map.isexplored(map.teleporters[i].x, map.teleporters[i].y))
|
||||||
{
|
{
|
||||||
graphics.drawtile(data.legendxoff + (map.teleporters[i].x * 12 * data.zoom), data.legendyoff + (map.teleporters[i].y * 9 * data.zoom), 1126 + tile_offset);
|
font::print(PR_FONT_8X8 | PR_BOR8, data.legendxoff + (map.teleporters[i].x * 12 * data.zoom), data.legendyoff + (map.teleporters[i].y * 9 * data.zoom), "❓", 64, 64, 64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2590,7 +2590,7 @@ static void rendermaplegend(void)
|
||||||
{
|
{
|
||||||
if (!obj.collect[i])
|
if (!obj.collect[i])
|
||||||
{
|
{
|
||||||
graphics.drawtile(data.legendxoff + (map.shinytrinkets[i].x * 12 * data.zoom), data.legendyoff + (map.shinytrinkets[i].y * 9 * data.zoom), 1086 + tile_offset);
|
font::print(PR_FONT_8X8 | PR_BOR8, data.legendxoff + (map.shinytrinkets[i].x * 12 * data.zoom), data.legendyoff + (map.shinytrinkets[i].y * 9 * data.zoom), "🪙", 254, 252, 58);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3215,7 +3215,7 @@ void teleporterrender(void)
|
||||||
|
|
||||||
if (game.useteleporter && (help.slowsine % 16 > 8 || game.noflashingmode))
|
if (game.useteleporter && (help.slowsine % 16 > 8 || game.noflashingmode))
|
||||||
{
|
{
|
||||||
graphics.drawtile(data.legendxoff + data.xoff + (telex * 12 * data.zoom), data.legendyoff + data.yoff + (teley * 9 * data.zoom), 1128 + (graphics.flipmode ? 3 : 0));
|
font::print(PR_FONT_8X8 | PR_BOR8, data.legendxoff + data.xoff + (telex * 12 * data.zoom), data.legendyoff + data.yoff + (teley * 9 * data.zoom), "💿", 255, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
graphics.cutscenebars();
|
graphics.cutscenebars();
|
||||||
|
|
Loading…
Reference in a new issue