diff --git a/dlls/dod2/dodx/CMisc.cpp b/dlls/dod2/dodx/CMisc.cpp index 07b007a0..7b69fd45 100755 --- a/dlls/dod2/dodx/CMisc.cpp +++ b/dlls/dod2/dodx/CMisc.cpp @@ -330,6 +330,8 @@ void CMapInfo::Init(){ } +#ifdef FORWARD_OLD_SYSTEM + // ***************************************************** // class Forward // ***************************************************** @@ -369,4 +371,6 @@ void Forward::exec(int p1,int p2){ MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 2,p1, p2); a = a->next; } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/dlls/dod2/dodx/CMisc.h b/dlls/dod2/dodx/CMisc.h index 679d59c9..2d2c7627 100755 --- a/dlls/dod2/dodx/CMisc.h +++ b/dlls/dod2/dodx/CMisc.h @@ -157,6 +157,8 @@ public: void Init(); }; +#ifdef FORWARD_OLD_SYSTEM + // ***************************************************** // class Forward // ***************************************************** @@ -178,5 +180,6 @@ public: void exec(int p1,int p2,int p3,int p4,int p5); void exec(int p1,int p2); }; +#endif #endif // CMISC_H \ No newline at end of file diff --git a/dlls/dod2/dodx/NBase.cpp b/dlls/dod2/dodx/NBase.cpp index a14580bc..0a0e912f 100755 --- a/dlls/dod2/dodx/NBase.cpp +++ b/dlls/dod2/dodx/NBase.cpp @@ -178,7 +178,29 @@ static cell AMX_NATIVE_CALL get_user_pronestate(AMX *amx, cell *params){ return 0; } +static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){ + int index = params[1]; + if (index<1||index>gpGlobals->maxClients){ + MF_RaiseAmxError(amx,AMX_ERR_NATIVE); + return 0; + } + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (pPlayer->ingame){ + int wpn = pPlayer->current; + cell *cpTemp = MF_GetAmxAddr(amx,params[2]); + *cpTemp = pPlayer->weapons[wpn].clip; + cpTemp = MF_GetAmxAddr(amx,params[3]); + *cpTemp = pPlayer->weapons[wpn].ammo; + return wpn; + } + + return 0; +} + static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params){ // forward + +#ifdef FORWARD_OLD_SYSTEM + int iFunctionIndex; switch( params[1] ){ case 0: @@ -199,6 +221,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params){ // forward MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; } +#endif return 1; } @@ -214,6 +237,7 @@ AMX_NATIVE_INFO base_Natives[] = { { "dod_get_user_score", get_user_score }, { "dod_get_user_class", get_user_class }, { "dod_get_user_team", get_user_team }, + { "dod_get_user_weapon", get_user_weapon }, { "dod_get_map_info", get_map_info }, { "dod_user_kill", user_kill }, diff --git a/dlls/dod2/dodx/NRank.cpp b/dlls/dod2/dodx/NRank.cpp index c4b40436..5b370e9c 100755 --- a/dlls/dod2/dodx/NRank.cpp +++ b/dlls/dod2/dodx/NRank.cpp @@ -383,13 +383,25 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg 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; } diff --git a/dlls/dod2/dodx/dodx.h b/dlls/dod2/dodx/dodx.h index 4288326b..117d138c 100755 --- a/dlls/dod2/dodx/dodx.h +++ b/dlls/dod2/dodx/dodx.h @@ -73,9 +73,19 @@ extern int AxisScore; extern int gmsgScoreShort; extern int gmsgPTeam; + +#ifdef FORWARD_OLD_SYSTEM + extern Forward g_death_info; extern Forward g_damage_info; +#else + +extern int iFDamage; +extern int iFDeath; + +#endif + extern cvar_t* dodstats_maxsize; extern cvar_t* dodstats_rank; extern cvar_t* dodstats_reset; diff --git a/dlls/dod2/dodx/moduleconfig.cpp b/dlls/dod2/dodx/moduleconfig.cpp index a048599f..0afd72df 100755 --- a/dlls/dod2/dodx/moduleconfig.cpp +++ b/dlls/dod2/dodx/moduleconfig.cpp @@ -47,9 +47,18 @@ int mPlayerIndex; int AlliesScore; int AxisScore; +#ifdef FORWARD_OLD_SYSTEM + Forward g_death_info; Forward g_damage_info; +#else + +int iFDamage; +int iFDeath; + +#endif + int gmsgCurWeapon; int gmsgHealth; int gmsgResetHUD; @@ -164,9 +173,13 @@ void ServerDeactivate() { g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("dodstats") ) ); +#ifdef FORWARD_OLD_SYSTEM + g_damage_info.clear(); g_death_info.clear(); +#endif + // clear custom weapons info for ( i=DODMAX_WEAPONS-DODMAX_CUSTOMWPNS;icurrent = iId; break; case 2: if ( !iState || !isModuleActive() ) @@ -106,6 +105,7 @@ void Client_CurWeapon(void* mValue){ if ( weaponData[iId].needcheck ){ iId = get_weaponid(mPlayer); + mPlayer->current = iId; } if (iClip > -1) { if ( mPlayer->current == 17 ){ @@ -167,11 +167,22 @@ void Client_Health_End(void* mValue){ TA = 1; } +#ifdef FORWARD_OLD_SYSTEM g_damage_info.exec( pAttacker->index, mPlayer->index, damage, weapon, aim, TA ); - +#else + MF_ExecuteForward( iFDamage,pAttacker->index, mPlayer->index, damage, weapon, aim, TA ); +#endif + if ( !mPlayer->IsAlive() ){ pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA); + +#ifdef FORWARD_OLD_SYSTEM g_death_info.exec( pAttacker->index, mPlayer->index, weapon, aim, TA ); +#else + MF_ExecuteForward( iFDeath,pAttacker->index, mPlayer->index, weapon, aim, TA ); +#endif + + } }