Skip to content

Additional information can now be specified for levels. #1729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d38c0e1
Merge pull request #1 from SuperTux/master
mrkubax10 Apr 21, 2021
43d34cb
Additional information can now be specified for levels (Issue #1291)
mrkubax10 Apr 21, 2021
fc904f1
Additional information can now be specified for levels (Issue #1291)
mrkubax10 Apr 21, 2021
be46f4c
Fixed code formatting
mrkubax10 Apr 22, 2021
ffd98bf
Merge pull request #2 from SuperTux/master
mrkubax10 Apr 22, 2021
2fac060
Deleted translation
mrkubax10 Apr 22, 2021
85ac65b
Fixed code formatting
mrkubax10 Apr 22, 2021
2102de5
Fixed code formatting
mrkubax10 Apr 22, 2021
cae3d3e
Fixed code formatting
mrkubax10 Apr 24, 2021
6d212b7
Fixed code formatting
mrkubax10 Apr 26, 2021
8fea9da
Merge pull request #3 from SuperTux/master
mrkubax10 Apr 27, 2021
0c11d04
Merge pull request #4 from SuperTux/master
mrkubax10 May 2, 2021
293efcd
Merge pull request #5 from SuperTux/master
mrkubax10 May 5, 2021
1970014
Merge branch 'SuperTux:master' into master
mrkubax10 May 7, 2021
71053fa
Merge branch 'SuperTux:master' into master
mrkubax10 May 17, 2021
ee10c77
Added empty line
mrkubax10 May 17, 2021
9889b9e
Merge branch 'SuperTux:master' into master
mrkubax10 May 18, 2021
e1038f3
Fixed code formatting
mrkubax10 May 19, 2021
f658456
Merge branch 'SuperTux:master' into master
mrkubax10 May 23, 2021
36b314e
Changed text rendering to draw_stats_line
mrkubax10 May 28, 2021
ad959ca
Delete Level Note string
mrkubax10 May 29, 2021
564a75f
Merge branch 'SuperTux:master' into master
mrkubax10 May 30, 2021
ea23212
Merge branch 'SuperTux:master' into master
mrkubax10 Jun 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data/locale/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,9 @@ msgstr "Wrogowie"
#: src/supertux/statistics.cpp:271 src/supertux/levelintro.cpp:172
msgid "Secrets"
msgstr "Sekrety"
#: src/supertux/levelintro.cpp:187
msgid "Level Note"
msgstr "Informacja o poziome"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add translations manually, use Transifex instead


#: src/supertux/game_object.hpp:77
msgid "Unknown object"
Expand Down
14 changes: 9 additions & 5 deletions src/audio/sound_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ SoundManager::play_music(const std::string& filename, float fadetime)
if (fadetime > 0)
newmusic->set_fading(StreamSoundSource::FadingOn, fadetime);
newmusic->play();

m_music_source = std::move(newmusic);
} catch(std::exception& e) {
log_warning << "Couldn't play music file '" << filename << "': " << e.what() << std::endl;
// When this happens, previous music continued playing, stop it, just in case.
stop_music(0);
}

}

void
Expand All @@ -344,11 +344,13 @@ SoundManager::pause_music(float fadetime)
{
if (m_music_source == nullptr)
return;


if (fadetime > 0) {
if (m_music_source
&& m_music_source->get_fade_state() != StreamSoundSource::FadingPause)
m_music_source->set_fading(StreamSoundSource::FadingPause, fadetime);
&& m_music_source->get_fade_state() != StreamSoundSource::FadingPause){
m_music_source->set_fading(StreamSoundSource::FadingPause, fadetime);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab alignment with the closing bracket

} else {
m_music_source->pause();
}
Expand Down Expand Up @@ -394,13 +396,15 @@ SoundManager::set_sound_volume(int volume)
void
SoundManager::resume_music(float fadetime)
{

if (m_music_source == nullptr)
return;

if (fadetime > 0) {
if (m_music_source
&& m_music_source->get_fade_state() != StreamSoundSource::FadingResume)
m_music_source->set_fading(StreamSoundSource::FadingResume, fadetime);
&& m_music_source->get_fade_state() != StreamSoundSource::FadingResume){
m_music_source->set_fading(StreamSoundSource::FadingResume, fadetime);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Why have these lines changes? They don't seem related to the PR...

} else {
m_music_source->resume();
}
Expand Down
4 changes: 4 additions & 0 deletions src/supertux/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Level::Level(bool worldmap) :
m_filename(),
m_sectors(),
m_stats(),
m_note(),
m_target_time(),
m_tileset("images/tiles.strf"),
m_suppress_pause_menu(),
Expand Down Expand Up @@ -125,6 +126,9 @@ Level::save(Writer& writer)
writer.write("version", 3);
writer.write("name", m_name, true);
writer.write("author", m_author, false);
if(!m_note.empty()){
writer.write("note",m_note,false);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing (before open brackets and after commas)

if (!m_contact.empty()) {
writer.write("contact", m_contact, false);
}
Expand Down
1 change: 1 addition & 0 deletions src/supertux/level.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Level final
std::string m_contact;
std::string m_license;
std::string m_filename;
std::string m_note;
std::vector<std::unique_ptr<Sector> > m_sectors;
Statistics m_stats;
float m_target_time;
Expand Down
1 change: 1 addition & 0 deletions src/supertux/level_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ LevelParser::load(const ReaderDocument& doc)
level.get("license", m_level.m_license);
level.get("target-time", m_level.m_target_time);
level.get("suppress-pause-menu", m_level.m_suppress_pause_menu);
level.get("note", m_level.m_note);

auto iter = level.get_iter();
while (iter.next()) {
Expand Down
5 changes: 5 additions & 0 deletions src/supertux/levelintro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ LevelIntro::draw(Compositor& compositor)
Statistics::time_to_string(m_level.m_target_time), targetTimeBeaten);
}
}
py += 32;
if(!m_level.m_note.empty()){
context.color().draw_center_text(Resources::normal_font, _("Level Note")+": "+m_level.m_note, Vector(0,py), LAYER_FOREGROUND1);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing (same as above, and around operators)


}

IntegrationStatus
Expand Down
1 change: 1 addition & 0 deletions src/supertux/menu/editor_level_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ EditorLevelMenu::EditorLevelMenu() :
add_textfield(_("Author"), &(level->m_author));
add_textfield(_("Contact"), &(level->m_contact));
add_textfield(_("License"), &(level->m_license));
add_textfield(_("Level Note"),(&level->m_note));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after comma

Also, ampersand outside parentheses

add_file(_("Tileset"), &(level->m_tileset), std::vector<std::string>(1, ".strf"), {});

if (!worldmap) {
Expand Down
2 changes: 1 addition & 1 deletion src/supertux/menu/game_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GameMenu::GameMenu() :
})
{
Level& level = GameSession::current()->get_current_level();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No spaces on empty line

add_label(level.m_name);
add_hl();
add_entry(MNID_CONTINUE, _("Continue"));
Expand Down