func_door: Add some useful inputs.

VGUI: Some misc changes related to classic mode.
This commit is contained in:
Marco Cawthorne 2022-05-13 14:10:07 -07:00
parent 1e0534c922
commit 06efd9495d
Signed by: eukara
GPG key ID: C196CD8BA993248A
5 changed files with 42 additions and 10 deletions

View file

@ -117,8 +117,28 @@ class func_door:NSRenderableEntity
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(string, string) SpawnKey;
virtual void(entity, string, string) Input;
};
void
func_door::Input(entity eAct, string strInput, string strData)
{
switch (strInput) {
case "Open":
Trigger(eAct, TRIG_OFF);
break;
case "Close":
Trigger(eAct, TRIG_ON);
break;
case "Toggle":
Trigger(eAct, TRIG_TOGGLE);
break;
default:
super::Input(eAct, strInput, strData);
}
}
void
func_door::PortalOpen(void)
{

View file

@ -96,7 +96,7 @@ class NSSpraylogo:NSEntity
int m_iOwnerID;
string m_strName;
string m_m_strPath;
int m_iInitialized;
bool m_bInitialized;
bool m_bMonochrome;
void(void) NSSpraylogo;
@ -130,7 +130,7 @@ const string g_spray_mat_0 = \
void
NSSpraylogo::RendererRestarted(void)
{
m_iInitialized = FALSE;
m_bInitialized = false;
}
float
@ -145,9 +145,9 @@ NSSpraylogo::predraw(void)
return (PREDRAW_NEXT);
}
if (m_iInitialized == FALSE) {
if (m_bInitialized == false) {
void *image;
m_iInitialized = TRUE;
m_bInitialized = true;
/* load the blob */
image = memalloc(iSize + 1);
@ -190,6 +190,7 @@ NSSpraylogo::NSSpraylogo(void)
m_vecColor = [1,1,1];
m_bMonochrome = false;
isCSQC = true;
m_bInitialized = false;
}
void
@ -204,7 +205,6 @@ Spray_Parse(void)
spSelf.m_vecAngles[0] = readcoord();
spSelf.m_vecAngles[1] = readcoord();
spSelf.m_vecAngles[2] = readcoord();
spSelf.m_iInitialized = FALSE;
spSelf.m_iOwnerID = readentitynum() - 1;
spSelf.m_bMonochrome = getplayerkeyfloat(spSelf.m_iOwnerID, "spraytype");
spSelf.m_strName = sprintf("spray_%i_%d", spSelf.m_iOwnerID, spSelf.m_bMonochrome);

View file

@ -18,8 +18,12 @@ font_s g_fntDefault;
var int g_vguiWidgetCount;
#ifdef CLASSIC_VGUI
#define UI_MAINCOLOR [255,200,0] / 255
#define UI_MAINALPHA 255
#ifndef UI_MAINCOLOR
#define UI_MAINCOLOR [255,200,0] / 255
#endif
#ifndef UI_MAINALPHA
#define UI_MAINALPHA 255
#endif
#else
var vector UI_MAINCOLOR;
var float UI_MAINALPHA;

View file

@ -41,6 +41,7 @@ class CUIButton:CUIWidget
virtual void(vector) SetSize;
virtual void(string) SetTitle;
virtual void(string) SetIcon;
virtual void(vector) SetColor;
virtual void(void(void)) SetFunc;
virtual void(string) SetExec;
virtual void(float, float, float, float) Input;
@ -57,6 +58,12 @@ CUIButton::CUIButton(void)
m_iFlags = BUTTON_VISIBLE;
}
void
CUIButton::SetColor(vector vecColor)
{
m_vecColor = vecColor;
}
void
CUIButton::SetSize(vector vecSize)
{
@ -159,7 +166,7 @@ CUIButton::Draw(void)
}
}
if (m_strIcon) {
drawpic(m_parent.m_vecOrigin + m_vecOrigin + [2,2], m_strIcon, [16,16], [1,1,1], 1.0f, 0);
drawpic(m_parent.m_vecOrigin + m_vecOrigin + [2,2], m_strIcon, [16,16], m_vecColor, 1.0f, 0);
}
}

View file

@ -82,6 +82,7 @@ void CUIWindow::CUIWindow(void)
m_btnClose = spawn(CUIButton);
m_btnClose.SetTitle(__NULL__);
m_btnClose.m_strIcon = "textures/ui/steam/icon_close";
m_btnClose.SetColor(m_vecColor);
m_btnClose.SetFunc(WindowButtonClose);
m_btnClose.SetSize([20,20]);
Add(m_btnClose);
@ -190,14 +191,14 @@ void CUIWindow::Draw(void)
drawfill(m_vecOrigin + [m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], [0,0,0], 0.5f);
if (m_iFlags & WINDOW_CANRESIZE) {
drawpic(m_vecOrigin + m_vecSize - [16,16], "textures/ui/steam/icon_resizer", [16,16], [1,1,1], 1.0f, 0);
drawpic(m_vecOrigin + m_vecSize - [16,16], "textures/ui/steam/icon_resizer", [16,16], m_vecColor, 1.0f, 0);
}
#endif
if (m_strTitle) {
if (m_strIcon) {
Font_DrawText(m_vecOrigin + [26, 8], m_strTitle, g_fntDefault);
drawpic(m_vecOrigin + [4, 4], m_strIcon, [16,16], [1,1,1], 1.0f, 0);
drawpic(m_vecOrigin + [4, 4], m_strIcon, [16,16], m_vecColor, 1.0f, 0);
} else {
Font_DrawText(m_vecOrigin + [8, 8], m_strTitle, g_fntDefault);
}