class mbotbase : public qcs
{
protected:
bspGraph map;
int mbf_target;
int mbn_target;
char flags[ QCS_MAX_ENTITIES ];
char oldFlags[ QCS_MAX_ENTITIES ];
int health, oldHealth;
int armour, oldArmour;
int cells, shells, rockets, nails;
int weapons;
int weapon;
int maxHate;
int maxFrags;
int lastDamage;
char mbotbase_localMessage[ Q_MAX_STRING ];
float mbotbase_messageTimestamp;
};
- map
- The loaded level (maybe) with functions to provide for checking line-of-sight, leaf type
and others. Documentation on this is forthcoming.
- mbn_target, mbf_target
- These are integers representing which entity mbnav and mbfire is targeting,
respectivly. 0 means there is no target. (Entity 0 is always the level itself, worldspawn)
- flags, oldflags
- These are flags used by the isVisible(), etc. functions to determine things about
the entities. They are updated in mbotbase::entityUpdated(), an overriden qcs function.
- health, oldHealth, armour, oldArmour, cells, shells, nails, rockets
- The current ammo/health levels.
- weapons
- A bitmask used by haveRL() etc. to determine which weapons I have.
- weapon
- The current weapon (same as the impulse used to get to it, so weapon 1 is the axe, weapon
2 is the shotgun, etc.)
- maxHate, maxFrags
- The maximum hate the bot has toward anyone (for use with mbl-hate) and maximum
frags anyone has. maxFrags is unused currently.
- lastDamage
- The playernumber of the last player to hurt me.
- mbotbase_localMessage, mbotbase_localMessageTimestamp
- Used by mbotbase::sayLocal(). Put into qcs::qcs_message[] eventually
class mbotbase : public qcs
{
protected:
void init();
void erase();
void reinit();
public:
mbotbase();
~mbotbase();
int isVisible( int x );
int isDead( int x );
int isPlayer( int x );
int isMe( int x );
int died( int x );
int vanished( int x );
int wasVisible( int x );
int wasDead( int x );
int isWeapon( int x );
int isLG( int x );
int isRL( int x );
int isNG( int x );
int isSNG( int x );
int isSSG( int x );
int haveLG();
int haveRL();
int haveNG();
int haveSNG();
int haveSSG();
int isShells( int x );
int isCells( int x );
int isNails( int x );
int isRockets( int x );
int isArmour( int x );
int isHealth( int x );
int isAmmo( int x );
int isPowerup( int x );
int isProjectile( int x );
int isBackpack( int x );
int isGrenade( int x );
int willHitMe( int x );
void increaseHate( int, int );
//
// QCS OVERRIDES [----
//
void timestampChanged( float );
void entityUpdated( int );
virtual void entityChanged( int x );
void receivedDamage( int, vector & );
void centerPrint( char * x );
void updateHealth( int x );
void updateArmour( int x );
void updateCells( int x );
void updateShells( int x );
void updateRockets( int x );
void updateNails( int x );
void updateWeapon( int x );
void updateItems( int x );
void changedLevel( char * fname );
void update();
//
// -----]
//
void printPlayerEntities();
void printVisibleEntities();
void printAmmo();
void set( char * x, int v );
int get( char * x );
void sayLocal( char * x );
};
- init, erase, reinit
- Don't worry about it :) reinitializes everything.
- mbotbase, ~mbotbase
- ctor, dtor.
- isVisible, isDead, etc...
- Returns TRUE if the entity in question is visible, is dead or is whatever.
- wasVisible, wasDead, etc...
- Returns TRUE if the entity in question was visible, dead, etc. on the last update (not the
most recent update).
- vanished, died
- Means the entity was visible last time and isn't this time, or was alive last time and
isn't this time. NOTE: isDead, wasDead ONLY RETURN VALID INFORMATION FOR
player.mdls (i.e. entity numbers 1 to qcs::info.maxPlayers + 1)
- haveWeapon()
- These functions return TRUE if you currenly have the specified weapon (i.e. haveRL(), etc.)
- increaseHate( int playernumber, int amount )
- Increase's playernumber's hate by amount (amount can be negative)
- QCS overrides
- Don't mess with these :) they override some of the virtual functions in
qcs and are called during packet decoding.
- get, set
- Affect or get the status of flags in the hash table (i.e. mbotbase::set( "mike", 1 )
will set the value of flag "mike" to 1, and a subsequent call to
mbotbase::get( "mike" ) will return 1. Unset flags return 0.)