Removed all warnings.

This commit is contained in:
David Anderson 2004-04-01 05:53:22 +00:00
parent b0e6ea16ce
commit 4f4c87d9b2
15 changed files with 117 additions and 82 deletions

View File

@ -100,8 +100,8 @@ private:
CmdLink* clcmdlist; CmdLink* clcmdlist;
struct CmdPrefix { struct CmdPrefix {
CmdMngr* parent;
String name; String name;
CmdMngr* parent;
CmdLink* list; CmdLink* list;
CmdPrefix* next; CmdPrefix* next;
CmdPrefix( const char* nn , CmdMngr* pp) : name(nn),parent(pp),list(0),next(0){} CmdPrefix( const char* nn , CmdMngr* pp) : name(nn),parent(pp),list(0),next(0){}

View File

@ -153,3 +153,5 @@ public:
}; };
#endif // #ifdef __CEVENTS_H__ #endif // #ifdef __CEVENTS_H__

View File

@ -96,23 +96,22 @@ public:
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c) , next(n) { } LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c) , next(n) { }
}; };
struct LogCond { struct LogCond {
LogCondEle *list;
int argnum; int argnum;
LogCondEle *list;
LogCond *next; LogCond *next;
LogCond( int a , LogCondEle* ee , LogCond* n ) : argnum(a) , list(ee), next(n) {} LogCond( int a , LogCondEle* ee , LogCond* n ) : argnum(a) , list(ee), next(n) {}
~LogCond(); ~LogCond();
}; };
CPluginMngr::CPlugin *plugin; CPluginMngr::CPlugin *plugin;
int func; int func;
LogEventsMngr* parent;
LogCond *filters; LogCond *filters;
LogEventsMngr* parent;
CLogEvent *next; CLogEvent *next;
CLogEvent(CPluginMngr::CPlugin *p,int f, LogEventsMngr* ppp) : plugin(p),func(f), filters(0),parent(ppp) ,next(0) { } CLogEvent(CPluginMngr::CPlugin *p,int f, LogEventsMngr* ppp) : plugin(p),func(f), filters(0),parent(ppp) ,next(0) { }
~CLogEvent(); ~CLogEvent();
public: public:
void registerFilter( char* filter );
inline CPluginMngr::CPlugin *getPlugin() { return plugin; } inline CPluginMngr::CPlugin *getPlugin() { return plugin; }
void registerFilter( char* filter );
inline int getFunction() { return func; } inline int getFunction() { return func; }
}; };
@ -144,8 +143,8 @@ public:
class iterator { class iterator {
LogEventsMngr* b;
CLogEvent* a; CLogEvent* a;
LogEventsMngr* b;
public: public:
inline iterator(CLogEvent*aa,LogEventsMngr* bb) : a(aa), b(bb) {} inline iterator(CLogEvent*aa,LogEventsMngr* bb) : a(aa), b(bb) {}
inline iterator& operator++() { inline iterator& operator++() {

View File

@ -151,11 +151,11 @@ public:
// class ForceObject // class ForceObject
// ***************************************************** // *****************************************************
class ForceObject { class ForceObject {
AMX* amx;
String filename; String filename;
FORCE_TYPE type; FORCE_TYPE type;
Vector mins; Vector mins;
Vector maxs; Vector maxs;
AMX* amx;
public: public:
ForceObject(const char* n, FORCE_TYPE c,Vector& mi, Vector& ma, AMX* a) : ForceObject(const char* n, FORCE_TYPE c,Vector& mi, Vector& ma, AMX* a) :
filename(n) , type(c), mins(mi), maxs(ma), amx(a) {} filename(n) , type(c), mins(mi), maxs(ma), amx(a) {}

View File

@ -107,8 +107,8 @@ public:
void clear(); void clear();
class iterator { class iterator {
CTaskMngr* b;
CTask* a; CTask* a;
CTaskMngr* b;
public: public:
iterator(CTask*aa,CTaskMngr* bb) : a(aa), b(bb) {} iterator(CTask*aa,CTaskMngr* bb) : a(aa), b(bb) {}
iterator& operator++() { iterator& operator++() {

View File

@ -44,7 +44,7 @@ endif
LIBFILE_LINUX = $(MODNAME)_i386.so LIBFILE_LINUX = $(MODNAME)_i686.so
LIBFILE_WIN32 = $(MODNAME).dll LIBFILE_WIN32 = $(MODNAME).dll
TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX) TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX)
TARGET_WIN32 = $(OBJDIR_WIN32)/$(LIBFILE_WIN32) TARGET_WIN32 = $(OBJDIR_WIN32)/$(LIBFILE_WIN32)
@ -61,7 +61,7 @@ OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o) OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o)
CCOPT = -O2 -march=i586 -ffast-math -funroll-loops \ CCOPT = -O6 -march=i686 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG -malign-jumps=2 -malign-functions=2 -s -DNDEBUG

View File

@ -1859,14 +1859,14 @@ static void *amx_opcodelist_nodebug[] = {
NEXT(cip); NEXT(cip);
op_load_i: op_load_i:
/* verify address */ /* verify address */
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp) if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
pri= * (cell *)(data+(int)pri); pri= * (cell *)(data+(int)pri);
NEXT(cip); NEXT(cip);
op_lodb_i: op_lodb_i:
GETPARAM(offs); GETPARAM(offs);
/* verify address */ /* verify address */
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp) if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
switch (offs) { switch (offs) {
case 1: case 1:
@ -1932,14 +1932,14 @@ static void *amx_opcodelist_nodebug[] = {
NEXT(cip); NEXT(cip);
op_stor_i: op_stor_i:
/* verify address */ /* verify address */
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp) if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
*(cell *)(data+(int)alt)=pri; *(cell *)(data+(int)alt)=pri;
NEXT(cip); NEXT(cip);
op_strb_i: op_strb_i:
GETPARAM(offs); GETPARAM(offs);
/* verify address */ /* verify address */
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp) if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
switch (offs) { switch (offs) {
case 1: case 1:
@ -1956,7 +1956,7 @@ static void *amx_opcodelist_nodebug[] = {
op_lidx: op_lidx:
offs=pri*sizeof(cell)+alt; offs=pri*sizeof(cell)+alt;
/* verify address */ /* verify address */
if (offs>=hea && offs<stk || (ucell)offs>=(ucell)amx->stp) if ((offs>=hea && offs<stk) || (ucell)offs>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
pri= * (cell *)(data+(int)offs); pri= * (cell *)(data+(int)offs);
NEXT(cip); NEXT(cip);
@ -1964,7 +1964,7 @@ static void *amx_opcodelist_nodebug[] = {
GETPARAM(offs); GETPARAM(offs);
offs=(pri << (int)offs)+alt; offs=(pri << (int)offs)+alt;
/* verify address */ /* verify address */
if (offs>=hea && offs<stk || (ucell)offs>=(ucell)amx->stp) if ((offs>=hea && offs<stk) || (ucell)offs>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
pri= * (cell *)(data+(int)offs); pri= * (cell *)(data+(int)offs);
NEXT(cip); NEXT(cip);
@ -2461,13 +2461,13 @@ static void *amx_opcodelist_nodebug[] = {
/* verify top & bottom memory addresses, for both source and destination /* verify top & bottom memory addresses, for both source and destination
* addresses * addresses
*/ */
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp) if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
if ((pri+offs)>hea && (pri+offs)<stk || (ucell)(pri+offs)>(ucell)amx->stp) if (((pri+offs)>hea && (pri+offs)<stk) || (ucell)(pri+offs)>(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp) if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp) if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
memcpy(data+(int)alt, data+(int)pri, (int)offs); memcpy(data+(int)alt, data+(int)pri, (int)offs);
NEXT(cip); NEXT(cip);
@ -2476,22 +2476,22 @@ static void *amx_opcodelist_nodebug[] = {
/* verify top & bottom memory addresses, for both source and destination /* verify top & bottom memory addresses, for both source and destination
* addresses * addresses
*/ */
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp) if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
if ((pri+offs)>hea && (pri+offs)<stk || (ucell)(pri+offs)>(ucell)amx->stp) if (((pri+offs)>hea && (pri+offs)<stk) || (ucell)(pri+offs)>(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp) if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp) if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
pri=memcmp(data+(int)alt, data+(int)pri, (int)offs); pri=memcmp(data+(int)alt, data+(int)pri, (int)offs);
NEXT(cip); NEXT(cip);
op_fill: op_fill:
GETPARAM(offs); GETPARAM(offs);
/* verify top & bottom memory addresses */ /* verify top & bottom memory addresses */
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp) if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp) if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
for (i=(int)alt; offs>=sizeof(cell); i+=sizeof(cell), offs-=sizeof(cell)) for (i=(int)alt; offs>=sizeof(cell); i+=sizeof(cell), offs-=sizeof(cell))
*(cell *)(data+i) = pri; *(cell *)(data+i) = pri;
@ -3788,7 +3788,7 @@ int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr)
data=(amx->data!=NULL) ? amx->data : amx->base+(int)hdr->dat; data=(amx->data!=NULL) ? amx->data : amx->base+(int)hdr->dat;
assert(phys_addr!=NULL); assert(phys_addr!=NULL);
if (amx_addr>=amx->hea && amx_addr<amx->stk || amx_addr<0 || amx_addr>=amx->stp) { if ((amx_addr>=amx->hea && amx_addr<amx->stk) || amx_addr<0 || amx_addr>=amx->stp) {
*phys_addr=NULL; *phys_addr=NULL;
return AMX_ERR_MEMACCESS; return AMX_ERR_MEMACCESS;
} /* if */ } /* if */
@ -3994,19 +3994,19 @@ static long utf8_lowmark[5] = { 0x80, 0x800, 0x10000, 0x200000, 0x4000000 };
switch (followup) { switch (followup) {
case 4: case 4:
if (((c=*string++) & 0xc0) != 0x80) goto error; if (((c=*string++) & 0xc0) != 0x80) goto error;
result = (result << 6) | c & 0x3f; result = (result << 6) | (c & 0x3f);
case 3: case 3:
if (((c=*string++) & 0xc0) != 0x80) goto error; if (((c=*string++) & 0xc0) != 0x80) goto error;
result = (result << 6) | c & 0x3f; result = (result << 6) | (c & 0x3f);
case 2: case 2:
if (((c=*string++) & 0xc0) != 0x80) goto error; if (((c=*string++) & 0xc0) != 0x80) goto error;
result = (result << 6) | c & 0x3f; result = (result << 6) | (c & 0x3f);
case 1: case 1:
if (((c=*string++) & 0xc0) != 0x80) goto error; if (((c=*string++) & 0xc0) != 0x80) goto error;
result = (result << 6) | c & 0x3f; result = (result << 6) | (c & 0x3f);
case 0: case 0:
if (((c=*string++) & 0xc0) != 0x80) goto error; if (((c=*string++) & 0xc0) != 0x80) goto error;
result = (result << 6) | c & 0x3f; result = (result << 6) | (c & 0x3f);
} /* switch */ } /* switch */
/* Do additional checks: shortest encoding & reserved positions. The /* Do additional checks: shortest encoding & reserved positions. The
* lowmark limits also depends on the code length; it can be read from * lowmark limits also depends on the code length; it can be read from
@ -4014,7 +4014,7 @@ static long utf8_lowmark[5] = { 0x80, 0x800, 0x10000, 0x200000, 0x4000000 };
*/ */
if (result<utf8_lowmark[followup]) if (result<utf8_lowmark[followup])
goto error; goto error;
if (result>=0xd800 && result<=0xdfff || result==0xfffe || result==0xffff) if ((result>=0xd800 && result<=0xdfff) || result==0xfffe || result==0xffff)
goto error; goto error;
} /* if */ } /* if */
@ -4049,40 +4049,40 @@ int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value)
} else if (value<0x800) { } else if (value<0x800) {
/* 110xxxxx 10xxxxxx */ /* 110xxxxx 10xxxxxx */
if (maxchars < 2) goto error; if (maxchars < 2) goto error;
*string++ = (char)((value>>6) & 0x1f | 0xc0); *string++ = (char)(((value>>6) & 0x1f) | 0xc0);
*string++ = (char)(value & 0x3f | 0x80); *string++ = (char)((value & 0x3f) | 0x80);
} else if (value<0x10000) { } else if (value<0x10000) {
/* 1110xxxx 10xxxxxx 10xxxxxx (16 bits, BMP plane) */ /* 1110xxxx 10xxxxxx 10xxxxxx (16 bits, BMP plane) */
if (maxchars < 3) goto error; if (maxchars < 3) goto error;
if (value>=0xd800 && value<=0xdfff || value==0xfffe || value==0xffff) if ((value>=0xd800 && value<=0xdfff) || value==0xfffe || value==0xffff)
goto error; /* surrogate pairs and invalid characters */ goto error; /* surrogate pairs and invalid characters */
*string++ = (char)((value>>12) & 0x0f | 0xe0); *string++ = (char)(((value>>12) & 0x0f) | 0xe0);
*string++ = (char)((value>>6) & 0x3f | 0x80); *string++ = (char)(((value>>6) & 0x3f) | 0x80);
*string++ = (char)(value & 0x3f | 0x80); *string++ = (char)((value & 0x3f) | 0x80);
} else if (value<0x200000) { } else if (value<0x200000) {
/* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
if (maxchars < 4) goto error; if (maxchars < 4) goto error;
*string++ = (char)((value>>18) & 0x07 | 0xf0); *string++ = (char)(((value>>18) & 0x07) | 0xf0);
*string++ = (char)((value>>12) & 0x3f | 0x80); *string++ = (char)(((value>>12) & 0x3f) | 0x80);
*string++ = (char)((value>>6) & 0x3f | 0x80); *string++ = (char)(((value>>6) & 0x3f) | 0x80);
*string++ = (char)(value & 0x3f | 0x80); *string++ = (char)((value & 0x3f) | 0x80);
} else if (value<0x4000000) { } else if (value<0x4000000) {
/* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
if (maxchars < 5) goto error; if (maxchars < 5) goto error;
*string++ = (char)((value>>24) & 0x03 | 0xf8); *string++ = (char)(((value>>24) & 0x03) | 0xf8);
*string++ = (char)((value>>18) & 0x3f | 0x80); *string++ = (char)(((value>>18) & 0x3f) | 0x80);
*string++ = (char)((value>>12) & 0x3f | 0x80); *string++ = (char)(((value>>12) & 0x3f) | 0x80);
*string++ = (char)((value>>6) & 0x3f | 0x80); *string++ = (char)(((value>>6) & 0x3f) | 0x80);
*string++ = (char)(value & 0x3f | 0x80); *string++ = (char)((value & 0x3f) | 0x80);
} else { } else {
/* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx (31 bits) */ /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx (31 bits) */
if (maxchars < 6) goto error; if (maxchars < 6) goto error;
*string++ = (char)((value>>30) & 0x01 | 0xfc); *string++ = (char)(((value>>30) & 0x01) | 0xfc);
*string++ = (char)((value>>24) & 0x3f | 0x80); *string++ = (char)(((value>>24) & 0x3f) | 0x80);
*string++ = (char)((value>>18) & 0x3f | 0x80); *string++ = (char)(((value>>18) & 0x3f) | 0x80);
*string++ = (char)((value>>12) & 0x3f | 0x80); *string++ = (char)(((value>>12) & 0x3f) | 0x80);
*string++ = (char)((value>>6) & 0x3f | 0x80); *string++ = (char)(((value>>6) & 0x3f) | 0x80);
*string++ = (char)(value & 0x3f | 0x80); *string++ = (char)((value & 0x3f) | 0x80);
} /* if */ } /* if */
if (endptr!=NULL) if (endptr!=NULL)

View File

@ -21,6 +21,7 @@
* Version: $Id$ * Version: $Id$
*/ */
#define LINUX
#if defined __linux__ #if defined __linux__
#include <sclinux.h> #include <sclinux.h>
#endif #endif

View File

@ -183,7 +183,7 @@ static cell AMX_NATIVE_CALL setarg(AMX *amx, cell *params)
/* adjust the address in "value" in case of an array access */ /* adjust the address in "value" in case of an array access */
value+=params[2]*sizeof(cell); value+=params[2]*sizeof(cell);
/* verify the address */ /* verify the address */
if (value<0 || value>=amx->hea && value<amx->stk) if (value<0 || (value>=amx->hea && value<amx->stk))
return 0; return 0;
/* set the value indirectly */ /* set the value indirectly */
* (cell *)(data+(int)value) = params[3]; * (cell *)(data+(int)value) = params[3];

View File

@ -29,11 +29,11 @@
* version. * version.
*/ */
#include <string>
#include <extdll.h> #include <extdll.h>
#include <meta_api.h> #include <meta_api.h>
#include <time.h> #include <time.h>
#include "amxmodx.h" #include "amxmodx.h"
#include <string>
static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
{ {
@ -201,7 +201,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 2 param */
if ( !ilen ) szHead = hostname->string; if ( !ilen ) szHead = hostname->string;
char* szBody = get_amxstring(amx,params[2],1,ilen); char* szBody = get_amxstring(amx,params[2],1,ilen);
int iFile = 0; int iFile = 0;
char* sToShow;// = szBody; char* sToShow = NULL;// = szBody;
if (ilen<128) sToShow = (char*)LOAD_FILE_FOR_ME( szBody , &iFile ); if (ilen<128) sToShow = (char*)LOAD_FILE_FOR_ME( szBody , &iFile );
if (!iFile) if (!iFile)
sToShow = szBody; sToShow = szBody;
@ -475,11 +475,24 @@ static cell AMX_NATIVE_CALL get_user_origin(AMX *amx, cell *params) /* 3 param *
if (mode && mode!=2) if (mode && mode!=2)
pos = pos + edict->v.view_ofs; pos = pos + edict->v.view_ofs;
if (mode > 1) { if (mode > 1) {
Vector v_forward; Vector vec;
ANGLEVECTORS( edict->v.v_angle , v_forward, NULL, NULL ); Vector v_angle = edict->v.v_angle;
float v_vec[3];
v_vec[0] = v_angle.x;
v_vec[1] = v_angle.y;
v_vec[2] = v_angle.z;
ANGLEVECTORS( v_vec, vec, NULL, NULL);
TraceResult trEnd; TraceResult trEnd;
Vector v_dest = pos + v_forward * 9999; Vector v_dest = pos+vec * 9999;
TRACE_LINE( pos , v_dest, 0 , edict, &trEnd ); float f_pos[3];
f_pos[0] = pos.x;
f_pos[1] = pos.y;
f_pos[2] = pos.z;
float f_dest[3];
f_dest[0] = v_dest.x;
f_dest[1] = v_dest.y;
f_dest[2] = v_dest.z;
TRACE_LINE( f_pos , f_dest, 0 , edict, &trEnd );
pos = (trEnd.flFraction < 1.0) ? trEnd.vecEndPos : Vector(0,0,0); pos = (trEnd.flFraction < 1.0) ? trEnd.vecEndPos : Vector(0,0,0);
} }
cpOrigin[0] = (long int)pos.x; cpOrigin[0] = (long int)pos.x;
@ -740,7 +753,7 @@ static cell AMX_NATIVE_CALL register_srvcmd(AMX *amx, cell *params) /* 2 param *
if(amx_FindPublic(amx, temp ,&idx)!=AMX_ERR_NONE) { if(amx_FindPublic(amx, temp ,&idx)!=AMX_ERR_NONE) {
AMXXLOG_Log("[AMXX] Function is not present (function \"%s\") (plugin \"%s\")",temp,plugin->getName() ); AMXXLOG_Log("[AMXX] Function is not present (function \"%s\") (plugin \"%s\")",temp,plugin->getName() );
amx_RaiseError(amx,AMX_ERR_NATIVE); amx_RaiseError(amx,AMX_ERR_NATIVE);
return NULL; return 0;
} }
temp = get_amxstring(amx,params[1],0, i ); temp = get_amxstring(amx,params[1],0, i );
char* info = get_amxstring(amx,params[4],1, i ); char* info = get_amxstring(amx,params[4],1, i );
@ -870,7 +883,7 @@ static cell AMX_NATIVE_CALL user_kill(AMX *amx, cell *params) /* 2 param */
return 0; return 0;
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame && pPlayer->IsAlive()){ if (pPlayer->ingame && pPlayer->IsAlive()){
int bef = pPlayer->pEdict->v.frags; float bef = pPlayer->pEdict->v.frags;
MDLL_ClientKill(pPlayer->pEdict); MDLL_ClientKill(pPlayer->pEdict);
if (params[2]) pPlayer->pEdict->v.frags = bef; if (params[2]) pPlayer->pEdict->v.frags = bef;
return 1; return 1;
@ -888,7 +901,7 @@ static cell AMX_NATIVE_CALL user_slap(AMX *amx, cell *params) /* 2 param */
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame && pPlayer->IsAlive()){ if (pPlayer->ingame && pPlayer->IsAlive()){
if (pPlayer->pEdict->v.health <= power) { if (pPlayer->pEdict->v.health <= power) {
int bef = pPlayer->pEdict->v.frags; float bef = pPlayer->pEdict->v.frags;
MDLL_ClientKill(pPlayer->pEdict); MDLL_ClientKill(pPlayer->pEdict);
pPlayer->pEdict->v.frags = bef; pPlayer->pEdict->v.frags = bef;
} }
@ -902,7 +915,12 @@ static cell AMX_NATIVE_CALL user_slap(AMX *amx, cell *params) /* 2 param */
} }
else { else {
Vector v_forward, v_right; Vector v_forward, v_right;
ANGLEVECTORS( pEdict->v.angles, v_forward, v_right, NULL ); Vector vang = pEdict->v.angles;
float fang[3];
fang[0] = vang.x;
fang[1] = vang.y;
fang[2] = vang.z;
ANGLEVECTORS( fang, v_forward, v_right, NULL );
pEdict->v.velocity = pEdict->v.velocity + v_forward * 220 + Vector(0,0,200); pEdict->v.velocity = pEdict->v.velocity + v_forward * 220 + Vector(0,0,200);
} }
pEdict->v.punchangle.x = RANDOM_LONG(-10,10); pEdict->v.punchangle.x = RANDOM_LONG(-10,10);
@ -1018,7 +1036,7 @@ static cell AMX_NATIVE_CALL set_cvar_string(AMX *amx, cell *params) /* 2 param *
static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
{ {
int numparam = *params/sizeof(cell); int numparam = *params/sizeof(cell);
Vector vecOrigin; float vecOrigin[3];
cell *cpOrigin; cell *cpOrigin;
switch (params[1]){ switch (params[1]){
case MSG_BROADCAST: case MSG_BROADCAST:
@ -1032,9 +1050,9 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
return 0; return 0;
} }
cpOrigin = get_amxaddr(amx,params[3]); cpOrigin = get_amxaddr(amx,params[3]);
vecOrigin.x = *cpOrigin; vecOrigin[0] = *cpOrigin;
vecOrigin.y = *(cpOrigin+1); vecOrigin[1] = *(cpOrigin+1);
vecOrigin.z = *(cpOrigin+2); vecOrigin[2] = *(cpOrigin+2);
MESSAGE_BEGIN( params[1], params[2] , vecOrigin ); MESSAGE_BEGIN( params[1], params[2] , vecOrigin );
break; break;
case MSG_ONE: case MSG_ONE:
@ -1284,7 +1302,7 @@ static cell AMX_NATIVE_CALL get_players(AMX *amx, cell *params) /* 4 param */
cell *aPlayers = get_amxaddr(amx,params[1]); cell *aPlayers = get_amxaddr(amx,params[1]);
cell *iMax = get_amxaddr(amx,params[2]); cell *iMax = get_amxaddr(amx,params[2]);
int team; int team = 0;
if (flags & 48) { if (flags & 48) {
sptemp = get_amxstring(amx,params[4],0,ilen); sptemp = get_amxstring(amx,params[4],0,ilen);
@ -1872,10 +1890,23 @@ static cell AMX_NATIVE_CALL get_user_aiming(AMX *amx, cell *params) /* 4 param *
edict_t* edict = pPlayer->pEdict; edict_t* edict = pPlayer->pEdict;
Vector v_forward; Vector v_forward;
Vector v_src = edict->v.origin + edict->v.view_ofs; Vector v_src = edict->v.origin + edict->v.view_ofs;
ANGLEVECTORS( edict->v.v_angle , v_forward, NULL, NULL ); Vector vang = edict->v.v_angle;
float fang[3];
fang[0] = vang.x;
fang[1] = vang.y;
fang[2] = vang.z;
ANGLEVECTORS( fang , v_forward, NULL, NULL );
TraceResult trEnd; TraceResult trEnd;
Vector v_dest = v_src + v_forward * params[4]; Vector v_dest = v_src + v_forward * params[4];
TRACE_LINE( v_src , v_dest, 0 , edict, &trEnd ); float fsrc[3];
fsrc[0] = v_src.x;
fsrc[1] = v_src.y;
fsrc[2] = v_src.z;
float fdst[3];
fdst[0] = v_dest.x;
fdst[1] = v_dest.y;
fdst[2] = v_dest.z;
TRACE_LINE( fsrc , fdst, 0 , edict, &trEnd );
*cpId = FNullEnt(trEnd.pHit) ? 0 : ENTINDEX(trEnd.pHit); *cpId = FNullEnt(trEnd.pHit) ? 0 : ENTINDEX(trEnd.pHit);
*cpBody = trEnd.iHitgroup; *cpBody = trEnd.iHitgroup;
if (trEnd.flFraction < 1.0) { if (trEnd.flFraction < 1.0) {
@ -2159,7 +2190,7 @@ struct CallFunc_ParamInfo
#define CALLFUNC_MAXPARAMS 64 /* Maximal params number */ #define CALLFUNC_MAXPARAMS 64 /* Maximal params number */
cell g_CallFunc_Params[CALLFUNC_MAXPARAMS] = {0}; // Params cell g_CallFunc_Params[CALLFUNC_MAXPARAMS] = {0}; // Params
CallFunc_ParamInfo g_CallFunc_ParamInfo[CALLFUNC_MAXPARAMS] = {0}; // Flags CallFunc_ParamInfo g_CallFunc_ParamInfo[CALLFUNC_MAXPARAMS] = {{0}}; // Flags
int g_CallFunc_CurParam = 0; // Current param id int g_CallFunc_CurParam = 0; // Current param id
#define CALLFUNC_FLAG_BYREF 1 /* Byref flag so that mem is released */ #define CALLFUNC_FLAG_BYREF 1 /* Byref flag so that mem is released */

View File

@ -81,7 +81,7 @@ static cell AMX_NATIVE_CALL n_floatstr(AMX *amx,cell *params)
/* Find out how long the string is in characters. */ /* Find out how long the string is in characters. */
amx_StrLen(pString, &nLen); amx_StrLen(pString, &nLen);
if (nLen == 0 || nLen >= sizeof szSource) if (nLen == 0 || (unsigned int)nLen >= sizeof szSource)
return 0; return 0;
/* Now convert the Small String into a C type null terminated string */ /* Now convert the Small String into a C type null terminated string */

View File

@ -720,7 +720,7 @@ void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t
#else #else
int *z = (int*)ptr + 0x16C; int *z = (int*)ptr + 0x16C;
#endif #endif
int stop = ed->v.armorvalue; int stop = (int)ed->v.armorvalue;
*z = stop; *z = stop;
ed->v.armorvalue = stop; ed->v.armorvalue = stop;
} }

View File

@ -123,7 +123,7 @@ char* get_amxstring(AMX *amx,cell amx_addr,int id, int& len)
register cell* source = (cell *)(amx->base + (int)(((AMX_HEADER *)amx->base)->dat + amx_addr)); register cell* source = (cell *)(amx->base + (int)(((AMX_HEADER *)amx->base)->dat + amx_addr));
register char* dest = buffor[id]; register char* dest = buffor[id];
char* start = dest; char* start = dest;
while (*dest++=(char)*source++) while ((*dest++=(char)(*source++)))
; ;
len = --dest - start; len = --dest - start;
return start; return start;

View File

@ -169,7 +169,7 @@ char* UTIL_SplitHudMessage(const char *src)
unsigned short FixedUnsigned16( float value, float scale ) unsigned short FixedUnsigned16( float value, float scale )
{ {
int output = value * scale; int output = (int)(value * scale);
if ( output < 0 ) if ( output < 0 )
output = 0; output = 0;
@ -181,7 +181,7 @@ unsigned short FixedUnsigned16( float value, float scale )
short FixedSigned16( float value, float scale ) short FixedSigned16( float value, float scale )
{ {
int output = value * scale; int output = (int)(value * scale);
if ( output > 32767 ) if ( output > 32767 )
output = 32767; output = 32767;

View File

@ -83,3 +83,5 @@ AMX_NATIVE_INFO vault_Natives[] = {
{ "vaultdata_exists", vaultdata_exists }, { "vaultdata_exists", vaultdata_exists },
{ 0, 0 } { 0, 0 }
}; };