mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-21 19:51:33 +00:00
Use the complete JKO level 3 saber seek code
This commit is contained in:
parent
b1a9ff3990
commit
09cf2d49f3
3 changed files with 72 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.jkxr"
|
||||
android:versionCode="61"
|
||||
android:versionName="1.1.10" android:installLocation="auto" >
|
||||
android:versionName="1.1.12" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||
|
|
|
@ -6346,6 +6346,75 @@ float WP_SaberRateEnemy( gentity_t *enemy, vec3_t center, vec3_t forward, float
|
|||
return rating;
|
||||
}
|
||||
|
||||
gentity_t *WP_SaberFindEnemy( gentity_t *self, gentity_t *saber )
|
||||
{
|
||||
//FIXME: should be a more intelligent way of doing this, like auto aim?
|
||||
//closest, most in front... did damage to... took damage from? How do we know who the player is focusing on?
|
||||
gentity_t *ent, *bestEnt = NULL;
|
||||
gentity_t *entityList[MAX_GENTITIES];
|
||||
int numListedEntities;
|
||||
vec3_t center, mins, maxs, fwdangles, forward;
|
||||
int i, e;
|
||||
float radius = 400;
|
||||
float rating, bestRating = 0.0f;
|
||||
|
||||
//FIXME: no need to do this in 1st person?
|
||||
fwdangles[1] = self->client->ps.viewangles[1];
|
||||
AngleVectors( fwdangles, forward, NULL, NULL );
|
||||
|
||||
VectorCopy( saber->currentOrigin, center );
|
||||
|
||||
for ( i = 0 ; i < 3 ; i++ )
|
||||
{
|
||||
mins[i] = center[i] - radius;
|
||||
maxs[i] = center[i] + radius;
|
||||
}
|
||||
|
||||
if ( WP_SaberValidateEnemy( self, self->enemy ) )
|
||||
{
|
||||
bestEnt = self->enemy;
|
||||
bestRating = WP_SaberRateEnemy( bestEnt, center, forward, radius );
|
||||
}
|
||||
|
||||
numListedEntities = gi.EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
|
||||
|
||||
if ( !numListedEntities )
|
||||
{//should we clear the enemy?
|
||||
return bestEnt;
|
||||
}
|
||||
|
||||
for ( e = 0 ; e < numListedEntities ; e++ )
|
||||
{
|
||||
ent = entityList[ e ];
|
||||
|
||||
if ( ent == self || ent == saber || ent == bestEnt )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( !WP_SaberValidateEnemy( self, ent ) )
|
||||
{//doesn't meet criteria of valid look enemy (don't check current since we would have done that before this func's call
|
||||
continue;
|
||||
}
|
||||
if ( !gi.inPVS( self->currentOrigin, ent->currentOrigin ) )
|
||||
{//not even potentially visible
|
||||
continue;
|
||||
}
|
||||
if ( !G_ClearLOS( self, self->client->renderInfo.eyePoint, ent ) )
|
||||
{//can't see him
|
||||
continue;
|
||||
}
|
||||
//rate him based on how close & how in front he is
|
||||
rating = WP_SaberRateEnemy( ent, center, forward, radius );
|
||||
if ( rating > bestRating )
|
||||
{
|
||||
bestEnt = ent;
|
||||
bestRating = rating;
|
||||
}
|
||||
}
|
||||
return bestEnt;
|
||||
}
|
||||
|
||||
/*
|
||||
gentity_t *WP_SaberFindEnemy( gentity_t *self, gentity_t *saber )
|
||||
{
|
||||
//FIXME: should be a more intelligent way of doing this, like auto aim?
|
||||
|
@ -6437,6 +6506,7 @@ gentity_t *WP_SaberFindEnemy( gentity_t *self, gentity_t *saber )
|
|||
}
|
||||
return bestEnt;
|
||||
}
|
||||
*/
|
||||
|
||||
void WP_RunSaber( gentity_t *self, gentity_t *saber )
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
// Current version of the single player game
|
||||
#include "../win32/AutoVersion.h"
|
||||
|
||||
#define JKXR_VERSION "1.1.10-ea"
|
||||
#define JKXR_VERSION "1.1.12-ea"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION
|
||||
|
|
Loading…
Reference in a new issue