Massive reorganization attempt - part 1.77

This commit is contained in:
Scott Ehlert
2007-03-13 19:22:44 +00:00
parent bf2c9620f3
commit b66fea0fbc
79 changed files with 344 additions and 19 deletions

539
dlls/dod/dodx/CMisc.cpp Executable file
View File

@ -0,0 +1,539 @@
/*
* DoDx
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "amxxmodule.h"
#include "CMisc.h"
#include "dodx.h"
// *****************************************************
// class CPlayer
// *****************************************************
void CPlayer::Disconnect()
{
ingame = false;
bot = false;
savedScore = 0;
olddeadflag = 0;
oldteam = 0;
oldclass = 0;
oldprone = 0;
oldstamina = 0.0f;
// Model Stuff
sModel.is_model_set = false;
sModel.body_num = 0;
// Object stuff
object.pEdict = NULL;
object.type = 0;
object.carrying = false;
object.do_forward = false;
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
return;
rank->updatePosition( &life );
}
void CPlayer::PutInServer(){
ingame = true;
if ( ignoreBots(pEdict) )
return;
restartStats();
const char* unique;
const char* name = STRING(pEdict->v.netname);
switch((int)dodstats_rank->value) {
case 1:
if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 )
unique = name; // failed to get authid
break;
case 2:
unique = ip;
break;
default:
unique = name;
}
if ( ( rank = g_rank.findEntryInRank( unique , name ) ) == 0 )
ingame = false;
}
void CPlayer::Connect(const char* nn,const char* ippp ){
bot = IsBot();
strcpy(ip,ippp);
}
void CPlayer::restartStats(bool all)
{
if ( all )
{
memset(weapons,0,sizeof(weapons));
memset(&round,0,sizeof(round));
memset(weaponsRnd,0,sizeof(weaponsRnd));
}
memset(weaponsLife,0,sizeof(weaponsLife)); //DEC-Weapon (Round) stats
memset(attackers,0,sizeof(attackers));
memset(victims,0,sizeof(victims));
memset(&life,0,sizeof(life));
}
void CPlayer::Init( int pi, edict_t* pe )
{
aiming = 0;
wpnModel = 0;
wpnscount = 0;
lastScore = 0;
sendScore = 0;
clearRound = 0.0f;
pEdict = pe;
index = pi;
current = 0;
clearStats = 0.0f;
ingame = false;
bot = false;
savedScore = 0;
olddeadflag = 0;
oldteam = 0;
oldclass = 0;
oldprone = 0;
oldstamina = 0.0f;
do_scoped = false;
is_scoped = false;
// Model Stuff
sModel.is_model_set = false;
sModel.body_num = 0;
// Object stuff
object.pEdict = NULL;
object.type = 0;
object.carrying = false;
object.do_forward = false;
}
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
if ( ignoreBots(pEdict,pVictim->pEdict) )
return;
if ( pVictim->index == index )
{ // killed self
pVictim->weapons[0].deaths++;
pVictim->life.deaths++;
pVictim->round.deaths++;
pVictim->weaponsLife[0].deaths++; // DEC-Weapon (life) stats
pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats
return;
}
int vw = get_weaponid(pVictim);
pVictim->attackers[index].name = (char*)weaponData[wweapon].name;
pVictim->attackers[index].kills++;
pVictim->attackers[index].hs += hhs;
pVictim->attackers[index].tks += ttk;
pVictim->attackers[0].kills++;
pVictim->attackers[0].hs += hhs;
pVictim->attackers[0].tks += ttk;
pVictim->weapons[vw].deaths++;
pVictim->weapons[0].deaths++;
pVictim->life.deaths++;
pVictim->round.deaths++;
pVictim->weaponsLife[vw].deaths++; // DEC-Weapon (life) stats
pVictim->weaponsLife[0].deaths++; // DEC-Weapon (life) stats
pVictim->weaponsRnd[vw].deaths++; // DEC-Weapon (round) stats
pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats
int vi = pVictim->index;
victims[vi].name = (char*)weaponData[wweapon].name;
victims[vi].deaths++;
victims[vi].hs += hhs;
victims[vi].tks += ttk;
victims[0].deaths++;
victims[0].hs += hhs;
victims[0].tks += ttk;
weaponsLife[wweapon].kills++; // DEC-Weapon (life) stats
weaponsLife[wweapon].hs += hhs; // DEC-Weapon (life) stats
weaponsLife[wweapon].tks += ttk; // DEC-Weapon (life) stats
weaponsLife[0].kills++; // DEC-Weapon (life) stats
weaponsLife[0].hs += hhs; // DEC-Weapon (life) stats
weaponsLife[0].tks += ttk; // DEC-Weapon (life) stats
weaponsRnd[wweapon].kills++; // DEC-Weapon (round) stats
weaponsRnd[wweapon].hs += hhs; // DEC-Weapon (round) stats
weaponsRnd[wweapon].tks += ttk; // DEC-Weapon (round) stats
weaponsRnd[0].kills++; // DEC-Weapon (round) stats
weaponsRnd[0].hs += hhs; // DEC-Weapon (round) stats
weaponsRnd[0].tks += ttk; // DEC-Weapon (round) stats
weapons[wweapon].kills++;
weapons[wweapon].hs += hhs;
weapons[wweapon].tks += ttk;
weapons[0].kills++;
weapons[0].hs += hhs;
weapons[0].tks += ttk;
life.kills++;
life.hs += hhs;
life.tks += ttk;
round.kills++;
round.hs += hhs;
round.tks += ttk;
}
void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){
if ( ignoreBots(pEdict,pVictim->pEdict) )
return;
pVictim->attackers[index].hits++;
pVictim->attackers[index].damage += ddamage;
pVictim->attackers[index].bodyHits[bbody]++;
pVictim->attackers[0].hits++;
pVictim->attackers[0].damage += ddamage;
pVictim->attackers[0].bodyHits[bbody]++;
int vi = pVictim->index;
victims[vi].hits++;
victims[vi].damage += ddamage;
victims[vi].bodyHits[bbody]++;
victims[0].hits++;
victims[0].damage += ddamage;
victims[0].bodyHits[bbody]++;
weaponsLife[wweapon].hits++; // DEC-Weapon (life) stats
weaponsLife[wweapon].damage += ddamage; // DEC-Weapon (life) stats
weaponsLife[wweapon].bodyHits[bbody]++; // DEC-Weapon (life) stats
weaponsLife[0].hits++; // DEC-Weapon (life) stats
weaponsLife[0].damage += ddamage; // DEC-Weapon (life) stats
weaponsLife[0].bodyHits[bbody]++; // DEC-Weapon (life) stats
weaponsRnd[wweapon].hits++; // DEC-Weapon (round) stats
weaponsRnd[wweapon].damage += ddamage; // DEC-Weapon (round) stats
weaponsRnd[wweapon].bodyHits[bbody]++; // DEC-Weapon (round) stats
weaponsRnd[0].hits++; // DEC-Weapon (round) stats
weaponsRnd[0].damage += ddamage; // DEC-Weapon (round) stats
weaponsRnd[0].bodyHits[bbody]++; // DEC-Weapon (round) stats
weapons[wweapon].hits++;
weapons[wweapon].damage += ddamage;
weapons[wweapon].bodyHits[bbody]++;
weapons[0].hits++;
weapons[0].damage += ddamage;
weapons[0].bodyHits[bbody]++;
life.hits++;
life.damage += ddamage;
life.bodyHits[bbody]++;
round.hits++;
round.damage += ddamage;
round.bodyHits[bbody]++;
}
void CPlayer::saveShot(int weapon)
{
if ( ignoreBots(pEdict) )
return;
victims[0].shots++;
weapons[weapon].shots++;
weapons[0].shots++;
life.shots++;
round.shots++;
weaponsLife[weapon].shots++; // DEC-Weapon (life) stats
weaponsLife[0].shots++; // DEC-Weapon (life) stats
weaponsRnd[weapon].shots++; // DEC-Weapon (round) stats
weaponsRnd[0].shots++; // DEC-Weapon (round) stats
}
void CPlayer::updateScore(int weapon, int score)
{
if ( ignoreBots(pEdict) )
return;
life.points += score;
round.points += score;
weaponsLife[weapon].points += score;
weaponsLife[0].points += score;
weaponsRnd[weapon].points += score;
weaponsRnd[0].points += score;
weapons[weapon].points += score;
weapons[0].points += score;
}
void CPlayer::killPlayer()
{
pEdict->v.dmg_inflictor = NULL;
pEdict->v.health = 0;
pEdict->v.deadflag = DEAD_RESPAWNABLE;
pEdict->v.weaponmodel = 0;
pEdict->v.weapons = 0;
}
void CPlayer::initModel(char* model)
{
strcpy(sModel.modelclass, (const char*)model);
sModel.is_model_set = true;
}
void CPlayer::clearModel()
{
sModel.is_model_set = false;
}
bool CPlayer::setModel()
{
if(!ingame || ignoreBots(pEdict))
return false;
if(sModel.is_model_set)
{
ENTITY_SET_KEYVALUE(pEdict, "model", sModel.modelclass);
pEdict->v.body = sModel.body_num;
return true;
}
return false;
}
void CPlayer::setBody(int bn)
{
if(!ingame || ignoreBots(pEdict))
return;
sModel.body_num = bn;
return;
}
/*
iuser3 = 0 standing up
iuser3 = 1 going prone or mg tearing down
iuser3 = 2 setting up mg
*/
void CPlayer::PreThink()
{
if(!ingame || ignoreBots(pEdict))
return;
if(olddeadflag != 0 && pEdict->v.deadflag == 0 && iFSpawnForward != -1)
MF_ExecuteForward(iFSpawnForward, index);
if(oldteam != pEdict->v.team && iFTeamForward != -1)
MF_ExecuteForward(iFTeamForward, index, pEdict->v.team, oldteam);
if(oldclass != pEdict->v.playerclass && iFClassForward != -1)
MF_ExecuteForward(iFClassForward, index, pEdict->v.playerclass, oldclass);
if(oldprone != pEdict->v.iuser3 && oldprone != 2 && pEdict->v.iuser3 != 2 && iFProneForward != -1)
MF_ExecuteForward(iFProneForward, index, pEdict->v.iuser3);
if(oldstamina > pEdict->v.fuser4 && iFStaminaForward != -1)
MF_ExecuteForward(iFStaminaForward, index, ((int)pEdict->v.fuser4));
if(wpns_bitfield != pEdict->v.weapons)
WeaponsCheck(pEdict->v.weapons & ~(1<<31));
// Set the old variables for
oldprone = pEdict->v.iuser3;
olddeadflag = pEdict->v.deadflag;
oldteam = pEdict->v.team;
oldclass = pEdict->v.playerclass;
oldstamina = pEdict->v.fuser4;
wpns_bitfield = pEdict->v.weapons & ~(1<<31);
}
void CPlayer::Scoping(int value)
{
// Everyone gets a 0 then another call for 90, so I need to figure out
// what weapon they have before I can then check if they are scoped or not
do_scoped = false;
switch(value)
{
// This is when the scope is dropped from the eye
case 0:
// Is this an initial call
if(mPlayer->current == 0)
return;
// SKar Spring SFG42 SEnfield
if((mPlayer->current == 6 || mPlayer->current == 9 || mPlayer->current == 32 || mPlayer->current == 35) && is_scoped)
{
is_scoped = false;
do_scoped = true;
}
break;
// This is when the scope is put up to the eye
case 20:
// SKar Spring SFG42 SEnfield
if((mPlayer->current == 6 || mPlayer->current == 9 || mPlayer->current == 32 || mPlayer->current == 35) && !is_scoped)
{
is_scoped = true;
do_scoped = true;
}
break;
// This means the scope has been initialized
case 90:
is_scoped = false;
return;
};
}
void CPlayer::ScopingCheck()
{
if(do_scoped)
MF_ExecuteForward(iFScopeForward, index, (int)is_scoped);
}
void CPlayer::WeaponsCheck(int weapons)
{
if(wpns_bitfield == 0)
return;
else if(pEdict->v.weapons == 0)
return;
int old;
int cur;
for(int i = 1; i < MAX_WEAPONS; ++i)
{
// Check to see we are not talking about a grenade and we have changed
if(i != 13 && i != 14 && i != 15 && i != 16 && i != 36)
{
old = wpns_bitfield&(1<<i);
cur = weapons&(1<<i);
if(old != cur)
MF_ExecuteForward(iFWpnPickupForward, index, i, ((weapons&(1<<i)) ? 1 : 0));
}
}
}
// *****************************************************
// class Grenades
// *****************************************************
void Grenades::put(edict_t* grenade, float time, int type, CPlayer* player )
{
Obj* a = new Obj;
a->player = player;
a->grenade = grenade;
a->time = gpGlobals->time + time;
a->type = type;
a->next = head;
head = a;
}
bool Grenades::find( edict_t* enemy, CPlayer** p, int& type )
{
bool found = false;
float lastTime = 0.0;
Obj** a = &head;
while(*a)
{
if((*a)->time > gpGlobals->time)
{
if((*a)->grenade == enemy)
{
found = true;
// we need this because of catched grenades
if((*a)->time > lastTime)
{
(*p) = (*a)->player; // two people can have the same nade in our list
type = (*a)->type;
lastTime = (*a)->time;
}
}
}
else
{
Obj* next = (*a)->next;
delete *a;
*a = next;
continue;
}
a = &(*a)->next;
}
return found;
}
void Grenades::clear()
{
while(head)
{
Obj* a = head->next;
delete head;
head = a;
}
}
// *****************************************************
// class CMapInfo
// *****************************************************
void CMapInfo::Init()
{
pEdict = 0;
initialized = false;
/* default values from dod.fgd */
detect_axis_paras = 0;
detect_allies_paras = 0;
detect_allies_country = 0;
}

214
dlls/dod/dodx/CMisc.h Executable file
View File

@ -0,0 +1,214 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef CMISC_H
#define CMISC_H
#include "CRank.h"
#define DODMAX_CUSTOMWPNS 5 // custom weapons
#define DODMAX_WEAPONS 42 + DODMAX_CUSTOMWPNS
#ifndef __linux__
#define LINUXOFFSET 0
#else
#define LINUXOFFSET 5
#endif
#define DOD_VERSION "0.1"
#define MAX_TRACE 6
struct traceVault
{
char szName[16];
int iId;
int iAction;
float fDel;
};
#define ACT_NADE_NONE (0)
#define ACT_NADE_SHOT (1<<0)
#define ACT_NADE_PUT (1<<1)
#define ACT_NADE_THROW (1<<2)
#define ACT_ROCKET_NONE (0)
#define ACT_ROCKET_SHOT (1<<0)
#define ACT_ROCKET_PUT (1<<3)
// *****************************************************
// class CPlayer
// *****************************************************
class CPlayer
{
private:
char ip[32];
public:
edict_t* pEdict;
int index;
int aiming;
int current;
int old;
int wpnModel;
int wpnscount;
int wpns_bitfield;
int old_weapons[DODMAX_WEAPONS];
float savedScore;
int lastScore;
int sendScore;
bool ingame;
bool bot;
float clearStats;
float clearRound;
int oldteam;
int olddeadflag;
int oldclass;
float oldstamina;
struct ModelStruct
{
int body_num;
bool is_model_set;
char* modelclass;
}
sModel;
int oldprone;
bool do_scoped;
bool is_scoped;
struct ObjectStruct
{
edict_t* pEdict;
bool carrying;
bool do_forward;
int type;
}
object;
struct PlayerWeapon : public Stats
{
char* name;
int ammo;
int clip;
};
PlayerWeapon weapons[DODMAX_WEAPONS];
PlayerWeapon attackers[33];
PlayerWeapon victims[33];
Stats weaponsLife[DODMAX_WEAPONS]; // DEC-Weapon (Life) stats
Stats weaponsRnd[DODMAX_WEAPONS]; // DEC-Weapon (Round) stats
Stats life;
Stats round;
RankSystem::RankStats* rank;
void Init( int pi, edict_t* pe );
void Connect(const char* name,const char* ip );
void PutInServer();
void Disconnect();
void saveKill(CPlayer* pVictim, int weapon, int hs, int tk);
void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming);
void saveShot(int weapon);
void updateScore(int weapon, int score);
void restartStats(bool all = true);
void killPlayer();
void initModel(char*);
void clearModel();
bool setModel();
void setBody(int);
void PreThink();
void Scoping(int);
void ScopingCheck();
void WeaponsCheck(int);
inline bool IsBot()
{
const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
return ( auth && !strcmp( auth , "BOT" ) );
}
inline bool IsAlive()
{
return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0));
}
};
// *****************************************************
// class Grenades
// *****************************************************
class Grenades // : public CObject
{
struct Obj
{
CPlayer* player;
edict_t* grenade;
float time;
int type;
Obj* next;
} *head;
public:
Grenades() { head = 0; }
~Grenades() { clear(); }
void put(edict_t* grenade, float time, int type, CPlayer* player);
bool find(edict_t* enemy, CPlayer** p, int& type);
void clear();
};
// *****************************************************
// class CMapInfo
// *****************************************************
class CMapInfo
{
public:
edict_t* pEdict;
bool initialized;
int detect_axis_paras;
int detect_allies_paras;
int detect_allies_country;
void Init();
};
#endif // CMISC_H

333
dlls/dod/dodx/CRank.cpp Executable file
View File

@ -0,0 +1,333 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "amxxmodule.h"
#include "CRank.h"
#include "dodx.h"
// *****************************************************
// class Stats
// *****************************************************
Stats::Stats(){
hits = shots = damage = hs = tks = points = kills = deaths = 0;
memset( bodyHits , 0 ,sizeof( bodyHits ) );
}
void Stats::commit(Stats* a){
hits += a->hits;
shots += a->shots;
damage += a->damage;
hs += a->hs;
tks += a->tks;
points += a->points;
kills += a->kills;
deaths += a->deaths;
for(int i = 1; i < 8; ++i)
bodyHits[i] += a->bodyHits[i];
}
// *****************************************************
// class RankSystem
// *****************************************************
RankSystem::RankStats::RankStats( const char* uu, const char* nn, RankSystem* pp ) {
name = 0;
namelen = 0;
unique = 0;
uniquelen = 0;
score = 0;
parent = pp;
id = ++parent->rankNum;
next = prev = 0;
setName( nn );
setUnique( uu );
}
RankSystem::RankStats::~RankStats() {
delete[] name;
delete[] unique;
--parent->rankNum;
}
void RankSystem::RankStats::setName( const char* nn ) {
delete[] name;
namelen = strlen(nn) + 1;
name = new char[namelen];
if ( name )
strcpy( name , nn );
else
namelen = 0;
}
void RankSystem::RankStats::setUnique( const char* nn ) {
delete[] unique;
uniquelen = strlen(nn) + 1;
unique = new char[uniquelen];
if ( unique )
strcpy( unique , nn );
else
uniquelen = 0;
}
RankSystem::RankSystem() {
head = 0;
tail = 0;
rankNum = 0;
calc.code = 0;
}
RankSystem::~RankSystem() {
clear();
}
void RankSystem::put_before( RankStats* a, RankStats* ptr ){
a->next = ptr;
if ( ptr ){
a->prev = ptr->prev;
ptr->prev = a;
}
else{
a->prev = head;
head = a;
}
if ( a->prev ) a->prev->next = a;
else tail = a;
}
void RankSystem::put_after( RankStats* a, RankStats* ptr ) {
a->prev = ptr;
if ( ptr ){
a->next = ptr->next;
ptr->next = a;
}
else{
a->next = tail;
tail = a;
}
if ( a->next ) a->next->prev = a;
else head = a;
}
void RankSystem::unlink( RankStats* ptr ){
if (ptr->prev) ptr->prev->next = ptr->next;
else tail = ptr->next;
if (ptr->next) ptr->next->prev = ptr->prev;
else head = ptr->prev;
}
void RankSystem::clear(){
while( tail ){
head = tail->next;
delete tail;
tail = head;
}
}
bool RankSystem::loadCalc(const char* filename, char* error)
{
if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
LOG_CONSOLE( PLID, "Couldn't load plugin (file \"%s\")",filename);
MF_UnloadAmxScript(&calc.amx, &calc.code);
return false;
}
return true;
}
void RankSystem::unloadCalc()
{
MF_UnloadAmxScript(&calc.amx , &calc.code);
}
RankSystem::RankStats* RankSystem::findEntryInRank(const char* unique, const char* name )
{
RankStats* a = head;
while ( a )
{
if ( strcmp( a->getUnique() ,unique ) == 0 )
return a;
a = a->prev;
}
a = new RankStats( unique ,name,this );
if ( a == 0 ) return 0;
put_after( a , 0 );
return a;
}
void RankSystem::updatePos( RankStats* rr , Stats* s )
{
rr->addStats( s );
if ( calc.code ) {
calc.physAddr1[0] = rr->kills;
calc.physAddr1[1] = rr->deaths;
calc.physAddr1[2] = rr->hs;
calc.physAddr1[3] = rr->tks;
calc.physAddr1[4] = rr->shots;
calc.physAddr1[5] = rr->hits;
calc.physAddr1[6] = rr->damage;
calc.physAddr1[7] = rr->points;
for(int i = 1; i < 8; ++i)
calc.physAddr2[i] = rr->bodyHits[i];
cell result = 0;
int err;
MF_AmxPush(&calc.amx, calc.amxAddr2);
MF_AmxPush(&calc.amx, calc.amxAddr1);
if ((err = MF_AmxExec(&calc.amx,&result, calc.func)) != AMX_ERR_NONE)
MF_LogError(&calc.amx, err, "Fatal error calculating stats");
rr->score = result;
}
else rr->score = rr->kills - rr->deaths;
RankStats* aa = rr->next;
while ( aa && (aa->score <= rr->score) ) { // try to nominate
rr->goUp();
aa->goDown();
aa = aa->next; // go to next rank
}
if ( aa != rr->next )
{
unlink( rr );
put_before( rr, aa );
}
else
{
aa = rr->prev;
while ( aa && (aa->score > rr->score) ) { // go down
rr->goDown();
aa->goUp();
aa = aa->prev; // go to prev rank
}
if ( aa != rr->prev ){
unlink( rr );
put_after( rr, aa );
}
}
}
/**
* Who put these backwards...
*/
#define TRYREAD(t_var, t_num, t_size, t_file) \
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
break; \
}
void RankSystem::loadRank(const char* filename)
{
FILE *bfp = fopen(filename , "rb");
if (!bfp)
{
MF_Log("Could not load stats file: %s", filename);
return;
}
short int i = 0;
if (fread(&i, sizeof(short int), 1, bfp) != 1)
{
fclose(bfp);
return;
}
if (i == RANK_VERSION)
{
Stats d;
char unique[64], name[64];
if (fread(&i, sizeof(short int), 1, bfp) != 1)
{
fclose(bfp);
return;
}
while(i && !feof(bfp))
{
TRYREAD(name, i, sizeof(char), bfp);
TRYREAD(&i, 1, sizeof(short int), bfp);
TRYREAD(unique, i, sizeof(char) , bfp);
TRYREAD(&d.tks, 1, sizeof(int), bfp);
TRYREAD(&d.damage, 1, sizeof(int), bfp);
TRYREAD(&d.deaths, 1, sizeof(int), bfp);
TRYREAD(&d.kills, 1, sizeof(int), bfp);
TRYREAD(&d.shots, 1, sizeof(int), bfp);
TRYREAD(&d.hits, 1, sizeof(int), bfp);
TRYREAD(&d.hs, 1, sizeof(int), bfp);
TRYREAD(&d.points, 1, sizeof(int), bfp);
TRYREAD(d.bodyHits, 1, sizeof(d.bodyHits), bfp);
TRYREAD(&i, 1, sizeof(short int), bfp);
RankSystem::RankStats* a = findEntryInRank( unique , name );
if ( a ) a->updatePosition( &d );
}
}
fclose(bfp);
}
void RankSystem::saveRank( const char* filename )
{
FILE *bfp = fopen(filename, "wb");
if ( !bfp ) return;
short int i = RANK_VERSION;
fwrite(&i, 1, sizeof(short int) , bfp);
RankSystem::iterator a = front();
while ( a )
{
if ( (*a).score != (1<<31) ) // score must be different than mincell
{
fwrite( &(*a).namelen , 1, sizeof(short int), bfp);
fwrite( (*a).name , (*a).namelen , sizeof(char) , bfp);
fwrite( &(*a).uniquelen , 1, sizeof(short int), bfp);
fwrite( (*a).unique , (*a).uniquelen , sizeof(char) , bfp);
fwrite( &(*a).tks, 1, sizeof(int), bfp);
fwrite( &(*a).damage, 1, sizeof(int), bfp);
fwrite( &(*a).deaths, 1, sizeof(int), bfp);
fwrite( &(*a).kills, 1, sizeof(int), bfp);
fwrite( &(*a).shots, 1, sizeof(int), bfp);
fwrite( &(*a).hits, 1, sizeof(int), bfp);
fwrite( &(*a).hs, 1, sizeof(int), bfp);
fwrite( &(*a).points, 1,sizeof(int), bfp);
fwrite( (*a).bodyHits, 1, sizeof((*a).bodyHits), bfp);
}
--a;
}
i = 0;
fwrite( &i , 1, sizeof(short int), bfp); // null terminator
fclose(bfp);
}

145
dlls/dod/dodx/CRank.h Executable file
View File

@ -0,0 +1,145 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef CRANK_H
#define CRANK_H
#define RANK_VERSION 5
#include "amxxmodule.h"
// *****************************************************
// class Stats
// *****************************************************
struct Stats {
int hits;
int shots;
int damage;
int hs;
int tks;
int points; // DoD score
int kills;
int deaths;
int bodyHits[8];
Stats();
void commit(Stats* a);
};
// *****************************************************
// class RankSystem
// *****************************************************
class RankSystem
{
public:
class RankStats;
friend class RankStats;
class iterator;
class RankStats : public Stats {
friend class RankSystem;
friend class iterator;
RankSystem* parent;
RankStats* next;
RankStats* prev;
char* unique;
short int uniquelen;
char* name;
short int namelen;
int score;
int id;
RankStats( const char* uu, const char* nn, RankSystem* pp );
~RankStats();
void setUnique( const char* nn );
inline void goDown() {++id;}
inline void goUp() {--id;}
inline void addStats(Stats* a) { commit( a ); }
public:
void setName( const char* nn );
inline const char* getName() const { return name ? name : ""; }
inline const char* getUnique() const { return unique ? unique : ""; }
inline int getPosition() const { return id; }
inline void updatePosition( Stats* points ) {
parent->updatePos( this , points );
}
};
private:
RankStats* head;
RankStats* tail;
int rankNum;
struct scoreCalc{
AMX amx;
void* code;
int func;
cell amxAddr1;
cell amxAddr2;
cell *physAddr1;
cell *physAddr2;
} calc;
void put_before( RankStats* a, RankStats* ptr );
void put_after( RankStats* a, RankStats* ptr );
void unlink( RankStats* ptr );
void updatePos( RankStats* r , Stats* s );
public:
RankSystem();
~RankSystem();
void saveRank( const char* filename );
void loadRank( const char* filename );
RankStats* findEntryInRank(const char* unique, const char* name );
bool loadCalc(const char* filename, char* error);
inline int getRankNum( ) const { return rankNum; }
void clear();
void unloadCalc();
class iterator {
RankStats* ptr;
public:
iterator(RankStats* a): ptr(a){}
inline iterator& operator--() { ptr = ptr->prev; return *this;}
inline iterator& operator++() { ptr = ptr->next; return *this; }
inline RankStats& operator*() { return *ptr;}
operator bool () { return (ptr != 0); }
};
inline iterator front() { return iterator(head); }
inline iterator begin() { return iterator(tail); }
};
#endif

67
dlls/dod/dodx/Makefile Executable file
View File

@ -0,0 +1,67 @@
#(C)2004-2005 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson
HLSDK = ../../../../hlsdk
MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
DEBUG_FLAGS = -g -ggdb3
CPP = gcc-4.1
NAME = dodx
BIN_SUFFIX = amxx_i386.so
OBJECTS = sdk/amxxmodule.cpp CRank.cpp CMisc.cpp NBase.cpp NRank.cpp usermsg.cpp Utils.cpp moduleconfig.cpp
LINK =
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
-I$(MM_ROOT) -I$(HLSDK)/common -Isdk
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
ifeq "$(GCC_VERSION)" "4"
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif
ifeq "$(DEBUG)" "true"
BIN_DIR = Debug
CFLAGS = $(DEBUG_FLAGS)
else
BIN_DIR = Release
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
BINARY = $(NAME)_$(BIN_SUFFIX)
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
OPT_FLAGS += -march=i586
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
$(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
all:
mkdir -p $(BIN_DIR)
mkdir -p $(BIN_DIR)/sdk
$(MAKE) dodx
dodx: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
debug:
$(MAKE) all DEBUG=true
default: all
clean:
rm -rf Release/sdk/*.o
rm -rf Release/*.o
rm -rf Release/$(NAME)_$(BIN_SUFFIX)
rm -rf Debug/sdk/*.o
rm -rf Debug/*.o
rm -rf Debug/$(NAME)_$(BIN_SUFFIX)

668
dlls/dod/dodx/NBase.cpp Executable file
View File

@ -0,0 +1,668 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "amxxmodule.h"
#include "dodx.h"
#define WEAPONLIST 71
/* Weapon names aren't send in WeaponList message in DoD */
weaponlist_s weaponlist[] =
{
{ 0, 0, 0, false}, // 0,
{ -1, 0, -1, true }, // DODW_AMERKNIFE = 1,
{ -1, 0, -1, true }, // DODW_GERKNIFE,
{ 4, 64, 7, true }, // DODW_COLT,
{ 4, 64, 8, true }, // DODW_LUGER,
{ 3, 128, 8, true }, // DODW_GARAND,
{ 3, 128, 5, true }, // DODW_SCOPED_KAR,
{ 1, 128, 30, true }, // DODW_THOMPSON,
{ 6, 128, 30, true }, // DODW_STG44,
{ 5, 128, 5, true }, // DODW_SPRINGFIELD,
{ 3, 128, 5, true }, // DODW_KAR,
{ 6, 128, 20, true }, // DODW_BAR,
{ 1, 130, 30, true }, // DODW_MP40,
{ 9, 24, -1, true }, // DODW_HANDGRENADE,
{ 11, 24, -1, true }, // DODW_STICKGRENADE,
{ 12, 24, -1, true }, // DODW_STICKGRENADE_EX,
{ 10, 24, -1, true }, // DODW_HANDGRENADE_EX,
{ 7, 2178, 250, true }, // DODW_MG42,
{ 8, 130, 150, true }, // DODW_30_CAL,
{ -1, 0, -1, true }, // DODW_SPADE,
{ 2, 128, 15, true }, // DODW_M1_CARBINE,
{ 2, 130, 75, true }, // DODW_MG34,
{ 1, 128, 30, true }, // DODW_GREASEGUN,
{ 6, 128, 20, true }, // DODW_FG42,
{ 2, 128, 10, true }, // DODW_K43,
{ 3, 128, 10, true }, // DODW_ENFIELD,
{ 1, 128, 30, true }, // DODW_STEN,
{ 6, 128, 30, true }, // DODW_BREN,
{ 4, 64, 6, true }, // DODW_WEBLEY,
{ 13, 642, 1, true }, // DODW_BAZOOKA,
{ 13, 642, 1, true }, // DODW_PANZERSCHRECK,
{ 13, 642, 1, true }, // DODW_PIAT,
{ 3, 128, 20, true }, // DODW_SCOPED_FG42, UNSURE ABOUT THIS ONE
{ 2, 128, 15, true }, // DODW_FOLDING_CARBINE,
{ 0, 0, 0, false}, // DODW_KAR_BAYONET,
{ 3, 128, 10, true }, // DODW_SCOPED_ENFIELD, UNSURE ABOUT THIS ONE
{ 9, 24, -1, true }, // DODW_MILLS_BOMB,
{ -1, 0, -1, true }, // DODW_BRITKNIFE,
{ 38, 0, 0, false}, // DODW_GARAND_BUTT,
{ 39, 0, 0, false}, // DODW_ENFIELD_BAYONET,
{ 40, 0, 0, false}, // DODW_MORTAR,
{ 41, 0, 0, false}, // DODW_K43_BUTT,
};
// from id to name 3 params id, name, len
static cell AMX_NATIVE_CALL get_weapon_name(AMX *amx, cell *params)
{
int id = params[1];
if(id < 0 || id >= DODMAX_WEAPONS)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
return 0;
}
return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
}
// from log to name
static cell AMX_NATIVE_CALL wpnlog_to_name(AMX *amx, cell *params)
{
int iLen;
char *log = MF_GetAmxString(amx,params[1],0,&iLen);
for(int i = 0; i < DODMAX_WEAPONS; i++)
{
if(strcmp(log,weaponData[i].logname ) == 0)
return MF_SetAmxString(amx,params[2],weaponData[i].name,params[3]);
}
return 0;
}
// from log to id
static cell AMX_NATIVE_CALL wpnlog_to_id(AMX *amx, cell *params)
{
int iLen;
char *log = MF_GetAmxString(amx, params[1], 0, &iLen);
for(int i = 0; i < DODMAX_WEAPONS; i++)
{
if(strcmp(log,weaponData[i].logname) == 0)
return i;
}
return 0;
}
// from id to log
static cell AMX_NATIVE_CALL get_weapon_logname(AMX *amx, cell *params)
{
int id = params[1];
if (id<0 || id>=DODMAX_WEAPONS)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
return 0;
}
return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
}
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params)
{
int id = params[1];
if(id < 0 || id >= DODMAX_WEAPONS)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
return 0;
}
return weaponData[id].melee;
}
static cell AMX_NATIVE_CALL get_team_score(AMX *amx, cell *params)
{
int index = params[1];
switch ( index )
{
case 1:
return AlliesScore;
break;
case 2:
return AxisScore;
break;
}
return 0;
}
static cell AMX_NATIVE_CALL get_user_score(AMX *amx, cell *params)
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame)
return (cell)pPlayer->savedScore;
return -1;
}
static cell AMX_NATIVE_CALL get_user_class(AMX *amx, cell *params)
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame)
return pPlayer->pEdict->v.playerclass;
return 0;
}
static cell AMX_NATIVE_CALL user_kill(AMX *amx, cell *params)
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if(pPlayer->ingame && pPlayer->IsAlive())
{
pPlayer->killPlayer();
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL get_map_info(AMX *amx, cell *params)
{
switch(params[1])
{
case 0:
return g_map.detect_allies_country;
break;
case 1:
return g_map.detect_allies_paras;
break;
case 2:
return g_map.detect_axis_paras;
break;
default:
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid map info id %d", params[1]);
break;
}
return -1;
}
static cell AMX_NATIVE_CALL get_user_pronestate(AMX *amx, cell *params)
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame)
return pPlayer->pEdict->v.iuser3;
return 0;
}
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params)
{
int index = params[1];
CHECK_PLAYER(index);
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;
}
/* We want to get just the weapon of whichever type that the player is on him */
static cell AMX_NATIVE_CALL dod_weapon_type(AMX *amx, cell *params) /* 2 params */
{
int index = params[1];
int type = params[2];
CHECK_PLAYER(index);
if(type < DODWT_PRIMARY || type > DODWT_OTHER)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon type id %d", type);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if(pPlayer->ingame)
{
int weaponsbit = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element
for(int x = 1; x < MAX_WEAPONS; ++x)
{
if((weaponsbit&(1<<x)) > 0)
{
if(weaponData[x].type == type)
return x;
}
}
}
return 0;
}
// forward
static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
{
#ifdef FORWARD_OLD_SYSTEM
int iFunctionIndex;
int err;
switch( params[1] )
{
case 0:
if((err = MF_AmxFindPublic(amx, "client_damage", &iFunctionIndex)) == AMX_ERR_NONE)
g_damage_info.put( amx , iFunctionIndex );
else
MF_LogError(amx, err, "client_damage not found");
return 0;
break;
case 1:
if((err = MF_AmxFindPublic(amx, "client_death", &iFunctionIndex)) == AMX_ERR_NONE)
g_death_info.put( amx , iFunctionIndex );
else
MF_LogError(amx, err, "client_Death not found");
return 0;
break;
case 2:
if((err = MF_AmxFindPublic(amx, "client_score", &iFunctionIndex)) == AMX_ERR_NONE)
g_score_info.put( amx , iFunctionIndex );
else
MF_LogError(amx, err, "client_score not found");
return 0;
break;
default:
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid forward id %d", params[2]);
return 0;
}
#endif
return 1;
}
// name,logname,melee=0
static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params)
{
int i;
bool bFree = false;
for(i = DODMAX_WEAPONS - DODMAX_CUSTOMWPNS; i < DODMAX_WEAPONS; i++)
{
if(!weaponData[i].needcheck)
{
bFree = true;
break;
}
}
if(!bFree)
return 0;
int iLen;
char *szName = MF_GetAmxString(amx, params[1], 0, &iLen);
char *szLogName = MF_GetAmxString(amx, params[3], 0, &iLen);
strcpy(weaponData[i].name,szName);
strcpy(weaponData[i].logname,szLogName);
weaponData[i].needcheck = true;
weaponData[i].melee = params[2] ? true:false;
return i;
}
// wid,att,vic,dmg,hp=0
static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params)
{
int weapon = params[1];
// only for custom weapons
if(weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid custom weapon id %d", weapon);
return 0;
}
int att = params[2];
CHECK_PLAYER(params[2]);
int vic = params[3];
CHECK_PLAYER(params[3]);
int dmg = params[4];
if(dmg<1)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid damage %d", dmg);
return 0;
}
int aim = params[5];
if(aim < 0 || aim > 7)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid aim %d", aim);
return 0;
}
CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
pVic->pEdict->v.dmg_inflictor = NULL;
if(pAtt->index != pVic->index)
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;
}
// player,wid
static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params)
{
int index = params[2];
CHECK_PLAYER(index);
int weapon = params[1];
if(weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid custom weapon id %d", weapon);
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;
}
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;
}
// player,wid
static cell AMX_NATIVE_CALL dod_get_user_team(AMX *amx, cell *params)
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
return pPlayer->pEdict->v.team;
}
// player,wid
static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params)
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
int iTeam = pPlayer->pEdict->v.team;
if ( params[3] )
{
char *szTeam = "";
switch(iTeam)
{
case 1:
szTeam = "Allies";
break;
case 2:
szTeam = "Axis";
break;
}
MF_SetAmxString(amx,params[2],szTeam,params[3]);
}
return iTeam;
}
static cell AMX_NATIVE_CALL dod_set_model(AMX *amx, cell *params) // player,model
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if(!pPlayer->ingame)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
return 0;
}
int length;
pPlayer->initModel((char*)STRING(ALLOC_STRING(MF_GetAmxString(amx, params[2], 1, &length))));
return true;
}
static cell AMX_NATIVE_CALL dod_set_body(AMX *amx, cell *params) // player,bodynumber
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if(!pPlayer->ingame)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
return 0;
}
pPlayer->setBody(params[2]);
return true;
}
static cell AMX_NATIVE_CALL dod_clear_model(AMX *amx, cell *params) // player
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if(!pPlayer->ingame)
return false;
pPlayer->clearModel();
return true;
}
/*
0 [Byte] 1 // Weapons Groupings
1 [Byte] 210 // Total Rounds Allowed
2 [Byte] -1 // Undefined Not Used
3 [Byte] -1 // Undefined Not Used
4 [Byte] 2 // Weapon Slot
5 [Byte] 0 // Bucket ( Position Under Weapon Slot )
6 [Short] 7 // Weapon Number / Bit Field for the weapon
7 [Byte] 128 // Bit Field for the Ammo or Ammo Type
8 [Byte] 30 // Rounds Per Mag
id, wpnID, slot, position, totalrds
*/
static cell AMX_NATIVE_CALL dod_weaponlist(AMX *amx, cell *params) // player
{
if(!weaponlist[params[1]].changeable)
{
MF_LogError(amx, AMX_ERR_NATIVE, "This Weapon Cannot be Changed");
return 0;
}
int id = params[1];
int wpnID = params[2];
int slot = params[3];
int position = params[4];
int totalrds = params[5];
UTIL_LogPrintf("ID (%d) WpnID (%d) Slot (%d) Pos (%d) Rounds (%d)", id, wpnID, slot, position, totalrds);
CHECK_PLAYER(id);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(id);
if(!pPlayer->ingame)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
return 0;
}
MESSAGE_BEGIN(MSG_ONE, GET_USER_MSG_ID(PLID, "WeaponList", NULL), NULL, INDEXENT(id));
WRITE_BYTE(weaponlist[wpnID].grp);
WRITE_BYTE(totalrds);
WRITE_BYTE(-1);
WRITE_BYTE(-1);
WRITE_BYTE(slot - 1);
WRITE_BYTE(position);
WRITE_SHORT(wpnID);
WRITE_BYTE(weaponlist[wpnID].bitfield);
// Is it grenades
if(wpnID == 13 || wpnID == 14 || wpnID == 15 || wpnID == 16 || wpnID == 36)
WRITE_BYTE(-1);
else if(wpnID == 29 || wpnID == 30 || wpnID == 31)
WRITE_BYTE(1);
else
WRITE_BYTE(weaponlist[wpnID].clip);
MESSAGE_END();
return 1;
}
AMX_NATIVE_INFO base_Natives[] =
{
{ "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_weapon_type", dod_weapon_type },
{ "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_is_custom_wpn", is_custom },
{ "register_statsfwd",register_forward },
// Custom Weapon Support
{ "custom_weapon_add", register_cwpn }, // name,melee,logname
{ "custom_weapon_dmg", cwpn_dmg },
{ "custom_weapon_shot", cwpn_shot },
//****************************************
{ "get_user_team", get_user_team },
{ "get_weaponname", get_weapon_name },
{ "get_user_weapon", get_user_weapon },
{ "dod_get_user_team", dod_get_user_team },
{ "dod_get_wpnname", get_weapon_name },
{ "dod_get_wpnlogname", get_weapon_logname },
{ "dod_is_melee", is_melee },
{"dod_set_model", dod_set_model},
{"dod_set_body_number", dod_set_body},
{"dod_clear_model", dod_clear_model},
{"dod_set_weaponlist", dod_weaponlist},
///*******************
{ NULL, NULL }
};

303
dlls/dod/dodx/NRank.cpp Executable file
View File

@ -0,0 +1,303 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "amxxmodule.h"
#include "dodx.h"
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
{
int index = params[1];
CHECK_PLAYERRANGE(index);
int attacker = params[2];
CHECK_PLAYERRANGE(attacker);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->attackers[attacker].hits){
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
CPlayer::PlayerWeapon* stats = &pPlayer->attackers[attacker];
cpStats[0] = stats->kills;
cpStats[1] = stats->deaths;
cpStats[2] = stats->hs;
cpStats[3] = stats->tks;
cpStats[4] = stats->shots;
cpStats[5] = stats->hits;
cpStats[6] = stats->damage;
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = stats->bodyHits[i];
if (params[6] && attacker && stats->name)
MF_SetAmxString(amx,params[5],stats->name,params[6]);
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param */
{
int index = params[1];
CHECK_PLAYERRANGE(index);
int victim = params[2];
CHECK_PLAYERRANGE(victim);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->victims[victim].hits){
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
CPlayer::PlayerWeapon* stats = &pPlayer->victims[victim];
cpStats[0] = stats->kills;
cpStats[1] = stats->deaths;
cpStats[2] = stats->hs;
cpStats[3] = stats->tks;
cpStats[4] = stats->shots;
cpStats[5] = stats->hits;
cpStats[6] = stats->damage;
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = stats->bodyHits[i];
if (params[6] && victim && stats->name)
MF_SetAmxString(amx,params[5],stats->name,params[6]);
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL get_user_wlstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
{
int index = params[1];
CHECK_PLAYER(index);
int weapon = params[2];
if (weapon<0||weapon>=DODMAX_WEAPONS){
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->weaponsLife[weapon].shots){
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
Stats* stats = &pPlayer->weaponsLife[weapon];
cpStats[0] = stats->kills;
cpStats[1] = stats->deaths;
cpStats[2] = stats->hs;
cpStats[3] = stats->tks;
cpStats[4] = stats->shots;
cpStats[5] = stats->hits;
cpStats[6] = stats->damage;
cpStats[7] = stats->points;
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = stats->bodyHits[i];
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
{
int index = params[1];
CHECK_PLAYER(index)
int weapon = params[2];
if (weapon<0||weapon>=DODMAX_WEAPONS){
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->weaponsLife[weapon].shots){
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
Stats* stats = &pPlayer->weaponsRnd[weapon];
cpStats[0] = stats->kills;
cpStats[1] = stats->deaths;
cpStats[2] = stats->hs;
cpStats[3] = stats->tks;
cpStats[4] = stats->shots;
cpStats[5] = stats->hits;
cpStats[6] = stats->damage;
cpStats[7] = stats->points;
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = stats->bodyHits[i];
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
{
int index = params[1];
CHECK_PLAYER(index)
int weapon = params[2];
if (weapon<0||weapon>=DODMAX_WEAPONS){
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->weapons[weapon].shots){
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
CPlayer::PlayerWeapon* stats = &pPlayer->weapons[weapon];
cpStats[0] = stats->kills;
cpStats[1] = stats->deaths;
cpStats[2] = stats->hs;
cpStats[3] = stats->tks;
cpStats[4] = stats->shots;
cpStats[5] = stats->hits;
cpStats[6] = stats->damage;
cpStats[7] = stats->points;
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = stats->bodyHits[i];
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
pPlayer->restartStats();
return 1;
}
static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if ( pPlayer->ingame ){
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
cpStats[0] = pPlayer->rank->kills;
cpStats[1] = pPlayer->rank->deaths;
cpStats[2] = pPlayer->rank->hs;
cpStats[3] = pPlayer->rank->tks;
cpStats[4] = pPlayer->rank->shots;
cpStats[5] = pPlayer->rank->hits;
cpStats[6] = pPlayer->rank->damage;
cpStats[7] = pPlayer->rank->points;
cpStats[8] = pPlayer->rank->getPosition();
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = pPlayer->rank->bodyHits[i];
return pPlayer->rank->getPosition();
}
return 0;
}
static cell AMX_NATIVE_CALL get_user_lstats(AMX *amx, cell *params) /* 3 param */
{
int index = params[1];
CHECK_PLAYER(index);
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame){
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
cpStats[0] = pPlayer->life.kills;
cpStats[1] = pPlayer->life.deaths;
cpStats[2] = pPlayer->life.hs;
cpStats[3] = pPlayer->life.tks;
cpStats[4] = pPlayer->life.shots;
cpStats[5] = pPlayer->life.hits;
cpStats[6] = pPlayer->life.damage;
cpStats[7] = pPlayer->life.points;
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = pPlayer->life.bodyHits[i];
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */
{
int index = params[1];
CHECK_PLAYER(index)
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame){
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
cpStats[0] = pPlayer->round.kills;
cpStats[1] = pPlayer->round.deaths;
cpStats[2] = pPlayer->round.hs;
cpStats[3] = pPlayer->round.tks;
cpStats[4] = pPlayer->round.shots;
cpStats[5] = pPlayer->round.hits;
cpStats[6] = pPlayer->round.damage;
cpStats[7] = pPlayer->round.points;
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = pPlayer->round.bodyHits[i];
return 1;
}
return 0;
}
static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */
{
int index = params[1] + 1;
for(RankSystem::iterator a = g_rank.front(); a ; --a){
if ((*a).getPosition() == index) {
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
cpStats[0] = (*a).kills;
cpStats[1] = (*a).deaths;
cpStats[2] = (*a).hs;
cpStats[3] = (*a).tks;
cpStats[4] = (*a).shots;
cpStats[5] = (*a).hits;
cpStats[6] = (*a).damage;
cpStats[7] = (*a).points;
cpStats[8] = (*a).getPosition();
MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
for(int i = 1; i < 8; ++i)
cpBodyHits[i] = (*a).bodyHits[i];
return --a ? (*a).getPosition() : 0;
}
}
return 0;
}
static cell AMX_NATIVE_CALL get_statsnum(AMX *amx, cell *params)
{
return g_rank.getRankNum();
}
AMX_NATIVE_INFO stats_Natives[] = {
{ "get_stats", get_stats},
{ "get_statsnum", get_statsnum},
{ "get_user_astats", get_user_astats },
{ "get_user_rstats", get_user_rstats }, // round stats , cleared after RoundState = 1
{ "get_user_lstats", get_user_lstats }, // from spawn to spawn stats
{ "get_user_stats", get_user_stats },
{ "get_user_vstats", get_user_vstats },
{ "get_user_wlstats", get_user_wlstats}, // DEC-Weapon(Life) Stats
{ "get_user_wrstats", get_user_wrstats}, // DEC-Weapon(Round) Stats
{ "get_user_wstats", get_user_wstats},
{ "reset_user_wstats", reset_user_wstats },
{ NULL, NULL }
};

186
dlls/dod/dodx/Utils.cpp Executable file
View File

@ -0,0 +1,186 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "amxxmodule.h"
#include "dodx.h"
/* Weapon names aren't send in WeaponList message in DoD */
weapon_t weaponData[] =
{
{ false, false, {"mortar"}, {"mortar"}, 0, DODWT_OTHER },
{ true, true, {"amerknife"}, {"knife"}, 0, DODWT_MELEE }, // aknife->bknife
{ false, true, {"gerknife"}, {"knife"}, 0, DODWT_MELEE },
{ false, false, {"colt"}, {"Colt"}, 4, DODWT_SECONDARY },
{ false, false, {"luger"}, {"Luger"}, 4, DODWT_SECONDARY },
{ true, false, {"garand"}, {"Garand"}, 3, DODWT_PRIMARY }, // Garand->Garand butt
{ false, false, {"scopedkar"}, {"scoped K98"}, 3, DODWT_PRIMARY },
{ false, false, {"thompson"}, {"Thompson"}, 1, DODWT_PRIMARY },
{ false, false, {"mp44"}, {"STG44"}, 6, DODWT_PRIMARY },
{ false, false, {"spring"}, {"Springfield"}, 5, DODWT_PRIMARY },
{ true, false, {"kar"}, {"K98"}, 3, DODWT_PRIMARY }, // KAR->KAR bayonet
{ false, false, {"bar"}, {"BAR"}, 6, DODWT_PRIMARY },
{ false, false, {"mp40"}, {"MP40"}, 1, DODWT_PRIMARY },
{ false, false, {"grenade"}, {"handgrenade"}, 9, DODWT_GRENADE },
{ false, false, {"grenade2"}, {"stickgrenade"}, 11, DODWT_GRENADE },
{ false, false, {"stickgrenade_ex"},{"stickgrenade_ex"}, 11, DODWT_GRENADE },
{ false, false, {"handgrenade_ex"}, {"handgrenade_ex"}, 9, DODWT_GRENADE },
{ false, false, {"mg42"}, {"MG42"}, 7, DODWT_PRIMARY },
{ false, false, {"30cal"}, {".30 cal"}, 8, DODWT_PRIMARY },
{ false, true, {"spade"}, {"spade"}, 0, DODWT_MELEE },
{ true, false, {"m1carbine"}, {"M1 Carbine"}, 2, DODWT_PRIMARY }, // M1 Carbine->Folding Carbine
{ false, false, {"mg34"}, {"MG34"}, 2, DODWT_PRIMARY },
{ false, false, {"greasegun"}, {"Greasegun"}, 1, DODWT_PRIMARY },
{ true, false, {"fg42"}, {"FG42"}, 6, DODWT_PRIMARY }, // FG42 -> scoped FG42
{ true, false, {"k43"}, {"K43"}, 2, DODWT_PRIMARY },
{ true, false, {"enfield"}, {"Enfield"}, 3, DODWT_PRIMARY }, // Enfield->Scoped Enfield->Enfield bayonet
{ false, false, {"sten"}, {"Sten"}, 1, DODWT_PRIMARY },
{ false, false, {"bren"}, {"Bren"}, 6, DODWT_PRIMARY },
{ false, false, {"webley"}, {"Webley"}, 4, DODWT_PRIMARY },
{ false, false, {"bazooka"}, {"Bazooka"}, 13, DODWT_PRIMARY },
{ false, false, {"pschreck"}, {"Panzerschrek"}, 13, DODWT_PRIMARY },
{ false, false, {"piat"}, {"Piat"}, 13, DODWT_PRIMARY },
{ false, false, {"scoped_fg42"}, {"scoped FG42"}, 6, DODWT_PRIMARY },
{ false, false, {"fcarbine"}, {"Folding Carbine"}, 0, DODWT_PRIMARY },
{ false, true, {"bayonet"}, {"K98 bayonet"}, 0, DODWT_MELEE }, // KAR bayonet
{ false, false, {"scoped_enfield"}, {"scoped Enfield"}, 3, DODWT_PRIMARY },
{ false, false, {"mills_bomb"}, {"mills bomb"}, 9, DODWT_GRENADE },
{ false, true, {"brit_knife"}, {"knife"}, 0, DODWT_MELEE },
{ false, true, {"garandbutt"}, {"Garand butt"}, 0, DODWT_MELEE }, // Garand butt
{ false, true, {"enf_bayonet"}, {"Enfield bayonet"}, 0, DODWT_MELEE },
{ false, false, {"mortar"}, {"mortar"}, 0, DODWT_OTHER }, // mortar new id
{ false, true, {"k43butt"}, {"K43 butt"}, 0, DODWT_MELEE },
};
/* Function will select correct id */
int get_weaponid(CPlayer* pPlayer)
{
int weapon = pPlayer->current;
const char *sz;
switch(weapon)
{
case 1:
if(g_map.detect_allies_country) weapon = 37;
break;
case 5:
if(pPlayer->pEdict->v.button&IN_ATTACK2) weapon = 38;
break;
case 10:
if(pPlayer->pEdict->v.button&IN_ATTACK2) weapon = 34;
break;
case 20:
if(g_map.detect_allies_paras) weapon = 33;
break;
case 23:
sz = STRING(pPlayer->pEdict->v.weaponmodel);
if(sz[13] == 's')
weapon = 32;
break;
case 24:
if(pPlayer->pEdict->v.button&IN_ATTACK2) weapon = 41;
break;
case 25:
sz = STRING(pPlayer->pEdict->v.weaponmodel);
if(sz[16] == 's')
weapon = 35;
else if(pPlayer->pEdict->v.button&IN_ATTACK2)
weapon = 39;
break;
case 15:
weapon = 14;
break;
case 16:
if(g_map.detect_allies_country) weapon = 36;
else weapon = 13;
break;
}
return weapon;
}
traceVault traceData[] =
{
{ "grenade", 13, ACT_NADE_PUT|ACT_NADE_SHOT, 2.0 }, // or 36
{ "grenade2", 14, ACT_NADE_PUT|ACT_NADE_SHOT, 2.0 },
{ "shell_bazooka", 29, ACT_ROCKET_PUT|ACT_ROCKET_SHOT, 2.0 },
{ "shell_pschreck", 30, ACT_ROCKET_PUT|ACT_ROCKET_SHOT, 2.0 },
{ "shell_piat", 31, ACT_ROCKET_PUT|ACT_ROCKET_SHOT, 2.0 },
{ "monster_mortar", 40, ACT_NADE_PUT|ACT_NADE_SHOT, 2.0 },
};
bool ignoreBots (edict_t *pEnt, edict_t *pOther)
{
if(!rankBots && (pEnt->v.flags & FL_FAKECLIENT || (pOther && pOther->v.flags & FL_FAKECLIENT)))
return true;
return false;
}
bool isModuleActive()
{
if(!(int)CVAR_GET_FLOAT("dodstats_pause"))
return true;
return false;
}
edict_t *FindEntityByString(edict_t *pentStart, const char *szKeyword, const char *szValue)
{
edict_t *pentEntity;
pentEntity = FIND_ENTITY_BY_STRING(pentStart, szKeyword, szValue);
if(!FNullEnt(pentEntity))
return pentEntity;
return NULL;
}
edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName)
{
return FindEntityByString(pentStart, "classname", szName);
}
edict_t *FindEntityInSphere(edict_t *pentStart, edict_t *origin, float radius)
{
edict_t* temp = FIND_ENTITY_IN_SPHERE(pentStart, origin->v.origin, radius);
if(!temp)
return NULL;
return temp;
}

216
dlls/dod/dodx/dodx.h Executable file
View File

@ -0,0 +1,216 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef DODX_H
#define DODX_H
#include "amxxmodule.h"
#include "CMisc.h"
#include "CRank.h"
#define GET_PLAYER_POINTER(e) (&players[ENTINDEX(e)])
#define GET_PLAYER_POINTER_I(i) (&players[i])
#ifndef GETPLAYERAUTHID
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
#endif
extern AMX_NATIVE_INFO stats_Natives[];
extern AMX_NATIVE_INFO base_Natives[];
extern AMX_NATIVE_INFO pd_Natives[];
// Weapons grabbing by type
enum
{
DODWT_PRIMARY = 0,
DODWT_SECONDARY,
DODWT_MELEE,
DODWT_GRENADE,
DODWT_OTHER
};
// Model Sequences
enum
{
DOD_SEQ_PRONE_IDLE = 15,
DOD_SEQ_PRONE_FORWARD,
DOD_SEQ_PRONE_DOWN,
DOD_SEQ_PRONE_UP
};
// Weapons Structure
struct weapon_t
{
bool needcheck;
bool melee;
char logname[16];
char name[32];
int ammoSlot;
int type;
};
struct weaponlist_s
{
int grp;
int bitfield;
int clip;
bool changeable;
};
extern bool rankBots;
extern int mState;
extern int mDest;
extern int mCurWpnEnd;
extern int mPlayerIndex;
void Client_CurWeapon(void*);
void Client_CurWeapon_End(void*);
void Client_Health_End(void*);
void Client_ResetHUD_End(void*);
void Client_ObjScore(void*);
void Client_TeamScore(void*);
void Client_RoundState(void*);
void Client_AmmoX(void*);
void Client_AmmoShort(void*);
void Client_SetFOV(void*);
void Client_SetFOV_End(void*);
void Client_Object(void*);
void Client_Object_End(void*);
typedef void (*funEventCall)(void*);
extern int AlliesScore;
extern int AxisScore;
extern int gmsgCurWeapon;
extern int gmsgCurWeaponEnd;
extern int gmsgHealth;
extern int gmsgResetHUD;
extern int gmsgObjScore;
extern int gmsgRoundState;
extern int gmsgTeamScore;
extern int gmsgScoreShort;
extern int gmsgPTeam;
extern int gmsgAmmoX;
extern int gmsgAmmoShort;
extern int gmsgSetFOV;
extern int gmsgSetFOV_End;
extern int gmsgObject;
extern int gmsgObject_End;
extern int iFDamage;
extern int iFDeath;
extern int iFScore;
extern int iFSpawnForward;
extern int iFTeamForward;
extern int iFClassForward;
extern int iFScopeForward;
extern int iFProneForward;
extern int iFWpnPickupForward;
extern int iFCurWpnForward;
extern int iFGrenadeExplode;
extern int iFRocketExplode;
extern int iFObjectTouched;
extern int iFStaminaForward;
extern cvar_t* dodstats_maxsize;
extern cvar_t* dodstats_rank;
extern cvar_t* dodstats_reset;
extern cvar_t* dodstats_rankbots;
extern cvar_t* dodstats_pause;
extern weapon_t weaponData[DODMAX_WEAPONS];
extern traceVault traceData[MAX_TRACE];
extern Grenades g_grenades;
extern RankSystem g_rank;
extern CPlayer players[33];
extern CPlayer* mPlayer;
extern CMapInfo g_map;
int get_weaponid(CPlayer* player);
bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL );
bool isModuleActive();
edict_t *FindEntityByString(edict_t *pentStart, const char *szKeyword, const char *szValue);
edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
edict_t *FindEntityInSphere(edict_t *pentStart, edict_t *origin, float radius);
#define CHECK_ENTITY(x) \
if (x < 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \
} else { \
if (x <= gpGlobals->maxClients) { \
if (!MF_IsPlayerIngame(x)) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
return 0; \
} \
} else { \
if (x != 0 && FNullEnt(INDEXENT(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
} \
} \
}
#define CHECK_PLAYER(x) \
if (x < 1 || x > gpGlobals->maxClients) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
return 0; \
} else { \
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
return 0; \
} \
}
#define CHECK_PLAYERRANGE(x) \
if (x > gpGlobals->maxClients || x < 0) \
{ \
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
return 0; \
}
#define CHECK_NONPLAYER(x) \
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
return 0; \
} else { \
if (FNullEnt(INDEXENT(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
return 0; \
} \
}
#define GETEDICT(n) \
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
#endif // DODX_H

517
dlls/dod/dodx/moduleconfig.cpp Executable file
View File

@ -0,0 +1,517 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "amxxmodule.h"
#include "dodx.h"
funEventCall modMsgsEnd[MAX_REG_MSGS];
funEventCall modMsgs[MAX_REG_MSGS];
void (*function)(void*);
void (*endfunction)(void*);
CPlayer* mPlayer;
CPlayer players[33];
CMapInfo g_map;
bool rankBots;
int mState;
int mDest;
int mCurWpnEnd;
int mPlayerIndex;
int AlliesScore;
int AxisScore;
int iFDamage = -1;
int iFDeath = -1;
int iFScore = -1;
int iFSpawnForward = -1;
int iFTeamForward = -1;
int iFClassForward = -1;
int iFScopeForward = -1;
int iFProneForward = -1;
int iFWpnPickupForward = -1;
int iFCurWpnForward = -1;
int iFGrenadeExplode = -1;
int iFRocketExplode = -1;
int iFObjectTouched = -1;
int iFStaminaForward = -1;
int gmsgCurWeapon;
int gmsgCurWeaponEnd;
int gmsgHealth;
int gmsgResetHUD;
int gmsgObjScore;
int gmsgRoundState;
int gmsgTeamScore;
int gmsgScoreShort;
int gmsgPTeam;
int gmsgAmmoX;
int gmsgAmmoShort;
int gmsgSetFOV;
int gmsgSetFOV_End;
int gmsgObject;
int gmsgObject_End;
RankSystem g_rank;
Grenades g_grenades;
cvar_t init_dodstats_maxsize ={"dodstats_maxsize","3500", 0 , 3500.0 };
cvar_t init_dodstats_reset ={"dodstats_reset","0"};
cvar_t init_dodstats_rank ={"dodstats_rank","0"};
cvar_t init_dodstats_rankbots ={"dodstats_rankbots","1"};
cvar_t init_dodstats_pause = {"dodstats_pause","0"};
cvar_t *dodstats_maxsize;
cvar_t *dodstats_reset;
cvar_t *dodstats_rank;
cvar_t *dodstats_rankbots;
cvar_t *dodstats_pause;
// User Messages
struct sUserMsg
{
const char *name;
int* id;
funEventCall func;
bool endmsg;
}
g_user_msg[] =
{
{ "CurWeapon", &gmsgCurWeapon, Client_CurWeapon, false },
{ "CurWeapon", &gmsgCurWeaponEnd, Client_CurWeapon_End, true },
{ "ObjScore", &gmsgObjScore, Client_ObjScore, false },
{ "RoundState", &gmsgRoundState, Client_RoundState, false },
{ "Health", &gmsgHealth, Client_Health_End, true },
{ "ResetHUD", &gmsgResetHUD, Client_ResetHUD_End, true },
{ "TeamScore", &gmsgTeamScore, Client_TeamScore, false },
{ "AmmoX", &gmsgAmmoX, Client_AmmoX, false },
{ "AmmoShort", &gmsgAmmoShort, Client_AmmoShort, false },
{ "SetFOV", &gmsgSetFOV, Client_SetFOV, false },
{ "SetFOV", &gmsgSetFOV_End, Client_SetFOV_End, true },
{ "Object", &gmsgObject, Client_Object, false },
{ "Object", &gmsgObject_End, Client_Object_End, true },
{ "ScoreShort", &gmsgScoreShort, NULL, false },
{ "PTeam", &gmsgPTeam, NULL, false },
{ 0,0,0,false }
};
const char* get_localinfo( const char* name , const char* def = 0 )
{
const char* b = LOCALINFO( (char*)name );
if (((b==0)||(*b==0)) && def )
SET_LOCALINFO((char*)name,(char*)(b = def) );
return b;
}
int RegUserMsg_Post(const char *pszName, int iSize)
{
for (int i = 0; g_user_msg[i].name; ++i )
{
if(!*g_user_msg[i].id && strcmp(g_user_msg[i].name, pszName) == 0)
{
int id = META_RESULT_ORIG_RET(int);
*g_user_msg[i].id = id;
if(g_user_msg[i].endmsg)
modMsgsEnd[id] = g_user_msg[i].func;
else
modMsgs[id] = g_user_msg[i].func;
break;
}
}
RETURN_META_VALUE(MRES_IGNORED, 0);
}
void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
rankBots = (int)dodstats_rankbots->value ? true:false;
for( int i = 1; i <= gpGlobals->maxClients; ++i )
GET_PLAYER_POINTER_I(i)->Init( i , pEdictList + i );
RETURN_META(MRES_IGNORED);
}
void PlayerPreThink_Post(edict_t *pEntity)
{
if ( !isModuleActive() )
RETURN_META(MRES_IGNORED);
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
if (!pPlayer->ingame)
RETURN_META(MRES_IGNORED);
// Zors
pPlayer->PreThink();
if(pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time)
{
if(!ignoreBots(pEntity))
{
pPlayer->clearStats = 0.0f;
pPlayer->rank->updatePosition( &pPlayer->life );
pPlayer->restartStats(false);
}
}
if(pPlayer->clearRound && pPlayer->clearRound < gpGlobals->time)
{
pPlayer->clearRound = 0.0f;
memset(&pPlayer->round,0,sizeof(pPlayer->round));
memset(pPlayer->weaponsRnd,0,sizeof(pPlayer->weaponsRnd));
}
if (pPlayer->sendScore && pPlayer->sendScore < gpGlobals->time)
{
pPlayer->sendScore = 0;
MF_ExecuteForward(iFScore, pPlayer->index, pPlayer->lastScore, pPlayer->savedScore);
}
RETURN_META(MRES_IGNORED);
}
void ServerDeactivate()
{
int i;
for( i = 1;i<=gpGlobals->maxClients; ++i)
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame) pPlayer->Disconnect();
}
if ( (g_rank.getRankNum() >= (int)dodstats_maxsize->value) || ((int)dodstats_reset->value == 1) )
{
CVAR_SET_FLOAT("dodstats_reset",0.0);
g_rank.clear();
}
g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("dodstats") ) );
// clear custom weapons info
for ( i=DODMAX_WEAPONS-DODMAX_CUSTOMWPNS;i<DODMAX_WEAPONS;i++)
weaponData[i].needcheck = false;
g_map.Init();
RETURN_META(MRES_IGNORED);
}
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);
if ( pPlayer->ingame)
{
if ( strcmp(oldname,name) )
{
if (!dodstats_rank->value)
pPlayer->rank = g_rank.findEntryInRank( name, name );
else
pPlayer->rank->setName( name );
}
}
else if ( pPlayer->IsBot() )
{
pPlayer->Connect( name , "127.0.0.1" );
pPlayer->PutInServer();
}
RETURN_META(MRES_IGNORED);
}
void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
{
if(ed)
{
mPlayerIndex = ENTINDEX(ed);
mPlayer = GET_PLAYER_POINTER_I(mPlayerIndex);
}
else
{
mPlayerIndex = 0;
mPlayer = NULL;
}
mDest = msg_dest;
mState = 0;
if ( msg_type < 0 || msg_type >= MAX_REG_MSGS )
msg_type = 0;
function=modMsgs[msg_type];
endfunction=modMsgsEnd[msg_type];
RETURN_META(MRES_IGNORED);
}
void MessageEnd_Post(void) {
if (endfunction) (*endfunction)(NULL);
RETURN_META(MRES_IGNORED);
}
void WriteByte_Post(int iValue) {
if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED);
}
void WriteChar_Post(int iValue) {
if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED);
}
void WriteShort_Post(int iValue) {
if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED);
}
void WriteLong_Post(int iValue) {
if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED);
}
void WriteAngle_Post(float flValue) {
if (function) (*function)((void *)&flValue);
RETURN_META(MRES_IGNORED);
}
void WriteCoord_Post(float flValue) {
if (function) (*function)((void *)&flValue);
RETURN_META(MRES_IGNORED);
}
void WriteString_Post(const char *sz) {
if (function) (*function)((void *)sz);
RETURN_META(MRES_IGNORED);
}
void WriteEntity_Post(int iValue) {
if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED);
}
void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr)
{
if(ptr->pHit && (ptr->pHit->v.flags&(FL_CLIENT | FL_FAKECLIENT)) && e && (e->v.flags&(FL_CLIENT | FL_FAKECLIENT)))
{
GET_PLAYER_POINTER(e)->aiming = ptr->iHitgroup;
RETURN_META(MRES_IGNORED);
}
if(e && e->v.owner && e->v.owner->v.flags&(FL_CLIENT | FL_FAKECLIENT))
{
CPlayer *pPlayer = GET_PLAYER_POINTER(e->v.owner);
for(int i = 0;i < MAX_TRACE; i++)
{
if(strcmp(traceData[i].szName, STRING(e->v.classname)) == 0)
{
int grenId = (traceData[i].iId == 13 && g_map.detect_allies_country) ? 36 : traceData[i].iId;
int rocketId = traceData[i].iId;
if(traceData[i].iAction&ACT_NADE_SHOT)
{
if(traceData[i].iId == 13 && g_map.detect_allies_country)
pPlayer->saveShot(grenId);
else
pPlayer->saveShot(traceData[i].iId);
}
else if(traceData[i].iAction&ACT_ROCKET_SHOT)
pPlayer->saveShot(traceData[i].iId);
cell position[3];
position[0] = amx_ftoc(v2[0]);
position[1] = amx_ftoc(v2[1]);
position[2] = amx_ftoc(v2[2]);
cell pos = MF_PrepareCellArray(position, 3);
if(traceData[i].iAction&ACT_NADE_PUT)
{
g_grenades.put(e, traceData[i].fDel, grenId, GET_PLAYER_POINTER(e->v.owner));
MF_ExecuteForward(iFGrenadeExplode, GET_PLAYER_POINTER(e->v.owner)->index, pos, grenId);
}
if(traceData[i].iAction&ACT_ROCKET_PUT)
MF_ExecuteForward(iFRocketExplode, pPlayer->index, pos, rocketId);
break;
}
}
}
RETURN_META(MRES_IGNORED);
}
void DispatchKeyValue_Post( edict_t *pentKeyvalue, KeyValueData *pkvd )
{
if ( !pkvd->szClassName ){
// info_doddetect
if ( pkvd->szValue[0]=='i' && pkvd->szValue[5]=='d' ){
g_map.pEdict = pentKeyvalue;
g_map.initialized = true;
}
RETURN_META(MRES_IGNORED);
}
// info_doddetect
if ( g_map.initialized && pentKeyvalue == g_map.pEdict ){
if ( pkvd->szKeyName[0]=='d' && pkvd->szKeyName[7]=='a' ){
if ( pkvd->szKeyName[8]=='l' ){
switch ( pkvd->szKeyName[14] ){
case 'c':
g_map.detect_allies_country=atoi(pkvd->szValue);
break;
case 'p':
g_map.detect_allies_paras=atoi(pkvd->szValue);
break;
}
}
else if ( pkvd->szKeyName[12]=='p' ) g_map.detect_axis_paras=atoi(pkvd->szValue);
}
}
RETURN_META(MRES_IGNORED);
}
void SetClientKeyValue(int id, char *protocol, char *type, char *var)
{
// ID: Number
// protocol: \name\Sgt.MEOW\topcolor\1\bottomcolor\1\cl_lw\1\team\axis\model\axis-inf
// type: model
// var: axis-inf
// Check to see if its a player and we are setting a model
if(strcmp(type, "model") == 0 &&
(strcmp(var, "axis-inf") == 0 ||
strcmp(var, "axis-para") == 0 ||
strcmp(var, "us-inf") == 0 ||
strcmp(var, "us-para") == 0 ||
strcmp(var, "brit-inf") == 0))
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if(!pPlayer->ingame)
RETURN_META(MRES_IGNORED);
if(pPlayer->setModel())
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void OnMetaAttach()
{
CVAR_REGISTER (&init_dodstats_maxsize);
CVAR_REGISTER (&init_dodstats_reset);
CVAR_REGISTER (&init_dodstats_rank);
CVAR_REGISTER (&init_dodstats_rankbots);
CVAR_REGISTER (&init_dodstats_pause);
dodstats_maxsize=CVAR_GET_POINTER(init_dodstats_maxsize.name);
dodstats_reset=CVAR_GET_POINTER(init_dodstats_reset.name);
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);
}
void OnAmxxAttach()
{
MF_AddNatives( stats_Natives );
MF_AddNatives( base_Natives );
const char* path = get_localinfo("dodstats_score","addons/amxmodx/data/dodstats.amxx");
if ( path && *path )
{
char error[128];
g_rank.loadCalc( MF_BuildPathname("%s",path) , error );
}
if ( !g_rank.begin() )
{
g_rank.loadRank( MF_BuildPathname("%s",
get_localinfo("dodstats","addons/amxmodx/data/dodstats.dat") ) );
}
g_map.Init();
}
void OnAmxxDetach()
{
g_rank.clear();
g_grenades.clear();
g_rank.unloadCalc();
}
void OnPluginsLoaded()
{
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);
iFScore = MF_RegisterForward("client_score",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
iFTeamForward = MF_RegisterForward("dod_client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*team*/,FP_CELL/*oldteam*/,FP_DONE);
iFSpawnForward = MF_RegisterForward("dod_client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
iFClassForward = MF_RegisterForward("dod_client_changeclass",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*class*/,FP_CELL/*oldclass*/,FP_DONE);
iFScopeForward = MF_RegisterForward("dod_client_scope",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*value*/,FP_DONE);
iFWpnPickupForward = MF_RegisterForward("dod_client_weaponpickup",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*weapon*/,FP_CELL/*value*/,FP_DONE);
iFProneForward = MF_RegisterForward("dod_client_prone",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*value*/,FP_DONE);
iFCurWpnForward = MF_RegisterForward("dod_client_weaponswitch",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*wpnold*/,FP_CELL/*wpnew*/,FP_DONE);
iFGrenadeExplode = MF_RegisterForward("dod_grenade_explosion",ET_IGNORE,FP_CELL/*id*/,FP_ARRAY/*pos[3]*/,FP_CELL/*wpnid*/,FP_DONE);
iFRocketExplode = MF_RegisterForward("dod_rocket_explosion",ET_IGNORE,FP_CELL/*id*/,FP_ARRAY/*pos[3]*/,FP_CELL/*wpnid*/,FP_DONE);
iFObjectTouched = MF_RegisterForward("dod_client_objectpickup",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*object*/,FP_ARRAY/*pos[3]*/,FP_CELL/*value*/,FP_DONE);
iFStaminaForward = MF_RegisterForward("dod_client_stamina",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*stamina*/,FP_DONE);
}

View File

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dodx", "dodx.vcproj", "{9008A886-2DD0-443C-B468-AD84868D89B0}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{9008A886-2DD0-443C-B468-AD84868D89B0}.Debug.ActiveCfg = Debug|Win32
{9008A886-2DD0-443C-B468-AD84868D89B0}.Debug.Build.0 = Debug|Win32
{9008A886-2DD0-443C-B468-AD84868D89B0}.Release.ActiveCfg = Release|Win32
{9008A886-2DD0-443C-B468-AD84868D89B0}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

222
dlls/dod/dodx/msvc7/dodx.vcproj Executable file
View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="dodx"
ProjectGUID="{9008A886-2DD0-443C-B468-AD84868D89B0}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\sdk"
PreprocessorDefinitions="dodx_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="4"
StructMemberAlignment="3"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/dodx.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="Release/dodx_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/dodx_amxx.pdb"
ImportLibrary=".\Release/dodx_amxx.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/dodx.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\sdk"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;dodx_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/dodx.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="Debug/dodx_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/dodx_amxx.pdb"
ImportLibrary=".\Debug/dodx_amxx.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/dodx.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\CMisc.cpp">
</File>
<File
RelativePath="..\CRank.cpp">
</File>
<File
RelativePath="..\moduleconfig.cpp">
</File>
<File
RelativePath="..\NBase.cpp">
</File>
<File
RelativePath="..\NRank.cpp">
</File>
<File
RelativePath="..\usermsg.cpp">
</File>
<File
RelativePath="..\Utils.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\CMisc.h">
</File>
<File
RelativePath="..\CRank.h">
</File>
<File
RelativePath="..\dodx.h">
</File>
</Filter>
<Filter
Name="Module SDK"
Filter="">
<File
RelativePath="..\sdk\moduleconfig.h">
</File>
<File
RelativePath="..\sdk\svn_version.h">
</File>
<Filter
Name="SDK Base"
Filter="">
<File
RelativePath="..\sdk\amxxmodule.cpp">
</File>
<File
RelativePath="..\sdk\amxxmodule.h">
</File>
</Filter>
</Filter>
<Filter
Name="Pawn Includes"
Filter="">
<File
RelativePath="..\..\..\..\plugins\include\dodconst.inc">
</File>
<File
RelativePath="..\..\..\..\plugins\include\dodstats.inc">
</File>
<File
RelativePath="..\..\..\..\plugins\include\dodx.inc">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dodx", "dodx.vcproj", "{9008A886-2DD0-443C-B468-AD84868D89B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9008A886-2DD0-443C-B468-AD84868D89B0}.Debug|Win32.ActiveCfg = Debug|Win32
{9008A886-2DD0-443C-B468-AD84868D89B0}.Debug|Win32.Build.0 = Debug|Win32
{9008A886-2DD0-443C-B468-AD84868D89B0}.Release|Win32.ActiveCfg = Release|Win32
{9008A886-2DD0-443C-B468-AD84868D89B0}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,306 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="dodx"
ProjectGUID="{9008A886-2DD0-443C-B468-AD84868D89B0}"
RootNamespace="dodx"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/dodx.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\sdk"
PreprocessorDefinitions="dodx_EXPORTS"
StringPooling="true"
RuntimeLibrary="0"
StructMemberAlignment="3"
EnableFunctionLevelLinking="true"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/dodx.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="Release/dodx_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/dodx_amxx.pdb"
ImportLibrary=".\Release/dodx_amxx.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/dodx.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\sdk"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;dodx_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/dodx.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="Debug/dodx_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/dodx_amxx.pdb"
ImportLibrary=".\Debug/dodx_amxx.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\CMisc.cpp"
>
</File>
<File
RelativePath="..\CRank.cpp"
>
</File>
<File
RelativePath="..\moduleconfig.cpp"
>
</File>
<File
RelativePath="..\NBase.cpp"
>
</File>
<File
RelativePath="..\NRank.cpp"
>
</File>
<File
RelativePath="..\usermsg.cpp"
>
</File>
<File
RelativePath="..\Utils.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\CMisc.h"
>
</File>
<File
RelativePath="..\CRank.h"
>
</File>
<File
RelativePath="..\dodx.h"
>
</File>
</Filter>
<Filter
Name="Module SDK"
>
<File
RelativePath="..\sdk\moduleconfig.h"
>
</File>
<File
RelativePath="..\sdk\svn_version.h"
>
</File>
<Filter
Name="SDK Base"
>
<File
RelativePath="..\sdk\amxxmodule.cpp"
>
</File>
<File
RelativePath="..\sdk\amxxmodule.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Pawn Includes"
>
<File
RelativePath="..\..\..\..\plugins\include\dodconst.inc"
>
</File>
<File
RelativePath="..\..\..\..\plugins\include\dodstats.inc"
>
</File>
<File
RelativePath="..\..\..\..\plugins\include\dodx.inc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

3119
dlls/dod/dodx/sdk/amxxmodule.cpp Executable file

File diff suppressed because it is too large Load Diff

2454
dlls/dod/dodx/sdk/amxxmodule.h Executable file

File diff suppressed because it is too large Load Diff

494
dlls/dod/dodx/sdk/moduleconfig.h Executable file
View File

@ -0,0 +1,494 @@
// Configuration
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
// Module info
#define MODULE_NAME "DoDX"
#define MODULE_VERSION SVN_VERSION
#define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "DODX"
#define MODULE_LIBRARY "dodx"
#define MODULE_LIBCLASS "xstats"
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
#define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
#else // __DATE__
#define MODULE_DATE "Unknown"
#endif // __DATE__
// metamod plugin?
#define USE_METAMOD
// use memory manager/tester?
// note that if you use this, you cannot construct/allocate
// anything before the module attached (OnAmxxAttach).
// be careful of default constructors using new/malloc!
// #define MEMORY_TEST
// Unless you use STL or exceptions, keep this commented.
// It allows you to compile without libstdc++.so as a dependency
// #define NO_ALLOC_OVERRIDES
// Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself
// #define NO_MSVC8_AUTO_COMPAT
/**
* AMXX Init functions
* Also consider using FN_META_*
*/
/** AMXX query */
//#define FN_AMXX_QUERY OnAmxxQuery
/** AMXX attach
* Do native functions init here (MF_AddNatives)
*/
#define FN_AMXX_ATTACH OnAmxxAttach
/** AMXX Detach (unload) */
#define FN_AMXX_DETACH OnAmxxDetach
/** All plugins loaded
* Do forward functions init here (MF_RegisterForward)
*/
#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
/** All plugins are about to be unloaded */
//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading
/** All plugins are now unloaded */
//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded
/**** METAMOD ****/
// If your module doesn't use metamod, you may close the file now :)
#ifdef USE_METAMOD
// ----
// Hook Functions
// Uncomment these to be called
// You can also change the function name
// - Metamod init functions
// Also consider using FN_AMXX_*
// Meta query
//#define FN_META_QUERY OnMetaQuery
// Meta attach
#define FN_META_ATTACH OnMetaAttach
// Meta detach
//#define FN_META_DETACH OnMetaDetach
// (wd) are Will Day's notes
// - GetEntityAPI2 functions
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */
// #define FN_DispatchThink DispatchThink /* pfnThink() */
// #define FN_DispatchUse DispatchUse /* pfnUse() */
// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
// #define FN_DispatchSave DispatchSave /* pfnSave() */
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
// #define FN_SaveWriteFields SaveWriteFields /* pfnSaveWriteFields() */
// #define FN_SaveReadFields SaveReadFields /* pfnSaveReadFields() */
// #define FN_SaveGlobalState SaveGlobalState /* pfnSaveGlobalState() */
// #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
// #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
// #define FN_PlayerCustomization PlayerCustomization /* pfnPlayerCustomization() Notifies .dll of new customization for player. */
// #define FN_SpectatorConnect SpectatorConnect /* pfnSpectatorConnect() Called when spectator joins server */
// #define FN_SpectatorDisconnect SpectatorDisconnect /* pfnSpectatorDisconnect() Called when spectator leaves the server */
// #define FN_SpectatorThink SpectatorThink /* pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) */
// #define FN_Sys_Error Sys_Error /* pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 */
// #define FN_PM_Move PM_Move /* pfnPM_Move() (wd) SDK2 */
// #define FN_PM_Init PM_Init /* pfnPM_Init() Server version of player movement initialization; (wd) SDK2 */
// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */
// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */
// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */
// #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
// #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
// #define FN_CreateInstancedBaselines CreateInstancedBaselines /* pfnCreateInstancedBaselines() (wd) SDK2 */
// #define FN_InconsistentFile InconsistentFile /* pfnInconsistentFile() (wd) SDK2 */
// #define FN_AllowLagCompensation AllowLagCompensation /* pfnAllowLagCompensation() (wd) SDK2 */
// - GetEntityAPI2_Post functions
// #define FN_GameDLLInit_Post GameDLLInit_Post
// #define FN_DispatchSpawn_Post DispatchSpawn_Post
// #define FN_DispatchThink_Post DispatchThink_Post
// #define FN_DispatchUse_Post DispatchUse_Post
// #define FN_DispatchTouch_Post DispatchTouch_Post
// #define FN_DispatchBlocked_Post DispatchBlocked_Post
#define FN_DispatchKeyValue_Post DispatchKeyValue_Post
// #define FN_DispatchSave_Post DispatchSave_Post
// #define FN_DispatchRestore_Post DispatchRestore_Post
// #define FN_DispatchObjectCollsionBox_Post DispatchObjectCollsionBox_Post
// #define FN_SaveWriteFields_Post SaveWriteFields_Post
// #define FN_SaveReadFields_Post SaveReadFields_Post
// #define FN_SaveGlobalState_Post SaveGlobalState_Post
// #define FN_RestoreGlobalState_Post RestoreGlobalState_Post
// #define FN_ResetGlobalState_Post ResetGlobalState_Post
#define FN_ClientConnect_Post ClientConnect_Post
// #define FN_ClientDisconnect_Post ClientDisconnect_Post
// #define FN_ClientKill_Post ClientKill_Post
#define FN_ClientPutInServer_Post ClientPutInServer_Post
// #define FN_ClientCommand_Post ClientCommand_Post
#define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post
#define FN_ServerActivate_Post ServerActivate_Post
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
#define FN_PlayerPreThink_Post PlayerPreThink_Post
// #define FN_PlayerPostThink_Post PlayerPostThink_Post
// #define FN_StartFrame_Post StartFrame_Post
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
// #define FN_GetGameDescription_Post GetGameDescription_Post
// #define FN_PlayerCustomization_Post PlayerCustomization_Post
// #define FN_SpectatorConnect_Post SpectatorConnect_Post
// #define FN_SpectatorDisconnect_Post SpectatorDisconnect_Post
// #define FN_SpectatorThink_Post SpectatorThink_Post
// #define FN_Sys_Error_Post Sys_Error_Post
// #define FN_PM_Move_Post PM_Move_Post
// #define FN_PM_Init_Post PM_Init_Post
// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post
// #define FN_SetupVisibility_Post SetupVisibility_Post
// #define FN_UpdateClientData_Post UpdateClientData_Post
// #define FN_AddToFullPack_Post AddToFullPack_Post
// #define FN_CreateBaseline_Post CreateBaseline_Post
// #define FN_RegisterEncoders_Post RegisterEncoders_Post
// #define FN_GetWeaponData_Post GetWeaponData_Post
// #define FN_CmdStart_Post CmdStart_Post
// #define FN_CmdEnd_Post CmdEnd_Post
// #define FN_ConnectionlessPacket_Post ConnectionlessPacket_Post
// #define FN_GetHullBounds_Post GetHullBounds_Post
// #define FN_CreateInstancedBaselines_Post CreateInstancedBaselines_Post
// #define FN_InconsistentFile_Post InconsistentFile_Post
// #define FN_AllowLagCompensation_Post AllowLagCompensation_Post
// - GetEngineAPI functions
// #define FN_PrecacheModel PrecacheModel
// #define FN_PrecacheSound PrecacheSound
// #define FN_SetModel SetModel
// #define FN_ModelIndex ModelIndex
// #define FN_ModelFrames ModelFrames
// #define FN_SetSize SetSize
// #define FN_ChangeLevel ChangeLevel
// #define FN_GetSpawnParms GetSpawnParms
// #define FN_SaveSpawnParms SaveSpawnParms
// #define FN_VecToYaw VecToYaw
// #define FN_VecToAngles VecToAngles
// #define FN_MoveToOrigin MoveToOrigin
// #define FN_ChangeYaw ChangeYaw
// #define FN_ChangePitch ChangePitch
// #define FN_FindEntityByString FindEntityByString
// #define FN_GetEntityIllum GetEntityIllum
// #define FN_FindEntityInSphere FindEntityInSphere
// #define FN_FindClientInPVS FindClientInPVS
// #define FN_EntitiesInPVS EntitiesInPVS
// #define FN_MakeVectors MakeVectors
// #define FN_AngleVectors AngleVectors
// #define FN_CreateEntity CreateEntity
// #define FN_RemoveEntity RemoveEntity
// #define FN_CreateNamedEntity CreateNamedEntity
// #define FN_MakeStatic MakeStatic
// #define FN_EntIsOnFloor EntIsOnFloor
// #define FN_DropToFloor DropToFloor
// #define FN_WalkMove WalkMove
// #define FN_SetOrigin SetOrigin
// #define FN_EmitSound EmitSound
// #define FN_EmitAmbientSound EmitAmbientSound
// #define FN_TraceLine TraceLine
// #define FN_TraceToss TraceToss
// #define FN_TraceMonsterHull TraceMonsterHull
// #define FN_TraceHull TraceHull
// #define FN_TraceModel TraceModel
// #define FN_TraceTexture TraceTexture
// #define FN_TraceSphere TraceSphere
// #define FN_GetAimVector GetAimVector
// #define FN_ServerCommand ServerCommand
// #define FN_ServerExecute ServerExecute
// #define FN_engClientCommand engClientCommand
// #define FN_ParticleEffect ParticleEffect
// #define FN_LightStyle LightStyle
// #define FN_DecalIndex DecalIndex
// #define FN_PointContents PointContents
// #define FN_MessageBegin MessageBegin
// #define FN_MessageEnd MessageEnd
// #define FN_WriteByte WriteByte
// #define FN_WriteChar WriteChar
// #define FN_WriteShort WriteShort
// #define FN_WriteLong WriteLong
// #define FN_WriteAngle WriteAngle
// #define FN_WriteCoord WriteCoord
// #define FN_WriteString WriteString
// #define FN_WriteEntity WriteEntity
// #define FN_CVarRegister CVarRegister
// #define FN_CVarGetFloat CVarGetFloat
// #define FN_CVarGetString CVarGetString
// #define FN_CVarSetFloat CVarSetFloat
// #define FN_CVarSetString CVarSetString
// #define FN_AlertMessage AlertMessage
// #define FN_EngineFprintf EngineFprintf
// #define FN_PvAllocEntPrivateData PvAllocEntPrivateData
// #define FN_PvEntPrivateData PvEntPrivateData
// #define FN_FreeEntPrivateData FreeEntPrivateData
// #define FN_SzFromIndex SzFromIndex
// #define FN_AllocString AllocString
// #define FN_GetVarsOfEnt GetVarsOfEnt
// #define FN_PEntityOfEntOffset PEntityOfEntOffset
// #define FN_EntOffsetOfPEntity EntOffsetOfPEntity
// #define FN_IndexOfEdict IndexOfEdict
// #define FN_PEntityOfEntIndex PEntityOfEntIndex
// #define FN_FindEntityByVars FindEntityByVars
// #define FN_GetModelPtr GetModelPtr
// #define FN_RegUserMsg RegUserMsg
// #define FN_AnimationAutomove AnimationAutomove
// #define FN_GetBonePosition GetBonePosition
// #define FN_FunctionFromName FunctionFromName
// #define FN_NameForFunction NameForFunction
// #define FN_ClientPrintf ClientPrintf
// #define FN_ServerPrint ServerPrint
// #define FN_Cmd_Args Cmd_Args
// #define FN_Cmd_Argv Cmd_Argv
// #define FN_Cmd_Argc Cmd_Argc
// #define FN_GetAttachment GetAttachment
// #define FN_CRC32_Init CRC32_Init
// #define FN_CRC32_ProcessBuffer CRC32_ProcessBuffer
// #define FN_CRC32_ProcessByte CRC32_ProcessByte
// #define FN_CRC32_Final CRC32_Final
// #define FN_RandomLong RandomLong
// #define FN_RandomFloat RandomFloat
// #define FN_SetView SetView
// #define FN_Time Time
// #define FN_CrosshairAngle CrosshairAngle
// #define FN_LoadFileForMe LoadFileForMe
// #define FN_FreeFile FreeFile
// #define FN_EndSection EndSection
// #define FN_CompareFileTime CompareFileTime
// #define FN_GetGameDir GetGameDir
// #define FN_Cvar_RegisterVariable Cvar_RegisterVariable
// #define FN_FadeClientVolume FadeClientVolume
// #define FN_SetClientMaxspeed SetClientMaxspeed
// #define FN_CreateFakeClient CreateFakeClient
// #define FN_RunPlayerMove RunPlayerMove
// #define FN_NumberOfEntities NumberOfEntities
// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer
// #define FN_InfoKeyValue InfoKeyValue
// #define FN_SetKeyValue SetKeyValue
#define FN_SetClientKeyValue SetClientKeyValue
// #define FN_IsMapValid IsMapValid
// #define FN_StaticDecal StaticDecal
// #define FN_PrecacheGeneric PrecacheGeneric
// #define FN_GetPlayerUserId GetPlayerUserId
// #define FN_BuildSoundMsg BuildSoundMsg
// #define FN_IsDedicatedServer IsDedicatedServer
// #define FN_CVarGetPointer CVarGetPointer
// #define FN_GetPlayerWONId GetPlayerWONId
// #define FN_Info_RemoveKey Info_RemoveKey
// #define FN_GetPhysicsKeyValue GetPhysicsKeyValue
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
// #define FN_PrecacheEvent PrecacheEvent
// #define FN_PlaybackEvent PlaybackEvent
// #define FN_SetFatPVS SetFatPVS
// #define FN_SetFatPAS SetFatPAS
// #define FN_CheckVisibility CheckVisibility
// #define FN_DeltaSetField DeltaSetField
// #define FN_DeltaUnsetField DeltaUnsetField
// #define FN_DeltaAddEncoder DeltaAddEncoder
// #define FN_GetCurrentPlayer GetCurrentPlayer
// #define FN_CanSkipPlayer CanSkipPlayer
// #define FN_DeltaFindField DeltaFindField
// #define FN_DeltaSetFieldByIndex DeltaSetFieldByIndex
// #define FN_DeltaUnsetFieldByIndex DeltaUnsetFieldByIndex
// #define FN_SetGroupMask SetGroupMask
// #define FN_engCreateInstancedBaseline engCreateInstancedBaseline
// #define FN_Cvar_DirectSet Cvar_DirectSet
// #define FN_ForceUnmodified ForceUnmodified
// #define FN_GetPlayerStats GetPlayerStats
// #define FN_AddServerCommand AddServerCommand
// #define FN_Voice_GetClientListening Voice_GetClientListening
// #define FN_Voice_SetClientListening Voice_SetClientListening
// #define FN_GetPlayerAuthId GetPlayerAuthId
// - GetEngineAPI_Post functions
// #define FN_PrecacheModel_Post PrecacheModel_Post
// #define FN_PrecacheSound_Post PrecacheSound_Post
// #define FN_SetModel_Post SetModel_Post
// #define FN_ModelIndex_Post ModelIndex_Post
// #define FN_ModelFrames_Post ModelFrames_Post
// #define FN_SetSize_Post SetSize_Post
// #define FN_ChangeLevel_Post ChangeLevel_Post
// #define FN_GetSpawnParms_Post GetSpawnParms_Post
// #define FN_SaveSpawnParms_Post SaveSpawnParms_Post
// #define FN_VecToYaw_Post VecToYaw_Post
// #define FN_VecToAngles_Post VecToAngles_Post
// #define FN_MoveToOrigin_Post MoveToOrigin_Post
// #define FN_ChangeYaw_Post ChangeYaw_Post
// #define FN_ChangePitch_Post ChangePitch_Post
// #define FN_FindEntityByString_Post FindEntityByString_Post
// #define FN_GetEntityIllum_Post GetEntityIllum_Post
// #define FN_FindEntityInSphere_Post FindEntityInSphere_Post
// #define FN_FindClientInPVS_Post FindClientInPVS_Post
// #define FN_EntitiesInPVS_Post EntitiesInPVS_Post
// #define FN_MakeVectors_Post MakeVectors_Post
// #define FN_AngleVectors_Post AngleVectors_Post
// #define FN_CreateEntity_Post CreateEntity_Post
// #define FN_RemoveEntity_Post RemoveEntity_Post
// #define FN_CreateNamedEntity_Post CreateNamedEntity_Post
// #define FN_MakeStatic_Post MakeStatic_Post
// #define FN_EntIsOnFloor_Post EntIsOnFloor_Post
// #define FN_DropToFloor_Post DropToFloor_Post
// #define FN_WalkMove_Post WalkMove_Post
// #define FN_SetOrigin_Post SetOrigin_Post
// #define FN_EmitSound_Post EmitSound_Post
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
#define FN_TraceLine_Post TraceLine_Post
// #define FN_TraceToss_Post TraceToss_Post
// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post
// #define FN_TraceHull_Post TraceHull_Post
// #define FN_TraceModel_Post TraceModel_Post
// #define FN_TraceTexture_Post TraceTexture_Post
// #define FN_TraceSphere_Post TraceSphere_Post
// #define FN_GetAimVector_Post GetAimVector_Post
// #define FN_ServerCommand_Post ServerCommand_Post
// #define FN_ServerExecute_Post ServerExecute_Post
// #define FN_engClientCommand_Post engClientCommand_Post
// #define FN_ParticleEffect_Post ParticleEffect_Post
// #define FN_LightStyle_Post LightStyle_Post
// #define FN_DecalIndex_Post DecalIndex_Post
// #define FN_PointContents_Post PointContents_Post
#define FN_MessageBegin_Post MessageBegin_Post
#define FN_MessageEnd_Post MessageEnd_Post
#define FN_WriteByte_Post WriteByte_Post
#define FN_WriteChar_Post WriteChar_Post
#define FN_WriteShort_Post WriteShort_Post
#define FN_WriteLong_Post WriteLong_Post
#define FN_WriteAngle_Post WriteAngle_Post
#define FN_WriteCoord_Post WriteCoord_Post
#define FN_WriteString_Post WriteString_Post
#define FN_WriteEntity_Post WriteEntity_Post
// #define FN_CVarRegister_Post CVarRegister_Post
// #define FN_CVarGetFloat_Post CVarGetFloat_Post
// #define FN_CVarGetString_Post CVarGetString_Post
// #define FN_CVarSetFloat_Post CVarSetFloat_Post
// #define FN_CVarSetString_Post CVarSetString_Post
// #define FN_AlertMessage_Post AlertMessage_Post
// #define FN_EngineFprintf_Post EngineFprintf_Post
// #define FN_PvAllocEntPrivateData_Post PvAllocEntPrivateData_Post
// #define FN_PvEntPrivateData_Post PvEntPrivateData_Post
// #define FN_FreeEntPrivateData_Post FreeEntPrivateData_Post
// #define FN_SzFromIndex_Post SzFromIndex_Post
// #define FN_AllocString_Post AllocString_Post
// #define FN_GetVarsOfEnt_Post GetVarsOfEnt_Post
// #define FN_PEntityOfEntOffset_Post PEntityOfEntOffset_Post
// #define FN_EntOffsetOfPEntity_Post EntOffsetOfPEntity_Post
// #define FN_IndexOfEdict_Post IndexOfEdict_Post
// #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post
// #define FN_FindEntityByVars_Post FindEntityByVars_Post
// #define FN_GetModelPtr_Post GetModelPtr_Post
#define FN_RegUserMsg_Post RegUserMsg_Post
// #define FN_AnimationAutomove_Post AnimationAutomove_Post
// #define FN_GetBonePosition_Post GetBonePosition_Post
// #define FN_FunctionFromName_Post FunctionFromName_Post
// #define FN_NameForFunction_Post NameForFunction_Post
// #define FN_ClientPrintf_Post ClientPrintf_Post
// #define FN_ServerPrint_Post ServerPrint_Post
// #define FN_Cmd_Args_Post Cmd_Args_Post
// #define FN_Cmd_Argv_Post Cmd_Argv_Post
// #define FN_Cmd_Argc_Post Cmd_Argc_Post
// #define FN_GetAttachment_Post GetAttachment_Post
// #define FN_CRC32_Init_Post CRC32_Init_Post
// #define FN_CRC32_ProcessBuffer_Post CRC32_ProcessBuffer_Post
// #define FN_CRC32_ProcessByte_Post CRC32_ProcessByte_Post
// #define FN_CRC32_Final_Post CRC32_Final_Post
// #define FN_RandomLong_Post RandomLong_Post
// #define FN_RandomFloat_Post RandomFloat_Post
// #define FN_SetView_Post SetView_Post
// #define FN_Time_Post Time_Post
// #define FN_CrosshairAngle_Post CrosshairAngle_Post
// #define FN_LoadFileForMe_Post LoadFileForMe_Post
// #define FN_FreeFile_Post FreeFile_Post
// #define FN_EndSection_Post EndSection_Post
// #define FN_CompareFileTime_Post CompareFileTime_Post
// #define FN_GetGameDir_Post GetGameDir_Post
// #define FN_Cvar_RegisterVariable_Post Cvar_RegisterVariable_Post
// #define FN_FadeClientVolume_Post FadeClientVolume_Post
// #define FN_SetClientMaxspeed_Post SetClientMaxspeed_Post
// #define FN_CreateFakeClient_Post CreateFakeClient_Post
// #define FN_RunPlayerMove_Post RunPlayerMove_Post
// #define FN_NumberOfEntities_Post NumberOfEntities_Post
// #define FN_GetInfoKeyBuffer_Post GetInfoKeyBuffer_Post
// #define FN_InfoKeyValue_Post InfoKeyValue_Post
// #define FN_SetKeyValue_Post SetKeyValue_Post
// #define FN_SetClientKeyValue_Post SetClientKeyValue_Post
// #define FN_IsMapValid_Post IsMapValid_Post
// #define FN_StaticDecal_Post StaticDecal_Post
// #define FN_PrecacheGeneric_Post PrecacheGeneric_Post
// #define FN_GetPlayerUserId_Post GetPlayerUserId_Post
// #define FN_BuildSoundMsg_Post BuildSoundMsg_Post
// #define FN_IsDedicatedServer_Post IsDedicatedServer_Post
// #define FN_CVarGetPointer_Post CVarGetPointer_Post
// #define FN_GetPlayerWONId_Post GetPlayerWONId_Post
// #define FN_Info_RemoveKey_Post Info_RemoveKey_Post
// #define FN_GetPhysicsKeyValue_Post GetPhysicsKeyValue_Post
// #define FN_SetPhysicsKeyValue_Post SetPhysicsKeyValue_Post
// #define FN_GetPhysicsInfoString_Post GetPhysicsInfoString_Post
// #define FN_PrecacheEvent_Post PrecacheEvent_Post
// #define FN_PlaybackEvent_Post PlaybackEvent_Post
// #define FN_SetFatPVS_Post SetFatPVS_Post
// #define FN_SetFatPAS_Post SetFatPAS_Post
// #define FN_CheckVisibility_Post CheckVisibility_Post
// #define FN_DeltaSetField_Post DeltaSetField_Post
// #define FN_DeltaUnsetField_Post DeltaUnsetField_Post
// #define FN_DeltaAddEncoder_Post DeltaAddEncoder_Post
// #define FN_GetCurrentPlayer_Post GetCurrentPlayer_Post
// #define FN_CanSkipPlayer_Post CanSkipPlayer_Post
// #define FN_DeltaFindField_Post DeltaFindField_Post
// #define FN_DeltaSetFieldByIndex_Post DeltaSetFieldByIndex_Post
// #define FN_DeltaUnsetFieldByIndex_Post DeltaUnsetFieldByIndex_Post
// #define FN_SetGroupMask_Post SetGroupMask_Post
// #define FN_engCreateInstancedBaseline_Post engCreateInstancedBaseline_Post
// #define FN_Cvar_DirectSet_Post Cvar_DirectSet_Post
// #define FN_ForceUnmodified_Post ForceUnmodified_Post
// #define FN_GetPlayerStats_Post GetPlayerStats_Post
// #define FN_AddServerCommand_Post AddServerCommand_Post
// #define FN_Voice_GetClientListening_Post Voice_GetClientListening_Post
// #define FN_Voice_SetClientListening_Post Voice_SetClientListening_Post
// #define FN_GetPlayerAuthId_Post GetPlayerAuthId_Post
// #define FN_OnFreeEntPrivateData OnFreeEntPrivateData
// #define FN_GameShutdown GameShutdown
// #define FN_ShouldCollide ShouldCollide
// #define FN_OnFreeEntPrivateData_Post OnFreeEntPrivateData_Post
// #define FN_GameShutdown_Post GameShutdown_Post
// #define FN_ShouldCollide_Post ShouldCollide_Post
#endif // USE_METAMOD
#endif // __MODULECONFIG_H__

View File

@ -0,0 +1,9 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "1.8.0.3405"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -0,0 +1,9 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$.$LOCAL_BUILD$"
#endif //_INCLUDE_SVN_VERSION_H_

351
dlls/dod/dodx/usermsg.cpp Executable file
View File

@ -0,0 +1,351 @@
/*
* DoDX
* Copyright (c) 2004 Lukasz Wlasinski
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#include "amxxmodule.h"
#include "dodx.h"
void Client_ResetHUD_End(void* mValue)
{
mPlayer->clearStats = gpGlobals->time + 0.25f;
}
void Client_RoundState(void* mValue)
{
if ( mPlayer ) return;
int result = *(int*)mValue;
if ( result == 1 )
{
for (int i=1;i<=gpGlobals->maxClients;i++)
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame)
{
pPlayer->clearRound = gpGlobals->time + 0.25f;
}
}
}
}
void Client_TeamScore(void* mValue)
{
static int index;
switch(mState++)
{
case 0:
index = *(int*)mValue;
break;
case 1:
switch (index)
{
case 1:
AlliesScore = *(int*)mValue;
break;
case 2:
AxisScore = *(int*)mValue;
break;
}
break;
}
}
void Client_ObjScore(void* mValue)
{
static CPlayer *pPlayer;
static int score;
switch(mState++)
{
case 0:
pPlayer = GET_PLAYER_POINTER_I(*(int*)mValue);
break;
case 1:
score = *(int*)mValue;
if ( (pPlayer->lastScore = score - (int)(pPlayer->savedScore)) && isModuleActive() )
{
pPlayer->updateScore(pPlayer->current,pPlayer->lastScore);
pPlayer->sendScore = (int)(gpGlobals->time + 0.25f);
}
pPlayer->savedScore = score;
break;
}
}
void Client_CurWeapon(void* mValue)
{
static int iState;
static int iId;
switch (mState++)
{
case 0:
iState = *(int*)mValue;
break;
case 1:
if (!iState)
break;
iId = *(int*)mValue;
break;
case 2:
if(!iState || !isModuleActive())
break;
int iClip = *(int*)mValue;
mPlayer->old = mPlayer->current;
mPlayer->current = iId;
if(weaponData[iId].needcheck)
{
iId = get_weaponid(mPlayer);
mPlayer->current = iId;
}
if(iClip > -1)
{
if(mPlayer->current == 17)
{
if(iClip+2 == mPlayer->weapons[iId].clip)
mPlayer->saveShot(iId);
}
else
{
if ( iClip+1 == mPlayer->weapons[iId].clip)
mPlayer->saveShot(iId);
}
}
mPlayer->weapons[iId].clip = iClip;
mCurWpnEnd = 1;
break;
};
}
void Client_CurWeapon_End(void*)
{
if(mCurWpnEnd == 1 && mPlayer->index && mPlayer->current && mPlayer->old && (mPlayer->current != mPlayer->old))
MF_ExecuteForward(iFCurWpnForward, mPlayer->index, mPlayer->current, mPlayer->old);
mCurWpnEnd = 0;
}
/*
Nie ma damage event ...
*/
void Client_Health_End(void* mValue)
{
if ( !isModuleActive() )
return;
edict_t *enemy = mPlayer->pEdict->v.dmg_inflictor;
int damage = (int)mPlayer->pEdict->v.dmg_take;
if ( !mPlayer || !damage || !enemy )
return;
int weapon = 0;
int aim = 0;
mPlayer->pEdict->v.dmg_take = 0.0;
CPlayer* pAttacker = NULL;
if(enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT))
{
pAttacker = GET_PLAYER_POINTER(enemy);
weapon = pAttacker->current;
if ( weaponData[weapon].needcheck )
weapon = get_weaponid(pAttacker);
aim = pAttacker->aiming;
if ( weaponData[weapon].melee )
pAttacker->saveShot(weapon);
}
else
{
g_grenades.find(enemy , &pAttacker , weapon);
}
int TA = 0;
if ( !pAttacker )
{
pAttacker = mPlayer;
}
if ( pAttacker->index != mPlayer->index )
{
pAttacker->saveHit( mPlayer , weapon , damage, aim );
if ( mPlayer->pEdict->v.team == pAttacker->pEdict->v.team )
TA = 1;
}
MF_ExecuteForward( iFDamage, pAttacker->index, mPlayer->index, damage, weapon, aim, TA );
if ( !mPlayer->IsAlive() )
{
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA);
MF_ExecuteForward( iFDeath, pAttacker->index, mPlayer->index, weapon, aim, TA );
}
}
void Client_AmmoX(void* mValue)
{
static int iAmmo;
switch (mState++)
{
case 0:
iAmmo = *(int*)mValue;
break;
case 1:
if (!mPlayer )
break;
for(int i = 1; i < MAX_WEAPONS ; ++i)
{
if (iAmmo == weaponData[i].ammoSlot)
mPlayer->weapons[i].ammo = *(int*)mValue;
}
}
}
void Client_AmmoShort(void* mValue)
{
static int iAmmo;
switch (mState++)
{
case 0:
iAmmo = *(int*)mValue;
break;
case 1:
if(!mPlayer )
break;
for(int i = 1; i < MAX_WEAPONS ; ++i)
{
if (iAmmo == weaponData[i].ammoSlot)
mPlayer->weapons[i].ammo = *(int*)mValue;
}
}
}
// Called with a value of 90 at start 20 when someone scopes in and 0 when they scope out
void Client_SetFOV(void* mValue)
{
if(!mPlayer)
return;
mPlayer->Scoping(*(int*)mValue);
}
void Client_SetFOV_End(void* mValue)
{
if(!mPlayer)
return;
mPlayer->ScopingCheck();
}
void Client_Object(void* mValue)
{
if(!mPlayer)
return;
// First need to find out what was picked up
const char *classname;
edict_t* pObject = NULL;
const char* value;
if(mValue)
{
value = (char*)mValue;
}
if(!mPlayer->object.carrying)
{
// We grab the first object within the sphere of our player
pObject = FindEntityInSphere(mPlayer->pEdict, mPlayer->pEdict, 50.0);
// The loop through all the objects within the sphere
while(pObject && !FNullEnt(pObject))
{
classname = STRING(pObject->v.classname);
if(strcmp(classname, "dod_object") == 0)
{
mPlayer->object.pEdict = pObject;
mPlayer->object.do_forward = true;
return;
}
pObject = FindEntityInSphere(pObject, mPlayer->pEdict, 50.0);
}
}
else
{
mPlayer->object.do_forward = true;
}
}
void Client_Object_End(void* mValue)
{
if(!mPlayer)
return;
float fposition[3];
if(mPlayer->object.do_forward)
{
mPlayer->object.do_forward = (mPlayer->object.do_forward) ? false : true;
mPlayer->object.carrying = (mPlayer->object.carrying) ? false : true;
mPlayer->object.pEdict->v.origin.CopyToArray(fposition);
cell position[3];
position[0] = amx_ftoc(fposition[0]);
position[1] = amx_ftoc(fposition[1]);
position[2] = amx_ftoc(fposition[2]);
cell pos = MF_PrepareCellArray(position, 3);
MF_ExecuteForward(iFObjectTouched, mPlayer->index, ENTINDEX(mPlayer->object.pEdict), pos, mPlayer->object.carrying);
if(!mPlayer->object.carrying)
mPlayer->object.pEdict = NULL;
}
}