zomg, I guess I should move these too

This commit is contained in:
Scott Ehlert 2006-05-17 20:23:36 +00:00
parent a993ba159a
commit cf9cdaa3d6
4 changed files with 121 additions and 119 deletions

View File

@ -1621,114 +1621,6 @@ static cell AMX_NATIVE_CALL set_cvar_string(AMX *amx, cell *params) /* 2 param *
return 1;
}
static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
{
int numparam = *params / sizeof(cell);
float vecOrigin[3];
cell *cpOrigin;
if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages
&& !GET_USER_MSG_NAME(PLID, params[2], NULL)))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called message_begin with an invalid message id (%d).", params[2]);
return 0;
}
switch (params[1])
{
case MSG_BROADCAST:
case MSG_ALL:
case MSG_SPEC:
MESSAGE_BEGIN(params[1], params[2], NULL);
break;
case MSG_PVS: case MSG_PAS:
case MSG_PVS_R: case MSG_PAS_R:
if (numparam < 3)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
cpOrigin = get_amxaddr(amx, params[3]);
vecOrigin[0] = static_cast<float>(*cpOrigin);
vecOrigin[1] = static_cast<float>(*(cpOrigin + 1));
vecOrigin[2] = static_cast<float>(*(cpOrigin + 2));
MESSAGE_BEGIN(params[1], params[2], vecOrigin);
break;
case MSG_ONE_UNRELIABLE:
case MSG_ONE:
if (numparam < 4)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
MESSAGE_BEGIN(params[1], params[2], NULL, INDEXENT(params[4]));
break;
}
return 1;
}
static cell AMX_NATIVE_CALL message_end(AMX *amx, cell *params)
{
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL write_byte(AMX *amx, cell *params) /* 1 param */
{
WRITE_BYTE(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_char(AMX *amx, cell *params) /* 1 param */
{
WRITE_CHAR(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_short(AMX *amx, cell *params) /* 1 param */
{
WRITE_SHORT(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_long(AMX *amx, cell *params) /* 1 param */
{
WRITE_LONG(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */
{
WRITE_ENTITY(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */
{
WRITE_ANGLE(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */
{
WRITE_COORD(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_string(AMX *amx, cell *params) /* 1 param */
{
int a;
WRITE_STRING(get_amxstring(amx, params[1], 3, a));
return 1;
}
static cell AMX_NATIVE_CALL log_message(AMX *amx, cell *params) /* 1 param */
{
int len;
@ -4151,8 +4043,6 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"log_to_file", log_to_file},
{"md5", amx_md5},
{"md5_file", amx_md5_file},
{"message_begin", message_begin},
{"message_end", message_end},
{"module_exists", module_exists},
{"mkdir", amx_mkdir},
{"next_hudchannel", next_hudchannel},
@ -4216,14 +4106,6 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"user_has_weapon", user_has_weapon},
{"user_kill", user_kill},
{"user_slap", user_slap},
{"write_angle", write_angle},
{"write_byte", write_byte},
{"write_char", write_char},
{"write_coord", write_coord},
{"write_entity", write_entity},
{"write_long", write_long},
{"write_short", write_short},
{"write_string", write_string},
{"xvar_exists", xvar_exists},
{"ClearSyncHud", ClearSyncHud},
{"CreateHudSyncObj", CreateHudSyncObj},

View File

@ -83,6 +83,7 @@ extern AMX_NATIVE_INFO file_Natives[];
extern AMX_NATIVE_INFO float_Natives[];
extern AMX_NATIVE_INFO string_Natives[];
extern AMX_NATIVE_INFO vault_Natives[];
extern AMX_NATIVE_INFO msg_Natives[];
#ifndef __linux__
#define DLLOAD(path) (DLHANDLE)LoadLibrary(path)

View File

@ -355,6 +355,114 @@ void C_MessageEnd(void)
RETURN_META(MRES_IGNORED);
}
static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
{
int numparam = *params / sizeof(cell);
float vecOrigin[3];
cell *cpOrigin;
if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages
&& !GET_USER_MSG_NAME(PLID, params[2], NULL)))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called message_begin with an invalid message id (%d).", params[2]);
return 0;
}
switch (params[1])
{
case MSG_BROADCAST:
case MSG_ALL:
case MSG_SPEC:
MESSAGE_BEGIN(params[1], params[2], NULL);
break;
case MSG_PVS: case MSG_PAS:
case MSG_PVS_R: case MSG_PAS_R:
if (numparam < 3)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
cpOrigin = get_amxaddr(amx, params[3]);
vecOrigin[0] = static_cast<float>(*cpOrigin);
vecOrigin[1] = static_cast<float>(*(cpOrigin + 1));
vecOrigin[2] = static_cast<float>(*(cpOrigin + 2));
MESSAGE_BEGIN(params[1], params[2], vecOrigin);
break;
case MSG_ONE_UNRELIABLE:
case MSG_ONE:
if (numparam < 4)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
MESSAGE_BEGIN(params[1], params[2], NULL, INDEXENT(params[4]));
break;
}
return 1;
}
static cell AMX_NATIVE_CALL message_end(AMX *amx, cell *params)
{
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL write_byte(AMX *amx, cell *params) /* 1 param */
{
WRITE_BYTE(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_char(AMX *amx, cell *params) /* 1 param */
{
WRITE_CHAR(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_short(AMX *amx, cell *params) /* 1 param */
{
WRITE_SHORT(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_long(AMX *amx, cell *params) /* 1 param */
{
WRITE_LONG(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */
{
WRITE_ENTITY(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */
{
WRITE_ANGLE(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */
{
WRITE_COORD(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_string(AMX *amx, cell *params) /* 1 param */
{
int a;
WRITE_STRING(get_amxstring(amx, params[1], 3, a));
return 1;
}
static cell AMX_NATIVE_CALL register_message(AMX *amx, cell *params)
{
int len;
@ -545,6 +653,18 @@ static cell AMX_NATIVE_CALL get_msg_origin(AMX *amx, cell *params)
AMX_NATIVE_INFO msg_Natives[] =
{
{"message_begin", message_begin},
{"message_end", message_end},
{"write_angle", write_angle},
{"write_byte", write_byte},
{"write_char", write_char},
{"write_coord", write_coord},
{"write_entity", write_entity},
{"write_long", write_long},
{"write_short", write_short},
{"write_string", write_string},
{"register_message", register_message},
{"set_msg_block", set_msg_block},

View File

@ -74,7 +74,6 @@ void C_WriteString(const char *sz);
void C_WriteEntity(int iValue);
void C_MessageEnd(void);
extern AMX_NATIVE_INFO msg_Natives[];
extern CVector<int> msgHooks[256];
extern int msgBlocks[256];