mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Added math functions recommended by AssKicr
Little bug fixes
This commit is contained in:
parent
8f63a1a7b9
commit
2a460d8c18
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 */
|
||||
};
|
||||
|
||||
|
@ -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")) );
|
||||
|
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user