]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Merge branch 'master' into master 8/head
authorElias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com>
Wed, 4 Nov 2020 13:40:00 +0000 (14:40 +0100)
committerGitHub <noreply@github.com>
Wed, 4 Nov 2020 13:40:00 +0000 (14:40 +0100)
1  2 
builtin/settingtypes.txt
src/defaultsettings.cpp
src/gui/cheatMenu.cpp
src/gui/cheatMenu.h

index ebd0ad621224d324a70075656ec0c10d360b1c2f,adb8e7a0035ffdc85ce22f4bf3dea6c2b31f851d..620e4b3559f9a4452444d00d99f8f4d52e8ad2ec
@@@ -2213,6 -2213,6 +2213,31 @@@ contentdb_url (ContentDB URL) string ht
  #    so see a full list at https://content.minetest.net/help/content_flags/
  contentdb_flag_blacklist (ContentDB Flag Blacklist) string nonfree, desktop_default
  
++[Cheat Menu]
++
++#   Font to use for cheat menu
++cheat_menu_font (MenuFont) enum FM_Standard, FM_Mono, FM_Fallback, FM_Simple, FM_SimpleMono, FM_MaxMode, FM_Unspecified
++
++#   (RGB value)
++m_bg_color (Cell background color) v3f 45 45 68
++
++m_bg_color_alpha (Cell background color alpha) int 173
++
++#   (RGB value)
++m_active_bg_color (Active cell background color) v3f 0 0 0
++
++m_active_bg_color_alpha (Active cell background color alpha) int 210
++
++#   (RGB value)
++m_font_color (Font color) v3f 255 255 255
++
++m_font_color_alpha (Font color alpha) int 195 
++
++#   (RGB value)
++m_selected_font_color (Selected font color) v3f 255 255 255
++
++m_selected_font_color_alpha (Selected font color alpha) int 235
++
  [Cheats]
  
  fullbright (Fullbright) bool false
@@@ -2299,27 -2299,24 +2324,24 @@@ replace (Replace) bool fals
  
  crystal_pvp (CrystalPvP) bool false
  
- [Cheat Menu]
+ autototem (AutoTotem) bool false
  
- #   Font to use for cheat menu
- cheat_menu_font (MenuFont) enum FM_Standard, FM_Mono, FM_Fallback, FM_Simple, FM_SimpleMono, FM_MaxMode, FM_Unspecified
+ dont_point_nodes (ThroughWalls) bool false
  
- #   (RGB value)
- m_bg_color (Cell background color) v3f 45 45 68
+ strip (Strip) bool false
  
- m_bg_color_alpha (Cell background color alpha) int 173
+ autorefill (AutoRefill) bool false
  
- #   (RGB value)
- m_active_bg_color (Active cell background color) v3f 0 0 0
+ nuke (Nuke) bool false
  
- m_active_bg_color_alpha (Active cell background color alpha) int 210
+ chat_color (Chat Color) string rainbow
  
- #   (RGB value)
- m_font_color (Font color) v3f 255 255 255
+ use_chat_color (ColoredChat) bool false
  
- m_font_color_alpha (Font color alpha) int 195 
+ chat_reverse (ReversedChat) bool false
  
- #   (RGB value)
- m_selected_font_color (Selected font color) v3f 255 255 255
+ forcefield (Forcefield) bool false
+ friendlist (Killaura / Forcefield Friendlist) string
  
- m_selected_font_color_alpha (Selected font color alpha) int 235
 -cheat_hud (CheatHUD) bool true
++cheat_hud (CheatHUD) bool true
Simple merge
index f4f85c7fecee0d402c94289cbd5be4cd67d187a1,1485541c255e375b542ec8d04fd3b0b4149ee6e0..5a7f5247721d8a15bf6a161d5be9623eeca976c7
@@@ -151,7 -94,73 +151,73 @@@ void CheatMenu::draw(video::IVideoDrive
        }
  }
  
 -void CheatMenu::selectUp()
+ void CheatMenu::drawHUD(video::IVideoDriver *driver, double dtime)
+ {
+       CHEAT_MENU_GET_SCRIPTPTR
+       
+       m_rainbow_offset += dtime;
+       m_rainbow_offset = fmod(m_rainbow_offset, 6.0f);
+       
+       std::vector<std::string> enabled_cheats;
+       
+       int cheat_count = 0;
+       
+       for (auto category = script->m_cheat_categories.begin(); category != script->m_cheat_categories.end(); category++) {
+               for (auto cheat = (*category)->m_cheats.begin(); cheat != (*category)->m_cheats.end(); cheat++) {
+                       if ((*cheat)->is_enabled()) {
+                               enabled_cheats.push_back((*cheat)->m_name);
+                               cheat_count++;
+                       }
+               }
+       }
+       
+       if (enabled_cheats.empty())
+               return;
+       
+       std::vector<video::SColor> colors;
+       
+       for (int i = 0; i < cheat_count; i++) {
+               video::SColor color;
+               f32 h = (f32)i * 2.0f / (f32)cheat_count - m_rainbow_offset;
+               if (h < 0)
+                       h = 6.0f + h;
+               f32 x = (1 - fabs(fmod(h, 2.0f) - 1.0f)) * 255.0f;
+               switch((int)h) {
+               case 0:
+                       color = video::SColor(255, 255, x, 0); break;
+               case 1:
+                       color = video::SColor(255, x, 255, 0); break;
+               case 2:
+                       color = video::SColor(255, 0, 255, x); break;
+               case 3:
+                       color = video::SColor(255, 0, x, 255); break;
+               case 4:
+                       color = video::SColor(255, x, 0, 255); break;
+               case 5:
+                       color = video::SColor(255, 255, 0, x); break;
+               }
+               colors.push_back(color);
+       }
+       
+       core::dimension2d<u32> screensize = driver->getScreenSize();
+       
+       u32 y = 5;
+       
+       int i = 0;
+       for (std::string cheat : enabled_cheats) {
+               core::dimension2d<u32> dim = m_font->getDimension(utf8_to_wide(cheat).c_str());
+               u32 x = screensize.Width - 5 - dim.Width;
+               
+               core::rect<s32> fontbounds(x, y, x + dim.Width, y + dim.Height);
+               m_font->draw(cheat.c_str(), fontbounds, colors[i], false, false);
+               
+               y += dim.Height;
+               i++;
+       }
+ }
 +void CheatMenu::selectLeft()
  {
        CHEAT_MENU_GET_SCRIPTPTR
  
index f12f10ac01132e36436600a0f4d38fce03a47f1e,f67cdea5ae532cc8be1c3bee86bac96dd7aa1f1e..bedd7e048e71fa92093058f7837672f4238bc5e5
@@@ -42,17 -41,13 +42,19 @@@ class CheatMen
  public:
        CheatMenu(Client *client);
  
 +      ClientScripting *getScript()
 +      {
 +              return m_client->getScript();
 +      }
 +
        void draw(video::IVideoDriver *driver, bool show_debug);
+       
+       void drawHUD(video::IVideoDriver *driver, double dtime);
  
 -      void drawEntry(video::IVideoDriver *driver, std::string name, int number,
 -                      bool selected, bool active,
 -                      CheatMenuEntryType entry_type = CHEAT_MENU_ENTRY_TYPE_ENTRY);
 +      void drawEntry(video::IVideoDriver *driver, std::string name,
 +              std::size_t column_align_index, std::size_t cheat_entry_index,
 +              bool is_selected, bool is_enabled,
 +              CheatMenuEntryType entry_type = CHEAT_MENU_ENTRY_TYPE_ENTRY);
  
        void selectUp();
        void selectDown();