From 1ed1d0005c772d6a0715b5708e1733fbd6bb1c88 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Wed, 18 Apr 2007 04:20:48 +0000 Subject: [PATCH] Added menu property to change number color --- amxmodx/newmenus.cpp | 70 +++++++++++++++++++++++++++--------- amxmodx/newmenus.h | 2 ++ plugins/include/amxconst.inc | 1 + 3 files changed, 57 insertions(+), 16 deletions(-) diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index 3c9e63d2..2d83e711 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -90,6 +90,7 @@ Menu::Menu(const char *title, int mid, int tid) m_OptNames[abs(MENU_MORE)].assign("More"); m_OptNames[abs(MENU_EXIT)].assign("Exit"); + m_ItemColor.assign("\\r"); m_NeverExit = false; m_AutoColors = g_coloredmenus; @@ -392,7 +393,7 @@ const char *Menu::GetTextString(int player, page_t page, int &keys) { if (m_AutoColors) { - _snprintf(buffer, sizeof(buffer)-1, "\\r%d.\\w %s\n", option_display, pItem->name.c_str()); + _snprintf(buffer, sizeof(buffer)-1, "%s%d.\\w %s\n", m_ItemColor.c_str(),option_display, pItem->name.c_str()); } else { _snprintf(buffer, sizeof(buffer)-1, "%d. %s\n", option_display, pItem->name.c_str()); } @@ -440,11 +441,21 @@ const char *Menu::GetTextString(int player, page_t page, int &keys) if (flags & Display_Back) { keys |= (1<m_ItemColor.assign(str); + break; + } case MPROP_PERPAGE: { cell count = *get_amxaddr(amx, params[3]); diff --git a/amxmodx/newmenus.h b/amxmodx/newmenus.h index c4a97e27..858cdd1a 100755 --- a/amxmodx/newmenus.h +++ b/amxmodx/newmenus.h @@ -50,6 +50,7 @@ #define MPROP_ORDER 7 #define MPROP_NOCOLORS 8 #define MPROP_PADMENU 9 +#define MPROP_SET_NUMBER_COLOR 10 typedef int (*MENUITEM_CALLBACK)(int, int, int); @@ -94,6 +95,7 @@ public: String m_OptNames[4]; + String m_ItemColor; bool m_NeverExit; bool m_AutoColors; diff --git a/plugins/include/amxconst.inc b/plugins/include/amxconst.inc index c16cee80..461b2eff 100755 --- a/plugins/include/amxconst.inc +++ b/plugins/include/amxconst.inc @@ -296,6 +296,7 @@ enum { #define MPROP_ORDER 7 /* Deprecated, has no effect */ #define MPROP_NOCOLORS 8 //NUM - sets whether colors are not auto (0=default) #define MPROP_PADMENU 9 /* Deprecated, has no effect */ +#define MPROP_NUMBER_COLOR 10 //STRING - color indicator to use for the numbers. ("\r"=default) #define SND_SPAWNING (1<<8) // we're spawing, used in some cases for ambients #define SND_STOP (1<<5) // stop sound