Skip to content

Commit

Permalink
Merge pull request #35762 from ZhilkinSerg/interface-holidays
Browse files Browse the repository at this point in the history
Holiday title screens
  • Loading branch information
Rivet-the-Zombie committed Dec 2, 2019
2 parents daadd4a + 0f30872 commit fa2d297
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 25 deletions.
21 changes: 21 additions & 0 deletions data/title/en.christmas
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The ASCII art must be 18 lines in height (6 lines per ascii art text line).
# Max length of a line is 80 characters; the following line is for reference.
################################################################################
<color_light_cyan> _________ __ .__
<color_light_cyan> \_ ___ \ _____ _/ |_ _____ ____ | | ___.__ ______ _____
<color_light_cyan> / \ \/ \__ \ \ __\\__ \ _/ ___\ | | < | | / ___/ / \
<color_light_cyan> \ \____ / __ \_ | | / __ \_\ \___ | |__ \___ | \___ \ | Y Y \
<color_light_cyan> \______ /(____ / |__| (____ / \___ >|____/ / ____|/____ >|__|_| /
<color_light_cyan> \/ \/ \/ \/ \/ \/ \/
<color_white> _________ __ _________ .__
<color_white> / _____/____ _____/ |______ \_ ___ \| | _____ __ __ ______
<color_red> \_____ \\__ \ / \ __\__ \ / \ \/| | \__ \ | | \/ ___/
<color_red> / \/ __ \| | \ | / __ \_ \ \___| |__/ __ \| | /\___ \
<color_red> /_______ (____ /___| /__| (____ / \______ /____(____ /____//____ >
<color_red> \/ \/ \/ \/ \/ \/ \/
<color_light_blue> _____ .__ .___
<color_light_blue> / _ \ | |__ ____ _____ __| _/
<color_light_blue> / /_\ \ | | \ _/ __ \ \__ \ / __ |
<color_light_blue> / | \| Y \\ ___/ / __ \_/ /_/ |
<color_light_blue> \____|__ /|___| / \___ >(____ /\____ |
<color_light_blue> \/ \/ \/ \/ \/
24 changes: 24 additions & 0 deletions data/title/en.easter
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# The ASCII art must be 18 lines in height (6 lines per ascii art text line).
# Max length of a line is 80 characters; the following line is for reference.
################################################################################
<color_light_green> _________ __ .__
<color_light_green> \_ ___ \ _____ _/ |_ _____ ____ | | ___.__ ______ _____
<color_light_green> / \ \/ \__ \ \ __\\__ \ _/ ___\ | | < | | / ___/ / \
<color_light_green> \ \____ / __ \_ | | / __ \_\ \___ | |__ \___ | \___ \ | Y Y \
<color_light_green> \______ /(____ / |__| (____ / \___ >|____/ / ____|/____ >|__|_| /
<color_light_green> \/ \/ \/ \/ \/ \/ \/
<color_white> _______ ___ _ ,---. .--.,---. .--.<color_light_cyan>.-./`)<color_white> .-''-. .-'''-.
<color_white> \ ____ \ .' | | || \ | || \ | |<color_light_cyan> \<color_light_red>.-.<color_light_cyan>')<color_white> .'<color_blue>_ _<color_white> \ / <color_red>_<color_white> \
<color_white> | | \ | | .' | || , \ | || , \ | |<color_light_cyan>/ <color_light_red>`-'<color_light_cyan> \<color_white> / <color_blue>( ` )<color_white> ' <color_red>(`' )<color_white>/`--'
<color_white> | |____/ / .' '<color_green>_<color_white> | || |\<color_light_blue>_<color_white> \| || |\<color_magenta>_<color_white> \| | <color_light_cyan>`-'`"`<color_white>. <color_blue>(_ <color_yellow>o<color_blue> _)<color_white> |<color_red>(_ <color_yellow>o<color_red> _)<color_white>.
<color_white> | <color_yellow>_ _<color_white> '. ' <color_green>( \.-.<color_white>|| <color_light_blue>_( )_<color_white>\ || <color_magenta>_( )_<color_white>\ | .---. | <color_blue>(_,_)<color_white>___| <color_red>(_,_)<color_white>. '.
<color_white> | <color_yellow>( ' )<color_white> \' <color_green>(`. <color_yellow>_<color_green>` /<color_white>|| <color_light_blue>(_ <color_yellow>o<color_light_blue> _)<color_white> || <color_magenta>(_ <color_light_green>o<color_magenta> _)<color_white> | | | ' \ .---..---. \ :
<color_white> | <color_yellow>(_<color_red>{;}<color_yellow>_)<color_white> || <color_green>(_ <color_yellow>(_)<color_green> _)<color_white>| <color_light_blue>(_,_)<color_white>\ || <color_magenta>(_,_)<color_white>\ | | | \ `-' /\ `-' |
<color_white> | <color_yellow>(_,_)<color_white> / \ <color_green>/ . \<color_white> /| | | || | | | | | \ / \ /
<color_white> /_______.' `<color_green>`-'`-'<color_white>' '--' '--''--' '--' '---' `'-..-' `-...-'
<color_green> _____ .__ .___
<color_green> / _ \ | |__ ____ _____ __| _/
<color_green> / /_\ \ | | \ _/ __ \ \__ \ / __ |
<color_green> / | \| Y \\ ___/ / __ \_/ /_/ |
<color_green> \____|__ /|___| / \___ >(____ /\____ |
<color_green> \/ \/ \/ \/ \/
21 changes: 21 additions & 0 deletions data/title/en.independence_day
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The ASCII art must be 18 lines in height (6 lines per ascii art text line).
# Max length of a line is 80 characters; the following line is for reference.
################################################################################
<color_blue> _________ __ .__ __ __ .__
<color_blue> \_ ___ \ ____ ____ _______/ |_|__|/ |_ __ ___/ |_|__| ____ ____
<color_blue> / \ \/ / _ \ / \ / ___/\ __\ \ __\ | \ __\ |/ _ \ / \
<color_blue> \ \___( <_> ) | \\___ \ | | | || | | | /| | | ( <_> ) | \
<color_blue> \______ /\____/|___| /____ > |__| |__||__| |____/ |__| |__|\____/|___| /
<color_blue> \/ \/ \/ \/
<color_red> ___________ __________ __
<color_red> \__ ___/___ _____ \______ \_____ ________/ |_ ___.__.
<color_red> | |_/ __ \\__ \ | ___/\__ \\_ __ \ __< | |
<color_red> | |\ ___/ / __ \_ | | / __ \| | \/| | \___ |
<color_red> |____| \___ >____ / |____| (____ /__| |__| / ____|
<color_red> \/ \/ \/ \/
<color_white> _____ .__ .___
<color_light_gray> ________ <color_white> / _ \ | |__ ____ _____ __| _/
<color_light_gray> |<color_blue>:<color_white>:<color_blue>:<color_white>:<color_red>====<color_light_gray>|<color_white> / /_\ \| | \_/ __ \\__ \ / __ |
<color_light_gray> |<color_white>:<color_blue>:<color_white>:<color_blue>:<color_white>====<color_light_gray>|<color_white> / | \ Y \ ___/ / __ \_/ /_/ |
<color_light_gray> |<color_red>========<color_light_gray>|<color_white> \____|__ /___| /\___ >____ /\____ |
<color_light_gray> <color_white> \/ \/ \/ \/ \/
22 changes: 22 additions & 0 deletions data/title/en.new_year
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# The ASCII art must be 18 lines in height (6 lines per ascii art text line).
# Max length of a line is 80 characters; the following line is for reference.
################################################################################
<color_white> _________ __ .__
<color_white> \_ ___ \ _____ _/ |_ _____ ____ | | ___.__ ______ _____
<color_red> / \ \/ \__ \ \ __\\__ \ _/ ___\ | | < | | / ___/ / \
<color_red> \ \____ / __ \_ | | / __ \_\ \___ | |__ \___ | \___ \ | Y Y \
<color_red> \______ /(____ / |__| (____ / \___ >|____/ / ____|/____ >|__|_| /
<color_red> \/ \/ \/ \/ \/ \/ \/
<color_green> ___________.__ ___________
<color_green> \_ _____/|__|______ \__ ___/______ ____ ____
<color_green> | __) | \_ __ \ | | \_ __ \_/ __ \_/ __ \
<color_green> /\<color_green> | \ | || | \/ | | | | \/\ ___/\ ___/
<color_green> /\<color_red>*<color_green>\<color_brown> \___ / |__||__| |____| |__| \___ >\___ >
<color_green> /\<color_yellow>O<color_green>\<color_blue>*<color_green>\<color_brown> \/ \/ \/
<color_green> /<color_red>*<color_green>/\/\/\<color_white> _____ .__ .___
<color_green> /\<color_white>O<color_green><color_green>\/\<color_pink>*<color_green>\/\<color_white> / _ \ | |__ ____ _____ __| _/
<color_green> /\<color_blue>*<color_green>\/\<color_light_green>*<color_green>\/\/\<color_red> / /_\ \ | | \ _/ __ \ \__ \ / __ |
<color_green>/\<color_light_cyan>O<color_green><color_green>\/\/<color_red>*<color_green>/\/<color_yellow>O<color_green>/\<color_red> / | \| Y \\ ___/ / __ \_/ /_/ |
<color_brown> ||<color_red> \____|__ /|___| / \___ >(____ /\____ |
<color_brown> ||<color_red> \/ \/ \/ \/ \/
<color_brown> ||
29 changes: 29 additions & 0 deletions data/title/en.thanksgiving
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# The ASCII art must be 18 lines in height (6 lines per ascii art text line).
# Max length of a line is 80 characters; the following line is for reference.
################################################################################
<color_light_cyan> _________ __ .__
<color_light_cyan> \_ ___ \ _____ _/ |_ _____ ____ | | ___.__ ______ _____
<color_light_cyan> / \ \/ \__ \ \ __\\__ \ _/ ___\ | | < | | / ___/ / \
<color_light_cyan> \ \____ / __ \_ | | / __ \_\ \___ | |__ \___ | \___ \ | Y Y \
<color_light_cyan> \______ /(____ / |__| (____ / \___ >|____/ / ____|/____ >|__|_| /
<color_light_cyan> \/ \/ \/ \/ \/ \/ \/
<color_light_blue> ___________ __ ________
<color_light_blue> \__ ___/_ _________| | __ ____ ___.__. \______ \ _____ ___.__.
<color_light_blue> | | | | \_ __ \ |/ // __ < | | | | \\__ \< | |
<color_light_blue> | | | | /| | \/ <\ ___/\___ | | ` \/ __ \\___ |
<color_light_blue> |____| |____/ |__| |__|_ \\___ > ____| /_______ (____ / ____|
<color_light_blue> \/ \/\/ \/ \/\/
<color_light_blue> _____ .__ .___
<color_white> .--. <color_light_blue>/ _ \ | |__ ____ _____ __| _/
<color_white> {\<color_brown> / <color_yellow>q<color_red> {\ <color_light_blue>/ /_\ \ | | \ _/ __ \ \__ \ / __ |
<color_white> { `\<color_brown> \ (-<color_red>(~` <color_light_blue>/ | \| Y \\ ___/ / __ \_/ /_/ |
<color_white> { '.{`\<color_brown> \ \ <color_red>) <color_light_blue>\____|__ /|___| / \___ >(____ /\____ |
<color_white> {'-{ ' \<color_brown> .-""'-. \ \ <color_light_blue>\/ \/ \/ \/ \/
<color_white> {._{'.' \<color_brown>/ '.) \
<color_white> {_.{. <color_brown>{` |
<color_white> {._{ ' <color_brown>{ <color_white>;'-=-.<color_brown> |
<color_white> {-.{.' <color_brown>{ <color_white>';-=-.`<color_brown> /
<color_white> {._.{.<color_brown>; <color_white>'-=-<color_brown> .'
<color_white> {_.-' <color_brown>`'.__ _,-'
<color_white> <color_red>|||`
<color_white> <color_red>.='==,
16 changes: 16 additions & 0 deletions src/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ constexpr inline int sgn( const T x )
return x < 0 ? -1 : ( x > 0 ? 1 : 0 );
}

enum class holiday : int {
none = 0,
new_year,
easter,
independence_day,
halloween,
thanksgiving,
christmas,
num_holiday
};

template<>
struct enum_traits<holiday> {
static constexpr holiday last = holiday::num_holiday;
};

enum temperature_flag : int {
TEMP_NORMAL = 0,
TEMP_HEATER,
Expand Down
65 changes: 47 additions & 18 deletions src/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#define dbg(x) DebugLog((DebugLevel)(x),D_GAME) << __FILE__ << ":" << __LINE__ << ": "

static const bool halloween_theme = false;
static const holiday current_holiday = holiday::thanksgiving;

void main_menu::on_move() const
{
Expand Down Expand Up @@ -142,28 +142,57 @@ void main_menu::print_menu( const catacurses::window &w_open, int iSel, const po
const nc_color cColor2 = c_light_blue;
const nc_color cColor3 = c_light_blue;

if( halloween_theme ) {
fold_and_print_from( w_open, point_zero, 30, 0, c_white, halloween_spider() );
fold_and_print_from( w_open, point( getmaxx( w_open ) - 25, offset.y - 8 ),
25, 0, c_white, halloween_graves() );
switch( current_holiday ) {
case holiday::new_year:
break;
case holiday::easter:
break;
case holiday::halloween:
fold_and_print_from( w_open, point_zero, 30, 0, c_white, halloween_spider() );
fold_and_print_from( w_open, point( getmaxx( w_open ) - 25, offset.y - 8 ),
25, 0, c_white, halloween_graves() );
break;
case holiday::thanksgiving:
break;
case holiday::christmas:
break;
case holiday::none:
case holiday::num_holiday:
default:
break;
}

if( mmenu_title.size() > 1 ) {
for( size_t i = 0; i < mmenu_title.size(); ++i ) {
if( halloween_theme ) {
static const std::string marker = "";
const utf8_wrapper text( mmenu_title[i] );
for( size_t j = 0; j < text.size(); j++ ) {
std::string temp = text.substr_display( j, 1 ).str();
if( temp != " " ) {
mvwprintz( w_open, point( iOffsetX + j, iLine ),
( temp != marker ) ? c_red : ( i < 9 ? cColor1 : cColor2 ),
"%s", ( temp == marker ) ? "" : temp );
switch( current_holiday ) {
case holiday::halloween: {
static const std::string marker = "";
const utf8_wrapper text( mmenu_title[i] );
for( size_t j = 0; j < text.size(); j++ ) {
std::string temp = text.substr_display( j, 1 ).str();
if( temp != " " ) {
mvwprintz( w_open, point( iOffsetX + j, iLine ),
( temp != marker ) ? c_red : ( i < 9 ? cColor1 : cColor2 ),
"%s", ( temp == marker ) ? "" : temp );
}
}
iLine++;
}
iLine++;
} else {
mvwprintz( w_open, point( iOffsetX, iLine++ ), i < 6 ? cColor1 : cColor2, "%s", mmenu_title[i] );
break;
case holiday::thanksgiving:
case holiday::new_year:
case holiday::easter:
case holiday::christmas: {
nc_color cur_color = c_white;
nc_color base_color = c_white;
print_colored_text( w_open, point( iOffsetX, iLine++ ), cur_color, base_color, mmenu_title[i] );
}
break;
case holiday::none:
case holiday::num_holiday:
default:
mvwprintz( w_open, point( iOffsetX, iLine++ ), i < 6 ? cColor1 : cColor2, "%s", mmenu_title[i] );
break;
}
}
} else {
Expand Down Expand Up @@ -258,7 +287,7 @@ void main_menu::init_windows()
void main_menu::init_strings()
{
// ASCII Art
mmenu_title = load_file( PATH_INFO::title( halloween_theme ), _( "Cataclysm: Dark Days Ahead" ) );
mmenu_title = load_file( PATH_INFO::title( current_holiday ), _( "Cataclysm: Dark Days Ahead" ) );
// MOTD
auto motd = load_file( PATH_INFO::motd(), _( "No message today." ) );

Expand Down
2 changes: 1 addition & 1 deletion src/main_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class main_menu
void init_windows();
std::string handle_input_timeout( input_context &ctxt );

std::string halloween_spider();
static std::string halloween_spider();
std::string halloween_graves();
};

Expand Down
42 changes: 37 additions & 5 deletions src/path_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cstdlib>
#include <utility>

#include "enums.h"
#include "filesystem.h"
#include "options.h"

Expand Down Expand Up @@ -384,11 +385,42 @@ std::string PATH_INFO::motd()
return find_translated_file( datadir_value + "motd/", ".motd", motd_value );
}

std::string PATH_INFO::title( const bool halloween_theme )
{
return find_translated_file( datadir_value + "title/", halloween_theme ? ".halloween" : ".title",
halloween_theme ? ( datadir_value + "title/" + "en.halloween" ) : ( datadir_value + "title/" +
"en.title" ) );
std::string PATH_INFO::title( const holiday current_holiday )
{
std::string theme_basepath = datadir_value + "title/";
std::string theme_extension = ".title";
std::string theme_fallback = theme_basepath + "en.title";
switch( current_holiday ) {
case holiday::new_year:
theme_extension = ".new_year";
theme_fallback = datadir_value + "title/" + "en.new_year";
break;
case holiday::easter:
theme_extension = ".easter";
theme_fallback = datadir_value + "title/" + "en.easter";
break;
case holiday::independence_day:
theme_extension = ".independence_day";
theme_fallback = datadir_value + "title/" + "en.independence_day";
break;
case holiday::halloween:
theme_extension = ".halloween";
theme_fallback = datadir_value + "title/" + "en.halloween";
break;
case holiday::thanksgiving:
theme_extension = ".thanksgiving";
theme_fallback = datadir_value + "title/" + "en.thanksgiving";
break;
case holiday::christmas:
theme_extension = ".christmas";
theme_fallback = datadir_value + "title/" + "en.christmas";
break;
case holiday::none:
case holiday::num_holiday:
default:
break;
}
return find_translated_file( theme_basepath, theme_extension, theme_fallback );
}

std::string PATH_INFO::names()
Expand Down
Loading

0 comments on commit fa2d297

Please sign in to comment.