removed radix stuff from trig natives

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40240
This commit is contained in:
Borja Ferrer 2006-12-30 22:16:53 +00:00
parent 2e835df380
commit 8c09e0c50d
2 changed files with 7 additions and 59 deletions

View File

@ -455,18 +455,6 @@ const char *stristr(const char *str, const char *substr)
return NULL;
}
inline int StrConvInt(const char *str)
{
char *dummy;
return strtol(str, &dummy, 10);
}
inline float StrConvFloat(const char *str)
{
char *dummy;
return (float)strtod(str, &dummy);
}
unsigned int strncopy(char *dest, const char *src, size_t count)
{
if (!count)

View File

@ -5,46 +5,6 @@
using namespace SourcePawn;
#define PI 3.14159265358979323846
inline float AngleToRadians(float val, int mode)
{
switch (mode)
{
case 1:
{
return (float)((val * PI) / 180.0);
}
case 2:
{
return (float)((val * PI) / 200.0);
}
default:
{
return val;
}
}
}
inline float RadiansToAngle(float val, int mode)
{
switch (mode)
{
case 1:
{
return (float)((val / PI) * 180.0);
}
case 2:
{
return (float)((val / PI) * 200.0);
}
default:
{
return val;
}
}
}
/****************************************
* *
@ -217,7 +177,7 @@ static cell_t sm_floatfract(IPluginContext *pCtx, const cell_t *params)
static cell_t sm_floatsin(IPluginContext *pCtx, const cell_t *params)
{
float val = sp_ctof(params[1]);
val = sin(AngleToRadians(val, params[2]));
val = sin(val);
return sp_ftoc(val);
}
@ -225,7 +185,7 @@ static cell_t sm_floatsin(IPluginContext *pCtx, const cell_t *params)
static cell_t sm_floatcos(IPluginContext *pCtx, const cell_t *params)
{
float val = sp_ctof(params[1]);
val = cos(AngleToRadians(val, params[2]));
val = cos(val);
return sp_ftoc(val);
}
@ -233,7 +193,7 @@ static cell_t sm_floatcos(IPluginContext *pCtx, const cell_t *params)
static cell_t sm_floattan(IPluginContext *pCtx, const cell_t *params)
{
float val = sp_ctof(params[1]);
val = tan(AngleToRadians(val, params[2]));
val = tan(val);
return sp_ftoc(val);
}
@ -243,7 +203,7 @@ static cell_t sm_floatasin(IPluginContext *pCtx, const cell_t *params)
float val = sp_ctof(params[1]);
val = asin(val);
return sp_ftoc(RadiansToAngle(val, params[2]));
return sp_ftoc(val);
}
static cell_t sm_floatacos(IPluginContext *pCtx, const cell_t *params)
@ -251,7 +211,7 @@ static cell_t sm_floatacos(IPluginContext *pCtx, const cell_t *params)
float val = sp_ctof(params[1]);
val = acos(val);
return sp_ftoc(RadiansToAngle(val, params[2]));
return sp_ftoc(val);
}
static cell_t sm_floatatan(IPluginContext *pCtx, const cell_t *params)
@ -259,7 +219,7 @@ static cell_t sm_floatatan(IPluginContext *pCtx, const cell_t *params)
float val = sp_ctof(params[1]);
val = atan(val);
return sp_ftoc(RadiansToAngle(val, params[2]));
return sp_ftoc(val);
}
static cell_t sm_floatatan2(IPluginContext *pCtx, const cell_t *params)
@ -268,5 +228,5 @@ static cell_t sm_floatatan2(IPluginContext *pCtx, const cell_t *params)
float val2 = sp_ctof(params[2]);
val1 = atan2(val1, val2);
return sp_ftoc(RadiansToAngle(val1, params[3]));
return sp_ftoc(val1);
}