diff --git a/dlls/dod2/dodx/NBase.cpp b/dlls/dod2/dodx/NBase.cpp index b65282e4..0f75435f 100755 --- a/dlls/dod2/dodx/NBase.cpp +++ b/dlls/dod2/dodx/NBase.cpp @@ -213,6 +213,113 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params){ // forward return 1; } +static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0 + int i; + bool bFree = false; + for ( i=DODMAX_WEAPONS-DODMAX_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; + +#ifdef FORWARD_OLD_SYSTEM + g_damage_info.exec( pAtt->index, pVic->index, dmg, weapon, aim, TA ); +#else + MF_ExecuteForward( iFDamage,pAtt->index, pVic->index, dmg, weapon, aim, TA ); +#endif + + if ( pVic->IsAlive() ) + return 1; + + pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA); + +#ifdef FORWARD_OLD_SYSTEM + g_death_info.exec( pAtt->index, pVic->index, weapon, aim, TA ); +#else + MF_ExecuteForward( iFDeath,pAtt->index, pVic->index, weapon, aim, TA ); +#endif + + + + return 1; +} + +static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid + int index = params[2]; + if (index<1||index>gpGlobals->maxClients){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + + int weapon = params[1]; + if ( weapon < DODMAX_WEAPONS-DODMAX_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 get_maxweapons(AMX *amx, cell *params){ return DODMAX_WEAPONS; } @@ -221,28 +328,42 @@ static cell AMX_NATIVE_CALL get_stats_size(AMX *amx, cell *params){ return 9; } +static cell AMX_NATIVE_CALL is_custom(AMX *amx, cell *params){ + int weapon = params[1]; + if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){ + return 0; + } + return 1; +} + AMX_NATIVE_INFO base_Natives[] = { - { "dod_wpnlog_to_name", wpnlog_to_name }, - { "dod_wpnlog_to_id", wpnlog_to_id }, + { "dod_wpnlog_to_name", wpnlog_to_name }, + { "dod_wpnlog_to_id", wpnlog_to_id }, - { "dod_get_team_score", get_team_score }, - { "dod_get_user_score", get_user_score }, - { "dod_get_user_class", get_user_class }, - { "dod_get_user_weapon", get_user_weapon }, + { "dod_get_team_score", get_team_score }, + { "dod_get_user_score", get_user_score }, + { "dod_get_user_class", get_user_class }, + { "dod_get_user_weapon", get_user_weapon }, - { "dod_get_map_info", get_map_info }, - { "dod_user_kill", user_kill }, - { "dod_get_pronestate", get_user_pronestate }, + { "dod_get_map_info", get_map_info }, + { "dod_user_kill", user_kill }, + { "dod_get_pronestate", get_user_pronestate }, - { "xmod_get_wpnname", get_weapon_name }, - { "xmod_get_wpnlogname", get_weapon_logname }, - { "xmod_is_melee_wpn", is_melee }, - { "xmod_get_maxweapons", get_maxweapons }, - { "xmod_get_stats_size", get_stats_size }, + { "xmod_get_wpnname", get_weapon_name }, + { "xmod_get_wpnlogname", get_weapon_logname }, + { "xmod_is_melee_wpn", is_melee }, + { "xmod_get_maxweapons", get_maxweapons }, + { "xmod_get_stats_size", get_stats_size }, + { "xmod_is_custom_wpn", is_custom }, - {"register_statsfwd",register_forward }, + { "register_statsfwd",register_forward }, - ///******************* - { NULL, NULL } + // Custom Weapon Support + { "custom_weapon_add", register_cwpn }, // name,melee,logname + { "custom_weapon_dmg", cwpn_dmg }, + { "custom_weapon_shot", cwpn_shot }, + + ///******************* + { NULL, NULL } }; \ No newline at end of file diff --git a/dlls/dod2/dodx/NRank.cpp b/dlls/dod2/dodx/NRank.cpp index 9558e9d1..a06d7bf0 100755 --- a/dlls/dod2/dodx/NRank.cpp +++ b/dlls/dod2/dodx/NRank.cpp @@ -318,113 +318,6 @@ 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=DODMAX_WEAPONS-DODMAX_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; - -#ifdef FORWARD_OLD_SYSTEM - g_damage_info.exec( pAtt->index, pVic->index, dmg, weapon, aim, TA ); -#else - MF_ExecuteForward( iFDamage,pAtt->index, pVic->index, dmg, weapon, aim, TA ); -#endif - - if ( pVic->IsAlive() ) - return 1; - - pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA); - -#ifdef FORWARD_OLD_SYSTEM - g_death_info.exec( pAtt->index, pVic->index, weapon, aim, TA ); -#else - MF_ExecuteForward( iFDeath,pAtt->index, pVic->index, weapon, aim, TA ); -#endif - - - - return 1; -} - -static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid - int index = params[2]; - if (index<1||index>gpGlobals->maxClients){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int weapon = params[1]; - if ( weapon < DODMAX_WEAPONS-DODMAX_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}, @@ -438,11 +331,6 @@ AMX_NATIVE_INFO stats_Natives[] = { { "get_user_wstats", get_user_wstats}, { "reset_user_wstats", reset_user_wstats }, - // Custom Weapon Support - { "custom_weapon_add", register_cwpn }, // name,melee,logname - { "custom_weapon_dmg", cwpn_dmg }, - { "custom_weapon_shot", cwpn_shot }, - { NULL, NULL } }; diff --git a/dlls/tfc/tfcx/NBase.cpp b/dlls/tfc/tfcx/NBase.cpp index b2779c80..b6bb7279 100755 --- a/dlls/tfc/tfcx/NBase.cpp +++ b/dlls/tfc/tfcx/NBase.cpp @@ -425,6 +425,14 @@ static cell AMX_NATIVE_CALL get_stats_size(AMX *amx, cell *params){ return 8; } +static cell AMX_NATIVE_CALL is_custom(AMX *amx, cell *params){ + int weapon = params[1]; + if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ + return 0; + } + return 1; +} + // Native list. AMX_NATIVE_INFO base_Natives[] = { {"tfc_setmodel", TFC_SetModel}, @@ -439,6 +447,7 @@ AMX_NATIVE_INFO base_Natives[] = { {"xmod_is_melee_wpn", TFC_IsMelee}, {"xmod_get_maxweapons", get_maxweapons}, {"xmod_get_stats_size", get_stats_size}, + {"xmod_is_custom_wpn", is_custom}, {"tfc_userkill" , TFC_UserKill}, diff --git a/dlls/ts/tsx/NBase.cpp b/dlls/ts/tsx/NBase.cpp index bd01926b..ab63e760 100755 --- a/dlls/ts/tsx/NBase.cpp +++ b/dlls/ts/tsx/NBase.cpp @@ -382,6 +382,13 @@ static cell AMX_NATIVE_CALL get_stats_size(AMX *amx, cell *params){ return 8; } +static cell AMX_NATIVE_CALL is_custom(AMX *amx, cell *params){ + int weapon = params[1]; + if ( weapon < TSMAX_WEAPONS-TSMAX_CUSTOMWPNS ){ + return 0; + } + return 1; +} AMX_NATIVE_INFO base_Natives[] = { @@ -390,6 +397,7 @@ AMX_NATIVE_INFO base_Natives[] = { { "xmod_is_melee_wpn", is_melee }, { "xmod_get_maxweapons", get_maxweapons }, { "xmod_get_stats_size", get_stats_size }, + { "xmod_is_custom_wpn", is_custom }, { "ts_wpnlogtoname", wpnlog_to_name }, { "ts_wpnlogtoid", wpnlog_to_id }, diff --git a/dlls/ts/tsx/NRank.cpp b/dlls/ts/tsx/NRank.cpp index 053270e6..dfc5a470 100755 --- a/dlls/ts/tsx/NRank.cpp +++ b/dlls/ts/tsx/NRank.cpp @@ -1,5 +1,5 @@ /* - * TSX + * TFCX * Copyright (c) 2004 Lukasz Wlasinski * * diff --git a/dlls/ts/tsx/Utils.cpp b/dlls/ts/tsx/Utils.cpp index b349ab4c..fd52f9bf 100755 --- a/dlls/ts/tsx/Utils.cpp +++ b/dlls/ts/tsx/Utils.cpp @@ -1,5 +1,5 @@ /* - * TSX + * TFCX * Copyright (c) 2004 Lukasz Wlasinski * *