Added debugging engine

This commit is contained in:
David Anderson
2004-10-03 22:33:55 +00:00
parent 601bb30b7e
commit 846ef95c58
5 changed files with 122 additions and 112 deletions

View File

@ -35,7 +35,7 @@
static cell AMX_NATIVE_CALL get_weapon_name(AMX *amx, cell *params){ // from id to name 3 params id, name, len
int id = params[1];
if (id<0 || id>=TSMAX_WEAPONS){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
return 0;
}
return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
@ -67,7 +67,7 @@ static cell AMX_NATIVE_CALL wpnlog_to_id(AMX *amx, cell *params){ // from log to
static cell AMX_NATIVE_CALL get_weapon_logname(AMX *amx, cell *params){ // from id to log
int id = params[1];
if (id<0 || id>=TSMAX_WEAPONS){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
return 0;
}
return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
@ -76,7 +76,7 @@ static cell AMX_NATIVE_CALL get_weapon_logname(AMX *amx, cell *params){ // from
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
int id = params[1];
if (id<1 || id>=TSMAX_WEAPONS){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
return 0;
}
if ( weaponData[id].melee )
@ -86,10 +86,7 @@ static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL ts_get_user_weapon(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
int wpn = pPlayer->current;
@ -108,10 +105,7 @@ static cell AMX_NATIVE_CALL ts_get_user_weapon(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
int wpn = pPlayer->current;
@ -126,10 +120,7 @@ static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_user_cash(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
return pPlayer->money;
@ -139,10 +130,7 @@ static cell AMX_NATIVE_CALL get_user_cash(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_user_space(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
return pPlayer->space;
@ -152,10 +140,7 @@ static cell AMX_NATIVE_CALL get_user_space(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_user_pwup(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
cell *cpTemp = MF_GetAmxAddr(amx,params[2]);
@ -167,10 +152,7 @@ static cell AMX_NATIVE_CALL get_user_pwup(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_user_items(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
return pPlayer->items;
@ -180,10 +162,7 @@ static cell AMX_NATIVE_CALL get_user_items(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_killingStreak(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
return pPlayer->killingSpree;
@ -193,10 +172,7 @@ static cell AMX_NATIVE_CALL get_killingStreak(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_lastFrag(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
return pPlayer->lastFrag;
@ -206,10 +182,7 @@ static cell AMX_NATIVE_CALL get_lastFrag(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_killflags(AMX *amx, cell *params){
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( pPlayer->ingame ){
return pPlayer->killFlags;
@ -219,10 +192,7 @@ static cell AMX_NATIVE_CALL get_killflags(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL give_weapon(AMX *amx, cell *params){ // index,weapon,clips,extra
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( !pPlayer->ingame || !pPlayer->IsAlive() ){
return 0;
@ -342,10 +312,7 @@ static cell AMX_NATIVE_CALL give_pwup(AMX *amx, cell *params){ // index,pwupenti
}
int id = params[1];
if ( id<1 || id>gpGlobals->maxClients ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CHECK_PLAYER(id);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if ( !pPlayer->ingame || !pPlayer->IsAlive() ){
REMOVE_ENTITY(pent);
@ -370,23 +337,24 @@ static cell AMX_NATIVE_CALL ts_setup(AMX *amx, cell *params){ // index,pwupentin
static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params){ // forward
int iFunctionIndex;
int err;
switch( params[1] ){
case 0:
if( MF_AmxFindPublic(amx, "client_damage", &iFunctionIndex) == AMX_ERR_NONE )
if( (err=MF_AmxFindPublic(amx, "client_damage", &iFunctionIndex)) == AMX_ERR_NONE )
g_damage_info.put( amx , iFunctionIndex );
else
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_LogError(amx, err, "Error finding function \"client_damage\"");
return 0;
break;
case 1:
if( MF_AmxFindPublic(amx, "client_death", &iFunctionIndex) == AMX_ERR_NONE )
if( (err=MF_AmxFindPublic(amx, "client_death", &iFunctionIndex)) == AMX_ERR_NONE )
g_death_info.put( amx , iFunctionIndex );
else
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_LogError(amx, err, "Error finding function \"client_death\"");
return 0;
break;
default:
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid forward id %d", params[1]);
return 0;
}
return 1;