Added math functions recommended by AssKicr

Little bug fixes
This commit is contained in:
David Anderson 2004-04-07 04:06:55 +00:00
parent 8f63a1a7b9
commit 2a460d8c18
4 changed files with 74 additions and 4 deletions

View File

@ -60,7 +60,7 @@ int CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
cell realParams[FORWARD_MAX_PARAMS];
cell *physAddrs[FORWARD_MAX_PARAMS];
const STRINGEX_MAXLENGTH = 128;
const int STRINGEX_MAXLENGTH = 128;
int globRetVal = 0;
@ -249,4 +249,4 @@ cell prepareCellArray(cell *ptr, unsigned int size)
cell prepareCharArray(char *ptr, unsigned int size)
{
return g_forwards.prepareArray((void*)ptr, size, Type_Char);
}
}

View File

@ -346,6 +346,72 @@ static cell AMX_NATIVE_CALL n_floattan(AMX *amx,cell *params)
return amx_ftoc(fA);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
/* Added by BAILOPAN */
static cell AMX_NATIVE_CALL n_floatatan(AMX *amx, cell *params)
{
/*
* params[1] = angle
* params[2] = radix
*/
REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = atan(fA);
return amx_ftoc(fA);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
/* Added by BAILOPAN */
static cell AMX_NATIVE_CALL n_floatacos(AMX *amx, cell *params)
{
/*
* params[1] = angle
* params[2] = radix
*/
REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = acos(fA);
return amx_ftoc(fA);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
/* Added by BAILOPAN */
static cell AMX_NATIVE_CALL n_floatasin(AMX *amx, cell *params)
{
/*
* params[1] = angle
* params[2] = radix
*/
REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = asin(fA);
return amx_ftoc(fA);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
/* Added by BAILOPAN */
static cell AMX_NATIVE_CALL n_floatatan2(AMX *amx, cell *params)
{
/*
* params[1] = x
* params[2] = y
* params[3] = radix
*/
REAL fA = amx_ctof(params[1]);
REAL fB = amx_ctof(params[2]);
REAL fC;
fC = atan2(fA, fB);
return amx_ftoc(fC);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
@ -374,6 +440,10 @@ AMX_NATIVE_INFO float_Natives[] = {
{ "floatcos", n_floatcos },
{ "floattan", n_floattan },
{ "floatabs", n_floatabs },
{ "floatasin", n_floatasin },
{ "floatacos", n_floatacos },
{ "floatatan", n_floatatan },
{ "floatatan2", n_floatatan2 },
{ NULL, NULL } /* terminator */
};

View File

@ -256,7 +256,7 @@ int Spawn( edict_t *pent ) {
// :TODO: Remove modules num from amxmodx_version, make amxmodx_modules cvar
CVAR_SET_STRING(init_amxmodx_version.name, AMX_VERSION);
char buffer[32];
CVAR_SET_STRING(init_amxmodx_modules.name, itoa(loaded, buffer, 10));
// CVAR_SET_STRING(init_amxmodx_modules.name, itoa(loaded, buffer, 10));
// ###### Load Vault
g_vault.setSource( build_pathname("%s", get_localinfo("amxx_vault", "addons/amxx/configs/vault.ini")) );

View File

@ -514,7 +514,7 @@ static cell AMX_NATIVE_CALL strbreak(AMX *amx, cell *params) /* 5 param */
if (!done_flag && string[i]!='"') {
if (left_pos < LeftMax) {
left[left_pos] = string[i];
if (left[left_pos] = '\'') {
if (left[left_pos] == '\'') {
left[left_pos] = hold;
}
left_pos++;