mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
64 bit float compatibility
This commit is contained in:
parent
607da4d4a2
commit
21287f4f3a
@ -30,8 +30,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <extdll.h>
|
|
||||||
#include <meta_api.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "amxmodx.h"
|
#include "amxmodx.h"
|
||||||
|
|
||||||
@ -73,8 +71,8 @@ static cell AMX_NATIVE_CALL emit_sound(AMX *amx, cell *params) /* 7 param */
|
|||||||
|
|
||||||
int len;
|
int len;
|
||||||
char* szSample = get_amxstring(amx,params[3],0,len);
|
char* szSample = get_amxstring(amx,params[3],0,len);
|
||||||
float vol = *(float *)((void *)¶ms[4]);
|
float vol = *(REAL *)((void *)¶ms[4]);
|
||||||
float att = *(float *)((void *)¶ms[5]);
|
float att = *(REAL *)((void *)¶ms[5]);
|
||||||
int channel = params[2];
|
int channel = params[2];
|
||||||
int pitch = params[7];
|
int pitch = params[7];
|
||||||
int flags = params[6];
|
int flags = params[6];
|
||||||
@ -239,13 +237,13 @@ static cell AMX_NATIVE_CALL set_hudmessage(AMX *amx, cell *params) /* 11 param
|
|||||||
g_hudset.r1 = params[1];
|
g_hudset.r1 = params[1];
|
||||||
g_hudset.g1 = params[2];
|
g_hudset.g1 = params[2];
|
||||||
g_hudset.b1 = params[3];
|
g_hudset.b1 = params[3];
|
||||||
g_hudset.x = *(float *)((void *)¶ms[4]);
|
g_hudset.x = *(REAL *)((void *)¶ms[4]);
|
||||||
g_hudset.y = *(float *)((void *)¶ms[5]);
|
g_hudset.y = *(REAL *)((void *)¶ms[5]);
|
||||||
g_hudset.effect = params[6];
|
g_hudset.effect = params[6];
|
||||||
g_hudset.fxTime = *(float *)((void *)¶ms[7]);
|
g_hudset.fxTime = *(REAL *)((void *)¶ms[7]);
|
||||||
g_hudset.holdTime = *(float *)((void *)¶ms[8]);
|
g_hudset.holdTime = *(REAL *)((void *)¶ms[8]);
|
||||||
g_hudset.fadeinTime = *(float *)((void *)¶ms[9]);
|
g_hudset.fadeinTime = *(REAL *)((void *)¶ms[9]);
|
||||||
g_hudset.fadeoutTime = *(float *)((void *)¶ms[10]);
|
g_hudset.fadeoutTime = *(REAL *)((void *)¶ms[10]);
|
||||||
g_hudset.channel = params[11];
|
g_hudset.channel = params[11];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1000,14 +998,14 @@ static cell AMX_NATIVE_CALL get_cvar_string(AMX *amx, cell *params) /* 3 param *
|
|||||||
static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */
|
static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */
|
||||||
{
|
{
|
||||||
int ilen;
|
int ilen;
|
||||||
float pFloat = CVAR_GET_FLOAT(get_amxstring(amx,params[1],0,ilen));
|
REAL pFloat = CVAR_GET_FLOAT(get_amxstring(amx,params[1],0,ilen));
|
||||||
return *(cell*)((void *)&pFloat);
|
return *(cell*)((void *)&pFloat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */
|
static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */
|
||||||
{
|
{
|
||||||
int ilen;
|
int ilen;
|
||||||
CVAR_SET_FLOAT(get_amxstring(amx,params[1],0,ilen),*(float *)((void *)¶ms[2]));
|
CVAR_SET_FLOAT(get_amxstring(amx,params[1],0,ilen),*(REAL *)((void *)¶ms[2]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1275,7 +1273,7 @@ static cell AMX_NATIVE_CALL read_data(AMX *amx, cell *params) /* 3 param */
|
|||||||
return set_amxstring(amx,params[2], g_events.getArgString( params[1] ),*get_amxaddr(amx,params[3]));
|
return set_amxstring(amx,params[2], g_events.getArgString( params[1] ),*get_amxaddr(amx,params[3]));
|
||||||
default:
|
default:
|
||||||
cell *fCell = get_amxaddr(amx,params[2]);
|
cell *fCell = get_amxaddr(amx,params[2]);
|
||||||
float *pFloat = (float *)((void *)fCell);
|
float *pFloat = (REAL *)((void *)fCell);
|
||||||
*pFloat = g_events.getArgFloat( params[1] );
|
*pFloat = g_events.getArgFloat( params[1] );
|
||||||
return (int)(*pFloat);
|
return (int)(*pFloat);
|
||||||
}
|
}
|
||||||
@ -1423,7 +1421,7 @@ static cell AMX_NATIVE_CALL get_maxplayers(AMX *amx, cell *params)
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_gametime(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_gametime(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
float pFloat = gpGlobals->time;
|
REAL pFloat = gpGlobals->time;
|
||||||
return *(cell*)((void *)&pFloat);
|
return *(cell*)((void *)&pFloat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1522,7 +1520,7 @@ static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float base = *(float *)((void *)¶ms[1]);
|
float base = *(REAL *)((void *)¶ms[1]);
|
||||||
|
|
||||||
if ( base < 0.1 )
|
if ( base < 0.1 )
|
||||||
base = 0.1;
|
base = 0.1;
|
||||||
@ -1562,7 +1560,7 @@ static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params) /* 3 param */
|
|||||||
{
|
{
|
||||||
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
|
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
|
||||||
CCVar* cvar = new CCVar( temp , plugin->getName() , params[3] ,
|
CCVar* cvar = new CCVar( temp , plugin->getName() , params[3] ,
|
||||||
*(float *)((void *)¶ms[4]) );
|
*(REAL *)((void *)¶ms[4]) );
|
||||||
|
|
||||||
if ( cvar == 0 )
|
if ( cvar == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
@ -1845,9 +1843,9 @@ static cell AMX_NATIVE_CALL get_distance(AMX *amx, cell *params) /* 2 param */
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL random_float(AMX *amx, cell *params) /* 2 param */
|
static cell AMX_NATIVE_CALL random_float(AMX *amx, cell *params) /* 2 param */
|
||||||
{
|
{
|
||||||
float one = *(float *)((void *)¶ms[1]);
|
float one = *(REAL *)((void *)¶ms[1]);
|
||||||
float two = *(float *)((void *)¶ms[2]);
|
float two = *(REAL *)((void *)¶ms[2]);
|
||||||
float fRnd = RANDOM_FLOAT(one,two);
|
REAL fRnd = RANDOM_FLOAT(one,two);
|
||||||
return *(cell*)((void *)&fRnd);
|
return *(cell*)((void *)&fRnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1888,7 +1886,7 @@ static cell AMX_NATIVE_CALL get_user_aiming(AMX *amx, cell *params) /* 4 param *
|
|||||||
cell *cpId = get_amxaddr(amx,params[2]);
|
cell *cpId = get_amxaddr(amx,params[2]);
|
||||||
cell *cpBody = get_amxaddr(amx,params[3]);
|
cell *cpBody = get_amxaddr(amx,params[3]);
|
||||||
cell fCell;
|
cell fCell;
|
||||||
float *pFloat = (float *)((void *)&fCell);
|
float *pFloat = (REAL *)((void *)&fCell);
|
||||||
*pFloat = 0.0;
|
*pFloat = 0.0;
|
||||||
if (pPlayer->ingame) {
|
if (pPlayer->ingame) {
|
||||||
edict_t* edict = pPlayer->pEdict;
|
edict_t* edict = pPlayer->pEdict;
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
* version.
|
* version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <extdll.h>
|
|
||||||
#include <meta_api.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "amxmodx.h"
|
#include "amxmodx.h"
|
||||||
|
|
||||||
@ -78,7 +76,7 @@ char* format_amxstring(AMX *amx, cell *params, int parm,int& len)
|
|||||||
arg = buffer[1];
|
arg = buffer[1];
|
||||||
switch(*(ptr-1)){
|
switch(*(ptr-1)){
|
||||||
case 's': sprintf(arg,format,get_amxstring(amx, params[parm++],2,len)); break;
|
case 's': sprintf(arg,format,get_amxstring(amx, params[parm++],2,len)); break;
|
||||||
case 'f': case 'g': sprintf(arg,format,*(float*)get_amxaddr(amx, params[parm++])); break;
|
case 'f': case 'g': sprintf(arg,format,(float)*(REAL*)get_amxaddr(amx, params[parm++])); break;
|
||||||
default: sprintf(arg,format,(int)*get_amxaddr(amx, params[parm++]));
|
default: sprintf(arg,format,(int)*get_amxaddr(amx, params[parm++]));
|
||||||
}
|
}
|
||||||
while(*arg) *dest++=*arg++;
|
while(*arg) *dest++=*arg++;
|
||||||
@ -427,7 +425,7 @@ float fo_getargfloat(AMX *amx, int pos)
|
|||||||
unsigned char *data =amx->base+(int)((AMX_HEADER *)amx->base)->dat;
|
unsigned char *data =amx->base+(int)((AMX_HEADER *)amx->base)->dat;
|
||||||
cell value = * (cell *)(data+(int)amx->frm+(pos+3)*sizeof(cell));
|
cell value = * (cell *)(data+(int)amx->frm+(pos+3)*sizeof(cell));
|
||||||
cell number = *(cell *)(data+(int)value);
|
cell number = *(cell *)(data+(int)value);
|
||||||
return *(float *)((void *)&number);
|
return *(REAL *)((void *)&number);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* fo_getargstr(AMX *amx, int swap, int pos)
|
char* fo_getargstr(AMX *amx, int swap, int pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user