diff --git a/dlls/dod2/dodfun/CMisc.cpp b/dlls/dod2/dodfun/CMisc.cpp index 248b01ea..48d990b3 100755 --- a/dlls/dod2/dodfun/CMisc.cpp +++ b/dlls/dod2/dodfun/CMisc.cpp @@ -70,18 +70,12 @@ void CPlayer::killPlayer(){ void CPlayer::setTeamName( char *szName ){ for (int i=0;i<16;i++){ - if ( bSteam ) - *( (char*)pEdict->pvPrivateData + STEAM_PDOFFSET_TEAMNAME + i ) = szName[i]; - else - *( (char*)pEdict->pvPrivateData + WON_PDOFFSET_TEAMNAME + i ) = szName[i]; + *( (char*)pEdict->pvPrivateData + STEAM_PDOFFSET_TEAMNAME + i ) = szName[i]; } } void CPlayer::getTeamName(char * szName ){ for (int i=0;i<16;i++){ - if ( bSteam ) - szName[i] = *( (char*)pEdict->pvPrivateData + STEAM_PDOFFSET_TEAMNAME + i ); - else - szName[i] = *( (char*)pEdict->pvPrivateData + WON_PDOFFSET_TEAMNAME + i ); + szName[i] = *( (char*)pEdict->pvPrivateData + STEAM_PDOFFSET_TEAMNAME + i ); } } \ No newline at end of file diff --git a/dlls/dod2/dodfun/CMisc.h b/dlls/dod2/dodfun/CMisc.h index a3e1e407..3bcff1c0 100755 --- a/dlls/dod2/dodfun/CMisc.h +++ b/dlls/dod2/dodfun/CMisc.h @@ -47,13 +47,6 @@ #define STEAM_PDOFFSET_DEATHS 476 + LINUXOFFSET // deaths #define STEAM_PDOFFSET_TEAMNAME 1396 + LINUXOFFSET // team name -#define WON_PDOFFSET_DEATHS 456 + LINUXOFFSET // deaths -#define WON_PDOFFSET_CLASS 511 + LINUXOFFSET // player class -#define WON_PDOFFSET_RCLASS 512 + LINUXOFFSET // random class -#define WON_PDOFFSET_WDEPLOY 605 + LINUXOFFSET // weapon deploy -#define WON_PDOFFSET_SCORE 626 + LINUXOFFSET // score -#define WON_PDOFFSET_TEAMNAME 1896 + LINUXOFFSET // team name - /* DoD weapons */ enum { DODW_AMERKNIFE = 1, diff --git a/dlls/dod2/dodfun/NPD.cpp b/dlls/dod2/dodfun/NPD.cpp index d87565c0..78915914 100755 --- a/dlls/dod2/dodfun/NPD.cpp +++ b/dlls/dod2/dodfun/NPD.cpp @@ -46,23 +46,12 @@ static cell AMX_NATIVE_CALL set_user_class(AMX *amx, cell *params){ if (iClass){ - if ( bSteam ){ - *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_CLASS) = iClass; - *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS) = 0; // disable random class - } - else { - *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_CLASS) = iClass; - *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_RCLASS) = 0; // disable random class - - } + *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_CLASS) = iClass; + *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS) = 0; // disable random class } else { - if ( bSteam ){ - *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS) = 1; // set random class - } - else { - *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_RCLASS) = 1; // set random class - } + *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS) = 1; // set random class + } return 1; @@ -96,10 +85,7 @@ static cell AMX_NATIVE_CALL set_user_team(AMX *amx, cell *params){ break; } - if ( bSteam ) - *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS) = 1; // set random class - else - *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_RCLASS) = 1; // set random class + *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS) = 1; // set random class if ( params[3] ){ MESSAGE_BEGIN(MSG_ALL,gmsgPTeam); @@ -122,10 +108,7 @@ static cell AMX_NATIVE_CALL get_user_nextclass(AMX *amx, cell *params){ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); if ( pPlayer->ingame ){ - if ( bSteam ) - return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_CLASS); - else - return *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_CLASS); + return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_CLASS); } return 0; @@ -140,10 +123,7 @@ static cell AMX_NATIVE_CALL is_randomclass(AMX *amx, cell *params){ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); if ( pPlayer->ingame ){ - if ( bSteam ) - return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS); - else - return *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_RCLASS); + return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS); } return 0; } @@ -156,10 +136,7 @@ static cell AMX_NATIVE_CALL get_user_deaths(AMX *amx, cell *params){ } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); if (pPlayer->ingame){ - if ( bSteam ) - return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ); - else - return *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_DEATHS ); + return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ); } return 0; } @@ -172,18 +149,12 @@ static cell AMX_NATIVE_CALL set_user_deaths(AMX *amx, cell *params){ } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); if (pPlayer->ingame){ - if ( bSteam ) - *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) = params[2]; - else - *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_DEATHS ) = params[2]; + *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) = params[2]; if ( params[3]){ //ScoreShort message MESSAGE_BEGIN(MSG_ALL,gmsgScoreShort); WRITE_BYTE(pPlayer->index); - if ( bSteam ) - WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_SCORE ) ); - else - WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_SCORE ) ); + WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_SCORE ) ); WRITE_SHORT((int)pPlayer->pEdict->v.frags); WRITE_SHORT(params[2]); WRITE_BYTE(1); @@ -202,20 +173,15 @@ static cell AMX_NATIVE_CALL set_user_score(AMX *amx, cell *params){ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); if (pPlayer->ingame){ - if ( bSteam ) - *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_SCORE ) = params[2]; - else - *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_SCORE ) = params[2]; + *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_SCORE ) = params[2]; + if ( params[3]){ //ScoreShort message MESSAGE_BEGIN(MSG_ALL,gmsgScoreShort); WRITE_BYTE(pPlayer->index); WRITE_SHORT(params[2]); WRITE_SHORT((int)pPlayer->pEdict->v.frags); - if ( bSteam ) - WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) ); - else - WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_DEATHS ) ); + WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) ); WRITE_BYTE(1); MESSAGE_END(); } @@ -274,14 +240,8 @@ static cell AMX_NATIVE_CALL is_weapon_deployed(AMX *amx, cell *params){ } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); if (pPlayer->ingame){ - if ( bSteam ){ - if ( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_WDEPLOY) == 1 ) - return 1; - } - else { - if ( *( (int*)pPlayer->pEdict->pvPrivateData + WON_PDOFFSET_WDEPLOY) == 1 ) - return 1; - } + if ( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_WDEPLOY) == 1 ) + return 1; } return 0; } @@ -295,7 +255,7 @@ static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){ } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if ( !pPlayer->ingame || !bSteam ) + if ( !pPlayer->ingame ) return 0; switch(params[2]){ @@ -394,7 +354,6 @@ static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){ return 1; } - static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){ int index = params[1]; if (index<1||index>gpGlobals->maxClients){ @@ -403,7 +362,7 @@ static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){ } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if ( !pPlayer->ingame || !bSteam ) + if ( !pPlayer->ingame ) return 0; switch(params[2]){ diff --git a/dlls/dod2/dodfun/dodfun.h b/dlls/dod2/dodfun/dodfun.h index c8e20e77..a52ab2d9 100755 --- a/dlls/dod2/dodfun/dodfun.h +++ b/dlls/dod2/dodfun/dodfun.h @@ -41,9 +41,6 @@ extern AMX_NATIVE_INFO base_Natives[]; extern AMX_NATIVE_INFO pd_Natives[]; -extern cvar_t* dodfun_steam; - -extern bool bSteam; extern int mState; extern int mPlayerIndex; diff --git a/dlls/dod2/dodfun/moduleconfig.cpp b/dlls/dod2/dodfun/moduleconfig.cpp index 6e438e5e..f803d010 100755 --- a/dlls/dod2/dodfun/moduleconfig.cpp +++ b/dlls/dod2/dodfun/moduleconfig.cpp @@ -39,7 +39,6 @@ void (*endfunction)(void*); CPlayer* mPlayer; CPlayer players[33]; -bool bSteam; int mState; int mPlayerIndex; @@ -49,8 +48,6 @@ int gmsgCurWeapon; int gmsgScoreShort; int gmsgPTeam; -cvar_t *dodfun_steam; -cvar_t init_dodfun_steam = {"dodfun_steam","1"}; struct sUserMsg { const char* name; @@ -85,7 +82,6 @@ int RegUserMsg_Post(const char *pszName, int iSize){ } void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){ - bSteam = (int)dodfun_steam->value ? true:false; for( int i = 1; i <= gpGlobals->maxClients; ++i ) GET_PLAYER_POINTER_I(i)->Init( i , pEdictList + i ); @@ -205,22 +201,30 @@ void WriteEntity_Post(int iValue) { } void SetModel_Post(edict_t *e, const char *m){ - if ( !e->v.owner ) + if ( !e->v.owner || !e->v.dmgtime ) RETURN_META(MRES_IGNORED); int owner = ENTINDEX(e->v.owner); if ( owner && owner<33 && m[7]=='w' && m[8]=='_' ){ + int w_id = 0; - if ( m[9]=='g' && m[10]=='r' && m[11]=='e' && m[12]=='n' ) w_id = 13; // grenade - else if ( m[9]=='m' && m[10]=='i' ) w_id = 36; // mills - else if ( m[9]=='s' && m[10]=='t' && m[11]=='i') w_id = 14; // stick + + CPlayer* pPlayer = GET_PLAYER_POINTER_I(owner); + bool newNade = ( pPlayer->current == 13 || pPlayer->current == 14 ) ? true:false; + + if ( m[9]=='g' && m[10]=='r' && m[11]=='e' && m[12]=='n' ) + newNade ? w_id = 13 : w_id = 16; // grenade + else if ( m[9]=='m' && m[10]=='i' ) + newNade ? w_id = 36 : w_id = 16 ; // mills ; should I add mills_grenade_ex weapon ? + else if ( m[9]=='s' && m[10]=='t' && m[11]=='i') + newNade ? w_id = 14 : w_id = 15; // stick + if ( !w_id ) RETURN_META(MRES_IGNORED); - CPlayer* pPlayer = GET_PLAYER_POINTER_I(owner); + MF_ExecuteForward( iFGrenade, pPlayer->index, ENTINDEX(e) ,w_id ); /* fuse start */ if ( pPlayer->fuseSet ){ - bool newNade = ( pPlayer->current == 13 || pPlayer->current == 14 ) ? true:false; if ( newNade ){ if ( pPlayer->fuseType & 1<<0 ){ e->v.dmgtime += pPlayer->nadeFuse - 5.0; @@ -239,11 +243,6 @@ void SetModel_Post(edict_t *e, const char *m){ RETURN_META(MRES_IGNORED); } -void OnMetaAttach() { - CVAR_REGISTER (&init_dodfun_steam); - dodfun_steam = CVAR_GET_POINTER(init_dodfun_steam.name); -} - void OnAmxxAttach() { MF_AddNatives( base_Natives ); MF_AddNatives( pd_Natives ); diff --git a/dlls/dod2/dodfun/moduleconfig.h b/dlls/dod2/dodfun/moduleconfig.h index dcad3fa3..a708ea12 100755 --- a/dlls/dod2/dodfun/moduleconfig.h +++ b/dlls/dod2/dodfun/moduleconfig.h @@ -47,7 +47,7 @@ // Meta query //#define FN_META_QUERY OnMetaQuery // Meta attach -#define FN_META_ATTACH OnMetaAttach +// #define FN_META_ATTACH OnMetaAttach // Meta dettach // #define FN_META_DETACH OnMetaDetach diff --git a/dlls/dod2/dodx/CMisc.cpp b/dlls/dod2/dodx/CMisc.cpp index a2b1b606..07b007a0 100755 --- a/dlls/dod2/dodx/CMisc.cpp +++ b/dlls/dod2/dodx/CMisc.cpp @@ -315,16 +315,6 @@ void CPlayer::killPlayer(){ pEdict->v.weapons = 0; } -void CPlayer::setTeamName( char *szName ){ - - for (int i=0;i<16;i++){ - if ( bSteam ) - *( (char*)pEdict->pvPrivateData + STEAM_PDOFFSET_TEAMNAME + i ) = szName[i]; - else - *( (char*)pEdict->pvPrivateData + WON_PDOFFSET_TEAMNAME + i ) = szName[i]; - } -} - // ***************************************************** // class CMapInfo // ***************************************************** diff --git a/dlls/dod2/dodx/CMisc.h b/dlls/dod2/dodx/CMisc.h index bfec1038..679d59c9 100755 --- a/dlls/dod2/dodx/CMisc.h +++ b/dlls/dod2/dodx/CMisc.h @@ -45,20 +45,6 @@ #define DOD_VERSION "0.1" -#define STEAM_PDOFFSET_WDEPLOY 229 + LINUXOFFSET // weapon deploy -#define STEAM_PDOFFSET_CLASS 366 + LINUXOFFSET // player class -#define STEAM_PDOFFSET_RCLASS 367 + LINUXOFFSET // random class -#define STEAM_PDOFFSET_SCORE 475 + LINUXOFFSET // score -#define STEAM_PDOFFSET_DEATHS 476 + LINUXOFFSET // deaths -#define STEAM_PDOFFSET_TEAMNAME 1396 + LINUXOFFSET // team name - -#define WON_PDOFFSET_DEATHS 456 + LINUXOFFSET // deaths -#define WON_PDOFFSET_CLASS 511 + LINUXOFFSET // player class -#define WON_PDOFFSET_RCLASS 512 + LINUXOFFSET // random class -#define WON_PDOFFSET_WDEPLOY 605 + LINUXOFFSET // weapon deploy -#define WON_PDOFFSET_SCORE 626 + LINUXOFFSET // score -#define WON_PDOFFSET_TEAMNAME 1896 + LINUXOFFSET // team name - #define MAX_TRACE 6 struct traceVault { @@ -120,7 +106,6 @@ public: void updateScore(int weapon, int score); void restartStats(bool all = true); void killPlayer(); - void setTeamName( char *szName ); inline bool IsBot(){ const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict); diff --git a/dlls/dod2/dodx/dodx.h b/dlls/dod2/dodx/dodx.h index 43b2d5a4..4288326b 100755 --- a/dlls/dod2/dodx/dodx.h +++ b/dlls/dod2/dodx/dodx.h @@ -55,7 +55,6 @@ struct weapon_t { }; extern bool rankBots; -extern bool bSteam; extern int mState; extern int mPlayerIndex; @@ -83,8 +82,6 @@ extern cvar_t* dodstats_reset; extern cvar_t* dodstats_rankbots; extern cvar_t* dodstats_pause; -extern cvar_t* dodstats_steam; - extern weapon_t weaponData[DODMAX_WEAPONS]; extern traceVault traceData[MAX_TRACE]; diff --git a/dlls/dod2/dodx/moduleconfig.cpp b/dlls/dod2/dodx/moduleconfig.cpp index df339ae5..a048599f 100755 --- a/dlls/dod2/dodx/moduleconfig.cpp +++ b/dlls/dod2/dodx/moduleconfig.cpp @@ -41,7 +41,6 @@ CPlayer players[33]; CMapInfo g_map; bool rankBots; -bool bSteam; int mState; int mPlayerIndex; @@ -76,9 +75,6 @@ cvar_t *dodstats_rank; cvar_t *dodstats_rankbots; cvar_t *dodstats_pause; -cvar_t *dodstats_steam; -cvar_t init_dodstats_steam = {"dodstats_steam","1"}; - struct sUserMsg { const char *name; int* id; @@ -128,7 +124,6 @@ int RegUserMsg_Post(const char *pszName, int iSize){ void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){ rankBots = (int)dodstats_rankbots->value ? true:false; - bSteam = (int)dodstats_steam->value ? true:false; for( int i = 1; i <= gpGlobals->maxClients; ++i ) GET_PLAYER_POINTER_I(i)->Init( i , pEdictList + i ); @@ -181,23 +176,28 @@ void ServerDeactivate() { BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){ GET_PLAYER_POINTER(pEntity)->Connect(pszName,pszAddress); + RETURN_META_VALUE(MRES_IGNORED, TRUE); } void ClientDisconnect( edict_t *pEntity ) { CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - if (pPlayer->ingame) + + if (pPlayer->ingame) pPlayer->Disconnect(); + RETURN_META(MRES_IGNORED); } void ClientPutInServer_Post( edict_t *pEntity ) { GET_PLAYER_POINTER(pEntity)->PutInServer(); + RETURN_META(MRES_IGNORED); } void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) { CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); + const char* name = INFOKEY_VALUE(infobuffer,"name"); const char* oldname = STRING(pEntity->v.netname); @@ -346,10 +346,6 @@ void OnMetaAttach() { dodstats_rank=CVAR_GET_POINTER(init_dodstats_rank.name); dodstats_rankbots = CVAR_GET_POINTER(init_dodstats_rankbots.name); dodstats_pause = CVAR_GET_POINTER(init_dodstats_pause.name); - - CVAR_REGISTER (&init_dodstats_steam); - dodstats_steam = CVAR_GET_POINTER(init_dodstats_steam.name); - } void OnAmxxAttach() { diff --git a/dlls/dod2/dodx/usermsg.cpp b/dlls/dod2/dodx/usermsg.cpp index da57fd2b..a41538ab 100755 --- a/dlls/dod2/dodx/usermsg.cpp +++ b/dlls/dod2/dodx/usermsg.cpp @@ -108,7 +108,7 @@ void Client_CurWeapon(void* mValue){ iId = get_weaponid(mPlayer); } if (iClip > -1) { - if ( mPlayer->current == 17 && bSteam ){ + if ( mPlayer->current == 17 ){ if ( iClip+2 == mPlayer->weapons[iId].clip) mPlayer->saveShot(iId); }