Update 1 changes

This commit is contained in:
Mike Rubits
2023-10-03 14:43:06 -04:00
parent 60f29560f3
commit 8dc1fc9794
67 changed files with 1806 additions and 1479 deletions

View File

@@ -149,3 +149,40 @@ int32_t Bot_GetItemID( const char * classname ) {
return Item_Invalid;
}
/*
================
Edict_ForceLookAtPoint
================
*/
void Edict_ForceLookAtPoint( edict_t * edict, gvec3_cref_t point ) {
vec3_t viewOrigin = edict->s.origin;
if ( edict->client != nullptr ) {
viewOrigin += edict->client->ps.viewoffset;
}
const vec3_t ideal = ( point - viewOrigin ).normalized();
vec3_t viewAngles = vectoangles( ideal );
if ( viewAngles.x < -180.0f ) {
viewAngles.x = anglemod( viewAngles.x + 360.0f );
}
if ( edict->client != nullptr ) {
edict->client->ps.pmove.delta_angles = ( viewAngles - edict->client->resp.cmd_angles );
edict->client->ps.viewangles = {};
edict->client->v_angle = {};
edict->s.angles = {};
}
}
/*
================
Bot_PickedUpItem
Check if the given bot has picked up the given item or not.
================
*/
bool Bot_PickedUpItem( edict_t * bot, edict_t * item ) {
return item->item_picked_up_by[ ( bot->s.number - 1 ) ];
}

View File

@@ -6,4 +6,6 @@
void Bot_SetWeapon( edict_t * bot, const int weaponIndex, const bool instantSwitch );
void Bot_TriggerEdict( edict_t * bot, edict_t * edict );
int32_t Bot_GetItemID( const char * classname );
void Bot_UseItem( edict_t * bot, const int32_t itemID );
void Bot_UseItem( edict_t * bot, const int32_t itemID );
void Edict_ForceLookAtPoint( edict_t * edict, gvec3_cref_t point );
bool Bot_PickedUpItem( edict_t * bot, edict_t * item );

View File

@@ -248,9 +248,6 @@ void Item_UpdateState( edict_t * item ) {
}
}
// track who has picked us up so far...
item->sv.pickedup_list = item->item_picked_up_by;
const item_id_t itemID = item->item->id;
if ( itemID == IT_FLAG1 || itemID == IT_FLAG2 ) {
item->sv.ent_flags |= SVFL_IS_OBJECTIVE;
@@ -529,4 +526,4 @@ const edict_t * FindActorUnderCrosshair( const edict_t * player ) {
}
return traceEnt;
}
}