Use the complete JKO level 3 saber seek code

This commit is contained in:
Simon 2023-07-14 22:41:21 +01:00
parent b1a9ff3990
commit 09cf2d49f3
3 changed files with 72 additions and 2 deletions

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.jkxr" package="com.drbeef.jkxr"
android:versionCode="61" 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. --> <!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030002" android:required="true"/> <uses-feature android:glEsVersion="0x00030002" android:required="true"/>

View file

@ -6346,6 +6346,75 @@ float WP_SaberRateEnemy( gentity_t *enemy, vec3_t center, vec3_t forward, float
return rating; 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 ) gentity_t *WP_SaberFindEnemy( gentity_t *self, gentity_t *saber )
{ {
//FIXME: should be a more intelligent way of doing this, like auto aim? //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; return bestEnt;
} }
*/
void WP_RunSaber( gentity_t *self, gentity_t *saber ) void WP_RunSaber( gentity_t *self, gentity_t *saber )
{ {

View file

@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
// Current version of the single player game // Current version of the single player game
#include "../win32/AutoVersion.h" #include "../win32/AutoVersion.h"
#define JKXR_VERSION "1.1.10-ea" #define JKXR_VERSION "1.1.12-ea"
#ifdef _DEBUG #ifdef _DEBUG
#define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION #define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION