Removed support for ns_*_menu
This commit is contained in:
parent
ee7a14faa2
commit
d692d8a4fb
|
@ -90,45 +90,9 @@ void CPlayer::Reset()
|
|||
this->customskin=false;
|
||||
this->maxspeed=0;
|
||||
this->speedchange=0;
|
||||
this->menucmd.chan=0;
|
||||
this->menucmd.channel1=0;
|
||||
this->menucmd.channel2=0;
|
||||
this->menucmd.iFunctionIndex=0;
|
||||
this->menucmd.inmenu=false;
|
||||
this->menucmd.keys=0;
|
||||
this->menucmd.text[0]='\0';
|
||||
this->menucmd.time=0.0;
|
||||
this->model[0]='\0';
|
||||
this->skin=0;
|
||||
this->body=0;
|
||||
this->fov=0.0;
|
||||
this->foved=false;
|
||||
}
|
||||
BOOL CPlayer::ClientCommand()
|
||||
{
|
||||
if (menucmd.inmenu)
|
||||
{
|
||||
if (FStrEq(CMD_ARGV(0),"menuselect"))
|
||||
{
|
||||
int key=0;
|
||||
int key_mask=0;
|
||||
menucmd.inmenu=false;
|
||||
if (gpGlobals->time > menucmd.time)
|
||||
{
|
||||
menucmd.inmenu=0;
|
||||
return false;
|
||||
}
|
||||
key=atoi(CMD_ARGV(1)) - 1;
|
||||
key_mask=(1<<key);
|
||||
if (key_mask & menucmd.keys)
|
||||
{
|
||||
ClearHudMessage(edict,menuhudtext," ");
|
||||
int temp = this->menucmd.iFunctionIndex;
|
||||
MF_ExecuteForward(this->menucmd.iFunctionIndex,this->index,key);
|
||||
MF_UnregisterSPForward(temp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -13,7 +13,6 @@ public:
|
|||
void Disconnect();
|
||||
void Reset();
|
||||
void Die();
|
||||
BOOL ClientCommand();
|
||||
int GetClass();
|
||||
bool bot;
|
||||
// Basic engine stuff.
|
||||
|
@ -38,17 +37,5 @@ public:
|
|||
int maxspeed;
|
||||
|
||||
int iclass;
|
||||
struct
|
||||
{
|
||||
int iFunctionIndex;
|
||||
bool inmenu;
|
||||
float time;
|
||||
int keys;
|
||||
char text[512];
|
||||
int chan;
|
||||
int channel1;
|
||||
int channel2;
|
||||
} menucmd;
|
||||
hudtextparms_t menuhudtext;
|
||||
};
|
||||
#endif
|
|
@ -1,120 +0,0 @@
|
|||
#include "ns.h"
|
||||
|
||||
static cell AMX_NATIVE_CALL ns_set_menu(AMX *amx,cell *params)
|
||||
{
|
||||
if (params[1] == 0) // Setting this for all
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<=32;i++)
|
||||
{
|
||||
CPlayer *p = GET_PLAYER_I(i);
|
||||
|
||||
p->menuhudtext.r1=params[2];
|
||||
p->menuhudtext.g1=params[3];
|
||||
p->menuhudtext.b1=params[4];
|
||||
p->menuhudtext.x=CELL_TO_FLOAT(params[5]);
|
||||
p->menuhudtext.y=CELL_TO_FLOAT(params[6]);
|
||||
p->menuhudtext.effect=params[7];
|
||||
p->menuhudtext.fxTime=CELL_TO_FLOAT(params[8]);
|
||||
p->menuhudtext.fadeinTime=CELL_TO_FLOAT(params[9]);
|
||||
p->menuhudtext.channel=params[10];
|
||||
p->menucmd.channel1=params[10];
|
||||
p->menucmd.channel2=params[11];
|
||||
|
||||
}
|
||||
}
|
||||
else // Setting this specific
|
||||
{
|
||||
CPlayer *p = GET_PLAYER_I(params[1]);
|
||||
p->menuhudtext.r1=params[2];
|
||||
p->menuhudtext.g1=params[3];
|
||||
p->menuhudtext.b1=params[4];
|
||||
p->menuhudtext.x=CELL_TO_FLOAT(params[5]);
|
||||
p->menuhudtext.y=CELL_TO_FLOAT(params[6]);
|
||||
p->menuhudtext.effect=params[7];
|
||||
p->menuhudtext.fxTime=CELL_TO_FLOAT(params[8]);
|
||||
p->menuhudtext.fadeinTime=CELL_TO_FLOAT(params[9]);
|
||||
p->menuhudtext.channel=params[10];
|
||||
p->menucmd.channel1=params[10];
|
||||
p->menucmd.channel2=params[11];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL ns_show_menu(AMX *amx,cell *params)
|
||||
{
|
||||
// Format: show_ns_menu(id=0,szcommand,sztext,keys,time)
|
||||
edict_t *pEntity=NULL;
|
||||
CPlayer *p = GET_PLAYER_I(params[1]);
|
||||
int iFunctionIndex;
|
||||
if (params[1]!=0 && params[1]<=gpGlobals->maxClients)
|
||||
{
|
||||
pEntity=INDEXENT2(params[1]);
|
||||
if (FNullEnt(INDEXENT2(params[1])))
|
||||
return 0;
|
||||
}
|
||||
int len;
|
||||
int ifx;
|
||||
char sTemp[20];
|
||||
char sText[512];
|
||||
strncpy(sTemp,MF_GetAmxString(amx,params[2],0,&len),19);
|
||||
strncpy(sText,MF_GetAmxString(amx,params[3],1,&len),511);
|
||||
sTemp[19]='\0';
|
||||
sText[511]='\0';
|
||||
if (MF_AmxFindPublic(amx,sTemp,&ifx) == AMX_ERR_NONE)
|
||||
iFunctionIndex = MF_RegisterSPForward(amx,ifx,FP_CELL, FP_CELL,FP_DONE);
|
||||
else
|
||||
{
|
||||
MF_Log("(ns_show_menu): Function not found: %s",sTemp);
|
||||
return 0;
|
||||
}
|
||||
if (pEntity==NULL)
|
||||
{
|
||||
int i;
|
||||
for (i=1;i<=gpGlobals->maxClients;i++)
|
||||
{
|
||||
CPlayer *p = GET_PLAYER_I(i);
|
||||
if (p->connected) /* Grrrrrrrrr */
|
||||
{
|
||||
p->menucmd.iFunctionIndex=iFunctionIndex;
|
||||
p->menucmd.inmenu=true;
|
||||
p->menucmd.time=gpGlobals->time+(float)params[5];
|
||||
sprintf(p->menucmd.text,"%s",sText);
|
||||
p->menucmd.keys=params[4];
|
||||
p->menuhudtext.channel = p->menucmd.chan ? p->menucmd.channel1 : p->menucmd.channel2;
|
||||
p->menuhudtext.holdTime=(float)params[5];
|
||||
p->menucmd.chan=p->menuhudtext.channel;
|
||||
p->menucmd.chan = p->menucmd.chan ? 0 : 1;
|
||||
// UTIL_EmptyMenu(INDEXENT2(i),params[4],params[5]);
|
||||
// HudMessage(i,p->menuhudtext,sText);
|
||||
}
|
||||
}
|
||||
UTIL_EmptyMenu(0,params[4],params[5]);
|
||||
HudMessage(0,p->menuhudtext,sText);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPlayer *p = GET_PLAYER_I(params[1]);
|
||||
if (p->connected)
|
||||
{
|
||||
p->menucmd.iFunctionIndex=iFunctionIndex;
|
||||
p->menucmd.inmenu=true;
|
||||
p->menucmd.time=gpGlobals->time+(float)params[5];
|
||||
sprintf(p->menucmd.text,"%s",sText);
|
||||
p->menucmd.keys=params[4];
|
||||
p->menuhudtext.channel = p->menucmd.chan ? p->menucmd.channel1 : p->menucmd.channel2;
|
||||
UTIL_EmptyMenu(INDEXENT2(params[1]),params[4],params[5]);
|
||||
p->menuhudtext.holdTime=(float)params[5];
|
||||
HudMessage(params[1],p->menuhudtext,sText);
|
||||
p->menucmd.chan=p->menuhudtext.channel;
|
||||
p->menucmd.chan = p->menucmd.chan ? 0 : 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
AMX_NATIVE_INFO ns_menu_natives[] = {
|
||||
{ "ns_set_menu", ns_set_menu },
|
||||
{ "ns_show_menu", ns_show_menu },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
@ -3023,105 +3023,6 @@ int Find_Building_Hive(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void GiveItem(edict_t *pEntity,char *szname)
|
||||
{
|
||||
edict_t *wEntity=NULL;
|
||||
wEntity=CREATE_NAMED_ENTITY(MAKE_STRING(szname));
|
||||
MDLL_Spawn(wEntity);
|
||||
MDLL_Touch(wEntity,pEntity);
|
||||
}
|
||||
void UTIL_EmptyMenu(edict_t *pEntity, int keys, int time)
|
||||
{
|
||||
if (pEntity != NULL)
|
||||
MESSAGE_BEGIN( MSG_ONE , gmsgShowMenu, NULL, pEntity );
|
||||
else
|
||||
MESSAGE_BEGIN(MSG_ALL, gmsgShowMenu);
|
||||
WRITE_SHORT( keys );
|
||||
WRITE_CHAR( time );
|
||||
WRITE_BYTE( FALSE);
|
||||
WRITE_STRING( " " );
|
||||
MESSAGE_END();
|
||||
}
|
||||
void HudMessage(int index, const hudtextparms_t &textparms, const char *pMessage )
|
||||
{
|
||||
|
||||
if (index > 0 && index<=gpGlobals->maxClients)
|
||||
{
|
||||
edict_t *pEntity = INDEXENT2(index);
|
||||
MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, pEntity);
|
||||
}
|
||||
else if (index == 0)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ALL, SVC_TEMPENTITY);
|
||||
}
|
||||
else
|
||||
return;
|
||||
WRITE_BYTE( TE_TEXTMESSAGE );
|
||||
WRITE_BYTE( textparms.channel & 0xFF );
|
||||
|
||||
WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) );
|
||||
WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) );
|
||||
WRITE_BYTE( textparms.effect );
|
||||
|
||||
WRITE_BYTE( textparms.r1 );
|
||||
WRITE_BYTE( textparms.g1 );
|
||||
WRITE_BYTE( textparms.b1 );
|
||||
WRITE_BYTE( textparms.a1 );
|
||||
|
||||
WRITE_BYTE( textparms.r2 );
|
||||
WRITE_BYTE( textparms.g2 );
|
||||
WRITE_BYTE( textparms.b2 );
|
||||
WRITE_BYTE( textparms.a2 );
|
||||
|
||||
WRITE_SHORT( FixedUnsigned16( textparms.fadeinTime, 1<<8 ) );
|
||||
WRITE_SHORT( FixedUnsigned16( textparms.fadeoutTime, 1<<8 ) );
|
||||
WRITE_SHORT( FixedUnsigned16( textparms.holdTime, 1<<8 ) );
|
||||
|
||||
if ( textparms.effect == 2 )
|
||||
WRITE_SHORT( FixedUnsigned16( textparms.fxTime, 1<<8 ) );
|
||||
|
||||
if ( strlen( pMessage ) < 512 )
|
||||
{
|
||||
WRITE_STRING( pMessage );
|
||||
}
|
||||
else
|
||||
{
|
||||
char tmp[512];
|
||||
strncpy( tmp, pMessage, 511 );
|
||||
tmp[511] = 0;
|
||||
WRITE_STRING( tmp );
|
||||
}
|
||||
MESSAGE_END();
|
||||
}
|
||||
void ClearHudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, pEntity);
|
||||
WRITE_BYTE( TE_TEXTMESSAGE );
|
||||
WRITE_BYTE( textparms.channel & 0xFF );
|
||||
WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) );
|
||||
WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) );
|
||||
WRITE_BYTE( textparms.effect );
|
||||
|
||||
WRITE_BYTE( textparms.r1 );
|
||||
WRITE_BYTE( textparms.g1 );
|
||||
WRITE_BYTE( textparms.b1 );
|
||||
WRITE_BYTE( textparms.a1 );
|
||||
|
||||
WRITE_BYTE( textparms.r2 );
|
||||
WRITE_BYTE( textparms.g2 );
|
||||
WRITE_BYTE( textparms.b2 );
|
||||
WRITE_BYTE( textparms.a2 );
|
||||
|
||||
WRITE_SHORT( FixedUnsigned16( 0.1, 1<<8 ) );
|
||||
WRITE_SHORT( FixedUnsigned16( 0.1, 1<<8 ) );
|
||||
WRITE_SHORT( FixedUnsigned16( 0.1, 1<<8 ) );
|
||||
|
||||
if ( textparms.effect == 2 )
|
||||
WRITE_SHORT( FixedUnsigned16( 0.0, 1<<8 ) );
|
||||
|
||||
WRITE_STRING( "" );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -16,21 +16,12 @@ int BuiltForward = 0;
|
|||
// Index of last entity hooked in CreateNamedEntity
|
||||
int iCreateEntityIndex;
|
||||
BOOL iscombat;
|
||||
int g_MsgInfo[10];
|
||||
int g_MsgLength;
|
||||
int gmsgScoreInfo=0;
|
||||
int hooked_msg=0;
|
||||
int hooked_dest=0;
|
||||
|
||||
|
||||
int gmsgShowMenu=0;
|
||||
int gmsgResetHUD=0;
|
||||
|
||||
// Module is attaching to AMXX
|
||||
void OnAmxxAttach()
|
||||
{
|
||||
MF_AddNatives(ns_misc_natives);
|
||||
MF_AddNatives(ns_menu_natives);
|
||||
MF_AddNatives(ns_pdata_natives);
|
||||
}
|
||||
|
||||
|
@ -53,13 +44,6 @@ void OnPluginsLoaded()
|
|||
}
|
||||
|
||||
|
||||
void ClientCommand(edict_t *pEntity)
|
||||
{
|
||||
CPlayer *player = GET_PLAYER_E(pEntity);
|
||||
if (player->ClientCommand())
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
int Spawn(edict_t *pEntity)
|
||||
{
|
||||
|
@ -127,37 +111,6 @@ void PlayerPostThink_Post(edict_t *pEntity)
|
|||
}
|
||||
|
||||
|
||||
void MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
|
||||
{
|
||||
if (gmsgShowMenu==0)
|
||||
gmsgShowMenu=GET_USER_MSG_ID(&Plugin_info,"ShowMenu",NULL);
|
||||
if (gmsgResetHUD==0)
|
||||
gmsgResetHUD=GET_USER_MSG_ID(&Plugin_info,"ResetHUD",NULL);
|
||||
if (msg_dest == MSG_ALL || msg_dest == MSG_BROADCAST)
|
||||
hooked_dest = 0;
|
||||
else
|
||||
hooked_dest = ENTINDEX(ed);
|
||||
hooked_msg = msg_type;
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void MessageEnd_Post(void)
|
||||
{
|
||||
if (hooked_msg == gmsgResetHUD && hooked_dest != 0)
|
||||
{
|
||||
CPlayer *player = GET_PLAYER_I(hooked_dest);
|
||||
if (!player->connected && player->bot)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
if (player->menucmd.inmenu == true && player->menucmd.time > gpGlobals->time)
|
||||
{
|
||||
// Reset the hold time, or the menu display and menu keys will become terribly out of sync.
|
||||
player->menuhudtext.holdTime=player->menucmd.time - gpGlobals->time;
|
||||
HudMessage(/* 0 */ hooked_dest,player->menuhudtext,player->menucmd.text);
|
||||
}
|
||||
}
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
|
||||
// Parse log messages here for any desired information (structure_built, etc.)
|
||||
// The following logs are needed:
|
||||
// name<CID><AUTHID><TEAM> triggered "structure_built" (type "type") -- client_built
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
|
||||
// #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
|
||||
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
|
||||
#define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
||||
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
||||
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
||||
#define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
|
||||
#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
|
||||
|
@ -202,7 +202,7 @@
|
|||
// #define FN_LightStyle LightStyle
|
||||
// #define FN_DecalIndex DecalIndex
|
||||
// #define FN_PointContents PointContents
|
||||
#define FN_MessageBegin MessageBegin
|
||||
// #define FN_MessageBegin MessageBegin
|
||||
// #define FN_MessageEnd MessageEnd
|
||||
// #define FN_WriteByte WriteByte
|
||||
// #define FN_WriteChar WriteChar
|
||||
|
@ -349,7 +349,7 @@
|
|||
// #define FN_DecalIndex_Post DecalIndex_Post
|
||||
// #define FN_PointContents_Post PointContents_Post
|
||||
// #define FN_MessageBegin_Post MessageBegin_Post
|
||||
#define FN_MessageEnd_Post MessageEnd_Post
|
||||
// #define FN_MessageEnd_Post MessageEnd_Post
|
||||
// #define FN_WriteByte_Post WriteByte_Post
|
||||
// #define FN_WriteChar_Post WriteChar_Post
|
||||
// #define FN_WriteShort_Post WriteShort_Post
|
||||
|
|
|
@ -20,10 +20,7 @@ extern edict_t *player_edicts[33]; // Stupid INDEXENT() bug.
|
|||
extern int gmsgHudText2;
|
||||
|
||||
|
||||
extern int gmsgShowMenu;
|
||||
|
||||
extern AMX_NATIVE_INFO ns_misc_natives[];
|
||||
extern AMX_NATIVE_INFO ns_menu_natives[];
|
||||
extern AMX_NATIVE_INFO ns_pdata_natives[];
|
||||
|
||||
|
||||
|
|
|
@ -177,9 +177,6 @@
|
|||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\NMenu.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\NMisc.cpp">
|
||||
</File>
|
||||
|
|
Loading…
Reference in New Issue
Block a user