View Single Post
Re: Custom Interfaces
Old
  (#8)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: Custom Interfaces - 08-06-2005

Here's the latest function list.
Code:
const QAngle& GetAbsAngles(const CBaseEntity &_ent) const;
const QAngle& GetLocalAngles(const CBaseEntity &_ent) const;
const Vector& GetAbsOrigin(const CBaseEntity &_ent) const;
const Vector& GetLocalOrigin(const CBaseEntity &_ent) const;
const Vector& GetAbsVelocity(const CBaseEntity &_ent) const;
const Vector& GetLocalVelocity(const CBaseEntity &_ent) const;
const QAngle& GetLocalAngularVelocity(const CBaseEntity &_ent) const;
const Vector GetEyePosition(const CBaseEntity &_ent) const;
const Vector GetEarPosition(const CBaseEntity &_ent) const;
const int GetEntityFlags(const CBaseEntity &_ent) const;
const int GetTeamIndex(const CBaseEntity &_ent) const;

// Player stuff.
const CBasePlayer *GetBasePlayer(CBaseEntity &_ent) const;
const CBaseEntity *GetPlayerVehicle(CBasePlayer &_ent) const;
int GetAmmoCount(CBasePlayer &_ent, int _ammoindex) const;
const char *GetCurrentWeapon(CBasePlayer &_ent) const;
const CBaseEntity *HasItem(CBasePlayer &_ent, const char *_itemname) const;

const char *GetName(CBasePlayer &_ent);
const char *GetNetworkIDString(CBasePlayer &_ent);
void ChangeTeam(CBasePlayer &_ent, int _newteam);
void ChangeClass(CBasePlayer &_ent, int _newclass);
const char *GetClassName(CBasePlayer &_ent);
int	GetFragCount(const CBasePlayer &_ent);
int	GetDeathCount(const CBasePlayer &_ent);
bool IsConnected(const CBasePlayer &_ent);
int	GetArmorValue(const CBasePlayer &_ent);
bool IsHLTV(const CBasePlayer &_ent);
bool IsPlayer(const CBasePlayer &_ent);
bool IsFakeClient(CBasePlayer &_ent);
bool IsDead(const CBasePlayer &_ent);
bool IsInAVehicle(const CBasePlayer &_ent);
bool IsObserver(const CBasePlayer &_ent);
Vector GetPlayerMins(const CBasePlayer &_ent);
Vector GetPlayerMaxs(const CBasePlayer &_ent);
bool IsAllied(CBaseEntity &_ent, CBaseEntity &_ent2);
I think this stuff covers just about all the stuff we need, other than sounds/visual effects which I think there's no way around needing the mod to generate events for.

Anyone see anything missing?

I still want to add some accessors to get more detailed weapon data.

What are ya'lls opinion about getting weapon data. I was thinking one of 2 methods.

Code:
int GetWeaponCount(CBasePlayer &_ent)
{
	return _ent.WeaponCount();
}
CBaseCombatWeapon *GetWeapon(CBasePlayer &_ent, int _index)
{
	return _ent.GetWeapon(_index);
}
int GetWeaponClip1(CBaseCombatWeapon *_weapon)
{
	return _weapon->Clip1();
}
int GetWeaponClip2(CBaseCombatWeapon *_weapon)
{
	return _weapon->Clip2();
}
This basically lets the plugin actually hold the pointer to the weapon and use it in other functions to get data from it. May be confusing though to users who try to call the functions directly and end up with linker errors.

I'm leaning more towards something like this.

Code:
class WeaponInfo
{
public:
	const char *m_WeaponName;
	int	m_Clip1, m_Clip2;

	WeaponInfo()
	{
	}
};
int GetWeaponCount(CBasePlayer &_ent)
{
	return _ent.WeaponCount();
}
const void GetWeaponInfo(CBasePlayer &_ent, int _weaponIndex, WeaponInfo &_wi)
{
	CBaseCombatWeapon *pWeapon = _ent->GetWeapon(_weaponIndex);
	_wi.m_WeaponName = pWeapon->GetName();
	_wi.m_Clip1 = pWeapon->Clip1();
	_wi.m_Clip2 = pWeapon->Clip2();
	//...
}
Any thoughts?


Omni-bot AI framework
http://www.omni-bot.com

Foxbot - for Team Fortress Classic
http://www.foxbot.net



Last edited by DrEvil; 08-06-2005 at 15:40..
  
Reply With Quote