From 416911587ee5d77c73ccc44c7b20bdb615ac408b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 17 Feb 2017 16:53:36 +0100 Subject: [PATCH] - scriptified PlayerMenu.Drawer --- src/menu/playermenu.cpp | 38 ++--------------------- wadsrc/static/zscript.txt | 1 + wadsrc/static/zscript/menu/playermenu.txt | 25 +++++++++++++++ 3 files changed, 28 insertions(+), 36 deletions(-) create mode 100644 wadsrc/static/zscript/menu/playermenu.txt diff --git a/src/menu/playermenu.cpp b/src/menu/playermenu.cpp index 3a13760529..ce657feae7 100644 --- a/src/menu/playermenu.cpp +++ b/src/menu/playermenu.cpp @@ -65,6 +65,7 @@ class DPlayerMenu : public DListMenu { DECLARE_CLASS(DPlayerMenu, DListMenu) +public: int PlayerClassIndex; FPlayerClass *PlayerClass; TArray PlayerColorSets; @@ -91,8 +92,6 @@ public: bool Responder (event_t *ev); bool MenuEvent (int mkey, bool fromcontroller); bool MouseEvent(int type, int x, int y); - void Ticker (); - void Drawer (); }; IMPLEMENT_CLASS(DPlayerMenu, false, false) @@ -693,38 +692,5 @@ bool DPlayerMenu::MouseEvent(int type, int x, int y) return res; } -//============================================================================= -// -// -// -//============================================================================= -void DPlayerMenu::Ticker () -{ - - Super::Ticker(); -} - -//============================================================================= -// -// -// -//============================================================================= - -void DPlayerMenu::Drawer () -{ - - Super::Drawer(); - - const char *str = "PRESS " TEXTCOLOR_WHITE "SPACE"; - screen->DrawText (SmallFont, CR_GOLD, 320 - 32 - 32 - - SmallFont->StringWidth (str)/2, - 50 + 48 + 70, str, - DTA_Clean, true, TAG_DONE); - str = mRotation ? "TO SEE FRONT" : "TO SEE BACK"; - screen->DrawText (SmallFont, CR_GOLD, 320 - 32 - 32 - - SmallFont->StringWidth (str)/2, - 50 + 48 + 70 + SmallFont->GetHeight (), str, - DTA_Clean, true, TAG_DONE); - -} +DEFINE_FIELD(DPlayerMenu, mRotation) diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index d755c85b97..ae582e058e 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -15,6 +15,7 @@ #include "zscript/menu/optionmenuitems.txt" #include "zscript/menu/colorpickermenu.txt" #include "zscript/menu/joystickmenu.txt" +#include "zscript/menu/playermenu.txt" #include "zscript/menu/playerdisplay.txt" #include "zscript/menu/playercontrols.txt" #include "zscript/menu/textentermenu.txt" diff --git a/wadsrc/static/zscript/menu/playermenu.txt b/wadsrc/static/zscript/menu/playermenu.txt new file mode 100644 index 0000000000..c8f5373405 --- /dev/null +++ b/wadsrc/static/zscript/menu/playermenu.txt @@ -0,0 +1,25 @@ + + +class PlayerMenu : ListMenu native +{ + native int mRotation; + + //============================================================================= + // + // + // + //============================================================================= + + override void Drawer () + { + + Super.Drawer(); + + String str = "PRESS " .. TEXTCOLOR_WHITE .. "SPACE"; + screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70, str, DTA_Clean, true); + str = mRotation ? "TO SEE FRONT" : "TO SEE BACK"; + screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70 + SmallFont.GetHeight (), str, DTA_Clean, true); + + } + +} \ No newline at end of file