Made linux compatible.

This commit is contained in:
David Anderson 2004-05-26 06:19:50 +00:00
parent e45e0c9634
commit a21537f644
3 changed files with 33 additions and 34 deletions

View File

@ -1,5 +1,5 @@
MODNAME = engine_amx MODNAME = engine_amxx
SRCFILES = meta_api.cpp SRCFILES = engine.cpp entity.cpp messages.cpp forwards.cpp amxxmodule.cpp amxxapi.cpp globals.cpp
EXTRA_LIBS_LINUX = EXTRA_LIBS_LINUX =
EXTRA_LIBS_WIN32 = EXTRA_LIBS_WIN32 =
@ -55,7 +55,7 @@ endif
OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o) OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o) OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \ CCOPT = -march=i386 -O6 -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

@ -586,7 +586,7 @@ static cell AMX_NATIVE_CALL playback_event(AMX *amx, cell *params)
} }
//(mahnsawce) //(mahnsawce)
static cell AMX_NATIVE_CALL ns2amx_anglevector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL angle_vector(AMX *amx, cell *params)
{ {
Vector v_angles,v_forward,v_right,v_up,v_return; Vector v_angles,v_forward,v_right,v_up,v_return;
cell *vCell = MF_GetAmxAddr(amx, params[1]); cell *vCell = MF_GetAmxAddr(amx, params[1]);
@ -786,6 +786,7 @@ AMX_NATIVE_INFO engine_Natives[] = {
{"RadiusDamage", RadiusDamage}, {"RadiusDamage", RadiusDamage},
{"PointContents", PointContents}, {"PointContents", PointContents},
{"vector_to_angle", vector_to_angle}, {"vector_to_angle", vector_to_angle},
{"angle_vector", angle_vector},
{"vector_length", vector_length}, {"vector_length", vector_length},
{"vector_distance", vector_distance}, {"vector_distance", vector_distance},
{"trace_normal", trace_normal}, {"trace_normal", trace_normal},

View File

@ -22,7 +22,7 @@ void argMsg::Reset()
{ {
iData = 0; iData = 0;
fData = 0.0; fData = 0.0;
cData.clear(); cData.assign("");
type = 0; type = 0;
} }
@ -120,8 +120,8 @@ void WriteByte(int iValue)
p->type = arg_byte; p->type = arg_byte;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->iData = iValue; Msg[msgCount-1]->iData = iValue;
Msg.at(msgCount-1)->type = arg_byte; Msg[msgCount-1]->type = arg_byte;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -140,8 +140,8 @@ void WriteChar(int iValue)
p->type = arg_char; p->type = arg_char;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->iData = iValue; Msg[msgCount-1]->iData = iValue;
Msg.at(msgCount-1)->type = arg_char; Msg[msgCount-1]->type = arg_char;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -160,8 +160,8 @@ void WriteShort(int iValue)
p->type = arg_short; p->type = arg_short;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->iData = iValue; Msg[msgCount-1]->iData = iValue;
Msg.at(msgCount-1)->type = arg_short; Msg[msgCount-1]->type = arg_short;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -180,8 +180,8 @@ void WriteLong(int iValue)
p->type = arg_long; p->type = arg_long;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->iData = iValue; Msg[msgCount-1]->iData = iValue;
Msg.at(msgCount-1)->type = arg_long; Msg[msgCount-1]->type = arg_long;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -200,8 +200,8 @@ void WriteAngle(float flValue)
p->type = arg_angle; p->type = arg_angle;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->fData = flValue; Msg[msgCount-1]->fData = flValue;
Msg.at(msgCount-1)->type = arg_angle; Msg[msgCount-1]->type = arg_angle;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -220,8 +220,8 @@ void WriteCoord(float flValue)
p->type = arg_coord; p->type = arg_coord;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->fData = flValue; Msg[msgCount-1]->fData = flValue;
Msg.at(msgCount-1)->type = arg_coord; Msg[msgCount-1]->type = arg_coord;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -240,8 +240,8 @@ void WriteString(const char *sz)
p->type = arg_string; p->type = arg_string;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->cData.assign(sz); Msg[msgCount-1]->cData.assign(sz);
Msg.at(msgCount-1)->type = arg_string; Msg[msgCount-1]->type = arg_string;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -260,8 +260,8 @@ void WriteEntity(int iValue)
p->type = arg_entity; p->type = arg_entity;
Msg.push_back(p); Msg.push_back(p);
} else { } else {
Msg.at(msgCount-1)->iData = iValue; Msg[msgCount-1]->iData = iValue;
Msg.at(msgCount-1)->type = arg_entity; Msg[msgCount-1]->type = arg_entity;
} }
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
@ -272,7 +272,6 @@ void WriteEntity(int iValue)
void MessageEnd(void) void MessageEnd(void)
{ {
int mres = 0; int mres = 0;
int mct = msgCount;
unsigned int i = 0; unsigned int i = 0;
if (inblock) { if (inblock) {
if (msgBlocks[msgType] == BLOCK_ONCE) if (msgBlocks[msgType] == BLOCK_ONCE)
@ -286,8 +285,8 @@ void MessageEnd(void)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
MESSAGE_BEGIN(msgDest, msgType, msgOrigin, msgpEntity); MESSAGE_BEGIN(msgDest, msgType, msgOrigin, msgpEntity);
for (i=0; i<msgCount; i++) { for (i=0; i<msgCount; i++) {
Msg.at(i)->Send(); Msg[i]->Send();
Msg.at(i)->Reset(); Msg[i]->Reset();
} }
MESSAGE_END(); MESSAGE_END();
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
@ -327,7 +326,6 @@ static cell AMX_NATIVE_CALL set_msg_block(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_msg_block(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_msg_block(AMX *amx, cell *params)
{ {
int msgid = params[1]; int msgid = params[1];
int block = params[2];
if (msgid < 1 || msgid > 255) { if (msgid < 1 || msgid > 255) {
MF_RaiseAmxError(amx, AMX_ERR_NATIVE); MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
@ -351,7 +349,7 @@ static cell AMX_NATIVE_CALL get_msg_argtype(AMX *amx, cell *params)
return 0; return 0;
} }
return Msg.at(argn-1)->Type(); return Msg[argn-1]->Type();
} }
static cell AMX_NATIVE_CALL get_msg_arg_int(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_msg_arg_int(AMX *amx, cell *params)
@ -363,7 +361,7 @@ static cell AMX_NATIVE_CALL get_msg_arg_int(AMX *amx, cell *params)
return 0; return 0;
} }
int iVal = Msg.at(argn-1)->iData; int iVal = Msg[argn-1]->iData;
return iVal; return iVal;
} }
@ -377,7 +375,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_int(AMX *amx, cell *params)
return 0; return 0;
} }
Msg.at(argn-1)->iData = params[2]; Msg[argn-1]->iData = params[2];
return 1; return 1;
} }
@ -391,7 +389,7 @@ static cell AMX_NATIVE_CALL get_msg_arg_float(AMX *amx, cell *params)
return 0; return 0;
} }
return amx_ftoc(Msg.at(argn-1)->fData); return amx_ftoc(Msg[argn-1]->fData);
} }
static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params)
@ -405,7 +403,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params)
REAL fVal = amx_ctof(params[2]); REAL fVal = amx_ctof(params[2]);
Msg.at(argn-1)->fData = fVal; Msg[argn-1]->fData = fVal;
return 1; return 1;
} }
@ -419,7 +417,7 @@ static cell AMX_NATIVE_CALL get_msg_arg_string(AMX *amx, cell *params)
return 0; return 0;
} }
const char *szVal = Msg.at(argn-1)->cData.c_str(); const char *szVal = Msg[argn-1]->cData.c_str();
return MF_SetAmxString(amx, params[2], szVal, params[3]); return MF_SetAmxString(amx, params[2], szVal, params[3]);
} }
@ -436,7 +434,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_string(AMX *amx, cell *params)
char *szVal = MF_GetAmxString(amx, params[2], 0, &iLen); char *szVal = MF_GetAmxString(amx, params[2], 0, &iLen);
Msg.at(argn-1)->cData.assign(szVal); Msg[argn-1]->cData.assign(szVal);
return 1; return 1;
} }