Compare commits

..
Author SHA1 Message Date
BotoX 7185be1121 fix remaining issues 2019-09-10 11:21:46 +02:00
BotoX 5ac1379b67 Add MenuSetClientMapping native. 2019-09-10 11:21:46 +02:00
BotoX d67d6321ad Implement per-client randomized menus with MenuShufflePerClient native. 2019-09-10 11:21:46 +02:00
28 changed files with 269 additions and 147 deletions
-12
View File
@@ -1,12 +0,0 @@
# GitHub views all .h files as C, let's assume it's C++
*.h linguist-language=c++
# Internal tools overriding
tools/* linguist-vendored
editor/* linguist-vendored
# Third-party overriding
extensions/curl/curl-src/* linguist-vendored
extensions/geoip/GeoIP.c linguist-vendored
extensions/geoip/GeoIP.h linguist-vendored
extensions/sqlite/sqlite-source/* linguist-vendored
-11
View File
@@ -379,16 +379,6 @@ class SMConfig(object):
def configure_windows(self, cxx):
cxx.defines += ['WIN32', '_WINDOWS']
def add_libamtl(self):
# Add libamtl.
self.libamtl = {}
for arch in self.archs:
def get_configure_fn(arch):
return lambda builder, name: self.StaticLibrary(builder, name, arch)
extra_vars = {'Configure': get_configure_fn(arch)}
libamtl = builder.Build('public/amtl/amtl/AMBuilder', extra_vars)
self.libamtl[arch] = libamtl.binary
def AddVersioning(self, binary, arch):
if builder.target.platform == 'windows':
binary.sources += ['version.rc']
@@ -623,7 +613,6 @@ SM = SMConfig()
SM.detectProductVersion()
SM.detectSDKs()
SM.configure()
SM.add_libamtl()
if SM.use_auto_versioning():
SM.generated_headers = builder.Build(
+3 -3
View File
@@ -308,7 +308,7 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
{
ItemDrawInfo &dr = drawItems[foundItems].draw;
/* Is the item valid? */
if (menu->GetItemInfo(i, &dr) != NULL)
if (menu->GetItemInfo(i, &dr, client) != NULL)
{
/* Ask the user to change the style, if necessary */
mh->OnMenuDrawItem(menu, client, i, dr.style);
@@ -398,7 +398,7 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
}
while (++lastItem < totalItems)
{
if (menu->GetItemInfo(lastItem, &dr) != NULL)
if (menu->GetItemInfo(lastItem, &dr, client) != NULL)
{
mh->OnMenuDrawItem(menu, client, lastItem, dr.style);
if (IsSlotItem(panel, dr.style))
@@ -420,7 +420,7 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
lastItem--;
while (lastItem != 0)
{
if (menu->GetItemInfo(lastItem, &dr) != NULL)
if (menu->GetItemInfo(lastItem, &dr, client) != NULL)
{
mh->OnMenuDrawItem(menu, client, lastItem, dr.style);
if (IsSlotItem(panel, dr.style))
+64 -3
View File
@@ -633,7 +633,7 @@ bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
return false;
}
CItem item;
CItem item(m_items.length());
item.info = info;
if (draw.display)
@@ -655,7 +655,7 @@ bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDr
if (position >= m_items.length())
return false;
CItem item;
CItem item(position);
item.info = info;
if (draw.display)
item.display = new ke::AString(draw.display);
@@ -679,11 +679,16 @@ void CBaseMenu::RemoveAllItems()
m_items.clear();
}
const char *CBaseMenu::GetItemInfo(unsigned int position, ItemDrawInfo *draw/* =NULL */)
const char *CBaseMenu::GetItemInfo(unsigned int position, ItemDrawInfo *draw/* =NULL */, int client/* =0 */)
{
if (position >= m_items.length())
return NULL;
if (client > 0 && position < m_RandomMaps[client].length())
{
position = m_RandomMaps[client][position];
}
if (draw)
{
draw->display = m_items[position].display->chars();
@@ -693,6 +698,62 @@ const char *CBaseMenu::GetItemInfo(unsigned int position, ItemDrawInfo *draw/* =
return m_items[position].info.chars();
}
void CBaseMenu::ShufflePerClient(int start, int stop)
{
// limit map len to 255 items since it's using uint8
int length = MIN(GetItemCount(), 255);
if (stop >= 0)
length = MIN(length, stop);
for (int i = 1; i < SM_MAXPLAYERS + 1; i++)
{
// populate per-client map ...
m_RandomMaps[i].resize(length);
for (int j = 0; j < length; j++)
m_RandomMaps[i][j] = j;
// ... and random shuffle it
for (int j = length - 1; j > start; j--)
{
int x = rand() % (j - start + 1) + start;
uint8_t tmp = m_RandomMaps[i][x];
m_RandomMaps[i][x] = m_RandomMaps[i][j];
m_RandomMaps[i][j] = tmp;
}
}
}
void CBaseMenu::SetClientMapping(int client, int *array, int length)
{
length = MIN(length, 255);
m_RandomMaps[client].resize(length);
for (int i = 0; i < length; i++)
{
m_RandomMaps[client][i] = array[i];
}
}
bool CBaseMenu::IsPerClientShuffled()
{
for (int i = 1; i < SM_MAXPLAYERS + 1; i++)
{
if(m_RandomMaps[i].length() > 0)
return true;
}
return false;
}
unsigned int CBaseMenu::GetRealItemIndex(int client, unsigned int position)
{
if (client > 0 && position < m_RandomMaps[client].length())
{
position = m_RandomMaps[client][position];
return m_items[position].index;
}
return position;
}
unsigned int CBaseMenu::GetItemCount()
{
return m_items.length();
+11 -2
View File
@@ -44,8 +44,9 @@ using namespace SourceMod;
class CItem
{
public:
CItem()
CItem(unsigned int index)
{
this->index = index;
style = 0;
access = 0;
}
@@ -53,11 +54,13 @@ public:
: info(ke::Move(other.info)),
display(ke::Move(other.display))
{
index = other.index;
style = other.style;
access = other.access;
}
CItem & operator =(CItem &&other)
{
index = other.index;
info = ke::Move(other.info);
display = ke::Move(other.display);
style = other.style;
@@ -66,6 +69,7 @@ public:
}
public:
unsigned int index;
ke::AString info;
ke::AutoPtr<ke::AString> display;
unsigned int style;
@@ -138,7 +142,7 @@ public:
virtual bool InsertItem(unsigned int position, const char *info, const ItemDrawInfo &draw);
virtual bool RemoveItem(unsigned int position);
virtual void RemoveAllItems();
virtual const char *GetItemInfo(unsigned int position, ItemDrawInfo *draw=NULL);
virtual const char *GetItemInfo(unsigned int position, ItemDrawInfo *draw=NULL, int client=0);
virtual unsigned int GetItemCount();
virtual bool SetPagination(unsigned int itemsPerPage);
virtual unsigned int GetPagination();
@@ -152,6 +156,10 @@ public:
virtual unsigned int GetMenuOptionFlags();
virtual void SetMenuOptionFlags(unsigned int flags);
virtual IMenuHandler *GetHandler();
virtual void ShufflePerClient(int start, int stop);
virtual void SetClientMapping(int client, int *array, int length);
virtual bool IsPerClientShuffled();
virtual unsigned int GetRealItemIndex(int client, unsigned int position);
unsigned int GetBaseMemUsage();
private:
void InternalDelete();
@@ -168,6 +176,7 @@ protected:
Handle_t m_hHandle;
IMenuHandler *m_pHandler;
unsigned int m_nFlags;
ke::Vector<uint8_t> m_RandomMaps[SM_MAXPLAYERS+1];
};
#endif //_INCLUDE_MENUSTYLE_BASE_H
+4 -3
View File
@@ -514,15 +514,16 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
/* Check by our item count, NOT the vote array size */
if (item < m_Items)
{
m_ClientVotes[client] = item;
m_Votes[item]++;
unsigned int index = menu->GetRealItemIndex(client, item);
m_ClientVotes[client] = index;
m_Votes[index]++;
m_NumVotes++;
if (sm_vote_chat.GetBool() || sm_vote_console.GetBool() || sm_vote_client_console.GetBool())
{
static char buffer[1024];
ItemDrawInfo dr;
menu->GetItemInfo(item, &dr);
menu->GetItemInfo(item, &dr, client);
if (sm_vote_console.GetBool())
{
+1 -4
View File
@@ -1474,10 +1474,7 @@ void PlayerManager::InvalidatePlayer(CPlayer *pPlayer)
}
}
auto userid = engine->GetPlayerUserId(pPlayer->m_pEdict);
if (userid != -1)
m_UserIdLookUp[userid] = 0;
m_UserIdLookUp[engine->GetPlayerUserId(pPlayer->m_pEdict)] = 0;
pPlayer->Disconnect();
}
+2 -2
View File
@@ -1364,7 +1364,7 @@ bool CLocalExtension::IsSameFile(const char *file)
bool CRemoteExtension::IsSameFile(const char *file)
{
/* Check full path and name passed in from LoadExternal */
return strcmp(file, m_Path.c_str()) == 0 || strcmp(file, m_File.c_str()) == 0;
/* :TODO: this could be better, but no one uses this API anyway. */
return strcmp(file, m_Path.c_str()) == 0;
}
+62 -1
View File
@@ -816,8 +816,14 @@ static cell_t GetMenuItem(IPluginContext *pContext, const cell_t *params)
ItemDrawInfo dr;
const char *info;
cell_t client = (params[0] >= 8) ? params[8] : 0;
if(!client && menu->IsPerClientShuffled())
{
return pContext->ThrowNativeError("This menu has been per-client random shuffled. "
"You have to call GetMenuItem with a client index!");
}
if ((info=menu->GetItemInfo(params[2], &dr)) == NULL)
if ((info=menu->GetItemInfo(params[2], &dr, client)) == NULL)
{
return 0;
}
@@ -832,6 +838,57 @@ static cell_t GetMenuItem(IPluginContext *pContext, const cell_t *params)
return 1;
}
static cell_t MenuShufflePerClient(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = (Handle_t)params[1];
HandleError err;
IBaseMenu *menu;
if ((err = ReadMenuHandle(params[1], &menu)) != HandleError_None)
{
return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
}
int start = params[2];
int stop = params[3];
if (stop > 0 && !(stop >= start))
{
return pContext->ThrowNativeError("Stop must be -1 or >= start!");
}
menu->ShufflePerClient(start, stop);
return 1;
}
static cell_t MenuSetClientMapping(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = (Handle_t)params[1];
HandleError err;
IBaseMenu *menu;
if ((err = ReadMenuHandle(params[1], &menu)) != HandleError_None)
{
return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
}
int client = params[2];
if (client < 1 || client > SM_MAXPLAYERS)
{
return pContext->ThrowNativeError("Invalid client index!");
}
cell_t *array;
pContext->LocalToPhysAddr(params[3], &array);
int length = params[4];
menu->SetClientMapping(client, array, length);
return 1;
}
static cell_t SetMenuPagination(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = (Handle_t)params[1];
@@ -1645,6 +1702,8 @@ REGISTER_NATIVES(menuNatives)
{"SetPanelKeys", SetPanelKeys},
{"SetVoteResultCallback", SetVoteResultCallback},
{"VoteMenu", VoteMenu},
{"MenuShufflePerClient", MenuShufflePerClient},
{"MenuSetClientMapping", MenuSetClientMapping},
{"SetMenuNoVoteButton", SetMenuNoVoteButton},
// Transitional syntax support.
@@ -1673,6 +1732,8 @@ REGISTER_NATIVES(menuNatives)
{"Menu.ToPanel", CreatePanelFromMenu},
{"Menu.Cancel", CancelMenu},
{"Menu.DisplayVote", VoteMenu},
{"Menu.ShufflePerClient", MenuShufflePerClient},
{"Menu.SetClientMapping", MenuSetClientMapping},
{"Menu.Pagination.get", GetMenuPagination},
{"Menu.Pagination.set", SetMenuPagination},
{"Menu.OptionFlags.get", GetMenuOptionFlags},
-4
View File
@@ -53,10 +53,6 @@ static CBaseEntity *FindEntityByNetClass(int start, const char *classname)
if (network == NULL)
continue;
IHandleEntity *pHandleEnt = network->GetEntityHandle();
if (pHandleEnt == NULL)
continue;
ServerClass *sClass = network->GetServerClass();
const char *name = sClass->GetName();
-17
View File
@@ -998,22 +998,6 @@ static cell_t smn_TRGetHitGroup(IPluginContext *pContext, const cell_t *params)
return tr->hitgroup;
}
static cell_t smn_TRGetHitBoxIndex(IPluginContext *pContext, const cell_t *params)
{
sm_trace_t *tr;
HandleError err;
HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
if (params[1] == BAD_HANDLE)
{
tr = &g_Trace;
} else if ((err = handlesys->ReadHandle(params[1], g_TraceHandle, &sec, (void **)&tr)) != HandleError_None) {
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", params[1], err);
}
return tr->hitbox;
}
static cell_t smn_TRGetEntityIndex(IPluginContext *pContext, const cell_t *params)
{
sm_trace_t *tr;
@@ -1118,7 +1102,6 @@ sp_nativeinfo_t g_TRNatives[] =
{"TR_StartSolid", smn_TRStartSolid},
{"TR_DidHit", smn_TRDidHit},
{"TR_GetHitGroup", smn_TRGetHitGroup},
{"TR_GetHitBoxIndex", smn_TRGetHitBoxIndex},
{"TR_ClipRayToEntity", smn_TRClipRayToEntity},
{"TR_ClipRayToEntityEx", smn_TRClipRayToEntityEx},
{"TR_ClipRayHullToEntity", smn_TRClipRayHullToEntity},
-4
View File
@@ -255,12 +255,10 @@ ValveCall *CreateValveVCall(unsigned int vtableIdx,
/* Get return information - encode only */
PassInfo retBuf;
ObjectField retFieldBuf[16];
size_t retBufSize = 0;
bool retbuf_needs_extra;
if (retInfo)
{
retBuf.fields = retFieldBuf;
if ((size = ValveParamToBinParam(retInfo->vtype, retInfo->type, retInfo->flags, &retBuf, retbuf_needs_extra)) == 0)
{
delete vc;
@@ -271,14 +269,12 @@ ValveCall *CreateValveVCall(unsigned int vtableIdx,
/* Get parameter info */
PassInfo paramBuf[32];
ObjectField fieldBuf[32][16];
size_t sizes[32];
size_t normSize = 0;
size_t extraSize = 0;
for (unsigned int i=0; i<numParams; i++)
{
bool needs_extra;
paramBuf[i].fields = fieldBuf[i];
if ((size = ValveParamToBinParam(params[i].vtype,
params[i].type,
params[i].flags,
+8 -5
View File
@@ -1,14 +1,15 @@
SOURCEMOD LICENSE INFORMATION
VERSION: 2019-9-30
VERSION: JUNE-13-2008
-----------------------------
SourceMod is licensed under the GNU General Public License, version 3.
As a special exception, AlliedModders LLC gives you permission to link the code
of this program (as well as its derivative works) to "Half-Life 2," the "Source
Engine" and any Game MODs that run on software by the Valve Corporation.
You must obey the GNU General Public License in all respects for all other code used.
Additionally, AlliedModders LLC grants this exception to all derivative works.
Engine," the "SourcePawn JIT," and any Game MODs that run on software by the
Valve Corporation. You must obey the GNU General Public License in all
respects for all other code used. Additionally, AlliedModders LLC grants this
exception to all derivative works.
As an additional special exception to the GNU General Public License 3.0,
AlliedModders LLC permits dual-licensing of DERIVATIVE WORKS ONLY (that is,
@@ -26,6 +27,7 @@ License version 2 (without an "or any higher version" clause) if and only if
the work was already GNU General Public License 2.0 exclusive. This clause is
provided for backwards compatibility only.
A copy of the JIT License is available in JIT.txt.
A copy of the GNU General Public License 2.0 is available in GPLv2.txt.
A copy of the GNU General Public License 3.0 is available in GPLv3.txt.
@@ -33,4 +35,5 @@ SourcePawn is Copyright (C) 2006-2008 AlliedModders LLC. All rights reserved.
SourceMod is Copyright (C) 2006-2008 AlliedModders LLC. All rights reserved.
Pawn and SMALL are Copyright (C) 1997-2008 ITB CompuPhase.
Source is Copyright (C) Valve Corporation.
All trademarks are property of their respective owners in the US and other countries.
All trademarks are property of their respective owners in the US and other
+32 -32
View File
@@ -4,26 +4,26 @@
#define ARRAY_STRING_LENGTH 32
enum struct GroupCommands
enum GroupCommands
{
ArrayList groupListName;
ArrayList groupListCommand;
}
ArrayList:groupListName,
ArrayList:groupListCommand
};
GroupCommands g_groupList;
int g_groupList[GroupCommands];
int g_groupCount;
SMCParser g_configParser;
enum struct Places
enum Places
{
int category;
int item;
int replaceNum;
}
Place_Category,
Place_Item,
Place_ReplaceNum
};
char g_command[MAXPLAYERS+1][CMD_LENGTH];
Places g_currentPlace[MAXPLAYERS+1];
int g_currentPlace[MAXPLAYERS+1][Places];
/**
* What to put in the 'info' menu field (for PlayerList and Player_Team menus only)
@@ -331,11 +331,11 @@ void ParseConfigs()
g_configParser.OnKeyValue = KeyValue;
g_configParser.OnLeaveSection = EndSection;
delete g_groupList.groupListName;
delete g_groupList.groupListCommand;
delete g_groupList[groupListName];
delete g_groupList[groupListCommand];
g_groupList.groupListName = new ArrayList(ARRAY_STRING_LENGTH);
g_groupList.groupListCommand = new ArrayList(ARRAY_STRING_LENGTH);
g_groupList[groupListName] = new ArrayList(ARRAY_STRING_LENGTH);
g_groupList[groupListCommand] = new ArrayList(ARRAY_STRING_LENGTH);
char configPath[256];
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/dynamicmenu/adminmenu_grouping.txt");
@@ -376,13 +376,13 @@ public SMCResult NewSection(SMCParser smc, const char[] name, bool opt_quotes)
public SMCResult KeyValue(SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes)
{
g_groupList.groupListName.PushString(key);
g_groupList.groupListCommand.PushString(value);
g_groupList[groupListName].PushString(key);
g_groupList[groupListCommand].PushString(value);
}
public SMCResult EndSection(SMCParser smc)
{
g_groupCount = g_groupList.groupListName.Length;
g_groupCount = g_groupList[groupListName].Length;
}
public void DynamicMenuCategoryHandler(TopMenu topmenu,
@@ -421,8 +421,8 @@ public void DynamicMenuItemHandler(TopMenu topmenu,
strcopy(g_command[param], sizeof(g_command[]), output.cmd);
g_currentPlace[param].item = location;
g_currentPlace[param].replaceNum = 1;
g_currentPlace[param][Place_Item] = location;
g_currentPlace[param][Place_ReplaceNum] = 1;
ParamCheck(param);
}
@@ -436,19 +436,19 @@ public void ParamCheck(int client)
Item outputItem;
Submenu outputSubmenu;
g_DataArray.GetArray(g_currentPlace[client].item, outputItem);
g_DataArray.GetArray(g_currentPlace[client][Place_Item], outputItem);
if (g_currentPlace[client].replaceNum < 1)
if (g_currentPlace[client][Place_ReplaceNum] < 1)
{
g_currentPlace[client].replaceNum = 1;
g_currentPlace[client][Place_ReplaceNum] = 1;
}
Format(buffer, 5, "#%i", g_currentPlace[client].replaceNum);
Format(buffer2, 5, "@%i", g_currentPlace[client].replaceNum);
Format(buffer, 5, "#%i", g_currentPlace[client][Place_ReplaceNum]);
Format(buffer2, 5, "@%i", g_currentPlace[client][Place_ReplaceNum]);
if (StrContains(g_command[client], buffer) != -1 || StrContains(g_command[client], buffer2) != -1)
{
outputItem.submenus.GetArray(g_currentPlace[client].replaceNum - 1, outputSubmenu);
outputItem.submenus.GetArray(g_currentPlace[client][Place_ReplaceNum] - 1, outputSubmenu);
Menu itemMenu = new Menu(Menu_Selection);
itemMenu.ExitBackButton = true;
@@ -460,8 +460,8 @@ public void ParamCheck(int client)
for (int i = 0; i<g_groupCount; i++)
{
g_groupList.groupListName.GetString(i, nameBuffer, sizeof(nameBuffer));
g_groupList.groupListCommand.GetString(i, commandBuffer, sizeof(commandBuffer));
g_groupList[groupListName].GetString(i, nameBuffer, sizeof(nameBuffer));
g_groupList[groupListCommand].GetString(i, commandBuffer, sizeof(commandBuffer));
itemMenu.AddItem(commandBuffer, nameBuffer);
}
}
@@ -591,7 +591,7 @@ public void ParamCheck(int client)
}
g_command[client][0] = '\0';
g_currentPlace[client].replaceNum = 1;
g_currentPlace[client][Place_ReplaceNum] = 1;
}
}
@@ -622,16 +622,16 @@ public int Menu_Selection(Menu menu, MenuAction action, int param1, int param2)
char infobuffer[NAME_LENGTH+2];
Format(infobuffer, sizeof(infobuffer), "\"%s\"", info);
Format(buffer, 5, "#%i", g_currentPlace[param1].replaceNum);
Format(buffer, 5, "#%i", g_currentPlace[param1][Place_ReplaceNum]);
ReplaceString(g_command[param1], sizeof(g_command[]), buffer, infobuffer);
//replace #num with the selected option (quoted)
Format(buffer, 5, "@%i", g_currentPlace[param1].replaceNum);
Format(buffer, 5, "@%i", g_currentPlace[param1][Place_ReplaceNum]);
ReplaceString(g_command[param1], sizeof(g_command[]), buffer, info);
//replace @num with the selected option (unquoted)
// Increment the parameter counter.
g_currentPlace[param1].replaceNum++;
g_currentPlace[param1][Place_ReplaceNum]++;
ParamCheck(param1);
}
+1 -3
View File
@@ -159,10 +159,8 @@ int LoadMapList(Menu menu)
for (int i = 0; i < map_count; i++)
{
char displayName[PLATFORM_MAX_PATH];
GetArrayString(g_map_array, i, map_name, sizeof(map_name));
GetMapDisplayName(map_name, displayName, sizeof(displayName));
menu.AddItem(map_name, displayName);
menu.AddItem(map_name, map_name);
}
return map_count;
+2 -2
View File
@@ -84,7 +84,7 @@ methodmap ArrayStack < Handle
// @param block Optionally specify which block to read from
// (useful if the blocksize > 0).
// @param asChar Optionally read as a byte instead of a cell.
// @return Value popped from the stack.
// @return True on success, false if the stack is empty.
// @error The stack is empty.
public native any Pop(int block=0, bool asChar=false);
@@ -92,7 +92,7 @@ methodmap ArrayStack < Handle
//
// @param buffer Buffer to store string.
// @param maxlength Maximum size of the buffer.
// @param written Number of characters written to buffer, not including
// @oaram written Number of characters written to buffer, not including
// the null terminator.
// @error The stack is empty.
public native void PopString(char[] buffer, int maxlength, int &written = 0);
-3
View File
@@ -45,8 +45,6 @@
#define CS_SLOT_KNIFE 2 /**< Knife slot. */
#define CS_SLOT_GRENADE 3 /**< Grenade slot (will only return one grenade). */
#define CS_SLOT_C4 4 /**< C4 slot. */
#define CS_SLOT_BOOST 11 /**< Slot for healthshot and shield (will only return one weapon/item). */
#define CS_SLOT_UTILITY 12 /**< Slot for tablet. */
#define CS_DMG_HEADSHOT (1 << 30) /**< Headshot */
@@ -158,7 +156,6 @@ enum CSWeaponID
CSWeapon_BUMPMINE = 85,
CSWeapon_MAX_WEAPONS_NO_KNIFES, // Max without the knife item defs, useful when treating all knives as a regular knife.
CSWeapon_BAYONET = 500,
CSWeapon_KNIFE_CLASSIC = 503,
CSWeapon_KNIFE_FLIP = 505,
CSWeapon_KNIFE_GUT = 506,
CSWeapon_KNIFE_KARAMBIT = 507,
+2 -2
View File
@@ -547,7 +547,7 @@ native bool SQL_CheckConfig(const char[] name);
* string to return the default driver.
* @return Driver Handle, or INVALID_HANDLE on failure.
*/
native DBDriver SQL_GetDriver(const char[] name="");
native Handle SQL_GetDriver(const char[] name="");
/**
* Reads the driver of an opened database.
@@ -557,7 +557,7 @@ native DBDriver SQL_GetDriver(const char[] name="");
* @param ident_length Maximum length of the buffer.
* @return Driver Handle.
*/
native DBDriver SQL_ReadDriver(Handle database, char[] ident="", int ident_length=0);
native Handle SQL_ReadDriver(Handle database, char[] ident="", int ident_length=0);
/**
* Retrieves a driver's identification string.
+1 -1
View File
@@ -314,7 +314,7 @@ native bool ReadDirEntry(Handle dir, char[] buffer, int maxlength, FileType &typ
* Mac, this has no distinction from binary mode. On Windows, it causes the '\n'
* character (0xA) to be written as "\r\n" (0xD, 0xA).
*
* Example: "rb" opens a binary file for reading; "at" opens a text file for
* Example: "rb" opens a binary file for writing; "at" opens a text file for
* appending.
*
* @param file File to open.
+1 -1
View File
@@ -682,7 +682,7 @@ enum ClientRangeType
* @param size Maximum size of clients array.
* @return Number of client indexes written to clients array.
*/
native int GetClientsInRange(const float origin[3], ClientRangeType rangeType, int[] clients, int size);
native int GetClientsInRange(float origin[3], ClientRangeType rangeType, int[] clients, int size);
/**
* Retrieves the server's authentication string (SteamID).
+37 -2
View File
@@ -307,9 +307,23 @@ methodmap Menu < Handle
// @param style By-reference variable to store drawing flags.
// @param dispBuf Display buffer.
// @param dispBufLen Maximum length of the display buffer.
// @param client Client index. Must be specified if menu is per-client random shuffled, -1 to ignore.
// @return True on success, false if position is invalid.
public native bool GetItem(int position, char[] infoBuf, int infoBufLen,
int &style=0, char[] dispBuf="", int dispBufLen=0);
int &style=0, char[] dispBuf="", int dispBufLen=0, int client=0);
// Generates a per-client random mapping for the current vote options.
//
// @param start Menu item index to start randomizing from.
// @param stop Menu item index to stop randomizing at. -1 = infinite
public native void ShufflePerClient(int start=0, int stop=-1);
// Fills the client vote option mapping with user supplied values.
//
// @param client Client index.
// @param array Integer array with mapping.
// @param length Length of array.
public native void SetClientMapping(int client, int[] array, int length);
// Sets the menu's default title/instruction message.
//
@@ -537,6 +551,7 @@ native void RemoveAllMenuItems(Handle menu);
* @param style By-reference variable to store drawing flags.
* @param dispBuf Display buffer.
* @param dispBufLen Maximum length of the display buffer.
* @param client Client index. Must be specified if menu is per-client random shuffled, -1 to ignore.
* @return True on success, false if position is invalid.
* @error Invalid Handle.
*/
@@ -546,7 +561,27 @@ native bool GetMenuItem(Handle menu,
int infoBufLen,
int &style=0,
char[] dispBuf="",
int dispBufLen=0);
int dispBufLen=0,
int client=0);
/**
* Generates a per-client random mapping for the current vote options.
*
* @param menu Menu Handle.
* @param start Menu item index to start randomizing from.
* @param stop Menu item index to stop randomizing at. -1 = infinite
*/
native void MenuShufflePerClient(Handle menu, int start=0, int stop=-1);
/*
* Fills the client vote option mapping with user supplied values.
*
* @param menu Menu Handle.
* @param client Client index.
* @param array Integer array with mapping.
* @param length Length of array.
*/
native void MenuSetClientMapping(Handle menu, int client, int[] array, int length);
/**
* Returns the first item on the page of a currently selected menu.
+1 -1
View File
@@ -224,7 +224,7 @@ stock void TE_SendToClient(int client, float delay=0.0)
* @param rangeType Range type to use for filtering clients.
* @param delay Delay in seconds to send the TE.
*/
stock void TE_SendToAllInRange(const float origin[3], ClientRangeType rangeType, float delay=0.0)
stock void TE_SendToAllInRange(float origin[3], ClientRangeType rangeType, float delay=0.0)
{
int[] clients = new int[MaxClients];
int total = GetClientsInRange(origin, rangeType, clients, MaxClients);
-12
View File
@@ -633,18 +633,6 @@ native bool TR_DidHit(Handle hndl=INVALID_HANDLE);
*/
native int TR_GetHitGroup(Handle hndl=INVALID_HANDLE);
/**
* Returns in which hitbox the trace collided if any.
*
* Note: if the entity that collided with the trace is the world entity,
* then this function doesn't return an hitbox index but a static prop index.
*
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
* @return Hitbox index (Or static prop index).
* @error Invalid Handle.
*/
native int TR_GetHitBoxIndex(Handle hndl=INVALID_HANDLE);
/**
* Find the normal vector to the collision plane of a trace.
*
+1 -1
View File
@@ -1 +1 @@
1.11.0
1.10.0
+32 -2
View File
@@ -36,7 +36,7 @@
#include <IHandleSys.h>
#define SMINTERFACE_MENUMANAGER_NAME "IMenuManager"
#define SMINTERFACE_MENUMANAGER_VERSION 16
#define SMINTERFACE_MENUMANAGER_VERSION 17
/**
* @file IMenuManager.h
@@ -485,9 +485,10 @@ namespace SourceMod
*
* @param position Position, starting from 0.
* @param draw Optional pointer to store a draw information.
* @param client Client index. (Important for randomized menus.)
* @return Info string pointer, or NULL if position was invalid.
*/
virtual const char *GetItemInfo(unsigned int position, ItemDrawInfo *draw) =0;
virtual const char *GetItemInfo(unsigned int position, ItemDrawInfo *draw, int client=0) =0;
/**
* @brief Returns the number of items.
@@ -636,6 +637,35 @@ namespace SourceMod
* @return Approximate number of bytes being used.
*/
virtual unsigned int GetApproxMemUsage() =0;
/**
* @brief Generates a per-client random mapping for the current vote options.
* @param start Menu item index to start randomizing from.
* @param stop Menu item index to stop randomizing at. -1 = infinite
*/
virtual void ShufflePerClient(int start=0, int stop=-1) =0;
/**
* @brief Fills the client vote option mapping with user supplied values.
* @param client Client index.
* @param array Integer array with mapping.
* @param length Length of array.
*/
virtual void SetClientMapping(int client, int *array, int length) =0;
/**
* @brief Returns true if the menu has a per-client random mapping.
* @return True on success, false otherwise.
*/
virtual bool IsPerClientShuffled() =0;
/**
* @brief Returns the actual (not shuffled) item index from the client position.
* @param client Client index.
* @param position Position, starting from 0.
* @return Actual item index in menu.
*/
virtual unsigned int GetRealItemIndex(int client, unsigned int position) =0;
};
/**
+2 -12
View File
@@ -18,17 +18,7 @@ param(
'tf2',
'insurgency',
'sdk2013',
'dota',
'orangebox',
'blade',
'episode1',
'bms',
'darkm',
'swarm',
'bgt',
'eye',
'contagion',
'doi'
'dota'
)
)
@@ -88,4 +78,4 @@ Checkout-Repo -Name "ambuild" -Branch "master" -Repo "https://github.com/alliedm
Set-Location ambuild
& python setup.py install
Set-Location ..
Set-Location ..