Hello community, here is the log from the commit of package xgalaga++ for openSUSE:Leap:15.2 checked in at 2020-04-05 17:07:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/xgalaga++ (Old) and /work/SRC/openSUSE:Leap:15.2/.xgalaga++.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xgalaga++" Sun Apr 5 17:07:19 2020 rev:11 rq:789990 version:0.9 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/xgalaga++/xgalaga++.changes 2020-01-15 16:30:41.784830274 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.xgalaga++.new.3248/xgalaga++.changes 2020-04-05 17:07:26.458237049 +0200 @@ -1,0 +2,10 @@ +Fri Mar 27 21:05:08 UTC 2020 - Christophe Giboudeaux <[email protected]> + +- Update to 0.9: + * Mouse pointer is now invisible + * Customizable refresh rate from 50 (default) to 120 Hz + * Optimized one XLib call per frame + * Fix Makefile usage + * Remove one fall through warning + +------------------------------------------------------------------- Old: ---- xgalaga++_0.8.4.tar.gz New: ---- xgalaga++_0.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xgalaga++.spec ++++++ --- /var/tmp/diff_new_pack.mvkN4R/_old 2020-04-05 17:07:26.870237488 +0200 +++ /var/tmp/diff_new_pack.mvkN4R/_new 2020-04-05 17:07:26.874237492 +0200 @@ -1,7 +1,7 @@ # # spec file for package xgalaga++ # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,29 +12,29 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: xgalaga++ -Version: 0.8.4 +Version: 0.9 Release: 0 Summary: Classic single screen vertical shoot em up -License: GPL-2.0 -Group: Amusements/Games/Action/Arcade/Shoot -Url: http://marc.mongenet.ch/OSS/XGalaga/ +License: GPL-2.0-only +URL: http://marc.mongenet.ch/OSS/XGalaga/ Source0: http://marc.mongenet.ch/OSS/XGalaga/%{name}_%{version}.tar.gz Source1: %{name}.desktop Source2: %{name}.png # PATCH-FIX-UPSTREAM -- TODO Patch0: reproducible.patch +BuildRequires: gcc-c++ +BuildRequires: pkgconfig +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xpm) %if 0%{?suse_version} BuildRequires: hicolor-icon-theme BuildRequires: update-desktop-files %endif -BuildRequires: gcc-c++ -BuildRequires: pkgconfig(x11) -BuildRequires: pkgconfig(xpm) %description XGalaga++ is a classic vertical scrolling shoot em up. @@ -43,7 +43,7 @@ except for the graphics. %prep -%setup -q -n %{name}-%{version} +%setup -q %patch0 -p1 # Adjust Highscore @@ -52,7 +52,7 @@ -i -e 's|#HIGH_SCORES_FILE=.xgalaga++|HIGH_SCORES_FILE=.xgalaga++|' Makefile %build -make %{?_smp_mflags} CXXFLAGS="%{optflags}" all +%make_build CXXFLAGS="%{optflags}" all %install # install executable @@ -62,17 +62,16 @@ install -Dm 0644 %{name}.6x %{buildroot}%{_mandir}/man6/%{name}.6x # install icon -install -Dm 0644 %{S:2} %{buildroot}/%{_datadir}/icons/hicolor/48x48/apps/%{name}.png +install -Dm 0644 %{SOURCE2} %{buildroot}/%{_datadir}/icons/hicolor/48x48/apps/%{name}.png # install Desktop file -install -Dm 0644 %{S:1} %{buildroot}%{_datadir}/applications/%{name}.desktop +install -Dm 0644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop %if 0%{?suse_version} %suse_update_desktop_file %{name} %endif %files -%defattr(-,root,root,-) %doc README %{_bindir}/%{name} %{_mandir}/man6/%{name}.6x%{ext_man} ++++++ xgalaga++_0.8.4.tar.gz -> xgalaga++_0.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/Makefile new/xgalaga++-0.9/Makefile --- old/xgalaga++-0.8.4/Makefile 2012-04-20 01:25:11.000000000 +0200 +++ new/xgalaga++-0.9/Makefile 2017-12-10 23:16:48.000000000 +0100 @@ -169,8 +169,8 @@ @echo "$(GOAL_DEBUG) build the executable with debug options" @echo "$(GOAL_PROF) build the executable with profiling options" @echo "clean remove all built files" - @echo "install remove all built files" - @echo "uninstall remove all built files" + @echo "install install executable, manual, and high scores files" + @echo "uninstall remove executable and manual files" # If source files exist then build the EXE file. .PHONY: $(GOAL_EXE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/README new/xgalaga++-0.9/README --- old/xgalaga++-0.8.4/README 2013-10-15 23:18:19.000000000 +0200 +++ new/xgalaga++-0.9/README 2017-12-10 11:03:45.000000000 +0100 @@ -8,7 +8,7 @@ COPYRIGHT -� 2003, 2004, 2008, 2009, 2010, 2013 Marc Mongenet +� 2003, 2004, 2008, 2009, 2010, 2013, 2017 Marc Mongenet Xgalaga++ is free software, available under the terms of the GNU General Public License. @@ -38,6 +38,9 @@ VERSIONS +(2017-12-10) v0.9: Added key to change screen refresh rate + Invisible mouse pointer + One xlib call per frame optimized out (2013-10-15) v0.8.4: Fix missing include (thanks to nemysis) (2012-04-20) v0.8.3: Fix to compile on BSD (thanks to nemysis) (2010-12-09) v0.8.2: Fix to compile on 64-bit systems (thanks to Zbigniew Baniewski) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/config.cc new/xgalaga++-0.9/config.cc --- old/xgalaga++-0.8.4/config.cc 2009-09-23 22:46:08.000000000 +0200 +++ new/xgalaga++-0.9/config.cc 2017-12-10 00:42:51.000000000 +0100 @@ -67,6 +67,7 @@ Config::Config() : details_level_ (max_details) +, refresh_rate_ (50) , player_name_ (PlayerName()) , score_file_name_(ScoreFileName()) { @@ -81,6 +82,10 @@ } +int Config::NextRefreshRate(void) const { + return refresh_rate_ >= 120 ? 50 : refresh_rate_ + 5; +} + /* * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/config.h new/xgalaga++-0.9/config.h --- old/xgalaga++-0.8.4/config.h 2004-03-08 06:06:30.000000000 +0100 +++ new/xgalaga++-0.9/config.h 2017-12-10 00:40:51.000000000 +0100 @@ -10,6 +10,7 @@ enum { min_details = 0, max_details = 4 }; int details_level_; + int refresh_rate_; const std::string player_name_; const std::string score_file_name_; @@ -24,6 +25,9 @@ int ScaleDetails(int val) const { return val * details_level_ / max_details; } int MaxDetails() const { return max_details; } + int RefreshRate(void) const { return refresh_rate_; } + int NextRefreshRate(void) const; + void SetNextRefreshRate(void) { refresh_rate_ = NextRefreshRate(); } const std::string & GetPlayerName() const { return player_name_; } const std::string & GetScoreFileName() const { return score_file_name_; } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/constants.h new/xgalaga++-0.9/constants.h --- old/xgalaga++-0.8.4/constants.h 2004-03-07 05:23:52.000000000 +0100 +++ new/xgalaga++-0.9/constants.h 2017-12-10 00:03:34.000000000 +0100 @@ -9,8 +9,5 @@ g_aliens_vspacing = 24 }; -// Vertical refresh rate -const int vfreq (50); - #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/gfxinterface.cc new/xgalaga++-0.9/gfxinterface.cc --- old/xgalaga++-0.8.4/gfxinterface.cc 2009-09-23 22:48:40.000000000 +0200 +++ new/xgalaga++-0.9/gfxinterface.cc 2017-12-10 01:54:49.000000000 +0100 @@ -171,3 +171,19 @@ *color = colors[best_index]; AllocColor(color); } + + +void X11::SetInvisibleCursor(void) { + Cursor invisibleCursor; + Pixmap bitmap; + XColor black; + static char noData[] = { 0,0,0,0,0,0,0,0 }; + black.red = black.green = black.blue = 0; + + bitmap = XCreateBitmapFromData(display_, window_, noData, 8, 8); + invisibleCursor = XCreatePixmapCursor(display_, bitmap, bitmap, + &black, &black, 0, 0); + XDefineCursor(display_, window_, invisibleCursor); + XFreeCursor(display_, invisibleCursor); + XFreePixmap(display_, bitmap); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/gfxinterface.h new/xgalaga++-0.9/gfxinterface.h --- old/xgalaga++-0.8.4/gfxinterface.h 2004-03-09 06:41:22.000000000 +0100 +++ new/xgalaga++-0.9/gfxinterface.h 2017-12-10 01:53:42.000000000 +0100 @@ -109,6 +109,8 @@ int WindowWidth() const; int WindowHeight() const; + void SetInvisibleCursor(void); + Color GetBlack() const; Color GetWhite() const; void SetForeground(Color color) const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/highscore.cc new/xgalaga++-0.9/highscore.cc --- old/xgalaga++-0.8.4/highscore.cc 2009-09-27 22:56:47.000000000 +0200 +++ new/xgalaga++-0.9/highscore.cc 2017-12-10 22:04:09.000000000 +0100 @@ -38,7 +38,7 @@ Load(file); file.clear(); if (last_score_ != -1) { - high_scores_[last_size_].insert(HighScore(last_score_)); + high_scores_[last_rate_][last_size_].insert(HighScore(last_score_)); last_score_ = -1; if (filebuf.Truncate() != 0) throw std::runtime_error ("Cannot update high scores file '"+score_file_name+"'!"); @@ -48,24 +48,35 @@ } -const std::multiset<HighScore> * HighScores::Get(Coord window_size) const +const std::multiset<HighScore> * HighScores::Get(Coord window_size, int refresh_rate) const { - const Ctn::const_iterator it (high_scores_.find(window_size)); - return it == high_scores_.end() ? 0 : &(it->second); + const MapRateCoordScore::const_iterator it1 (high_scores_.find(refresh_rate)); + if (it1 == high_scores_.end()) return 0; + const MapCoordScore::const_iterator it2 (it1->second.find(window_size)); + return it2 == it1->second.end() ? 0 : &(it2->second); } void HighScores::Load(std::istream & scores_file) { high_scores_.clear(); - int score; Coord window_size; string name; - std::time_t score_date = 0; - + std::time_t score_date; + int refresh_rate; + while (scores_file.peek() != EOF) { - if (scores_file.peek() == 'T') { + score_date = 0; + refresh_rate = 50; + + if (scores_file.peek() == '@') { + scores_file.ignore(); + if (!(scores_file >> refresh_rate >> score_date >> score >> window_size.x >> window_size.y && std::getline(scores_file, name))) { + break; + } + } + else if (scores_file.peek() == 'T') { scores_file.ignore(); if (!(scores_file >> score_date >> score >> window_size.x >> window_size.y && std::getline(scores_file, name))) { break; @@ -80,7 +91,8 @@ if (!name.empty()) { name.erase(0, 1); } - high_scores_[window_size].insert(HighScore(score, name, score_date)); + + high_scores_[refresh_rate][window_size].insert(HighScore(score, name, score_date)); } if (!scores_file.eof()) @@ -90,18 +102,22 @@ void HighScores::Save(std::ostream & scores_file) const { - for (Ctn::const_iterator mapit (high_scores_.begin()); - mapit != high_scores_.end(); ++mapit) { - for (std::multiset<HighScore>::const_iterator setit (mapit->second.begin()); - setit != mapit->second.end(); ++setit) { - scores_file << 'T' - << setit->Date() << ' ' - << setit->Value() << ' ' - << mapit->first.x << ' ' - << mapit->first.y << ' ' - << setit->Name() << '\n'; - if (!scores_file.good()) { - throw std::runtime_error ("Error while saving high scores file '"+Config::Instance().GetScoreFileName()+"'!"); + for (MapRateCoordScore::const_iterator rateit (high_scores_.begin()); + rateit != high_scores_.end(); ++rateit) { + for (MapCoordScore::const_iterator coordit (rateit->second.begin()); + coordit != rateit->second.end(); ++coordit) { + for (std::multiset<HighScore>::const_iterator setit (coordit->second.begin()); + setit != coordit->second.end(); ++setit) { + scores_file << '@' + << rateit->first << ' ' + << setit->Date() << ' ' + << setit->Value() << ' ' + << coordit->first.x << ' ' + << coordit->first.y << ' ' + << setit->Name() << '\n'; + if (!scores_file.good()) { + throw std::runtime_error ("Error while saving high scores file '"+Config::Instance().GetScoreFileName()+"'!"); + } } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/highscore.h new/xgalaga++-0.9/highscore.h --- old/xgalaga++-0.8.4/highscore.h 2008-05-21 10:31:37.000000000 +0200 +++ new/xgalaga++-0.9/highscore.h 2017-12-10 16:14:01.000000000 +0100 @@ -35,22 +35,25 @@ class HighScores { static HighScores * singleton_; - typedef std::map<Coord, std::multiset<HighScore> > Ctn; - Ctn high_scores_; + typedef std::map<Coord, std::multiset<HighScore> > MapCoordScore; + typedef std::map<int, MapCoordScore> MapRateCoordScore; + MapRateCoordScore high_scores_; int last_score_; Coord last_size_; + int last_rate_; HighScores() : last_score_(-1) {} public: static HighScores & Instance(); static void DestroyInstance() { delete singleton_; singleton_ = 0; } - void Add(int score, Coord window_size) { + void Add(int score, Coord window_size, int refresh_rate) { last_score_ = score; last_size_ = window_size; + last_rate_ = refresh_rate; } void Update(); - const std::multiset<HighScore> * Get(Coord window_size) const; + const std::multiset<HighScore> * Get(Coord window_size, int refresh_rate) const; private: void Load(std::istream &); void Save(std::ostream &) const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/input.cc new/xgalaga++-0.9/input.cc --- old/xgalaga++-0.8.4/input.cc 2004-02-25 23:48:54.000000000 +0100 +++ new/xgalaga++-0.9/input.cc 2017-12-10 00:21:27.000000000 +0100 @@ -4,16 +4,17 @@ Input::Input() -: quit_ (false) -, move_ (0) -, left_ (false), right_ (false), last_is_left_(false) -, up_ (false), down_ (false), last_is_up_(false) -, fire_ (false), firing_(false) -, start_ (false) -, pause_ (false) -, cheat_ (false) -, details_ (0) -, window_size_(0) +: quit_ (false) +, move_ (0) +, left_ (false), right_ (false), last_is_left_(false) +, up_ (false), down_ (false), last_is_up_(false) +, fire_ (false), firing_(false) +, start_ (false) +, pause_ (false) +, cheat_ (false) +, details_ (0) +, window_size_ (0) +, inc_refresh_rate_(false) {} @@ -27,13 +28,15 @@ highscores_ = false; details_ = 0; window_size_ = 0; + inc_refresh_rate_ = false; while (X11::Inst().Pending()) { XEvent e; - X11::Inst().NextEvent(&e); - switch (e.type) { + X11::Inst().NextEvent(&e); + + switch (e.type) { case KeyPress: - switch (XLookupKeysym(&e.xkey, 0)) { + switch (XLookupKeysym(&e.xkey, 0)) { case XK_Left: left_ = true; last_is_left_ = true; @@ -53,7 +56,7 @@ case XK_space: fire_ = firing_ = true; break; - default: { + default: char c (0); XLookupString(&e.xkey, &c, 1, 0, 0); switch (c) { @@ -63,6 +66,9 @@ case '-': details_ = -1; break; + case 'r': + inc_refresh_rate_ = true; + break; case '1': window_size_ = 1; break; @@ -86,19 +92,18 @@ break; case 'q': quit_ = true; - return; + return; case 's': start_ = true; - return; + return; case 'C': cheat_ = true; return; } } - } break; - case KeyRelease: - switch (XLookupKeysym(&e.xkey, 0)) { + case KeyRelease: + switch (XLookupKeysym(&e.xkey, 0)) { case XK_Left: left_ = false; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/input.h new/xgalaga++-0.9/input.h --- old/xgalaga++-0.8.4/input.h 2004-03-07 05:35:04.000000000 +0100 +++ new/xgalaga++-0.9/input.h 2017-12-10 00:20:07.000000000 +0100 @@ -15,19 +15,21 @@ bool highscores_; int details_; int window_size_; + bool inc_refresh_rate_; public: Input(); void Update(); - bool Quit() const { return quit_; } - int Move() const { return move_; } - int VMove() const { return vmove_; } - bool Fire() const { return fire_; } - bool Start() const { return start_; } - bool Pause() const { return pause_; } - bool Cheat() const { return cheat_; } - bool HighScores() const { return highscores_; } - int Details() const { return details_; } - int WindowSize() const { return window_size_; } + bool Quit() const { return quit_; } + int Move() const { return move_; } + int VMove() const { return vmove_; } + bool Fire() const { return fire_; } + bool Start() const { return start_; } + bool Pause() const { return pause_; } + bool Cheat() const { return cheat_; } + bool HighScores() const { return highscores_; } + int Details() const { return details_; } + int WindowSize() const { return window_size_; } + bool IncRefreshRate() const { return inc_refresh_rate_; } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/main.cc new/xgalaga++-0.9/main.cc --- old/xgalaga++-0.8.4/main.cc 2008-05-21 16:51:25.000000000 +0200 +++ new/xgalaga++-0.9/main.cc 2017-12-10 16:30:06.000000000 +0100 @@ -300,13 +300,21 @@ int fast_star_scrolling_time (0); bool cheated (false); bool window_resized (false); + bool rate_changed (false); Coord last_window_size (X11::Inst().WindowWidth(), X11::Inst().WindowHeight()); double frame_time (0); + for (;;) { input.Update(); if (input.Quit()) break; if (!input.Pause()) { Config::Instance().AddDetailsLevel(input.Details()); + + if (input.IncRefreshRate()) { + Config::Instance().SetNextRefreshRate(); + rate_changed = true; + } + SetStandardWindowSize(input.WindowSize()); X11::Inst().GetWindowAttributes(); if (last_window_size != Coord(X11::Inst().WindowWidth(), X11::Inst().WindowHeight())) { @@ -329,8 +337,8 @@ Score::Instance().SetShield(player.Shield()); if (player.Shield() < 0) { - if (!cheated && !window_resized) { - HighScores::Instance().Add(Score::Instance().Value(), last_window_size); + if (!cheated && !window_resized && !rate_changed) { + HighScores::Instance().Add(Score::Instance().Value(), last_window_size, Config::Instance().RefreshRate()); } break; } @@ -362,7 +370,7 @@ Score::Instance().Refresh(); } X11::Inst().Sync(False); - frame_time = SleepTimeInterval(frame_time, 1.0 / vfreq); + frame_time = SleepTimeInterval(frame_time, 1.0 / Config::Instance().RefreshRate()); } } @@ -371,6 +379,7 @@ { X11::CreateInstance(); X11::Inst().SetWindowTitle("XGalaga++"); + X11::Inst().SetInvisibleCursor(); while (StartMenu::Instance().Display()) { Play(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/managers.cc new/xgalaga++-0.9/managers.cc --- old/xgalaga++-0.8.4/managers.cc 2013-10-15 23:28:25.000000000 +0200 +++ new/xgalaga++-0.9/managers.cc 2017-12-10 19:35:10.000000000 +0100 @@ -244,7 +244,7 @@ case new_convoy: convoy_alien_idx_ = 0; next_creation_ = new_alien; - // continue with new_alien + // Falls through. case new_alien: { const ConvoyData *const convoy (convoys_ + convoy_idx_); const Coord delta_cruise ((convoy_alien_idx_ + (max_convoy_size_ - convoy->ConvoySize()) / 2) * g_aliens_hspacing, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/menu.cc new/xgalaga++-0.9/menu.cc --- old/xgalaga++-0.8.4/menu.cc 2013-10-15 23:29:06.000000000 +0200 +++ new/xgalaga++-0.9/menu.cc 2017-12-10 22:40:37.000000000 +0100 @@ -29,14 +29,13 @@ const char *const menu_lines[] = { - "XGalaga++ v0.8.4 (2013-10-15)", - "�2003-2013 Marc Mongenet, graphics from XGalaga 2.0.34", + "XGalaga++ v0.9 (2017-12-10)", + "�2003-2017 Marc Mongenet, graphics from XGalaga 2.0.34", "This game is free software, covered by the GPL.", "", "Welcome player %p!", "", - "Key Action", - "��� ������", + "KEY ACTION", "s start game", "q quit", "h toggle high scores / menu", @@ -44,12 +43,13 @@ "1,2,3,4,5 set window size", "+ increase details", "- decrease details", + "r refresh rate %r1->%r2 Hz", "<space bar> fire", "<left/right arrow> move left/right", "<up/down arrow> scroll high scores up/down", "", - "Bonus", - "�����", + "BONUS", + "", "extra shield every 1000 points" }; @@ -86,28 +86,43 @@ Input input; bool updated (false); double frame_time (0); - for (;;) { + + for (;;) { + input.Update(); + if (input.Quit()) return false; + if (input.Start()) { print_scores_ = true; wait_scores_ = 5000; return true; } + Config::Instance().AddDetailsLevel(input.Details()); + + if (input.IncRefreshRate()) { + Config::Instance().SetNextRefreshRate(); + X11::Inst().ClearWindow(); + } + SetStandardWindowSize(input.WindowSize()); X11::Inst().GetWindowAttributes(); + if (--wait_scores_ < 0 || input.HighScores()) { print_scores_ = !print_scores_; wait_scores_ = 1000; X11::Inst().ClearWindow(); } + StarsFields::Instance().Scroll(); Score::Instance().Refresh(); + if (last_window_size_ != Coord(X11::Inst().WindowWidth(), X11::Inst().WindowHeight())) { last_window_size_ = Coord(X11::Inst().WindowWidth(), X11::Inst().WindowHeight()); scroll_scores_ = 0; } + if (print_scores_) { try { if (!updated) { @@ -128,8 +143,10 @@ } } else PrintHelp(NextColor()); + X11::Inst().Sync(False); - frame_time = SleepTimeInterval(frame_time, 1.0 / vfreq); + + frame_time = SleepTimeInterval(frame_time, 1.0 / Config::Instance().RefreshRate()); } } @@ -162,13 +179,29 @@ { Coord pos (std::max(0, (last_window_size_.x - text_width_) / 2), 20); SetFontContext(color); + // Draw help text for (size_t i (0); i < sizeof menu_lines / sizeof menu_lines[0]; ++i) { std::string line (menu_lines[i]); + while (line.find("%p") != std::string::npos) { line.replace(line.find("%p"), 2, Config::Instance().GetPlayerName()); } + + std::ostringstream refresh_rate; + refresh_rate << Config::Instance().RefreshRate(); + while (line.find("%r1") != std::string::npos) { + line.replace(line.find("%r1"), 3, refresh_rate.str().c_str()); + } + + std::ostringstream next_refresh_rate; + next_refresh_rate << Config::Instance().NextRefreshRate(); + while (line.find("%r2") != std::string::npos) { + line.replace(line.find("%r2"), 3, next_refresh_rate.str().c_str()); + } + X11::Inst().DrawString(pos, line); + pos.y += LineHeight(); if (line.empty()) { color.red -= 8192; @@ -197,7 +230,13 @@ SetFontContext(color); // Draw high scores title std::ostringstream ost; - ost <<"High scores for "<<last_window_size_.x<<'�'<<last_window_size_.y<<" window"; + ost <<"High scores for " + <<last_window_size_.x + <<'�' + <<last_window_size_.y + <<'@' + <<Config::Instance().RefreshRate() + <<" window"; X11::Inst().DrawString(pos, ost.str().c_str()); pos.y += LineHeight(); ost.str(std::string(ost.str().size(), '�')); @@ -205,7 +244,7 @@ pos.y += LineHeight(); // get high scores for current window size - const std::multiset<HighScore> *const high_scores (HighScores::Instance().Get(last_window_size_)); + const std::multiset<HighScore> *const high_scores (HighScores::Instance().Get(last_window_size_, Config::Instance().RefreshRate())); if (!high_scores) { score_lines_.clear(); ost.str("None."); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/stars.cc new/xgalaga++-0.9/stars.cc --- old/xgalaga++-0.8.4/stars.cc 2008-05-21 18:26:41.000000000 +0200 +++ new/xgalaga++-0.9/stars.cc 2017-12-09 23:48:05.000000000 +0100 @@ -25,28 +25,29 @@ { static unsigned count = 0; - // Scroll existing stars, destroying out of window ones. + // Erase existing stars. X11::Inst().SetClipMask(None); X11::Inst().SetForeground(X11::Inst().GetBlack()); DrawAll(); - for (FieldCtn::size_type v = 0; v < field_.Size(); ++v) { - field_[v].y += speed_; + // Scroll existing stars, destroying out of window ones. + for (FieldCtn::size_type i = 0; i < field_.Size(); ++i) { + field_[i].y += speed_; } while (field_.Size() > 0 && field_[0].YOut()) { field_.Pop(); } - X11::Inst().SetForeground(color_.pixel); - DrawAll(); - // Create one star in an (empty) top line on pair 'count'. if (count++ & 1) { const Coord star (std::rand() % X11::Inst().WindowWidth(), std::rand() % speed_); field_.Push(star); - X11::Inst().DrawPoint(star); } + + // Draw all stars + X11::Inst().SetForeground(color_.pixel); + DrawAll(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xgalaga++-0.8.4/xgalaga++.6x new/xgalaga++-0.9/xgalaga++.6x --- old/xgalaga++-0.8.4/xgalaga++.6x 2008-05-22 01:22:16.000000000 +0200 +++ new/xgalaga++-0.9/xgalaga++.6x 2017-12-10 16:38:46.000000000 +0100 @@ -1,4 +1,4 @@ -.TH XGALAGA++ 6 "21-MAY-2008" +.TH XGALAGA++ 6 "10-DEC-2017" .SH NAME XGalaga++ \- X11 classic vertical scrolling shoot'em up .SH SYNOPSIS @@ -35,6 +35,9 @@ .TP .BI -/+ Decrease/increase details (use a bit less CPU and memory). +.TP +.BI r +Increment video refresh rate by 5 Hz in range 50 - 120 Hz. .SH ENVIRONMENT VARIABLES XGAL_PSEUDO - Player pseudonym, used for high scores. .SH "SEE ALSO"
