bye bye WON ..

This commit is contained in:
Lukasz Wlasinksi 2004-07-28 17:06:01 +00:00
parent 2fb9a5d4b5
commit 7801cde7f0
11 changed files with 41 additions and 131 deletions

View File

@ -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];
}
}
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 );
}
}

View File

@ -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,

View File

@ -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
}
}
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
}
}
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
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 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 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 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];
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->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];
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_BYTE(1);
MESSAGE_END();
}
@ -274,15 +240,9 @@ 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;
}
}
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]){

View File

@ -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;

View File

@ -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 );

View File

@ -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

View File

@ -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
// *****************************************************

View File

@ -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);

View File

@ -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];

View File

@ -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)
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() {

View File

@ -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);
}