Advertisement
MaX33333

wz patch

Mar 11th, 2020
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 13.09 KB | None | 0 0
  1. diff --git a/3rdparty/glm b/3rdparty/glm
  2. index d162eee1e..13724cfae 160000
  3. --- a/3rdparty/glm
  4. +++ b/3rdparty/glm
  5. @@ -1 +1 @@
  6. -Subproject commit d162eee1e6f7c317a09229fe6ceab8ec6ab9a4b4
  7. +Subproject commit 13724cfae64a8b5313d1cabc9a963d2c9dbeda12
  8. diff --git a/3rdparty/miniupnp b/3rdparty/miniupnp
  9. index 564464efd..927e2f366 160000
  10. --- a/3rdparty/miniupnp
  11. +++ b/3rdparty/miniupnp
  12. @@ -1 +1 @@
  13. -Subproject commit 564464efdbb7ab3a5982ebc411879ec84114129f
  14. +Subproject commit 927e2f36666f543d59a8080686921069832a3393-dirty
  15. diff --git a/3rdparty/sha b/3rdparty/sha
  16. --- a/3rdparty/sha
  17. +++ b/3rdparty/sha
  18. @@ -1 +1 @@
  19. -Subproject commit 4b9e13ead2c5b5e41ca27c65de4dd69ae0bac228
  20. +Subproject commit 4b9e13ead2c5b5e41ca27c65de4dd69ae0bac228-dirty
  21. diff --git a/3rdparty/utf8proc b/3rdparty/utf8proc
  22. --- a/3rdparty/utf8proc
  23. +++ b/3rdparty/utf8proc
  24. @@ -1 +1 @@
  25. -Subproject commit 5c632c57426f2e4246e3b64dd2fd088d3920f9e5
  26. +Subproject commit 5c632c57426f2e4246e3b64dd2fd088d3920f9e5-dirty
  27. diff --git a/3rdparty/utfcpp b/3rdparty/utfcpp
  28. index 170e2d11f..c3f9261eb 160000
  29. --- a/3rdparty/utfcpp
  30. +++ b/3rdparty/utfcpp
  31. @@ -1 +1 @@
  32. -Subproject commit 170e2d11f516539d18bf39f552fa204dbf41d9ce
  33. +Subproject commit c3f9261eb8e793fa6c6a62309d3a3942ee03486a
  34. diff --git a/src/cheat.cpp b/src/cheat.cpp
  35. index 2c0136b52..d62bc209e 100644
  36. --- a/src/cheat.cpp
  37. +++ b/src/cheat.cpp
  38. @@ -77,6 +77,7 @@ static CHEAT_ENTRY cheatCodes[] =
  39.     {"work harder", kf_FinishResearch},
  40.     {"tileinfo", kf_TileInfo}, // output debug info about a tile
  41.     {"showfps", kf_ToggleFPS},  //displays your average FPS
  42. +   {"showkills", kf_ToggleKillCount},  //displays your kills
  43.     {"showsamples", kf_ToggleSamples}, //displays the # of Sound samples in Queue & List
  44.     {"showorders", kf_ToggleOrders}, //displays unit order/action state.
  45.     {"pause", kf_TogglePauseMode}, // Pause the game.
  46. @@ -100,6 +101,11 @@ bool attemptCheatCode(const char *cheat_name)
  47.         kf_ToggleFPS();
  48.         return true;
  49.     }
  50. +   if (!strcasecmp("showkills", cheat_name))
  51. +   {
  52. +       kf_ToggleKillCount();
  53. +       return true;
  54. +   }
  55.  
  56.     if (strcmp(cheat_name, "cheat on") == 0 || strcmp(cheat_name, "debug") == 0)
  57.     {
  58. diff --git a/src/configuration.cpp b/src/configuration.cpp
  59. index 6faf6571e..4098aa838 100644
  60. --- a/src/configuration.cpp
  61. +++ b/src/configuration.cpp
  62. @@ -113,6 +113,7 @@ bool loadConfig()
  63.         wz_texture_compression = false;
  64.     }
  65.     showFPS = ini.value("showFPS", false).toBool();
  66. +   showKILLCOUNT = ini.value("showKILLCOUNT", false).toBool();
  67.     if (ini.contains("cameraSpeed"))
  68.     {
  69.         war_SetCameraSpeed(ini.value("cameraSpeed").toInt());
  70. @@ -258,6 +259,7 @@ bool saveConfig()
  71.     ini.setValue("RightClickOrders", (SDWORD)(getRightClickOrders()));
  72.     ini.setValue("MiddleClickRotate", (SDWORD)(getMiddleClickRotate()));
  73.     ini.setValue("showFPS", (SDWORD)showFPS);
  74. +   ini.setValue("showKILLCOUNT", (SDWORD)showKILLCOUNT);
  75.     ini.setValue("shadows", (SDWORD)(getDrawShadows()));    // shadows
  76.     ini.setValue("sound", (SDWORD)war_getSoundEnabled());
  77.     ini.setValue("FMVmode", (SDWORD)(war_GetFMVmode()));        // sequences
  78. diff --git a/src/console.cpp b/src/console.cpp
  79. index 291bcbe51..e99011546 100644
  80. --- a/src/console.cpp
  81. +++ b/src/console.cpp
  82. @@ -175,7 +175,16 @@ bool addConsoleMessage(const char *Text, CONSOLE_TEXT_JUSTIFICATION jusType, SDW
  83.         return false;   // Don't allow it to be added if we've disabled adding of new messages
  84.     }
  85.  
  86. -   std::istringstream stream(Text);
  87. +   time_t current_time;
  88. +   time(&current_time);
  89. +   struct tm time_info;
  90. +   gmtime_r(&current_time, &time_info);
  91. +   char time_str[9];
  92. +   ssprintf(time_str, "%d:%d", time_info.tm_hour, time_info.tm_min);
  93. +   char buff2[2048]; // can be not enough to fit all message?
  94. +   ssprintf(buff2, "[%s] %s", time_str, Text);
  95. +
  96. +   std::istringstream stream(buff2);
  97.     std::string lines;
  98.  
  99.     while (std::getline(stream, lines))
  100. diff --git a/src/display3d.cpp b/src/display3d.cpp
  101. index 6bbf5dbe8..3cb8d09bb 100644
  102. --- a/src/display3d.cpp
  103. +++ b/src/display3d.cpp
  104. @@ -79,6 +79,7 @@
  105.  #include "order.h"
  106.  #include "scores.h"
  107.  #include "multiplay.h"
  108. +#include "multistat.h"
  109.  #include "advvis.h"
  110.  #include "cmddroid.h"
  111.  #include "terrain.h"
  112. @@ -128,6 +129,7 @@ static WzText txtLevelName;
  113.  static WzText txtDebugStatus;
  114.  static WzText txtCurrentTime;
  115.  static WzText txtShowFPS;
  116. +static WzText txtKills;
  117.  // show Samples text
  118.  static WzText txtShowSamples_Que;
  119.  static WzText txtShowSamples_Lst;
  120. @@ -228,6 +230,10 @@ bool showFPS = false;       //
  121.  /** Show how many samples we are rendering per second
  122.   * default OFF, turn ON via console command 'showsamples'
  123.   */
  124. +bool showKILLCOUNT = false;
  125. +/** Show how many kills/deaths (produced units) made
  126. + * default OFF, turn ON via console command 'showkills'
  127. + */
  128.  bool showSAMPLES = false;
  129.  /**  Show the current selected units order / action
  130.   *  default OFF, turn ON via console command 'showorders'
  131. @@ -821,6 +827,17 @@ void draw3DScene()
  132.         const unsigned height = txtShowFPS.height();
  133.         txtShowFPS.render(pie_GetVideoBufferWidth() - width, pie_GetVideoBufferHeight() - height, WZCOL_TEXT_BRIGHT);
  134.     }
  135. +   if (showKILLCOUNT)
  136. +   {
  137. +       char *killdiff;
  138. +       unsigned int UnitsLost = missionData.unitsLost;
  139. +       unsigned int UnitsKilled = bMultiPlayer ? getMultiStats(selectedPlayer).recentKills : missionData.unitsKilled;
  140. +       unsigned int UnitsBuilt = missionData.unitsBuilt;
  141. +       double KDRaito = (double)UnitsKilled / (double)UnitsLost;
  142. +       sasprintf(&killdiff, "Kills: %d/%d %f (%d)", UnitsKilled, UnitsLost, KDRaito, UnitsBuilt);
  143. +       txtKills.setText(killdiff, font_regular);
  144. +       txtKills.render(pie_GetVideoBufferWidth() - txtKills.width() + 10 - 100, pie_GetVideoBufferHeight() - txtKills.height(), WZCOL_TEXT_BRIGHT);
  145. +   }
  146.     if (showORDERS)
  147.     {
  148.         unsigned int height;
  149. diff --git a/src/display3d.h b/src/display3d.h
  150. index 66438c016..d94d6bda1 100644
  151. --- a/src/display3d.h
  152. +++ b/src/display3d.h
  153. @@ -54,6 +54,7 @@ struct iView
  154.  };
  155.  
  156.  extern bool showFPS;
  157. +extern bool showKILLCOUNT;
  158.  extern bool showSAMPLES;
  159.  extern bool showORDERS;
  160.  
  161. diff --git a/src/frontend.cpp b/src/frontend.cpp
  162. index 63ed36f33..8ce39d180 100644
  163. --- a/src/frontend.cpp
  164. +++ b/src/frontend.cpp
  165. @@ -51,6 +51,7 @@
  166.  #include "configuration.h"
  167.  #include "difficulty.h"
  168.  #include "display.h"
  169. +#include "display3d.h"
  170.  #include "droid.h"
  171.  #include "frend.h"
  172.  #include "frontend.h"
  173. @@ -101,6 +102,7 @@ bool            bLimiterLoaded = false;
  174.  // Forward definitions
  175.  
  176.  static W_BUTTON * addSmallTextButton(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, unsigned int style);
  177. +void addText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, UDWORD formID);
  178.  
  179.  // ////////////////////////////////////////////////////////////////////////////
  180.  // Helper functions
  181. @@ -665,6 +667,7 @@ static bool startOptionsMenu()
  182.     addTextButton(FRONTEND_MOUSEOPTIONS, FRONTEND_POS6X, FRONTEND_POS6Y, _("Mouse Options"), WBUT_TXTCENTRE);
  183.     addTextButton(FRONTEND_KEYMAP,      FRONTEND_POS7X, FRONTEND_POS7Y, _("Key Mappings"), WBUT_TXTCENTRE);
  184.     addMultiBut(psWScreen, FRONTEND_BOTFORM, FRONTEND_QUIT, 10, 10, 30, 29, P_("menu", "Return"), IMAGE_RETURN, IMAGE_RETURN_HI, IMAGE_RETURN_HI);
  185. +   addMultiBut(psWScreen, FRONTEND_BOTFORM, FRONTEND_UPGRDLINK, 60, 7, MULTIOP_BUTW, MULTIOP_BUTH, _("All enemies destroyed by cheating!"), IMAGE_GAMEVERSION, IMAGE_GAMEVERSION_HI, true);
  186.  
  187.     return true;
  188.  }
  189. @@ -694,6 +697,9 @@ bool runOptionsMenu()
  190.     case FRONTEND_KEYMAP:
  191.         changeTitleMode(KEYMAP);
  192.         break;
  193. +   case FRONTEND_UPGRDLINK:
  194. +       changeTitleMode(GUI_OPTIONS);
  195. +       break;
  196.     case FRONTEND_QUIT:
  197.         changeTitleMode(TITLE);
  198.         break;
  199. @@ -712,6 +718,63 @@ bool runOptionsMenu()
  200.     return true;
  201.  }
  202.  
  203. +// ////////////////////////////////////////////////////////////////////////////
  204. +// GUI options
  205. +
  206. +static char const *guiIsKillcountEnabledString() {
  207. +   return (showKILLCOUNT ? "Shown" : "Hidden");
  208. +}
  209. +
  210. +static bool startGUIOptionsMenu()
  211. +{
  212. +   sliderEnableDrag(true);
  213. +
  214. +   addBackdrop();
  215. +   addTopForm();
  216. +   addBottomForm();
  217. +
  218. +   addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, _("GUI OPTIONS"));
  219. +
  220. +   addTextButton(FRONTEND_GUI_KILLCOUNT,   FRONTEND_POS2X - 35, FRONTEND_POS2Y, "Show kills", WBUT_SECONDARY);
  221. +   addTextButton(FRONTEND_GUI_KILLCOUNT_R, FRONTEND_POS2M - 55, FRONTEND_POS2Y, guiIsKillcountEnabledString(), WBUT_SECONDARY);
  222. +
  223. +   addMultiBut(psWScreen, FRONTEND_BOTFORM, FRONTEND_QUIT, 10, 10, 30, 29, P_("menu", "Return"), IMAGE_RETURN, IMAGE_RETURN_HI, IMAGE_RETURN_HI);
  224. +
  225. +   return true;
  226. +}
  227. +
  228. +bool runGUIOptionsMenu()
  229. +{
  230. +   WidgetTriggers const &triggers = widgRunScreen(psWScreen);
  231. +   unsigned id = triggers.empty() ? 0 : triggers.front().widget->id; // Just use first click here, since the next click could be on another menu.
  232. +
  233. +   switch (id)
  234. +   {
  235. +   case FRONTEND_GUI_KILLCOUNT:
  236. +   case FRONTEND_GUI_KILLCOUNT_R:
  237. +       showKILLCOUNT = !showKILLCOUNT;
  238. +       widgSetString(psWScreen, FRONTEND_GUI_KILLCOUNT_R, guiIsKillcountEnabledString());
  239. +       break;
  240. +   case FRONTEND_QUIT:
  241. +       changeTitleMode(OPTIONS);
  242. +       break;
  243. +   default:
  244. +       break;
  245. +   }
  246. +
  247. +   // If close button pressed then return from this menu.
  248. +   if (CancelPressed())
  249. +   {
  250. +       changeTitleMode(TITLE);
  251. +   }
  252. +
  253. +   widgDisplayScreen(psWScreen);                       // show the widgets currently running
  254. +
  255. +   return true;
  256. +}
  257. +
  258. +///////////////////////////
  259. +
  260.  static char const *graphicsOptionsFmvmodeString()
  261.  {
  262.     switch (war_GetFMVmode())
  263. @@ -1992,6 +2055,7 @@ void addTopForm()
  264.     sFormInit.height = dstH;
  265.     sFormInit.pDisplay = displayLogo;
  266.     widgAddForm(psWScreen, &sFormInit);
  267. +   addText(FRONTEND_GUI_PATCHTEXT, FRONTEND_TOPFORM_WIDEX, 0, "GUI PATCHED", FRONTEND_TOPFORM);
  268.  }
  269.  
  270.  // ////////////////////////////////////////////////////////////////////////////
  271. @@ -2194,6 +2258,9 @@ void changeTitleMode(tMode mode)
  272.     case MOUSE_OPTIONS:
  273.         startMouseOptionsMenu();
  274.         break;
  275. +   case GUI_OPTIONS:
  276. +       startGUIOptionsMenu();
  277. +       break;
  278.     case TUTORIAL:
  279.         startTutorialMenu();
  280.         break;
  281. diff --git a/src/frontend.h b/src/frontend.h
  282. index d8c8703c5..31a82dfff 100644
  283. --- a/src/frontend.h
  284. +++ b/src/frontend.h
  285. @@ -48,6 +48,7 @@ enum tMode
  286.     VIDEO_OPTIONS,          // 19 video options menu
  287.     MOUSE_OPTIONS,          // 20 mouse options menu
  288.     CAMPAIGNS,              // 21 campaign selector
  289. +   GUI_OPTIONS,            // 22 GUI editor
  290.  };
  291.  
  292.  extern tMode titleMode;                    // the global case
  293. @@ -67,6 +68,7 @@ bool runCampaignSelector();
  294.  bool runMultiPlayerMenu();
  295.  bool runGameOptionsMenu();
  296.  bool runOptionsMenu();
  297. +bool runGUIOptionsMenu();
  298.  bool runGraphicsOptionsMenu();
  299.  bool runAudioAndZoomOptionsMenu();
  300.  bool runVideoOptionsMenu();
  301. @@ -270,6 +272,12 @@ enum
  302.     FRONTEND_SCROLLEVENT_R,
  303.  
  304.     FRONTEND_KEYMAP         = 26000,    // Keymap menu
  305. +
  306. +   FRONTEND_GUI            = 27000,    // GUI options menu
  307. +   FRONTEND_GUI_KILLCOUNT,
  308. +   FRONTEND_GUI_KILLCOUNT_R,
  309. +   FRONTEND_GUI_PATCHTEXT,
  310. +
  311.     FRONTEND_NOGAMESAVAILABLE = 31666   // Used when no games are available in lobby
  312.  
  313.  };
  314. diff --git a/src/hci.h b/src/hci.h
  315. index edd9fc670..ee06e5e67 100644
  316. --- a/src/hci.h
  317. +++ b/src/hci.h
  318. @@ -412,4 +412,5 @@ bool isSecondaryWindowUp();
  319.  
  320.  void intOpenDebugMenu(OBJECT_TYPE id);
  321.  
  322. +
  323.  #endif // __INCLUDED_SRC_HCI_H__
  324. diff --git a/src/keybind.cpp b/src/keybind.cpp
  325. index a977df984..3c9eb5e21 100644
  326. --- a/src/keybind.cpp
  327. +++ b/src/keybind.cpp
  328. @@ -620,6 +620,10 @@ void kf_ToggleFPS() //This shows *just FPS* and is always visible (when active)
  329.         CONPRINTF("%s", _("FPS display is disabled."));
  330.     }
  331.  }
  332. +void kf_ToggleKillCount()
  333. +{
  334. +   showKILLCOUNT = !showKILLCOUNT;
  335. +}
  336.  void kf_ToggleSamples() //Displays number of sound sample in the sound queues & lists.
  337.  {
  338.     // Toggle the boolean value of showSAMPLES
  339. diff --git a/src/keybind.h b/src/keybind.h
  340. index 778e3ddc0..87ab043a0 100644
  341. --- a/src/keybind.h
  342. +++ b/src/keybind.h
  343. @@ -36,6 +36,7 @@ void kf_HalveHeights();
  344.  void kf_DebugDroidInfo();
  345.  void kf_BuildInfo();
  346.  void kf_ToggleFPS();           //FPS counter NOT same as kf_Framerate! -Q
  347. +void kf_ToggleKillCount();
  348.  void kf_ToggleSamples();       // Displays # of sound samples in Queue/list.
  349.  void kf_ToggleOrders();        //displays unit's Order/action state.
  350.  void kf_FrameRate();
  351. diff --git a/src/research.cpp b/src/research.cpp
  352. index 1179c6a5a..4617fbb2a 100644
  353. --- a/src/research.cpp
  354. +++ b/src/research.cpp
  355. @@ -579,7 +579,6 @@ void researchResult(UDWORD researchIndex, UBYTE player, bool bDisplay, STRUCTURE
  356.     {
  357.         audio_QueueTrack(ID_SOUND_RESEARCH_COMPLETED);
  358.     }
  359. -
  360.     if (player == selectedPlayer && bDisplay)
  361.     {
  362.         //add console text message
  363. diff --git a/src/selection.cpp b/src/selection.cpp
  364. index 1dacb0ca1..b0c381218 100644
  365. --- a/src/selection.cpp
  366. +++ b/src/selection.cpp
  367. @@ -402,7 +402,7 @@ void selNextSpecifiedBuilding(STRUCTURE_TYPE structType)
  368.         {
  369.             camToggleStatus();
  370.         }
  371. -       setViewPos(map_coord(psResult->pos.x), map_coord(psResult->pos.y), false);
  372. +       //setViewPos(map_coord(psResult->pos.x), map_coord(psResult->pos.y), false);
  373.         if (psOldStruct)
  374.         {
  375.             psOldStruct->selected = false;
  376. diff --git a/src/wrappers.cpp b/src/wrappers.cpp
  377. index 1d17db5e3..858651304 100644
  378. --- a/src/wrappers.cpp
  379. +++ b/src/wrappers.cpp
  380. @@ -218,6 +218,10 @@ TITLECODE titleLoop()
  381.         runOptionsMenu();
  382.         break;
  383.  
  384. +   case GUI_OPTIONS:
  385. +       runGUIOptionsMenu();
  386. +       break;
  387. +
  388.     case GAME:
  389.         runGameOptionsMenu();
  390.         break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement