From f1f15272242355ab7bc94028b4fa4b2e0f8152b5 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 3 Feb 2015 00:44:29 +0100 Subject: [PATCH 1/1] improved configurability of tape date and time display positions --- build-scripts/create_element_defs.pl | 1 + src/conf_gfx.c | 63 +++++++ src/conf_var.c | 244 +++++++++++++++++++++++++++ src/libgame/system.h | 6 +- src/tape.c | 23 ++- src/tape.h | 9 + 6 files changed, 336 insertions(+), 10 deletions(-) diff --git a/build-scripts/create_element_defs.pl b/build-scripts/create_element_defs.pl index af4b2bdf..8c097551 100755 --- a/build-scripts/create_element_defs.pl +++ b/build-scripts/create_element_defs.pl @@ -2395,6 +2395,7 @@ sub print_image_config_vars $var =~ s/^(game\.panel\..*)\.tile_size$/$1.size/; $var =~ s/^(request\.button\..*)\.tile_size$/$1.size/; $var =~ s/\.digits$/.size/; + $var =~ s/\.2nd_xoffset$/.xoffset2/; $var =~ s/\.element$/.id/; $var =~ s/\.draw_order$/.sort_priority/; diff --git a/src/conf_gfx.c b/src/conf_gfx.c index d44155d3..96ff7825 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -7097,14 +7097,77 @@ struct ConfigInfo image_config[] = { "tape.text.date.align", "left" }, { "tape.text.date.valign", "top" }, { "tape.text.date.digits", "-1" }, + { "tape.text.date.xoffset", "27" }, + { "tape.text.date.2nd_xoffset", "64" }, { "tape.text.date.font", "font.tape_recorder" }, + { "tape.text.date.draw_masked", "false" }, + + { "tape.text.date_yyyy.x", "-1" }, + { "tape.text.date_yyyy.y", "-1" }, + { "tape.text.date_yyyy.align", "left" }, + { "tape.text.date_yyyy.valign", "top" }, + { "tape.text.date_yyyy.digits", "2" }, + { "tape.text.date_yyyy.font", "font.tape_recorder" }, + { "tape.text.date_yyyy.draw_masked", "true" }, + { "tape.text.date_yy.x", "-1" }, + { "tape.text.date_yy.y", "-1" }, + { "tape.text.date_yy.align", "left" }, + { "tape.text.date_yy.valign", "top" }, + { "tape.text.date_yy.digits", "2" }, + { "tape.text.date_yy.font", "font.tape_recorder" }, + { "tape.text.date_yy.draw_masked", "true" }, + { "tape.text.date_mmm.x", "-1" }, + { "tape.text.date_mmm.y", "-1" }, + { "tape.text.date_mmm.align", "left" }, + { "tape.text.date_mmm.valign", "top" }, + { "tape.text.date_mmm.digits", "2" }, + { "tape.text.date_mmm.font", "font.tape_recorder" }, + { "tape.text.date_mmm.draw_masked", "true" }, + { "tape.text.date_mm.x", "-1" }, + { "tape.text.date_mm.y", "-1" }, + { "tape.text.date_mm.align", "left" }, + { "tape.text.date_mm.valign", "top" }, + { "tape.text.date_mm.digits", "2" }, + { "tape.text.date_mm.font", "font.tape_recorder" }, + { "tape.text.date_mm.draw_masked", "true" }, + { "tape.text.date_dd.x", "-1" }, + { "tape.text.date_dd.y", "-1" }, + { "tape.text.date_dd.align", "left" }, + { "tape.text.date_dd.valign", "top" }, + { "tape.text.date_dd.digits", "2" }, + { "tape.text.date_dd.font", "font.tape_recorder" }, + { "tape.text.date_dd.draw_masked", "true" }, { "tape.text.time.x", "44" }, { "tape.text.time.y", "55" }, { "tape.text.time.align", "left" }, { "tape.text.time.valign", "top" }, { "tape.text.time.digits", "-1" }, + { "tape.text.time.xoffset", "27" }, { "tape.text.time.font", "font.tape_recorder" }, + { "tape.text.time.draw_masked", "false" }, + + { "tape.text.time_hh.x", "-1" }, + { "tape.text.time_hh.y", "-1" }, + { "tape.text.time_hh.align", "left" }, + { "tape.text.time_hh.valign", "top" }, + { "tape.text.time_hh.digits", "2" }, + { "tape.text.time_hh.font", "font.tape_recorder" }, + { "tape.text.time_hh.draw_masked", "true" }, + { "tape.text.time_mm.x", "-1" }, + { "tape.text.time_mm.y", "-1" }, + { "tape.text.time_mm.align", "left" }, + { "tape.text.time_mm.valign", "top" }, + { "tape.text.time_mm.digits", "2" }, + { "tape.text.time_mm.font", "font.tape_recorder" }, + { "tape.text.time_mm.draw_masked", "true" }, + { "tape.text.time_ss.x", "-1" }, + { "tape.text.time_ss.y", "-1" }, + { "tape.text.time_ss.align", "left" }, + { "tape.text.time_ss.valign", "top" }, + { "tape.text.time_ss.digits", "2" }, + { "tape.text.time_ss.font", "font.tape_recorder" }, + { "tape.text.time_ss.draw_masked", "true" }, { "tape.show_game_buttons", "false" }, diff --git a/src/conf_var.c b/src/conf_var.c index 965b5348..4e06b2d2 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -6062,10 +6062,162 @@ struct TokenIntPtrInfo image_config_vars[] = "tape.text.date.digits", &tape.text.date.size }, + { + "tape.text.date.xoffset", + &tape.text.date.xoffset + }, + { + "tape.text.date.2nd_xoffset", + &tape.text.date.xoffset2 + }, { "tape.text.date.font", &tape.text.date.font }, + { + "tape.text.date.draw_masked", + &tape.text.date.draw_masked + }, + { + "tape.text.date_yyyy.x", + &tape.text.date_yyyy.x + }, + { + "tape.text.date_yyyy.y", + &tape.text.date_yyyy.y + }, + { + "tape.text.date_yyyy.align", + &tape.text.date_yyyy.align + }, + { + "tape.text.date_yyyy.valign", + &tape.text.date_yyyy.valign + }, + { + "tape.text.date_yyyy.digits", + &tape.text.date_yyyy.size + }, + { + "tape.text.date_yyyy.font", + &tape.text.date_yyyy.font + }, + { + "tape.text.date_yyyy.draw_masked", + &tape.text.date_yyyy.draw_masked + }, + { + "tape.text.date_yy.x", + &tape.text.date_yy.x + }, + { + "tape.text.date_yy.y", + &tape.text.date_yy.y + }, + { + "tape.text.date_yy.align", + &tape.text.date_yy.align + }, + { + "tape.text.date_yy.valign", + &tape.text.date_yy.valign + }, + { + "tape.text.date_yy.digits", + &tape.text.date_yy.size + }, + { + "tape.text.date_yy.font", + &tape.text.date_yy.font + }, + { + "tape.text.date_yy.draw_masked", + &tape.text.date_yy.draw_masked + }, + { + "tape.text.date_mmm.x", + &tape.text.date_mmm.x + }, + { + "tape.text.date_mmm.y", + &tape.text.date_mmm.y + }, + { + "tape.text.date_mmm.align", + &tape.text.date_mmm.align + }, + { + "tape.text.date_mmm.valign", + &tape.text.date_mmm.valign + }, + { + "tape.text.date_mmm.digits", + &tape.text.date_mmm.size + }, + { + "tape.text.date_mmm.font", + &tape.text.date_mmm.font + }, + { + "tape.text.date_mmm.draw_masked", + &tape.text.date_mmm.draw_masked + }, + { + "tape.text.date_mm.x", + &tape.text.date_mm.x + }, + { + "tape.text.date_mm.y", + &tape.text.date_mm.y + }, + { + "tape.text.date_mm.align", + &tape.text.date_mm.align + }, + { + "tape.text.date_mm.valign", + &tape.text.date_mm.valign + }, + { + "tape.text.date_mm.digits", + &tape.text.date_mm.size + }, + { + "tape.text.date_mm.font", + &tape.text.date_mm.font + }, + { + "tape.text.date_mm.draw_masked", + &tape.text.date_mm.draw_masked + }, + { + "tape.text.date_dd.x", + &tape.text.date_dd.x + }, + { + "tape.text.date_dd.y", + &tape.text.date_dd.y + }, + { + "tape.text.date_dd.align", + &tape.text.date_dd.align + }, + { + "tape.text.date_dd.valign", + &tape.text.date_dd.valign + }, + { + "tape.text.date_dd.digits", + &tape.text.date_dd.size + }, + { + "tape.text.date_dd.font", + &tape.text.date_dd.font + }, + { + "tape.text.date_dd.draw_masked", + &tape.text.date_dd.draw_masked + }, { "tape.text.time.x", &tape.text.time.x @@ -6086,10 +6238,102 @@ struct TokenIntPtrInfo image_config_vars[] = "tape.text.time.digits", &tape.text.time.size }, + { + "tape.text.time.xoffset", + &tape.text.time.xoffset + }, { "tape.text.time.font", &tape.text.time.font }, + { + "tape.text.time.draw_masked", + &tape.text.time.draw_masked + }, + { + "tape.text.time_hh.x", + &tape.text.time_hh.x + }, + { + "tape.text.time_hh.y", + &tape.text.time_hh.y + }, + { + "tape.text.time_hh.align", + &tape.text.time_hh.align + }, + { + "tape.text.time_hh.valign", + &tape.text.time_hh.valign + }, + { + "tape.text.time_hh.digits", + &tape.text.time_hh.size + }, + { + "tape.text.time_hh.font", + &tape.text.time_hh.font + }, + { + "tape.text.time_hh.draw_masked", + &tape.text.time_hh.draw_masked + }, + { + "tape.text.time_mm.x", + &tape.text.time_mm.x + }, + { + "tape.text.time_mm.y", + &tape.text.time_mm.y + }, + { + "tape.text.time_mm.align", + &tape.text.time_mm.align + }, + { + "tape.text.time_mm.valign", + &tape.text.time_mm.valign + }, + { + "tape.text.time_mm.digits", + &tape.text.time_mm.size + }, + { + "tape.text.time_mm.font", + &tape.text.time_mm.font + }, + { + "tape.text.time_mm.draw_masked", + &tape.text.time_mm.draw_masked + }, + { + "tape.text.time_ss.x", + &tape.text.time_ss.x + }, + { + "tape.text.time_ss.y", + &tape.text.time_ss.y + }, + { + "tape.text.time_ss.align", + &tape.text.time_ss.align + }, + { + "tape.text.time_ss.valign", + &tape.text.time_ss.valign + }, + { + "tape.text.time_ss.digits", + &tape.text.time_ss.size + }, + { + "tape.text.time_ss.font", + &tape.text.time_ss.font + }, + { + "tape.text.time_ss.draw_masked", + &tape.text.time_ss.draw_masked + }, { "tape.show_game_buttons", &tape.show_game_buttons diff --git a/src/libgame/system.h b/src/libgame/system.h index f7259356..d5027aec 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1204,13 +1204,15 @@ struct DoorPartPosInfo struct TextPosInfo { int x, y; + int xoffset; /* special case for tape date and time */ + int xoffset2; /* special case for tape date */ int width, height; int align, valign; - int size; + int size; /* also used for suffix ".digits" */ int font, font_alt; boolean draw_masked; boolean draw_player; /* special case for network player buttons */ - int sort_priority; + int sort_priority; /* also used for suffix ".draw_order" */ int id; }; diff --git a/src/tape.c b/src/tape.c index fb36f1e2..9de9839b 100644 --- a/src/tape.c +++ b/src/tape.c @@ -294,12 +294,16 @@ void DrawVideoDisplay(unsigned int state, unsigned int value) { struct TextPosInfo *pos = &tape.text.date; int tag = value % 100; - int monat = (value/100) % 100; - int jahr = (value/10000); - - DrawText(VX + pos->x, VY + pos->y, int2str(tag, 2), pos->font); - DrawText(VX + pos->x + 27, VY + pos->y, monatsname[monat], pos->font); - DrawText(VX + pos->x + 64, VY + pos->y, int2str(jahr, 2), pos->font); + int monat = (value / 100) % 100; + int jahr = (value / 10000); + int xpos1 = VX + pos->x; + int xpos2 = VX + pos->x + pos->xoffset; + int xpos3 = VX + pos->x + pos->xoffset2; + int ypos = VY + pos->y; + + DrawText(xpos1, ypos, int2str(tag, 2), pos->font); + DrawText(xpos2, ypos, monatsname[monat], pos->font); + DrawText(xpos3, ypos, int2str(jahr, 2), pos->font); } if (state & VIDEO_STATE_TIME_ON) @@ -307,9 +311,12 @@ void DrawVideoDisplay(unsigned int state, unsigned int value) struct TextPosInfo *pos = &tape.text.time; int min = value / 60; int sec = value % 60; + int xpos1 = VX + pos->x; + int xpos2 = VX + pos->x + pos->xoffset; + int ypos = VY + pos->y; - DrawText(VX + pos->x, VY + pos->y, int2str(min, 2), pos->font); - DrawText(VX + pos->x + 27, VY + pos->y, int2str(sec, 2), pos->font); + DrawText(xpos1, ypos, int2str(min, 2), pos->font); + DrawText(xpos2, ypos, int2str(sec, 2), pos->font); } redraw_mask |= REDRAW_DOOR_2; diff --git a/src/tape.h b/src/tape.h index 0e6d11d8..d1b60330 100644 --- a/src/tape.h +++ b/src/tape.h @@ -133,7 +133,16 @@ struct TapeLabelInfo struct TapeTextInfo { struct TextPosInfo date; + struct TextPosInfo date_yyyy; + struct TextPosInfo date_yy; + struct TextPosInfo date_mmm; + struct TextPosInfo date_mm; + struct TextPosInfo date_dd; + struct TextPosInfo time; + struct TextPosInfo time_hh; + struct TextPosInfo time_mm; + struct TextPosInfo time_ss; }; struct TapeInfo -- 2.34.1