From a9c5228c318c158ecd5e0a4add5815188b5c7638 Mon Sep 17 00:00:00 2001 From: Lukasz Wlasinksi Date: Fri, 25 Jun 2004 01:00:29 +0000 Subject: [PATCH] small tweaks .. --- dlls/tfc/tfcx/CMisc.h | 1 - dlls/tfc/tfcx/NBase.cpp | 99 -------------------------------- dlls/tfc/tfcx/NRank.cpp | 100 +++++++++++++++++++++++++++++++++ dlls/tfc/tfcx/Utils.cpp | 16 +++--- dlls/tfc/tfcx/moduleconfig.cpp | 5 -- dlls/tfc/tfcx/tfcx.h | 1 - 6 files changed, 108 insertions(+), 114 deletions(-) diff --git a/dlls/tfc/tfcx/CMisc.h b/dlls/tfc/tfcx/CMisc.h index 592dcc93..d369901d 100755 --- a/dlls/tfc/tfcx/CMisc.h +++ b/dlls/tfc/tfcx/CMisc.h @@ -25,7 +25,6 @@ #define ACT_NADE_NONE 0 #define ACT_NADE_SHOT 1<<0 #define ACT_NADE_PUT 1<<1 -#define ACT_NADE_THROW 1<<2 #define PD_AMMO_SHELLS 53 + LINUXOFFSET #define PD_AMMO_BULLETS 55 + LINUXOFFSET diff --git a/dlls/tfc/tfcx/NBase.cpp b/dlls/tfc/tfcx/NBase.cpp index 0c238be9..e24a4582 100755 --- a/dlls/tfc/tfcx/NBase.cpp +++ b/dlls/tfc/tfcx/NBase.cpp @@ -362,100 +362,6 @@ static cell AMX_NATIVE_CALL TFC_SetPDdata(AMX *amx, cell *params) { } - -static cell AMX_NATIVE_CALL TFC_register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0 - int i; - bool bFree = false; - for ( i=TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS;igpGlobals->maxClients){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int vic = params[3]; - if (vic<1||vic>gpGlobals->maxClients){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int dmg = params[4]; - if ( dmg<1 ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int aim = params[5]; - if ( aim < 0 || aim > 7 ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - CPlayer* pAtt = GET_PLAYER_POINTER_I(att); - CPlayer* pVic = GET_PLAYER_POINTER_I(vic); - - pVic->pEdict->v.dmg_inflictor = NULL; - pAtt->saveHit( pVic , weapon , dmg, aim ); - - if ( !pAtt ) pAtt = pVic; - int TA = 0; - if ( (pVic->pEdict->v.team == pAtt->pEdict->v.team ) && ( pVic != pAtt) ) - TA = 1; - MF_ExecuteForward ( iFDamage, pAtt->index, pVic->index, dmg, weapon, aim, TA ); - - if ( pVic->IsAlive() ) - return 1; - - pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA); - MF_ExecuteForward ( iFDeath, pAtt->index, pVic->index, weapon, aim, TA ); - - return 1; -} - -static cell AMX_NATIVE_CALL TFC_cwpn_shot(AMX *amx, cell *params){ // player,wid - int index = params[1]; - if (index<1||index>gpGlobals->maxClients){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int weapon = params[2]; - if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - pPlayer->saveShot(weapon); - - return 1; -} - static cell AMX_NATIVE_CALL TFC_IsMelee(AMX *amx, cell *params){ // player,wid int weapon = params[1]; if ( weapon < 1 || weapon >= TFCMAX_WEAPONS ){ @@ -490,11 +396,6 @@ AMX_NATIVE_INFO base_Natives[] = { {"TFC_IsMelee", TFC_IsMelee}, {"TFC_UserKill" , TFC_UserKill}, - // Custom Weapon Support - { "TFC_reg_custom_wpn", TFC_register_cwpn }, - { "TFC_custom_wpn_dmg", TFC_cwpn_dmg }, - { "TFC_custom_wpn_shot", TFC_cwpn_shot }, - {"TFC_SetPDdata", TFC_SetPDdata }, //******************* 19 :) {NULL, NULL} diff --git a/dlls/tfc/tfcx/NRank.cpp b/dlls/tfc/tfcx/NRank.cpp index 4a24adae..c373bf54 100755 --- a/dlls/tfc/tfcx/NRank.cpp +++ b/dlls/tfc/tfcx/NRank.cpp @@ -256,6 +256,100 @@ static cell AMX_NATIVE_CALL get_statsnum(AMX *amx, cell *params) return g_rank.getRankNum(); } + +static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0 + int i; + bool bFree = false; + for ( i=TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS;igpGlobals->maxClients){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + + int vic = params[3]; + if (vic<1||vic>gpGlobals->maxClients){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + + int dmg = params[4]; + if ( dmg<1 ){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + + int aim = params[5]; + if ( aim < 0 || aim > 7 ){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + + CPlayer* pAtt = GET_PLAYER_POINTER_I(att); + CPlayer* pVic = GET_PLAYER_POINTER_I(vic); + + pVic->pEdict->v.dmg_inflictor = NULL; + pAtt->saveHit( pVic , weapon , dmg, aim ); + + if ( !pAtt ) pAtt = pVic; + int TA = 0; + if ( (pVic->pEdict->v.team == pAtt->pEdict->v.team ) && ( pVic != pAtt) ) + TA = 1; + MF_ExecuteForward ( iFDamage, pAtt->index, pVic->index, dmg, weapon, aim, TA ); + + if ( pVic->IsAlive() ) + return 1; + + pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA); + MF_ExecuteForward ( iFDeath, pAtt->index, pVic->index, weapon, aim, TA ); + + return 1; +} + +static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid + int index = params[1]; + if (index<1||index>gpGlobals->maxClients){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + + int weapon = params[2]; + if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + pPlayer->saveShot(weapon); + + return 1; +} + AMX_NATIVE_INFO stats_Natives[] = { { "get_stats", get_stats}, { "get_statsnum", get_statsnum}, @@ -267,6 +361,12 @@ AMX_NATIVE_INFO stats_Natives[] = { { "get_user_wrstats", get_user_wrstats}, // DEC-Weapon(Round) Stats { "get_user_wstats", get_user_wstats}, { "reset_user_wstats", reset_user_wstats }, + + // Custom Weapon Support + { "reg_custom_wpn", register_cwpn }, + { "custom_wpn_dmg", cwpn_dmg }, + { "custom_wpn_shot", cwpn_shot }, + { NULL, NULL } }; diff --git a/dlls/tfc/tfcx/Utils.cpp b/dlls/tfc/tfcx/Utils.cpp index eca0873a..b4e671c6 100755 --- a/dlls/tfc/tfcx/Utils.cpp +++ b/dlls/tfc/tfcx/Utils.cpp @@ -35,16 +35,16 @@ traceVault traceData[] = { { "tf_gl_grenade", TFC_WPN_GL, ACT_NADE_PUT, 2.0 }, { "tf_gl_pipebomb", TFC_WPN_PL, ACT_NADE_PUT, 2.0 }, - { "tf_weapon_normalgrenade", TFC_WPN_NORMALGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 }, - { "tf_weapon_nailgrenade", TFC_WPN_NAILGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 }, - { "tf_weapon_mirvgrenade", TFC_WPN_MIRVGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 }, - { "tf_weapon_napalmgrenade", TFC_WPN_NAPALMGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 }, - { "tf_weapon_gasgrenade", TFC_WPN_GASGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 }, - { "tf_weapon_empgrenade", TFC_WPN_EMPGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 }, + { "tf_weapon_normalgrenade", TFC_WPN_NORMALGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT, 2.0 }, + { "tf_weapon_nailgrenade", TFC_WPN_NAILGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT, 2.0 }, + { "tf_weapon_mirvgrenade", TFC_WPN_MIRVGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT, 2.0 }, + { "tf_weapon_napalmgrenade", TFC_WPN_NAPALMGRENADE, ACT_NADE_SHOT, 0.0 }, + { "tf_weapon_gasgrenade", TFC_WPN_GASGRENADE, ACT_NADE_SHOT, 0.0 }, + { "tf_weapon_empgrenade", TFC_WPN_EMPGRENADE, ACT_NADE_SHOT, 0.0 }, { "tf_weapon_mirvbomblet", TFC_WPN_MIRVGRENADE,ACT_NADE_PUT, 2.0 }, { "tf_rpg_rocket", TFC_WPN_RPG,ACT_NADE_PUT, 2.0 }, - { "caltrop", TFC_WPN_CALTROP, ACT_NADE_SHOT|ACT_NADE_THROW,0.0 }, - { "tf_weapon_concussiongrenade", TFC_WPN_CONCUSSIONGRENADE, ACT_NADE_THROW, 0.0 }, + { "caltrop", TFC_WPN_CALTROP, ACT_NADE_SHOT,0.0 }, + { "tf_weapon_concussiongrenade", TFC_WPN_CONCUSSIONGRENADE, ACT_NADE_NONE, 0.0 }, // { "timer", TFC_WPN_TIMER,ACT_NADE_NONE, 2.0 }, diff --git a/dlls/tfc/tfcx/moduleconfig.cpp b/dlls/tfc/tfcx/moduleconfig.cpp index 743f1339..f9736fa8 100755 --- a/dlls/tfc/tfcx/moduleconfig.cpp +++ b/dlls/tfc/tfcx/moduleconfig.cpp @@ -57,7 +57,6 @@ int mPlayerIndex; int iFDamage; int iFDeath; -int iFGrenade; RankSystem g_rank; Grenades g_grenades; @@ -295,9 +294,6 @@ void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t * if ( traceData[i].iAction & ACT_NADE_PUT ){ g_grenades.put(e,traceData[i].fDel,traceData[i].iId,GET_PLAYER_POINTER(e->v.owner)); } - if ( traceData[i].iAction & ACT_NADE_THROW ){ - MF_ExecuteForward ( iFGrenade, pPlayer->index,ENTINDEX(e),traceData[i].iId ); - } break; } } @@ -359,5 +355,4 @@ void FN_AMXX_Detach() { void FN_AMXX_PLUGINSLOADED(){ iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE); iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE); - iFGrenade = MF_RegisterForward("grenade_throw",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE); } \ No newline at end of file diff --git a/dlls/tfc/tfcx/tfcx.h b/dlls/tfc/tfcx/tfcx.h index 848cd993..cd832054 100755 --- a/dlls/tfc/tfcx/tfcx.h +++ b/dlls/tfc/tfcx/tfcx.h @@ -83,7 +83,6 @@ extern int mState; extern int iFDamage; extern int iFDeath; -extern int iFGrenade; //extern int gmsgCurWeapon; //extern int gmsgDamage;