mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-04-23 07:20:51 +00:00
64bit
Runs but has some issues
This commit is contained in:
parent
6ee330d78f
commit
93c9b754c3
88 changed files with 2253 additions and 2849 deletions
|
@ -17,10 +17,10 @@ android {
|
|||
// override app plugin abiFilters for both 32 and 64-bit support
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
abiFilters 'armeabi-v7a'
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
ndkBuild {
|
||||
abiFilters 'armeabi-v7a'
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
}
|
||||
minSdkVersion 26
|
||||
|
@ -42,6 +42,7 @@ android {
|
|||
}
|
||||
compileSdkVersion = 26
|
||||
buildToolsVersion = '29.0.1'
|
||||
ndkVersion '21.1.6352462'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
ROOT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))../../../../..
|
||||
NDK_MODULE_PATH := $(ROOT_DIR)
|
||||
|
||||
APP_PLATFORM := android-19
|
||||
APP_PLATFORM := android-24
|
||||
|
||||
APP_CFLAGS += -Wl,--no-undefined
|
||||
|
||||
|
|
|
@ -498,18 +498,7 @@ static void ovrFramebuffer_Clear( ovrFramebuffer * frameBuffer )
|
|||
|
||||
static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum colorFormat, const int width, const int height, const int multisamples )
|
||||
{
|
||||
LOAD_GLES2(glBindTexture);
|
||||
LOAD_GLES2(glTexParameteri);
|
||||
LOAD_GLES2(glGenRenderbuffers);
|
||||
LOAD_GLES2(glBindRenderbuffer);
|
||||
LOAD_GLES2(glRenderbufferStorage);
|
||||
LOAD_GLES2(glGenFramebuffers);
|
||||
LOAD_GLES2(glBindFramebuffer);
|
||||
LOAD_GLES2(glFramebufferRenderbuffer);
|
||||
LOAD_GLES2(glFramebufferTexture2D);
|
||||
LOAD_GLES2(glCheckFramebufferStatus);
|
||||
|
||||
frameBuffer->Width = width;
|
||||
frameBuffer->Width = width;
|
||||
frameBuffer->Height = height;
|
||||
frameBuffer->Multisamples = multisamples;
|
||||
|
||||
|
@ -519,68 +508,32 @@ static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum co
|
|||
frameBuffer->FrameBuffers = (GLuint *)malloc( frameBuffer->TextureSwapChainLength * sizeof( GLuint ) );
|
||||
|
||||
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT =
|
||||
(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)eglGetProcAddress("glRenderbufferStorageMultisampleEXT");
|
||||
(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)eglGetProcAddress("glRenderbufferStorageMultisampleEXT");
|
||||
PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT =
|
||||
(PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)eglGetProcAddress("glFramebufferTexture2DMultisampleEXT");
|
||||
(PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)eglGetProcAddress("glFramebufferTexture2DMultisampleEXT");
|
||||
|
||||
for ( int i = 0; i < frameBuffer->TextureSwapChainLength; i++ )
|
||||
{
|
||||
// Create the color buffer texture.
|
||||
const GLuint colorTexture = vrapi_GetTextureSwapChainHandle( frameBuffer->ColorTextureSwapChain, i );
|
||||
GLenum colorTextureTarget = GL_TEXTURE_2D;
|
||||
GL( gles_glBindTexture( colorTextureTarget, colorTexture ) );
|
||||
// Just clamp to edge. However, this requires manually clearing the border
|
||||
// around the layer to clear the edge texels.
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ) );
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ) );
|
||||
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR ) );
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR ) );
|
||||
GL( gles_glBindTexture( colorTextureTarget, 0 ) );
|
||||
GL(glGenRenderbuffers(1, &frameBuffer->DepthBuffers[i]));
|
||||
GL(glBindRenderbuffer(GL_RENDERBUFFER, frameBuffer->DepthBuffers[i]));
|
||||
GL(glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, multisamples, GL_DEPTH_COMPONENT24, width, height));
|
||||
GL(glBindRenderbuffer(GL_RENDERBUFFER, 0));
|
||||
|
||||
if (multisamples > 1 && glRenderbufferStorageMultisampleEXT != NULL && glFramebufferTexture2DMultisampleEXT != NULL)
|
||||
// Create the frame buffer.
|
||||
GL(glGenFramebuffers(1, &frameBuffer->FrameBuffers[i]));
|
||||
GL(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer->FrameBuffers[i]));
|
||||
GL(glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0, multisamples));
|
||||
GL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i]));
|
||||
|
||||
GL(GLenum renderFramebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER));
|
||||
GL(glBindFramebuffer(GL_FRAMEBUFFER, 0));
|
||||
if (renderFramebufferStatus != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
// Create multisampled depth buffer.
|
||||
GL(glGenRenderbuffers(1, &frameBuffer->DepthBuffers[i]));
|
||||
GL(glBindRenderbuffer(GL_RENDERBUFFER, frameBuffer->DepthBuffers[i]));
|
||||
GL(glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, multisamples, GL_DEPTH_COMPONENT24, width, height));
|
||||
GL(glBindRenderbuffer(GL_RENDERBUFFER, 0));
|
||||
|
||||
// Create the frame buffer.
|
||||
GL(glGenFramebuffers(1, &frameBuffer->FrameBuffers[i]));
|
||||
GL(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer->FrameBuffers[i]));
|
||||
GL(glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0, multisamples));
|
||||
GL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i]));
|
||||
GL(GLenum renderFramebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER));
|
||||
GL(glBindFramebuffer(GL_FRAMEBUFFER, 0));
|
||||
if (renderFramebufferStatus != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
ALOGE("OVRHelper::Incomplete frame buffer object: %s", GlFrameBufferStatusString(renderFramebufferStatus));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Create depth buffer.
|
||||
GL( gles_glGenRenderbuffers( 1, &frameBuffer->DepthBuffers[i] ) );
|
||||
GL( gles_glBindRenderbuffer( GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) );
|
||||
GL( gles_glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( gles_glBindRenderbuffer( GL_RENDERBUFFER, 0 ) );
|
||||
|
||||
// Create the frame buffer.
|
||||
GL( gles_glGenFramebuffers( 1, &frameBuffer->FrameBuffers[i] ) );
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[i] ) );
|
||||
GL( gles_glFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) );
|
||||
GL( gles_glFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0 ) );
|
||||
GL( GLenum renderFramebufferStatus = gles_glCheckFramebufferStatus( GL_DRAW_FRAMEBUFFER ) );
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) );
|
||||
if ( renderFramebufferStatus != GL_FRAMEBUFFER_COMPLETE )
|
||||
{
|
||||
ALOGE( "Incomplete frame buffer object: %s", GlFrameBufferStatusString( renderFramebufferStatus ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ALOGE("OVRHelper::Incomplete frame buffer object: %s", GlFrameBufferStatusString(renderFramebufferStatus));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,11 +542,11 @@ static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum co
|
|||
|
||||
void ovrFramebuffer_Destroy( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
LOAD_GLES2(glDeleteFramebuffers);
|
||||
LOAD_GLES2(glDeleteRenderbuffers);
|
||||
//LOAD_GLES2(glDeleteFramebuffers);
|
||||
//LOAD_GLES2(glDeleteRenderbuffers);
|
||||
|
||||
GL( gles_glDeleteFramebuffers( frameBuffer->TextureSwapChainLength, frameBuffer->FrameBuffers ) );
|
||||
GL( gles_glDeleteRenderbuffers( frameBuffer->TextureSwapChainLength, frameBuffer->DepthBuffers ) );
|
||||
GL( glDeleteFramebuffers( frameBuffer->TextureSwapChainLength, frameBuffer->FrameBuffers ) );
|
||||
GL( glDeleteRenderbuffers( frameBuffer->TextureSwapChainLength, frameBuffer->DepthBuffers ) );
|
||||
|
||||
vrapi_DestroyTextureSwapChain( frameBuffer->ColorTextureSwapChain );
|
||||
|
||||
|
@ -616,14 +569,14 @@ void GPUWaitSync()
|
|||
|
||||
void ovrFramebuffer_SetCurrent( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
LOAD_GLES2(glBindFramebuffer);
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->ProcessingTextureSwapChainIndex] ) );
|
||||
//LOAD_GLES2(glBindFramebuffer);
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->ProcessingTextureSwapChainIndex] ) );
|
||||
}
|
||||
|
||||
void ovrFramebuffer_SetNone()
|
||||
{
|
||||
LOAD_GLES2(glBindFramebuffer);
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) );
|
||||
//LOAD_GLES2(glBindFramebuffer);
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) );
|
||||
}
|
||||
|
||||
void ovrFramebuffer_Resolve( ovrFramebuffer * frameBuffer )
|
||||
|
@ -646,36 +599,36 @@ void ovrFramebuffer_Advance( ovrFramebuffer * frameBuffer )
|
|||
|
||||
void ovrFramebuffer_ClearEdgeTexels( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
LOAD_GLES2(glEnable);
|
||||
LOAD_GLES2(glDisable);
|
||||
LOAD_GLES2(glViewport);
|
||||
LOAD_GLES2(glScissor);
|
||||
LOAD_GLES2(glClearColor);
|
||||
LOAD_GLES2(glClear);
|
||||
//LOAD_GLES2(glEnable);
|
||||
//LOAD_GLES2(glDisable);
|
||||
//LOAD_GLES2(glViewport);
|
||||
//LOAD_GLES2(glScissor);
|
||||
//LOAD_GLES2(glClearColor);
|
||||
//LOAD_GLES2(glClear);
|
||||
|
||||
GL( gles_glEnable( GL_SCISSOR_TEST ) );
|
||||
GL( gles_glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( glEnable( GL_SCISSOR_TEST ) );
|
||||
GL( glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
|
||||
// Explicitly clear the border texels to black because OpenGL-ES does not support GL_CLAMP_TO_BORDER.
|
||||
// Clear to fully opaque black.
|
||||
GL( gles_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
|
||||
GL( glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
|
||||
|
||||
// bottom
|
||||
GL( gles_glScissor( 0, 0, frameBuffer->Width, 1 ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( 0, 0, frameBuffer->Width, 1 ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
// top
|
||||
GL( gles_glScissor( 0, frameBuffer->Height - 1, frameBuffer->Width, 1 ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( 0, frameBuffer->Height - 1, frameBuffer->Width, 1 ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
// left
|
||||
GL( gles_glScissor( 0, 0, 1, frameBuffer->Height ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( 0, 0, 1, frameBuffer->Height ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
// right
|
||||
GL( gles_glScissor( frameBuffer->Width - 1, 0, 1, frameBuffer->Height ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( frameBuffer->Width - 1, 0, 1, frameBuffer->Height ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
|
||||
|
||||
GL( gles_glScissor( 0, 0, 0, 0 ) );
|
||||
GL( gles_glDisable( GL_SCISSOR_TEST ) );
|
||||
GL( glScissor( 0, 0, 0, 0 ) );
|
||||
GL( glDisable( GL_SCISSOR_TEST ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2180,7 +2133,7 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_rtcwquest_GLES3JNILib_onCreate( JNIEnv *
|
|||
}
|
||||
}
|
||||
|
||||
initialize_gl4es();
|
||||
// initialize_gl4es();
|
||||
|
||||
ovrAppThread * appThread = (ovrAppThread *) malloc( sizeof( ovrAppThread ) );
|
||||
ovrAppThread_Create( appThread, env, activity, activityClass );
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#define WEAPON_RECOIL 15.0f;
|
||||
|
||||
typedef struct {
|
||||
int clientNum;
|
||||
qboolean screen;
|
||||
float fov;
|
||||
qboolean weapon_stabilised;
|
||||
|
|
|
@ -166,7 +166,7 @@ void updateScopeAngles()
|
|||
}
|
||||
|
||||
void PortableMouseAbs(float x,float y);
|
||||
inline float clamp(float _min, float _val, float _max)
|
||||
float clamp(float _min, float _val, float _max)
|
||||
{
|
||||
return max(min(_val, _max), _min);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ LOCAL_CFLAGS += -g -funwind-tables -O3 -DBCMHOST -fvisibility=hidden -include in
|
|||
LOCAL_CFLAGS += -DNOX11
|
||||
LOCAL_CFLAGS += -DNO_GBM
|
||||
LOCAL_CFLAGS += -DDEFAULT_ES=2
|
||||
LOCAL_CFLAGS += -DNO_INIT_CONSTRUCTOR
|
||||
# LOCAL_CFLAGS += -DNO_INIT_CONSTRUCTOR
|
||||
|
||||
|
||||
LOCAL_LDLIBS := -ldl -llog -lEGL -lGLESv3
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
|
||||
|
||||
RTCW_BASE_CFLAGS = \
|
||||
-fsigned-char -O0 \
|
||||
-Ofast -ffast-math -fno-strict-aliasing -fstrength-reduce -ftree-vectorize -fsingle-precision-constant \
|
||||
-pipe -DPANDORA -DHAVE_GLES -DARM -DC_ONLY
|
||||
|
||||
#-DNEON -mfpu=neon
|
||||
|
||||
RTCW_BASE_LDFLAGS = \
|
||||
-Wl,--fix-cortex-a8 -llog
|
||||
-Wl, -llog
|
||||
|
||||
include $(TOP_DIR)/rtcw/Android_game.mk
|
||||
include $(TOP_DIR)/rtcw/Android_ui.mk
|
||||
|
|
|
@ -650,12 +650,12 @@ void *Sys_LoadDll_Wrapped( const char *name,
|
|||
int ( *systemcalls )( int, ... ) )
|
||||
#else
|
||||
void *Sys_LoadDll( const char *name,
|
||||
int( **entryPoint ) ( int, ... ),
|
||||
int ( *systemcalls )( int, ... ) )
|
||||
intptr_t( **entryPoint ) ( intptr_t, ... ),
|
||||
intptr_t ( *systemcalls )( intptr_t, ... ) )
|
||||
#endif
|
||||
{
|
||||
void *libHandle;
|
||||
void ( *dllEntry )( int ( *syscallptr )( int, ... ) );
|
||||
void ( *dllEntry )( intptr_t ( *syscallptr )( intptr_t, ... ) );
|
||||
char fname[MAX_OSPATH];
|
||||
char *homepath;
|
||||
char *basepath;
|
||||
|
|
|
@ -32,7 +32,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*
|
||||
* desc: Area Awareness System, stuff exported to the AI
|
||||
*
|
||||
* $Archive: /Wolf4/src/botlib/be_aas.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -72,12 +71,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//default travel flags
|
||||
|
||||
//----(SA) modified since slime is no longer deadly
|
||||
#define TFL_DEFAULT TFL_WALK | TFL_CROUCH | TFL_BARRIERJUMP | \
|
||||
TFL_JUMP | TFL_LADDER | \
|
||||
TFL_WALKOFFLEDGE | TFL_SWIM | TFL_WATERJUMP | \
|
||||
TFL_TELEPORT | TFL_ELEVATOR | TFL_AIR | \
|
||||
TFL_WATER | TFL_SLIME | \
|
||||
TFL_JUMPPAD | TFL_FUNCBOB
|
||||
#define TFL_DEFAULT ( ( TFL_WALK | TFL_CROUCH | TFL_BARRIERJUMP | \
|
||||
TFL_JUMP | TFL_LADDER | \
|
||||
TFL_WALKOFFLEDGE | TFL_SWIM | TFL_WATERJUMP | \
|
||||
TFL_TELEPORT | TFL_ELEVATOR | TFL_AIR | \
|
||||
TFL_WATER | TFL_SLIME | \
|
||||
TFL_JUMPPAD | TFL_FUNCBOB ) \
|
||||
& ~( TFL_JUMPPAD | TFL_ROCKETJUMP | TFL_BFGJUMP | TFL_GRAPPLEHOOK | TFL_DOUBLEJUMP | TFL_RAMPJUMP | TFL_STRAFEJUMP | TFL_LAVA ) )
|
||||
// RF, added that bottom line so it's the same as AICAST_TFL_DEFAULT
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -59,7 +59,6 @@ qboolean AAS_EntityCollision( int entnum,
|
|||
//for debugging
|
||||
void AAS_PrintFreeBSPLinks( char *str );
|
||||
//
|
||||
|
||||
#endif //AASINTERN
|
||||
|
||||
#define MAX_EPAIRKEY 128
|
||||
|
|
|
@ -41,8 +41,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_aas_def.h"
|
||||
|
||||
|
@ -400,7 +400,7 @@ void AAS_ParseBSPEntities( void ) {
|
|||
while ( PS_ReadToken( script, &token ) )
|
||||
{
|
||||
if ( strcmp( token.string, "{" ) ) {
|
||||
ScriptError( script, "invalid %s\n", token.string );
|
||||
ScriptError( script, "invalid %s", token.string );
|
||||
AAS_FreeBSPEntities();
|
||||
FreeScript( script );
|
||||
return;
|
||||
|
@ -416,7 +416,7 @@ void AAS_ParseBSPEntities( void ) {
|
|||
}
|
||||
bufsize += sizeof( bsp_epair_t );
|
||||
if ( token.type != TT_STRING ) {
|
||||
ScriptError( script, "invalid %s\n", token.string );
|
||||
ScriptError( script, "invalid %s", token.string );
|
||||
AAS_FreeBSPEntities();
|
||||
FreeScript( script );
|
||||
return;
|
||||
|
@ -432,7 +432,7 @@ void AAS_ParseBSPEntities( void ) {
|
|||
bufsize += strlen( token.string ) + 1;
|
||||
} //end while
|
||||
if ( strcmp( token.string, "}" ) ) {
|
||||
ScriptError( script, "missing }\n" );
|
||||
ScriptError( script, "missing }" );
|
||||
AAS_FreeBSPEntities();
|
||||
FreeScript( script );
|
||||
return;
|
||||
|
|
|
@ -44,10 +44,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_memory.h"
|
||||
#include "l_libvar.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_aas_def.h"
|
||||
#include "be_aas_cluster.h"
|
||||
|
||||
extern botlib_import_t botimport;
|
||||
|
||||
|
@ -129,7 +130,7 @@ int AAS_UpdatePortal( int areanum, int clusternum ) {
|
|||
} //end for
|
||||
//
|
||||
if ( portalnum == ( *aasworld ).numportals ) {
|
||||
AAS_Error( "no portal of area %d", areanum );
|
||||
AAS_Error( "no portal of area %d\n", areanum );
|
||||
return qtrue;
|
||||
} //end if
|
||||
//
|
||||
|
@ -151,13 +152,13 @@ int AAS_UpdatePortal( int areanum, int clusternum ) {
|
|||
} //end else if
|
||||
else
|
||||
{
|
||||
Log_Write( "portal using area %d is seperating more than two clusters\r\n", areanum );
|
||||
Log_Write( "portal using area %d is separating more than two clusters\r\n", areanum );
|
||||
//remove the cluster portal flag contents
|
||||
( *aasworld ).areasettings[areanum].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
return qfalse;
|
||||
} //end else
|
||||
if ( ( *aasworld ).portalindexsize >= AAS_MAX_PORTALINDEXSIZE ) {
|
||||
AAS_Error( "AAS_MAX_PORTALINDEXSIZE" );
|
||||
AAS_Error( "AAS_MAX_PORTALINDEXSIZE\n" );
|
||||
return qtrue;
|
||||
} //end if
|
||||
//set the area cluster number to the negative portal number
|
||||
|
@ -182,7 +183,7 @@ int AAS_FloodClusterAreas_r( int areanum, int clusternum ) {
|
|||
|
||||
//
|
||||
if ( areanum <= 0 || areanum >= ( *aasworld ).numareas ) {
|
||||
AAS_Error( "AAS_FloodClusterAreas_r: areanum out of range" );
|
||||
AAS_Error( "AAS_FloodClusterAreas_r: areanum out of range\n" );
|
||||
return qfalse;
|
||||
} //end if
|
||||
//if the area is already part of a cluster
|
||||
|
@ -193,7 +194,7 @@ int AAS_FloodClusterAreas_r( int areanum, int clusternum ) {
|
|||
//
|
||||
//there's a reachability going from one cluster to another only in one direction
|
||||
//
|
||||
AAS_Error( "cluster %d touched cluster %d at area %d\r\n",
|
||||
AAS_Error( "cluster %d touched cluster %d at area %d\n",
|
||||
clusternum, ( *aasworld ).areasettings[areanum].cluster, areanum );
|
||||
return qfalse;
|
||||
} //end if
|
||||
|
@ -424,7 +425,7 @@ int AAS_FindClusters( void ) {
|
|||
continue;
|
||||
}
|
||||
if ( ( *aasworld ).numclusters >= AAS_MAX_CLUSTERS ) {
|
||||
AAS_Error( "AAS_MAX_CLUSTERS" );
|
||||
AAS_Error( "AAS_MAX_CLUSTERS\n" );
|
||||
return qfalse;
|
||||
} //end if
|
||||
cluster = &( *aasworld ).clusters[( *aasworld ).numclusters];
|
||||
|
@ -462,7 +463,7 @@ void AAS_CreatePortals( void ) {
|
|||
//if the area is a cluster portal
|
||||
if ( ( *aasworld ).areasettings[i].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
if ( ( *aasworld ).numportals >= AAS_MAX_PORTALS ) {
|
||||
AAS_Error( "AAS_MAX_PORTALS" );
|
||||
AAS_Error( "AAS_MAX_PORTALS\n" );
|
||||
return;
|
||||
} //end if
|
||||
portal = &( *aasworld ).portals[( *aasworld ).numportals];
|
||||
|
@ -804,7 +805,7 @@ int AAS_GetAdjacentAreasWithLessPresenceTypes_r( int *areanums, int numareas, in
|
|||
//if the other area isn't already in the list
|
||||
if ( j == numareas ) {
|
||||
if ( numareas >= MAX_PORTALAREAS ) {
|
||||
AAS_Error( "MAX_PORTALAREAS" );
|
||||
AAS_Error( "MAX_PORTALAREAS\n" );
|
||||
return numareas;
|
||||
} //end if
|
||||
numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r( areanums, numareas, otherareanum );
|
||||
|
@ -842,7 +843,7 @@ int AAS_CheckAreaForPossiblePortals( int areanum ) {
|
|||
//
|
||||
memset( numareafrontfaces, 0, sizeof( numareafrontfaces ) );
|
||||
memset( numareabackfaces, 0, sizeof( numareabackfaces ) );
|
||||
numareas = numfrontfaces = numbackfaces = 0;
|
||||
numfrontfaces = numbackfaces = 0;
|
||||
numfrontareas = numbackareas = 0;
|
||||
frontplanenum = backplanenum = -1;
|
||||
//add any adjacent areas with less presence types
|
||||
|
@ -1006,57 +1007,67 @@ void AAS_RemoveAllPortals( void ) {
|
|||
( *aasworld ).areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
} //end for
|
||||
} //end of the function AAS_RemoveAllPortals
|
||||
/*
|
||||
|
||||
#if 0
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void AAS_FloodCluster_r(int areanum, int clusternum)
|
||||
{
|
||||
void AAS_FloodCluster_r( int areanum, int clusternum ) {
|
||||
int i, otherareanum;
|
||||
aas_face_t *face;
|
||||
aas_area_t *area;
|
||||
|
||||
//set cluster mark
|
||||
(*aasworld).areasettings[areanum].cluster = clusternum;
|
||||
( *aasworld ).areasettings[areanum].cluster = clusternum;
|
||||
//if the area is a portal
|
||||
//if ((*aasworld).areasettings[areanum].contents & AREACONTENTS_CLUSTERPORTAL) return;
|
||||
//
|
||||
area = &(*aasworld).areas[areanum];
|
||||
area = &( *aasworld ).areas[areanum];
|
||||
//use area faces to flood into adjacent areas
|
||||
for (i = 0; i < area->numfaces; i++)
|
||||
for ( i = 0; i < area->numfaces; i++ )
|
||||
{
|
||||
face = &(*aasworld).faces[abs((*aasworld).faceindex[area->firstface + i])];
|
||||
face = &( *aasworld ).faces[abs( ( *aasworld ).faceindex[area->firstface + i] )];
|
||||
//
|
||||
if (face->frontarea != areanum) otherareanum = face->frontarea;
|
||||
else otherareanum = face->backarea;
|
||||
if ( face->frontarea != areanum ) {
|
||||
otherareanum = face->frontarea;
|
||||
} else { otherareanum = face->backarea;}
|
||||
//if there's no area at the other side
|
||||
if (!otherareanum) continue;
|
||||
//if the area is a portal
|
||||
if ((*aasworld).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) continue;
|
||||
//if the area is already marked
|
||||
if ((*aasworld).areasettings[otherareanum].cluster) continue;
|
||||
//
|
||||
AAS_FloodCluster_r(otherareanum, clusternum);
|
||||
} //end for
|
||||
//use the reachabilities to flood into other areas
|
||||
for (i = 0; i < (*aasworld).areasettings[areanum].numreachableareas; i++)
|
||||
{
|
||||
otherareanum = (*aasworld).reachability[
|
||||
(*aasworld).areasettings[areanum].firstreachablearea + i].areanum;
|
||||
if (!otherareanum)
|
||||
{
|
||||
if ( !otherareanum ) {
|
||||
continue;
|
||||
AAS_Error("reachability %d has zero area\n", (*aasworld).areasettings[areanum].firstreachablearea + i);
|
||||
} //end if
|
||||
}
|
||||
//if the area is a portal
|
||||
if ((*aasworld).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) continue;
|
||||
if ( ( *aasworld ).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
}
|
||||
//if the area is already marked
|
||||
if ((*aasworld).areasettings[otherareanum].cluster) continue;
|
||||
if ( ( *aasworld ).areasettings[otherareanum].cluster ) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
AAS_FloodCluster_r(otherareanum, clusternum);
|
||||
AAS_FloodCluster_r( otherareanum, clusternum );
|
||||
} //end for
|
||||
//use the reachabilities to flood into other areas
|
||||
for ( i = 0; i < ( *aasworld ).areasettings[areanum].numreachableareas; i++ )
|
||||
{
|
||||
otherareanum = ( *aasworld ).reachability[
|
||||
( *aasworld ).areasettings[areanum].firstreachablearea + i].areanum;
|
||||
if ( !otherareanum ) {
|
||||
continue;
|
||||
AAS_Error( "reachability %d has zero area\n", ( *aasworld ).areasettings[areanum].firstreachablearea + i );
|
||||
} //end if
|
||||
//if the area is a portal
|
||||
if ( ( *aasworld ).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
}
|
||||
//if the area is already marked
|
||||
if ( ( *aasworld ).areasettings[otherareanum].cluster ) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
AAS_FloodCluster_r( otherareanum, clusternum );
|
||||
} //end for
|
||||
} //end of the function AAS_FloodCluster_r
|
||||
//===========================================================================
|
||||
|
@ -1065,19 +1076,17 @@ void AAS_FloodCluster_r(int areanum, int clusternum)
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void AAS_RemoveTeleporterPortals(void)
|
||||
{
|
||||
void AAS_RemoveTeleporterPortals( void ) {
|
||||
int i, j, areanum;
|
||||
|
||||
for (i = 1; i < (*aasworld).numareas; i++)
|
||||
for ( i = 1; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
for (j = 0; j < (*aasworld).areasettings[i].numreachableareas; j++)
|
||||
for ( j = 0; j < ( *aasworld ).areasettings[i].numreachableareas; j++ )
|
||||
{
|
||||
areanum = (*aasworld).reachability[(*aasworld).areasettings[i].firstreachablearea + j].areanum;
|
||||
if ((*aasworld).reachability[(*aasworld).areasettings[i].firstreachablearea + j].traveltype == TRAVEL_TELEPORT)
|
||||
{
|
||||
(*aasworld).areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
(*aasworld).areasettings[areanum].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
areanum = ( *aasworld ).reachability[( *aasworld ).areasettings[i].firstreachablearea + j].areanum;
|
||||
if ( ( *aasworld ).reachability[( *aasworld ).areasettings[i].firstreachablearea + j].traveltype == TRAVEL_TELEPORT ) {
|
||||
( *aasworld ).areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
( *aasworld ).areasettings[areanum].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
break;
|
||||
} //end if
|
||||
} //end for
|
||||
|
@ -1089,27 +1098,31 @@ void AAS_RemoveTeleporterPortals(void)
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void AAS_FloodClusterReachabilities(int clusternum)
|
||||
{
|
||||
void AAS_FloodClusterReachabilities( int clusternum ) {
|
||||
int i, j, areanum;
|
||||
|
||||
for (i = 1; i < (*aasworld).numareas; i++)
|
||||
for ( i = 1; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
//if this area already has a cluster set
|
||||
if ((*aasworld).areasettings[i].cluster) continue;
|
||||
if ( ( *aasworld ).areasettings[i].cluster ) {
|
||||
continue;
|
||||
}
|
||||
//if this area is a cluster portal
|
||||
if ((*aasworld).areasettings[i].contents & AREACONTENTS_CLUSTERPORTAL) continue;
|
||||
if ( ( *aasworld ).areasettings[i].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
}
|
||||
//loop over the reachable areas from this area
|
||||
for (j = 0; j < (*aasworld).areasettings[i].numreachableareas; j++)
|
||||
for ( j = 0; j < ( *aasworld ).areasettings[i].numreachableareas; j++ )
|
||||
{
|
||||
//the reachable area
|
||||
areanum = (*aasworld).reachability[(*aasworld).areasettings[i].firstreachablearea + j].areanum;
|
||||
areanum = ( *aasworld ).reachability[( *aasworld ).areasettings[i].firstreachablearea + j].areanum;
|
||||
//if this area is a cluster portal
|
||||
if ((*aasworld).areasettings[areanum].contents & AREACONTENTS_CLUSTERPORTAL) continue;
|
||||
if ( ( *aasworld ).areasettings[areanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
}
|
||||
//if this area has a cluster set
|
||||
if ((*aasworld).areasettings[areanum].cluster == clusternum)
|
||||
{
|
||||
AAS_FloodCluster_r(i, clusternum);
|
||||
if ( ( *aasworld ).areasettings[areanum].cluster == clusternum ) {
|
||||
AAS_FloodCluster_r( i, clusternum );
|
||||
i = 0;
|
||||
break;
|
||||
} //end if
|
||||
|
@ -1122,10 +1135,8 @@ void AAS_FloodClusterReachabilities(int clusternum)
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
*/
|
||||
/*
|
||||
void AAS_RemoveNotClusterClosingPortals(void)
|
||||
{
|
||||
|
||||
void AAS_RemoveNotClusterClosingPortals( void ) {
|
||||
int i, j, k, facenum, otherareanum, nonclosingportals;
|
||||
aas_area_t *area;
|
||||
aas_face_t *face;
|
||||
|
@ -1133,54 +1144,61 @@ void AAS_RemoveNotClusterClosingPortals(void)
|
|||
AAS_RemoveTeleporterPortals();
|
||||
//
|
||||
nonclosingportals = 0;
|
||||
for (i = 1; i < (*aasworld).numareas; i++)
|
||||
for ( i = 1; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
if (!((*aasworld).areasettings[i].contents & AREACONTENTS_CLUSTERPORTAL)) continue;
|
||||
if ( !( ( *aasworld ).areasettings[i].contents & AREACONTENTS_CLUSTERPORTAL ) ) {
|
||||
continue;
|
||||
}
|
||||
//find a non-portal area adjacent to the portal area and flood
|
||||
//the cluster from there
|
||||
area = &(*aasworld).areas[i];
|
||||
for (j = 0; j < area->numfaces; j++)
|
||||
area = &( *aasworld ).areas[i];
|
||||
for ( j = 0; j < area->numfaces; j++ )
|
||||
{
|
||||
facenum = abs((*aasworld).faceindex[area->firstface + j]);
|
||||
face = &(*aasworld).faces[facenum];
|
||||
facenum = abs( ( *aasworld ).faceindex[area->firstface + j] );
|
||||
face = &( *aasworld ).faces[facenum];
|
||||
//
|
||||
if (face->frontarea != i) otherareanum = face->frontarea;
|
||||
else otherareanum = face->backarea;
|
||||
if ( face->frontarea != i ) {
|
||||
otherareanum = face->frontarea;
|
||||
} else { otherareanum = face->backarea;}
|
||||
//
|
||||
if (!otherareanum) continue;
|
||||
if ( !otherareanum ) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if ((*aasworld).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL)
|
||||
{
|
||||
if ( ( *aasworld ).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
} //end if
|
||||
//reset all cluster fields
|
||||
//reset all cluster fields
|
||||
AAS_RemoveClusterAreas();
|
||||
//
|
||||
AAS_FloodCluster_r(otherareanum, 1);
|
||||
AAS_FloodClusterReachabilities(1);
|
||||
AAS_FloodCluster_r( otherareanum, 1 );
|
||||
AAS_FloodClusterReachabilities( 1 );
|
||||
//check if all adjacent non-portal areas have a cluster set
|
||||
for (k = 0; k < area->numfaces; k++)
|
||||
for ( k = 0; k < area->numfaces; k++ )
|
||||
{
|
||||
facenum = abs((*aasworld).faceindex[area->firstface + k]);
|
||||
face = &(*aasworld).faces[facenum];
|
||||
facenum = abs( ( *aasworld ).faceindex[area->firstface + k] );
|
||||
face = &( *aasworld ).faces[facenum];
|
||||
//
|
||||
if (face->frontarea != i) otherareanum = face->frontarea;
|
||||
else otherareanum = face->backarea;
|
||||
if ( face->frontarea != i ) {
|
||||
otherareanum = face->frontarea;
|
||||
} else { otherareanum = face->backarea;}
|
||||
//
|
||||
if (!otherareanum) continue;
|
||||
if ( !otherareanum ) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if ((*aasworld).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL)
|
||||
{
|
||||
if ( ( *aasworld ).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
} //end if
|
||||
//
|
||||
if (!(*aasworld).areasettings[otherareanum].cluster) break;
|
||||
//
|
||||
if ( !( *aasworld ).areasettings[otherareanum].cluster ) {
|
||||
break;
|
||||
}
|
||||
} //end for
|
||||
//if all adjacent non-portal areas have a cluster set then the portal
|
||||
//didn't seal a cluster
|
||||
if (k >= area->numfaces)
|
||||
{
|
||||
(*aasworld).areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
//if all adjacent non-portal areas have a cluster set then the portal
|
||||
//didn't seal a cluster
|
||||
if ( k >= area->numfaces ) {
|
||||
( *aasworld ).areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
nonclosingportals++;
|
||||
//recheck all the other portals again
|
||||
i = 0;
|
||||
|
@ -1188,7 +1206,7 @@ void AAS_RemoveNotClusterClosingPortals(void)
|
|||
} //end if
|
||||
} //end for
|
||||
} //end for
|
||||
botimport.Print(PRT_MESSAGE, "\r%6d non closing portals removed\n", nonclosingportals);
|
||||
botimport.Print( PRT_MESSAGE, "\r%6d non closing portals removed\n", nonclosingportals );
|
||||
} //end of the function AAS_RemoveNotClusterClosingPortals*/
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -1196,9 +1214,8 @@ void AAS_RemoveNotClusterClosingPortals(void)
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
/*
|
||||
void AAS_RemoveNotClusterClosingPortals(void)
|
||||
{
|
||||
|
||||
void AAS_RemoveNotClusterClosingPortals( void ) {
|
||||
int i, j, facenum, otherareanum, nonclosingportals, numseperatedclusters;
|
||||
aas_area_t *area;
|
||||
aas_face_t *face;
|
||||
|
@ -1206,73 +1223,86 @@ void AAS_RemoveNotClusterClosingPortals(void)
|
|||
AAS_RemoveTeleporterPortals();
|
||||
//
|
||||
nonclosingportals = 0;
|
||||
for (i = 1; i < (*aasworld).numareas; i++)
|
||||
for ( i = 1; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
if (!((*aasworld).areasettings[i].contents & AREACONTENTS_CLUSTERPORTAL)) continue;
|
||||
if ( !( ( *aasworld ).areasettings[i].contents & AREACONTENTS_CLUSTERPORTAL ) ) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
numseperatedclusters = 0;
|
||||
//reset all cluster fields
|
||||
AAS_RemoveClusterAreas();
|
||||
//find a non-portal area adjacent to the portal area and flood
|
||||
//the cluster from there
|
||||
area = &(*aasworld).areas[i];
|
||||
for (j = 0; j < area->numfaces; j++)
|
||||
area = &( *aasworld ).areas[i];
|
||||
for ( j = 0; j < area->numfaces; j++ )
|
||||
{
|
||||
facenum = abs((*aasworld).faceindex[area->firstface + j]);
|
||||
face = &(*aasworld).faces[facenum];
|
||||
facenum = abs( ( *aasworld ).faceindex[area->firstface + j] );
|
||||
face = &( *aasworld ).faces[facenum];
|
||||
//
|
||||
if (face->frontarea != i) otherareanum = face->frontarea;
|
||||
else otherareanum = face->backarea;
|
||||
if ( face->frontarea != i ) {
|
||||
otherareanum = face->frontarea;
|
||||
} else { otherareanum = face->backarea;}
|
||||
//if not solid at the other side of the face
|
||||
if (!otherareanum) continue;
|
||||
if ( !otherareanum ) {
|
||||
continue;
|
||||
}
|
||||
//don't flood into other portals
|
||||
if ((*aasworld).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) continue;
|
||||
if ( ( *aasworld ).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
}
|
||||
//if the area already has a cluster set
|
||||
if ((*aasworld).areasettings[otherareanum].cluster) continue;
|
||||
if ( ( *aasworld ).areasettings[otherareanum].cluster ) {
|
||||
continue;
|
||||
}
|
||||
//another cluster is seperated by this portal
|
||||
numseperatedclusters++;
|
||||
//flood the cluster
|
||||
AAS_FloodCluster_r(otherareanum, numseperatedclusters);
|
||||
AAS_FloodClusterReachabilities(numseperatedclusters);
|
||||
AAS_FloodCluster_r( otherareanum, numseperatedclusters );
|
||||
AAS_FloodClusterReachabilities( numseperatedclusters );
|
||||
} //end for
|
||||
//use the reachabilities to flood into other areas
|
||||
for (j = 0; j < (*aasworld).areasettings[i].numreachableareas; j++)
|
||||
//use the reachabilities to flood into other areas
|
||||
for ( j = 0; j < ( *aasworld ).areasettings[i].numreachableareas; j++ )
|
||||
{
|
||||
otherareanum = (*aasworld).reachability[
|
||||
(*aasworld).areasettings[i].firstreachablearea + j].areanum;
|
||||
otherareanum = ( *aasworld ).reachability[
|
||||
( *aasworld ).areasettings[i].firstreachablearea + j].areanum;
|
||||
//this should never be qtrue but we check anyway
|
||||
if (!otherareanum) continue;
|
||||
if ( !otherareanum ) {
|
||||
continue;
|
||||
}
|
||||
//don't flood into other portals
|
||||
if ((*aasworld).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) continue;
|
||||
if ( ( *aasworld ).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
}
|
||||
//if the area already has a cluster set
|
||||
if ((*aasworld).areasettings[otherareanum].cluster) continue;
|
||||
if ( ( *aasworld ).areasettings[otherareanum].cluster ) {
|
||||
continue;
|
||||
}
|
||||
//another cluster is seperated by this portal
|
||||
numseperatedclusters++;
|
||||
//flood the cluster
|
||||
AAS_FloodCluster_r(otherareanum, numseperatedclusters);
|
||||
AAS_FloodClusterReachabilities(numseperatedclusters);
|
||||
AAS_FloodCluster_r( otherareanum, numseperatedclusters );
|
||||
AAS_FloodClusterReachabilities( numseperatedclusters );
|
||||
} //end for
|
||||
//a portal must seperate no more and no less than 2 clusters
|
||||
if (numseperatedclusters != 2)
|
||||
{
|
||||
(*aasworld).areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
//a portal must seperate no more and no less than 2 clusters
|
||||
if ( numseperatedclusters != 2 ) {
|
||||
( *aasworld ).areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;
|
||||
nonclosingportals++;
|
||||
//recheck all the other portals again
|
||||
i = 0;
|
||||
} //end if
|
||||
} //end for
|
||||
botimport.Print(PRT_MESSAGE, "\r%6d non closing portals removed\n", nonclosingportals);
|
||||
botimport.Print( PRT_MESSAGE, "\r%6d non closing portals removed\n", nonclosingportals );
|
||||
} //end of the function AAS_RemoveNotClusterClosingPortals
|
||||
*/
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
/*
|
||||
void AAS_AddTeleporterPortals(void)
|
||||
{
|
||||
|
||||
void AAS_AddTeleporterPortals( void ) {
|
||||
int j, area2num, facenum, otherareanum;
|
||||
char *target, *targetname, *classname;
|
||||
bsp_entity_t *entities, *ent, *dest;
|
||||
|
@ -1285,143 +1315,144 @@ void AAS_AddTeleporterPortals(void)
|
|||
|
||||
entities = AAS_ParseBSPEntities();
|
||||
|
||||
for (ent = entities; ent; ent = ent->next)
|
||||
for ( ent = entities; ent; ent = ent->next )
|
||||
{
|
||||
classname = AAS_ValueForBSPEpairKey(ent, "classname");
|
||||
if (classname && !strcmp(classname, "misc_teleporter"))
|
||||
{
|
||||
if (!AAS_VectorForBSPEpairKey(ent, "origin", origin))
|
||||
{
|
||||
botimport.Print(PRT_ERROR, "teleporter (%s) without origin\n", target);
|
||||
classname = AAS_ValueForBSPEpairKey( ent, "classname" );
|
||||
if ( classname && !strcmp( classname, "misc_teleporter" ) ) {
|
||||
if ( !AAS_VectorForBSPEpairKey( ent, "origin", origin ) ) {
|
||||
botimport.Print( PRT_ERROR, "teleporter (%s) without origin\n", target );
|
||||
continue;
|
||||
} //end if
|
||||
//
|
||||
target = AAS_ValueForBSPEpairKey(ent, "target");
|
||||
if (!target)
|
||||
{
|
||||
botimport.Print(PRT_ERROR, "teleporter (%s) without target\n", target);
|
||||
//
|
||||
target = AAS_ValueForBSPEpairKey( ent, "target" );
|
||||
if ( !target ) {
|
||||
botimport.Print( PRT_ERROR, "teleporter (%s) without target\n", target );
|
||||
continue;
|
||||
} //end if
|
||||
for (dest = entities; dest; dest = dest->next)
|
||||
for ( dest = entities; dest; dest = dest->next )
|
||||
{
|
||||
classname = AAS_ValueForBSPEpairKey(dest, "classname");
|
||||
if (classname && !strcmp(classname, "misc_teleporter_dest"))
|
||||
{
|
||||
targetname = AAS_ValueForBSPEpairKey(dest, "targetname");
|
||||
if (targetname && !strcmp(targetname, target))
|
||||
{
|
||||
classname = AAS_ValueForBSPEpairKey( dest, "classname" );
|
||||
if ( classname && !strcmp( classname, "misc_teleporter_dest" ) ) {
|
||||
targetname = AAS_ValueForBSPEpairKey( dest, "targetname" );
|
||||
if ( targetname && !strcmp( targetname, target ) ) {
|
||||
break;
|
||||
} //end if
|
||||
} //end if
|
||||
} //end for
|
||||
if (!dest)
|
||||
{
|
||||
botimport.Print(PRT_ERROR, "teleporter without destination (%s)\n", target);
|
||||
if ( !dest ) {
|
||||
botimport.Print( PRT_ERROR, "teleporter without destination (%s)\n", target );
|
||||
continue;
|
||||
} //end if
|
||||
if (!AAS_VectorForBSPEpairKey(dest, "origin", destorigin))
|
||||
{
|
||||
botimport.Print(PRT_ERROR, "teleporter destination (%s) without origin\n", target);
|
||||
if ( !AAS_VectorForBSPEpairKey( dest, "origin", destorigin ) ) {
|
||||
botimport.Print( PRT_ERROR, "teleporter destination (%s) without origin\n", target );
|
||||
continue;
|
||||
} //end if
|
||||
destorigin[2] += 24; //just for q2e1m2, the dork has put the telepads in the ground
|
||||
VectorCopy(destorigin, end);
|
||||
VectorCopy( destorigin, end );
|
||||
end[2] -= 100;
|
||||
trace = AAS_TraceClientBBox(destorigin, end, PRESENCE_CROUCH, -1);
|
||||
if (trace.startsolid)
|
||||
{
|
||||
botimport.Print(PRT_ERROR, "teleporter destination (%s) in solid\n", target);
|
||||
trace = AAS_TraceClientBBox( destorigin, end, PRESENCE_CROUCH, -1 );
|
||||
if ( trace.startsolid ) {
|
||||
botimport.Print( PRT_ERROR, "teleporter destination (%s) in solid\n", target );
|
||||
continue;
|
||||
} //end if
|
||||
VectorCopy(trace.endpos, destorigin);
|
||||
area2num = AAS_PointAreaNum(destorigin);
|
||||
VectorCopy( trace.endpos, destorigin );
|
||||
area2num = AAS_PointAreaNum( destorigin );
|
||||
//reset all cluster fields
|
||||
for (j = 0; j < (*aasworld).numareas; j++)
|
||||
for ( j = 0; j < ( *aasworld ).numareas; j++ )
|
||||
{
|
||||
(*aasworld).areasettings[j].cluster = 0;
|
||||
( *aasworld ).areasettings[j].cluster = 0;
|
||||
} //end for
|
||||
//
|
||||
VectorSet( mins, -8, -8, 8 );
|
||||
VectorSet( maxs, 8, 8, 24 );
|
||||
//
|
||||
VectorSet(mins, -8, -8, 8);
|
||||
VectorSet(maxs, 8, 8, 24);
|
||||
AAS_PresenceTypeBoundingBox( PRESENCE_CROUCH, bbmins, bbmaxs );
|
||||
//
|
||||
AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, bbmins, bbmaxs);
|
||||
//
|
||||
VectorAdd(origin, mins, mins);
|
||||
VectorAdd(origin, maxs, maxs);
|
||||
VectorAdd( origin, mins, mins );
|
||||
VectorAdd( origin, maxs, maxs );
|
||||
//add bounding box size
|
||||
VectorSubtract(mins, bbmaxs, mins);
|
||||
VectorSubtract(maxs, bbmins, maxs);
|
||||
VectorSubtract( mins, bbmaxs, mins );
|
||||
VectorSubtract( maxs, bbmins, maxs );
|
||||
//link an invalid (-1) entity
|
||||
areas = AAS_AASLinkEntity(mins, maxs, -1);
|
||||
areas = AAS_AASLinkEntity( mins, maxs, -1 );
|
||||
//
|
||||
for (link = areas; link; link = link->next_area)
|
||||
for ( link = areas; link; link = link->next_area )
|
||||
{
|
||||
if (!AAS_AreaGrounded(link->areanum)) continue;
|
||||
if ( !AAS_AreaGrounded( link->areanum ) ) {
|
||||
continue;
|
||||
}
|
||||
//add the teleporter portal mark
|
||||
(*aasworld).areasettings[link->areanum].contents |= AREACONTENTS_CLUSTERPORTAL |
|
||||
AREACONTENTS_TELEPORTAL;
|
||||
( *aasworld ).areasettings[link->areanum].contents |= AREACONTENTS_CLUSTERPORTAL |
|
||||
AREACONTENTS_TELEPORTAL;
|
||||
} //end for
|
||||
//
|
||||
for (link = areas; link; link = link->next_area)
|
||||
//
|
||||
for ( link = areas; link; link = link->next_area )
|
||||
{
|
||||
if (!AAS_AreaGrounded(link->areanum)) continue;
|
||||
if ( !AAS_AreaGrounded( link->areanum ) ) {
|
||||
continue;
|
||||
}
|
||||
//find a non-portal area adjacent to the portal area and flood
|
||||
//the cluster from there
|
||||
area = &(*aasworld).areas[link->areanum];
|
||||
for (j = 0; j < area->numfaces; j++)
|
||||
area = &( *aasworld ).areas[link->areanum];
|
||||
for ( j = 0; j < area->numfaces; j++ )
|
||||
{
|
||||
facenum = abs((*aasworld).faceindex[area->firstface + j]);
|
||||
face = &(*aasworld).faces[facenum];
|
||||
facenum = abs( ( *aasworld ).faceindex[area->firstface + j] );
|
||||
face = &( *aasworld ).faces[facenum];
|
||||
//
|
||||
if (face->frontarea != link->areanum) otherareanum = face->frontarea;
|
||||
else otherareanum = face->backarea;
|
||||
if ( face->frontarea != link->areanum ) {
|
||||
otherareanum = face->frontarea;
|
||||
} else { otherareanum = face->backarea;}
|
||||
//
|
||||
if (!otherareanum) continue;
|
||||
if ( !otherareanum ) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if ((*aasworld).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL)
|
||||
{
|
||||
if ( ( *aasworld ).areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL ) {
|
||||
continue;
|
||||
} //end if
|
||||
//
|
||||
AAS_FloodCluster_r(otherareanum, 1);
|
||||
//
|
||||
AAS_FloodCluster_r( otherareanum, 1 );
|
||||
} //end for
|
||||
} //end for
|
||||
//if the teleport destination IS in the same cluster
|
||||
if ((*aasworld).areasettings[area2num].cluster)
|
||||
{
|
||||
for (link = areas; link; link = link->next_area)
|
||||
//if the teleport destination IS in the same cluster
|
||||
if ( ( *aasworld ).areasettings[area2num].cluster ) {
|
||||
for ( link = areas; link; link = link->next_area )
|
||||
{
|
||||
if (!AAS_AreaGrounded(link->areanum)) continue;
|
||||
if ( !AAS_AreaGrounded( link->areanum ) ) {
|
||||
continue;
|
||||
}
|
||||
//add the teleporter portal mark
|
||||
(*aasworld).areasettings[link->areanum].contents &= ~(AREACONTENTS_CLUSTERPORTAL |
|
||||
AREACONTENTS_TELEPORTAL);
|
||||
( *aasworld ).areasettings[link->areanum].contents &= ~( AREACONTENTS_CLUSTERPORTAL |
|
||||
AREACONTENTS_TELEPORTAL );
|
||||
} //end for
|
||||
} //end if
|
||||
} //end if
|
||||
} //end for
|
||||
AAS_FreeBSPEntities(entities);
|
||||
} //end of the function AAS_AddTeleporterPortals*/
|
||||
/*
|
||||
AAS_FreeBSPEntities( entities );
|
||||
} //end of the function AAS_AddTeleporterPortals
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void AAS_AddTeleporterPortals(void)
|
||||
{
|
||||
void AAS_AddTeleporterPortals( void ) {
|
||||
int i, j, areanum;
|
||||
|
||||
for (i = 1; i < (*aasworld).numareas; i++)
|
||||
for ( i = 1; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
for (j = 0; j < (*aasworld).areasettings[i].numreachableareas; j++)
|
||||
for ( j = 0; j < ( *aasworld ).areasettings[i].numreachableareas; j++ )
|
||||
{
|
||||
if ((*aasworld).reachability[(*aasworld).areasettings[i].firstreachablearea + j].traveltype != TRAVEL_TELEPORT) continue;
|
||||
areanum = (*aasworld).reachability[(*aasworld).areasettings[i].firstreachablearea + j].areanum;
|
||||
(*aasworld).areasettings[areanum].contents |= AREACONTENTS_CLUSTERPORTAL;
|
||||
if ( ( *aasworld ).reachability[( *aasworld ).areasettings[i].firstreachablearea + j].traveltype != TRAVEL_TELEPORT ) {
|
||||
continue;
|
||||
}
|
||||
areanum = ( *aasworld ).reachability[( *aasworld ).areasettings[i].firstreachablearea + j].areanum;
|
||||
( *aasworld ).areasettings[areanum].contents |= AREACONTENTS_CLUSTERPORTAL;
|
||||
} //end for
|
||||
} //end for
|
||||
} //end of the function AAS_AddTeleporterPortals*/
|
||||
#endif
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
|
|
|
@ -38,6 +38,5 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#ifdef AASINTERN
|
||||
//initialize the AAS clustering
|
||||
void AAS_InitClustering( void );
|
||||
void AAS_SetViewPortalsAsClusterPortals( void );
|
||||
#endif //AASINTERN
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_struct.h"
|
||||
#include "l_libvar.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_aas_def.h"
|
||||
|
|
|
@ -35,28 +35,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../game/q_shared.h"
|
||||
|
||||
//debugging on
|
||||
#define AAS_DEBUG
|
||||
|
||||
//#define MAX_CLIENTS 128
|
||||
//#define MAX_MODELS 256 // these are sent over the net as 8 bits
|
||||
//#define MAX_SOUNDS 256 // so they cannot be blindly increased
|
||||
//#define MAX_CONFIGSTRINGS 1024
|
||||
#define MAX_CONFIGSTRINGS 2048 //----(SA) upped
|
||||
|
||||
//#define CS_SCORES 32
|
||||
//#define CS_MODELS (CS_SCORES+MAX_CLIENTS)
|
||||
//#define CS_SOUNDS (CS_MODELS+MAX_MODELS)
|
||||
|
||||
#define DF_AASENTNUMBER( x ) ( x - ( *aasworlds ).entities )
|
||||
#define DF_NUMBERAASENT( x ) ( &( *aasworlds ).entities[x] )
|
||||
#define DF_AASENTCLIENT( x ) ( x - ( *aasworlds ).entities - 1 )
|
||||
#define DF_CLIENTAASENT( x ) ( &( *aasworlds ).entities[x + 1] )
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH MAX_QPATH
|
||||
#endif
|
||||
|
||||
//string index (for model, sound and image index)
|
||||
typedef struct aas_stringindex_s
|
||||
{
|
||||
|
@ -122,7 +112,6 @@ typedef struct aas_settings_s
|
|||
float sv_maxwaterjump;
|
||||
float sv_maxbarrier;
|
||||
float sv_jumpvel;
|
||||
qboolean sv_allowladders;
|
||||
} aas_settings_t;
|
||||
|
||||
//routing cache
|
||||
|
@ -140,6 +129,21 @@ typedef struct aas_routingcache_s
|
|||
unsigned short int traveltimes[1]; //travel time for every area (variable sized)
|
||||
} aas_routingcache_t;
|
||||
|
||||
//32bit values for pointers to allow loading cache on non-32 bit platforms
|
||||
typedef struct
|
||||
{
|
||||
int size; //size of the routing cache
|
||||
float time; //last time accessed or updated
|
||||
int cluster; //cluster the cache is for
|
||||
int areanum; //area the cache is created for
|
||||
vec3_t origin; //origin within the area
|
||||
float starttraveltime; //travel time to start with
|
||||
int travelflags; //combinations of the travel flags
|
||||
int prev_, next_;
|
||||
int reachabilities_; //reachabilities used for routing
|
||||
unsigned short int traveltimes[1]; //travel time for every area (variable sized)
|
||||
} aas_routingcache_32_t;
|
||||
|
||||
//fields for the routing algorithm
|
||||
typedef struct aas_routingupdate_s
|
||||
{
|
||||
|
@ -182,8 +186,8 @@ typedef struct aas_s
|
|||
float time;
|
||||
int numframes;
|
||||
//name of the aas file
|
||||
char filename[MAX_PATH];
|
||||
char mapname[MAX_PATH];
|
||||
char filename[MAX_QPATH];
|
||||
char mapname[MAX_QPATH];
|
||||
//bounding boxes
|
||||
int numbboxes;
|
||||
aas_bbox_t *bboxes;
|
||||
|
|
|
@ -43,8 +43,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_utils.h"
|
||||
#include "l_log.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_def.h"
|
||||
|
@ -146,7 +146,6 @@ int AAS_UpdateEntity( int entnum, bot_entitystate_t *state ) {
|
|||
//absolute mins and maxs
|
||||
VectorAdd( ent->i.mins, ent->i.origin, absmins );
|
||||
VectorAdd( ent->i.maxs, ent->i.origin, absmaxs );
|
||||
|
||||
//unlink the entity
|
||||
AAS_UnlinkFromAreas( ent->areas );
|
||||
//relink the entity to the AAS areas (use the larges bbox)
|
||||
|
@ -352,8 +351,8 @@ int AAS_NearestEntity( vec3_t origin, int modelindex ) {
|
|||
continue;
|
||||
}
|
||||
VectorSubtract( ent->i.origin, origin, dir );
|
||||
if ( abs( dir[0] ) < 40 ) {
|
||||
if ( abs( dir[1] ) < 40 ) {
|
||||
if ( fabs( dir[0] ) < 40 ) {
|
||||
if ( fabs( dir[1] ) < 40 ) {
|
||||
dist = VectorLength( dir );
|
||||
if ( dist < bestdist ) {
|
||||
bestdist = dist;
|
||||
|
@ -467,7 +466,7 @@ void AAS_SetAASBlockingEntity( vec3_t absmin, vec3_t absmax, qboolean blocking )
|
|||
int numareas, i, w;
|
||||
//
|
||||
// check for resetting AAS blocking
|
||||
if ( VectorCompare( absmin, absmax ) && blocking < 0 ) {
|
||||
if ( VectorCompare( absmin, absmax ) && !blocking ) {
|
||||
for ( w = 0; w < MAX_AAS_WORLDS; w++ ) {
|
||||
AAS_SetCurrentWorld( w );
|
||||
//
|
||||
|
|
|
@ -43,8 +43,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_libvar.h"
|
||||
#include "l_utils.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_def.h"
|
||||
|
@ -322,7 +322,7 @@ void AAS_FileInfo( void ) {
|
|||
} //end of the function AAS_FileInfo
|
||||
#endif //AASFILEDEBUG
|
||||
//===========================================================================
|
||||
// allocate memory and read a lump of a AAS file
|
||||
// allocate memory and read a lump of an AAS file
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
|
@ -341,7 +341,7 @@ char *AAS_LoadAASLump( fileHandle_t fp, int offset, int length, int *lastoffset
|
|||
AAS_Error( "can't seek to aas lump\n" );
|
||||
AAS_DumpAASData();
|
||||
botimport.FS_FCloseFile( fp );
|
||||
return 0;
|
||||
return NULL;
|
||||
} //end if
|
||||
} //end if
|
||||
//allocate memory
|
||||
|
|
|
@ -44,8 +44,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_struct.h"
|
||||
#include "l_log.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_def.h"
|
||||
|
@ -65,9 +65,9 @@ void QDECL AAS_Error( char *fmt, ... ) {
|
|||
va_list arglist;
|
||||
|
||||
va_start( arglist, fmt );
|
||||
vsprintf( str, fmt, arglist );
|
||||
vsnprintf(str, sizeof(str), fmt, arglist);
|
||||
va_end( arglist );
|
||||
botimport.Print( PRT_FATAL, str );
|
||||
botimport.Print(PRT_FATAL, "%s", str);
|
||||
} //end of the function AAS_Error
|
||||
|
||||
// Ridah, multiple AAS worlds
|
||||
|
@ -242,7 +242,7 @@ void AAS_ContinueInit( float time ) {
|
|||
}
|
||||
//save the AAS file
|
||||
if ( AAS_WriteAASFile( ( *aasworld ).filename ) ) {
|
||||
botimport.Print( PRT_MESSAGE, "%s written succesfully\n", ( *aasworld ).filename );
|
||||
botimport.Print(PRT_MESSAGE, "%s written successfully\n", ( *aasworld ).filename);
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
|
@ -318,10 +318,9 @@ float AAS_Time( void ) {
|
|||
//===========================================================================
|
||||
int AAS_LoadFiles( const char *mapname ) {
|
||||
int errnum;
|
||||
char aasfile[MAX_PATH];
|
||||
// char bspfile[MAX_PATH];
|
||||
char aasfile[MAX_QPATH];
|
||||
|
||||
strcpy( ( *aasworld ).mapname, mapname );
|
||||
Q_strncpyz( ( *aasworld ).mapname, mapname, sizeof( ( *aasworld ).mapname ) );
|
||||
//NOTE: first reset the entity links into the AAS areas and BSP leaves
|
||||
// the AAS link heap and BSP link heap are reset after respectively the
|
||||
// AAS file and BSP file are loaded
|
||||
|
@ -332,14 +331,14 @@ int AAS_LoadFiles( const char *mapname ) {
|
|||
AAS_LoadBSPFile();
|
||||
|
||||
//load the aas file
|
||||
Com_sprintf( aasfile, MAX_PATH, "maps/%s.aas", mapname );
|
||||
Com_sprintf( aasfile, sizeof( aasfile ), "maps/%s.aas", mapname );
|
||||
errnum = AAS_LoadAASFile( aasfile );
|
||||
if ( errnum != BLERR_NOERROR ) {
|
||||
return errnum;
|
||||
}
|
||||
|
||||
botimport.Print( PRT_MESSAGE, "loaded %s\n", aasfile );
|
||||
strncpy( ( *aasworld ).filename, aasfile, MAX_PATH );
|
||||
Q_strncpyz( ( *aasworld ).filename, aasfile, sizeof( ( *aasworld ).filename ) );
|
||||
return BLERR_NOERROR;
|
||||
} //end of the function AAS_LoadFiles
|
||||
//===========================================================================
|
||||
|
@ -353,20 +352,21 @@ int AAS_LoadFiles( const char *mapname ) {
|
|||
// Ridah, modified this for multiple AAS files
|
||||
|
||||
int AAS_LoadMap( const char *mapname ) {
|
||||
#define MAPNAME_LEN 256
|
||||
int errnum;
|
||||
int i;
|
||||
char this_mapname[256], intstr[4];
|
||||
char this_mapname[MAPNAME_LEN], intstr[4];
|
||||
qboolean loaded = qfalse;
|
||||
int missingErrNum = 0; // TTimo: init
|
||||
int missingErrNum = 0;
|
||||
|
||||
for ( i = 0; i < MAX_AAS_WORLDS; i++ )
|
||||
{
|
||||
AAS_SetCurrentWorld( i );
|
||||
|
||||
strncpy( this_mapname, mapname, 256 );
|
||||
strncat( this_mapname, "_b", 256 );
|
||||
sprintf( intstr, "%i", i );
|
||||
strncat( this_mapname, intstr, 256 );
|
||||
Q_strncpyz( this_mapname, mapname, sizeof( this_mapname ) );
|
||||
Q_strcat( this_mapname, sizeof( this_mapname ) - strlen( this_mapname ) - 1, "_b" );
|
||||
Com_sprintf( intstr, sizeof( intstr ), "%i", i);
|
||||
Q_strcat( this_mapname, sizeof( this_mapname ) - strlen( this_mapname ) - 1, intstr );
|
||||
|
||||
//if no mapname is provided then the string indexes are updated
|
||||
if ( !mapname ) {
|
||||
|
@ -423,7 +423,7 @@ int AAS_Setup( void ) {
|
|||
AAS_SetCurrentWorld( 0 );
|
||||
|
||||
( *aasworlds ).maxclients = (int) LibVarValue( "maxclients", "128" );
|
||||
( *aasworlds ).maxentities = (int) LibVarValue( "maxentities", "1024" );
|
||||
( *aasworlds ).maxentities = (int) LibVarValue( "maxentities", "2048" );
|
||||
//allocate memory for the entities
|
||||
if ( ( *aasworld ).entities ) {
|
||||
FreeMemory( ( *aasworld ).entities );
|
||||
|
@ -480,7 +480,7 @@ void AAS_Shutdown( void ) {
|
|||
}
|
||||
|
||||
//NOTE: as soon as a new .bsp file is loaded the .bsp file memory is
|
||||
// freed an reallocated, so there's no need to free that memory here
|
||||
// freed and reallocated, so there's no need to free that memory here
|
||||
//print shutdown
|
||||
botimport.Print( PRT_MESSAGE, "AAS shutdown.\n" );
|
||||
} //end of the function AAS_Shutdown
|
||||
|
|
|
@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
extern aas_t( *aasworld );
|
||||
|
||||
//AAS error message
|
||||
void QDECL AAS_Error( char *fmt, ... );
|
||||
void QDECL AAS_Error(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
//set AAS initialized
|
||||
void AAS_SetInitialized( void );
|
||||
//setup AAS with the given number of entities and clients
|
||||
|
|
|
@ -41,8 +41,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_aas_def.h"
|
||||
|
||||
|
@ -97,9 +97,8 @@ void AAS_InitSettings( void ) {
|
|||
aassettings.sv_maxwaterjump = 17;
|
||||
// Ridah, calculate maxbarrier according to jumpvel and gravity
|
||||
aassettings.sv_jumpvel = 270;
|
||||
aassettings.sv_maxbarrier = 49; //-0.8 + (0.5 * aassettings.sv_gravity * (aassettings.sv_jumpvel / aassettings.sv_gravity) * (aassettings.sv_jumpvel / aassettings.sv_gravity));
|
||||
aassettings.sv_maxbarrier = 49; // -0.8 + ( 0.5 * aassettings.sv_gravity * ( aassettings.sv_jumpvel / aassettings.sv_gravity ) * ( aassettings.sv_jumpvel / aassettings.sv_gravity ) );
|
||||
// done.
|
||||
|
||||
} //end of the function AAS_InitSettings
|
||||
//===========================================================================
|
||||
// returns qtrue if the bot is against a ladder
|
||||
|
@ -161,7 +160,7 @@ int AAS_AgainstLadder( vec3_t origin, int ms_areanum ) {
|
|||
//get the plane the face is in
|
||||
plane = &( *aasworld ).planes[face->planenum ^ side];
|
||||
//if the origin is pretty close to the plane
|
||||
if ( abs( DotProduct( plane->normal, origin ) - plane->dist ) < 3 ) {
|
||||
if ( fabs( DotProduct( plane->normal, origin ) - plane->dist ) < 3 ) {
|
||||
if ( AAS_PointInsideFace( abs( facenum ), origin, 0.1 ) ) {
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -378,17 +377,6 @@ void AAS_Accelerate( vec3_t velocity, float frametime, vec3_t wishdir, float wis
|
|||
}
|
||||
} //end of the function AAS_Accelerate
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void AAS_AirControl( vec3_t start, vec3_t end, vec3_t velocity, vec3_t cmdmove ) {
|
||||
vec3_t dir;
|
||||
|
||||
VectorSubtract( end, start, dir );
|
||||
} //end of the function AAS_AirControl
|
||||
//===========================================================================
|
||||
// applies ground friction to the given velocity
|
||||
//
|
||||
// Parameter: -
|
||||
|
@ -444,7 +432,8 @@ int AAS_PredictClientMovement( struct aas_clientmove_s *move,
|
|||
float sv_maxstep, sv_maxsteepness, sv_jumpvel, friction;
|
||||
float gravity, delta, maxvel, wishspeed, accelerate;
|
||||
//float velchange, newvel;
|
||||
int n, i, j, pc, step, swimming, ax, crouch, event, jump_frame, areanum;
|
||||
//int ax;
|
||||
int n, i, j, pc, step, swimming, crouch, event, jump_frame, areanum;
|
||||
int areas[20], numareas;
|
||||
vec3_t points[20];
|
||||
vec3_t org, end, feet, start, stepend, lastorg, wishdir;
|
||||
|
@ -491,7 +480,7 @@ int AAS_PredictClientMovement( struct aas_clientmove_s *move,
|
|||
frame_test_vel[2] = frame_test_vel[2] - ( gravity * 0.1 * frametime );
|
||||
//if on the ground or swimming
|
||||
if ( onground || swimming ) {
|
||||
friction = swimming ? sv_friction : sv_waterfriction;
|
||||
friction = swimming ? sv_waterfriction : sv_friction;
|
||||
//apply friction
|
||||
VectorScale( frame_test_vel, 1 / frametime, frame_test_vel );
|
||||
AAS_ApplyFriction( frame_test_vel, friction, sv_stopspeed, frametime );
|
||||
|
@ -500,7 +489,7 @@ int AAS_PredictClientMovement( struct aas_clientmove_s *move,
|
|||
crouch = qfalse;
|
||||
//apply command movement
|
||||
if ( n < cmdframes ) {
|
||||
ax = 0;
|
||||
//ax = 0;
|
||||
maxvel = sv_maxwalkvelocity;
|
||||
accelerate = sv_airaccelerate;
|
||||
VectorCopy( cmdmove, wishdir );
|
||||
|
@ -521,12 +510,12 @@ int AAS_PredictClientMovement( struct aas_clientmove_s *move,
|
|||
{
|
||||
accelerate = sv_walkaccelerate;
|
||||
} //end else
|
||||
ax = 2;
|
||||
//ax = 2;
|
||||
} //end if
|
||||
if ( swimming ) {
|
||||
maxvel = sv_maxswimvelocity;
|
||||
accelerate = sv_swimaccelerate;
|
||||
ax = 3;
|
||||
//ax = 3;
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
|
|
|
@ -44,8 +44,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_def.h"
|
||||
|
|
|
@ -44,8 +44,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_aas_def.h"
|
||||
|
||||
|
@ -229,7 +229,7 @@ int AAS_BestReachableArea( vec3_t origin, vec3_t mins, vec3_t maxs, vec3_t goalo
|
|||
else
|
||||
{
|
||||
//it can very well happen that the AAS_PointAreaNum function tells that
|
||||
//a point is in an area and that starting a AAS_TraceClientBBox from that
|
||||
//a point is in an area and that starting an AAS_TraceClientBBox from that
|
||||
//point will return trace.startsolid qtrue
|
||||
/*
|
||||
if (AAS_PointAreaNum(start))
|
||||
|
@ -238,7 +238,7 @@ int AAS_BestReachableArea( vec3_t origin, vec3_t mins, vec3_t maxs, vec3_t goalo
|
|||
AAS_DrawPermanentCross(start, 4, LINECOLOR_RED);
|
||||
} //end if
|
||||
botimport.Print(PRT_MESSAGE, "AAS_BestReachableArea: start solid\n");
|
||||
*/
|
||||
*/
|
||||
VectorCopy( start, goalorigin );
|
||||
return areanum;
|
||||
} //end else
|
||||
|
@ -307,7 +307,7 @@ aas_lreachability_t *AAS_AllocReachability( void ) {
|
|||
}
|
||||
//make sure the error message only shows up once
|
||||
if ( !nextreachability->next ) {
|
||||
AAS_Error( "AAS_MAX_REACHABILITYSIZE" );
|
||||
AAS_Error( "AAS_MAX_REACHABILITYSIZE\n" );
|
||||
}
|
||||
//
|
||||
r = nextreachability;
|
||||
|
@ -338,10 +338,10 @@ void AAS_FreeReachability( aas_lreachability_t *lreach ) {
|
|||
//===========================================================================
|
||||
int AAS_AreaReachability( int areanum ) {
|
||||
if ( areanum < 0 || areanum >= ( *aasworld ).numareas ) {
|
||||
AAS_Error( "AAS_AreaReachability: areanum %d out of range", areanum );
|
||||
AAS_Error( "AAS_AreaReachability: areanum %d out of range\n", areanum );
|
||||
return 0;
|
||||
} //end if
|
||||
// RF, if this area is disabled, then fail
|
||||
// RF, if this area is disabled, then fail
|
||||
if ( ( *aasworld ).areasettings[areanum].areaflags & AREA_DISABLED ) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -714,7 +714,6 @@ int AAS_NearbySolidOrGap( vec3_t start, vec3_t end ) {
|
|||
int AAS_Reachability_Swim( int area1num, int area2num ) {
|
||||
int i, j, face1num, face2num, side1;
|
||||
aas_area_t *area1, *area2;
|
||||
aas_areasettings_t *areasettings;
|
||||
aas_lreachability_t *lreach;
|
||||
aas_face_t *face1;
|
||||
aas_plane_t *plane;
|
||||
|
@ -731,7 +730,7 @@ int AAS_Reachability_Swim( int area1num, int area2num ) {
|
|||
area1 = &( *aasworld ).areas[area1num];
|
||||
area2 = &( *aasworld ).areas[area2num];
|
||||
|
||||
//if the areas are not near anough
|
||||
//if the areas are not near enough
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
if ( area1->mins[i] > area2->maxs[i] + 10 ) {
|
||||
|
@ -758,7 +757,6 @@ int AAS_Reachability_Swim( int area1num, int area2num ) {
|
|||
if ( AAS_PointContents( start ) & ( CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER ) ) {
|
||||
//
|
||||
face1 = &( *aasworld ).faces[face1num];
|
||||
areasettings = &( *aasworld ).areasettings[area1num];
|
||||
//create a new reachability link
|
||||
lreach = AAS_AllocReachability();
|
||||
if ( !lreach ) {
|
||||
|
@ -813,7 +811,7 @@ int AAS_Reachability_EqualFloorHeight( int area1num, int area2num ) {
|
|||
|
||||
area1 = &( *aasworld ).areas[area1num];
|
||||
area2 = &( *aasworld ).areas[area2num];
|
||||
//if the areas are not near anough in the x-y direction
|
||||
//if the areas are not near enough in the x-y direction
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( area1->mins[i] > area2->maxs[i] + 10 ) {
|
||||
|
@ -958,18 +956,19 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge( int area1num, int area
|
|||
int ground_bestarea2groundedgenum, ground_foundreach;
|
||||
int water_bestarea2groundedgenum, water_foundreach;
|
||||
int side1, area1swim, faceside1, groundface1num;
|
||||
float dist, dist1, dist2, diff, invgravitydot, ortdot;
|
||||
float dist, dist1, dist2, diff, ortdot;
|
||||
//float invgravitydot;
|
||||
float x1, x2, x3, x4, y1, y2, y3, y4, tmp, y;
|
||||
float length, ground_bestlength, water_bestlength, ground_bestdist, water_bestdist;
|
||||
vec3_t v1, v2, v3, v4, tmpv, p1area1, p1area2, p2area1, p2area2;
|
||||
vec3_t normal, ort, edgevec, start, end, dir;
|
||||
vec3_t ground_beststart, ground_bestend, ground_bestnormal;
|
||||
vec3_t water_beststart, water_bestend, water_bestnormal;
|
||||
vec3_t ground_beststart = {0, 0, 0}, ground_bestend = {0, 0, 0}, ground_bestnormal = {0, 0, 0};
|
||||
vec3_t water_beststart = {0, 0, 0}, water_bestend = {0, 0, 0}, water_bestnormal = {0, 0, 0};
|
||||
vec3_t invgravity = {0, 0, 1};
|
||||
vec3_t testpoint;
|
||||
aas_plane_t *plane;
|
||||
aas_area_t *area1, *area2;
|
||||
aas_face_t *groundface1, *groundface2, *ground_bestface1, *water_bestface1;
|
||||
aas_face_t *groundface1, *groundface2;
|
||||
aas_edge_t *edge1, *edge2;
|
||||
aas_lreachability_t *lreach;
|
||||
aas_trace_t trace;
|
||||
|
@ -987,7 +986,7 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge( int area1num, int area
|
|||
area2 = &( *aasworld ).areas[area2num];
|
||||
//if the first area contains a liquid
|
||||
area1swim = AAS_AreaSwim( area1num );
|
||||
//if the areas are not near anough in the x-y direction
|
||||
//if the areas are not near enough in the x-y direction
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( area1->mins[i] > area2->maxs[i] + 10 ) {
|
||||
|
@ -1084,7 +1083,7 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge( int area1num, int area
|
|||
//edges if they overlap in the direction orthogonal to
|
||||
//the gravity direction
|
||||
CrossProduct( invgravity, normal, ort );
|
||||
invgravitydot = DotProduct( invgravity, invgravity );
|
||||
//invgravitydot = DotProduct( invgravity, invgravity );
|
||||
ortdot = DotProduct( ort, ort );
|
||||
//projection into the step plane
|
||||
//NOTE: since gravity is vertical this is just the z coordinate
|
||||
|
@ -1202,7 +1201,6 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge( int area1num, int area
|
|||
ground_bestlength = length;
|
||||
ground_foundreach = qtrue;
|
||||
ground_bestarea2groundedgenum = edge1num;
|
||||
ground_bestface1 = groundface1;
|
||||
//best point towards area1
|
||||
VectorCopy( start, ground_beststart );
|
||||
//normal is pointing into area2
|
||||
|
@ -1222,7 +1220,6 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge( int area1num, int area
|
|||
water_bestlength = length;
|
||||
water_foundreach = qtrue;
|
||||
water_bestarea2groundedgenum = edge1num;
|
||||
water_bestface1 = groundface1;
|
||||
//best point towards area1
|
||||
VectorCopy( start, water_beststart );
|
||||
//normal is pointing into area2
|
||||
|
@ -1490,7 +1487,8 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge( int area1num, int area
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
/* Ridah, moved to q_math.c
|
||||
// Ridah, moved to q_math.c
|
||||
/*
|
||||
float VectorDistance(vec3_t v1, vec3_t v2)
|
||||
{
|
||||
vec3_t dir;
|
||||
|
@ -1997,7 +1995,7 @@ int AAS_Reachability_Jump( int area1num, int area2num ) {
|
|||
int i, j, k, l, face1num, face2num, edge1num, edge2num, traveltype;
|
||||
float sv_jumpvel, maxjumpdistance, maxjumpheight, height, bestdist, speed;
|
||||
vec_t *v1, *v2, *v3, *v4;
|
||||
vec3_t beststart, beststart2, bestend, bestend2;
|
||||
vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0};
|
||||
vec3_t teststart, testend, dir, velocity, cmdmove, up = {0, 0, 1};
|
||||
aas_area_t *area1, *area2;
|
||||
aas_face_t *face1, *face2;
|
||||
|
@ -2024,7 +2022,7 @@ int AAS_Reachability_Jump( int area1num, int area2num ) {
|
|||
//maximum height a player can jump with the given initial z velocity
|
||||
maxjumpheight = AAS_MaxJumpHeight( sv_jumpvel );
|
||||
|
||||
//if the areas are not near anough in the x-y direction
|
||||
//if the areas are not near enough in the x-y direction
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( area1->mins[i] > area2->maxs[i] + maxjumpdistance ) {
|
||||
|
@ -2247,15 +2245,15 @@ int AAS_Reachability_Jump( int area1num, int area2num ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
int AAS_Reachability_Ladder( int area1num, int area2num ) {
|
||||
int i, j, k, l, edge1num, edge2num, sharededgenum, lowestedgenum;
|
||||
int face1num, face2num, ladderface1num, ladderface2num;
|
||||
int i, j, k, l, edge1num, edge2num, sharededgenum = 0, lowestedgenum = 0;
|
||||
int face1num, face2num, ladderface1num = 0, ladderface2num = 0;
|
||||
int ladderface1vertical, ladderface2vertical, firstv;
|
||||
float face1area, face2area, bestface1area, bestface2area;
|
||||
float face1area, face2area, bestface1area = -9999, bestface2area = -9999;
|
||||
float sv_jumpvel, maxjumpheight;
|
||||
vec3_t area1point, area2point, v1, v2, up = {0, 0, 1};
|
||||
vec3_t mid, lowestpoint, start, end, sharededgevec, dir;
|
||||
vec3_t mid, lowestpoint = {0, 0}, start, end, sharededgevec, dir;
|
||||
aas_area_t *area1, *area2;
|
||||
aas_face_t *face1, *face2, *ladderface1, *ladderface2;
|
||||
aas_face_t *face1, *face2, *ladderface1 = NULL, *ladderface2 = NULL;
|
||||
aas_plane_t *plane1, *plane2;
|
||||
aas_edge_t *sharededge, *edge1;
|
||||
aas_lreachability_t *lreach;
|
||||
|
@ -2271,16 +2269,7 @@ int AAS_Reachability_Ladder( int area1num, int area2num ) {
|
|||
|
||||
area1 = &( *aasworld ).areas[area1num];
|
||||
area2 = &( *aasworld ).areas[area2num];
|
||||
//
|
||||
ladderface1 = NULL;
|
||||
ladderface2 = NULL;
|
||||
ladderface1num = 0; //make compiler happy
|
||||
ladderface2num = 0; //make compiler happy
|
||||
bestface1area = -9999;
|
||||
bestface2area = -9999;
|
||||
sharededgenum = 0; //make compiler happy
|
||||
lowestedgenum = 0; //make compiler happy
|
||||
//
|
||||
|
||||
for ( i = 0; i < area1->numfaces; i++ )
|
||||
{
|
||||
face1num = ( *aasworld ).faceindex[area1->firstface + i];
|
||||
|
@ -2351,8 +2340,8 @@ int AAS_Reachability_Ladder( int area1num, int area2num ) {
|
|||
VectorMA( area1point, -32, dir, area1point );
|
||||
VectorMA( area2point, 32, dir, area2point );
|
||||
//
|
||||
ladderface1vertical = abs( DotProduct( plane1->normal, up ) ) < 0.1;
|
||||
ladderface2vertical = abs( DotProduct( plane2->normal, up ) ) < 0.1;
|
||||
ladderface1vertical = fabs( DotProduct( plane1->normal, up ) ) < 0.1;
|
||||
ladderface2vertical = fabs( DotProduct( plane2->normal, up ) ) < 0.1;
|
||||
//there's only reachability between vertical ladder faces
|
||||
if ( !ladderface1vertical && !ladderface2vertical ) {
|
||||
return qfalse;
|
||||
|
@ -2362,7 +2351,7 @@ int AAS_Reachability_Ladder( int area1num, int area2num ) {
|
|||
//and the ladder faces do not make a sharp corner
|
||||
&& DotProduct( plane1->normal, plane2->normal ) > 0.7
|
||||
//and the shared edge is not too vertical
|
||||
&& abs( DotProduct( sharededgevec, up ) ) < 0.7 ) {
|
||||
&& fabs( DotProduct( sharededgevec, up ) ) < 0.7 ) {
|
||||
//create a new reachability link
|
||||
lreach = AAS_AllocReachability();
|
||||
if ( !lreach ) {
|
||||
|
@ -2390,7 +2379,7 @@ int AAS_Reachability_Ladder( int area1num, int area2num ) {
|
|||
lreach->edgenum = abs( sharededgenum );
|
||||
VectorCopy( area2point, lreach->start );
|
||||
//VectorCopy(area1point, lreach->end);
|
||||
VectorMA( area1point, -3, plane2->normal, lreach->end );
|
||||
VectorMA( area1point, -3, plane1->normal, lreach->end );
|
||||
lreach->traveltype = TRAVEL_LADDER;
|
||||
lreach->traveltime = 10;
|
||||
lreach->next = areareachability[area2num];
|
||||
|
@ -2489,7 +2478,7 @@ int AAS_Reachability_Ladder( int area1num, int area2num ) {
|
|||
//
|
||||
if ( face2->faceflags & FACE_LADDER ) {
|
||||
plane2 = &( *aasworld ).planes[face2->planenum];
|
||||
if ( abs( DotProduct( plane2->normal, up ) ) < 0.1 ) {
|
||||
if ( fabs( DotProduct( plane2->normal, up ) ) < 0.1 ) {
|
||||
break;
|
||||
}
|
||||
} //end if
|
||||
|
@ -3010,7 +2999,7 @@ aas_lreachability_t *AAS_FindFaceReachabilities( vec3_t *facepoints, int numpoin
|
|||
int facenum, edgenum, bestfacenum;
|
||||
float *v1, *v2, *v3, *v4;
|
||||
float bestdist, speed, hordist, dist;
|
||||
vec3_t beststart, beststart2, bestend, bestend2, tmp, hordir, testpoint;
|
||||
vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0}, tmp, hordir, testpoint;
|
||||
aas_lreachability_t *lreach, *lreachabilities;
|
||||
aas_area_t *area;
|
||||
aas_face_t *face;
|
||||
|
@ -3105,8 +3094,10 @@ aas_lreachability_t *AAS_FindFaceReachabilities( vec3_t *facepoints, int numpoin
|
|||
if ( towardsface ) {
|
||||
VectorCopy( bestend, testpoint );
|
||||
} else { VectorCopy( beststart, testpoint );}
|
||||
testpoint[2] = 0;
|
||||
testpoint[2] = ( bestfaceplane->dist - DotProduct( bestfaceplane->normal, testpoint ) ) / bestfaceplane->normal[2];
|
||||
if (bestfaceplane != NULL)
|
||||
testpoint[2] = (bestfaceplane->dist - DotProduct(bestfaceplane->normal, testpoint)) / bestfaceplane->normal[2];
|
||||
else
|
||||
testpoint[2] = 0;
|
||||
//
|
||||
if ( !AAS_PointInsideFace( bestfacenum, testpoint, 0.1 ) ) {
|
||||
//if the faces are not overlapping then only go down
|
||||
|
@ -3268,7 +3259,6 @@ void AAS_Reachability_FuncBobbing( void ) {
|
|||
//
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
firststartreach = firstendreach = NULL;
|
||||
//
|
||||
if ( i == 0 ) {
|
||||
firststartreach = AAS_FindFaceReachabilities( start_edgeverts, 4, &start_plane, qtrue );
|
||||
|
@ -3370,7 +3360,7 @@ void AAS_Reachability_FuncBobbing( void ) {
|
|||
//===========================================================================
|
||||
void AAS_Reachability_JumpPad( void ) {
|
||||
int face2num, i, ret, modelnum, area2num, visualize;
|
||||
float speed, zvel, hordist, dist, time, height, gravity, forward;
|
||||
float speed, zvel, dist, time, height, gravity, forward;
|
||||
aas_face_t *face2;
|
||||
aas_area_t *area2;
|
||||
aas_lreachability_t *lreach;
|
||||
|
@ -3465,13 +3455,14 @@ void AAS_Reachability_JumpPad( void ) {
|
|||
velocity[2] = time * gravity;
|
||||
//get the areas the jump pad brush is in
|
||||
areas = AAS_LinkEntityClientBBox( absmins, absmaxs, -1, PRESENCE_CROUCH );
|
||||
//*
|
||||
/*
|
||||
for ( link = areas; link; link = link->next_area )
|
||||
{
|
||||
if ( link->areanum == 5772 ) {
|
||||
ret = qfalse;
|
||||
}
|
||||
} //*/
|
||||
}
|
||||
*/
|
||||
for ( link = areas; link; link = link->next_area )
|
||||
{
|
||||
if ( AAS_AreaJumpPad( link->areanum ) ) {
|
||||
|
@ -3483,7 +3474,7 @@ void AAS_Reachability_JumpPad( void ) {
|
|||
AAS_UnlinkFromAreas( areas );
|
||||
continue;
|
||||
} //end if
|
||||
//
|
||||
//
|
||||
botimport.Print( PRT_MESSAGE, "found a trigger_push with velocity %f %f %f\n", velocity[0], velocity[1], velocity[2] );
|
||||
//if there is a horizontal velocity check for a reachability without air control
|
||||
if ( velocity[0] || velocity[1] ) {
|
||||
|
@ -3606,7 +3597,7 @@ void AAS_Reachability_JumpPad( void ) {
|
|||
//direction towards the face center
|
||||
VectorSubtract( facecenter, areastart, dir );
|
||||
dir[2] = 0;
|
||||
hordist = VectorNormalize( dir );
|
||||
//hordist = VectorNormalize( dir );
|
||||
//if (hordist < 1.6 * facecenter[2] - areastart[2])
|
||||
{
|
||||
//get command movement
|
||||
|
@ -3674,7 +3665,7 @@ int AAS_Reachability_Grapple( int area1num, int area2num ) {
|
|||
aas_face_t *face2;
|
||||
aas_area_t *area1, *area2;
|
||||
aas_lreachability_t *lreach;
|
||||
vec3_t areastart, facecenter, start, end, dir, down = {0, 0, -1};
|
||||
vec3_t areastart = { 0, 0, 0 }, facecenter, start, end, dir, down = { 0, 0, -1 };
|
||||
vec_t *v;
|
||||
|
||||
//only grapple when on the ground or swimming
|
||||
|
@ -3924,7 +3915,7 @@ void AAS_SetWeaponJumpAreaFlags( void ) {
|
|||
//===========================================================================
|
||||
int AAS_Reachability_WeaponJump( int area1num, int area2num ) {
|
||||
int face2num, i, n, ret;
|
||||
float speed, zvel, hordist;
|
||||
float speed, zvel;
|
||||
aas_face_t *face2;
|
||||
aas_area_t *area1, *area2;
|
||||
aas_lreachability_t *lreach;
|
||||
|
@ -3995,7 +3986,7 @@ int AAS_Reachability_WeaponJump( int area1num, int area2num ) {
|
|||
//direction towards the face center
|
||||
VectorSubtract( facecenter, areastart, dir );
|
||||
dir[2] = 0;
|
||||
hordist = VectorNormalize( dir );
|
||||
//hordist = VectorNormalize( dir );
|
||||
//if (hordist < 1.6 * (facecenter[2] - areastart[2]))
|
||||
{
|
||||
//get command movement
|
||||
|
|
|
@ -45,12 +45,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_def.h"
|
||||
|
||||
#define LL(x) x=LittleLong(x)
|
||||
|
||||
#define ROUTING_DEBUG
|
||||
|
||||
//travel time in hundreths of a second = distance * 100 / speed
|
||||
|
@ -126,7 +128,7 @@ void AAS_RoutingInfo( void ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
__inline int AAS_ClusterAreaNum( int cluster, int areanum ) {
|
||||
static ID_INLINE int AAS_ClusterAreaNum(int cluster, int areanum) {
|
||||
int side, areacluster;
|
||||
|
||||
areacluster = ( *aasworld ).areasettings[areanum].cluster;
|
||||
|
@ -197,7 +199,7 @@ int AAS_TravelFlagForType( int traveltype ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
__inline float AAS_RoutingTime( void ) {
|
||||
static ID_INLINE float AAS_RoutingTime(void) {
|
||||
return AAS_Time();
|
||||
} //end of the function AAS_RoutingTime
|
||||
//===========================================================================
|
||||
|
@ -280,7 +282,7 @@ int AAS_EnableRoutingArea( int areanum, int enable ) {
|
|||
int flags;
|
||||
|
||||
if ( areanum <= 0 || areanum >= ( *aasworld ).numareas ) {
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_ERROR, "AAS_EnableRoutingArea: areanum %d out of range\n", areanum );
|
||||
} //end if
|
||||
return 0;
|
||||
|
@ -412,9 +414,11 @@ void AAS_CalculateAreaTravelTimes( void ) {
|
|||
aas_reversedlink_t *revlink;
|
||||
aas_reachability_t *reach;
|
||||
aas_areasettings_t *settings;
|
||||
#ifdef DEBUG
|
||||
int starttime;
|
||||
|
||||
starttime = Sys_MilliSeconds();
|
||||
#endif
|
||||
//if there are still area travel times, free the memory
|
||||
if ( ( *aasworld ).areatraveltimes ) {
|
||||
AAS_RoutingFreeMemory( ( *aasworld ).areatraveltimes );
|
||||
|
@ -429,7 +433,8 @@ void AAS_CalculateAreaTravelTimes( void ) {
|
|||
//
|
||||
size += settings->numreachableareas * sizeof( unsigned short * );
|
||||
//
|
||||
size += settings->numreachableareas * revreach->numlinks * sizeof( unsigned short );
|
||||
size += settings->numreachableareas *
|
||||
PAD(revreach->numlinks, sizeof(long)) * sizeof(unsigned short);
|
||||
} //end for
|
||||
//allocate memory for the area travel times
|
||||
ptr = (char *) AAS_RoutingGetMemory( size );
|
||||
|
@ -450,7 +455,7 @@ void AAS_CalculateAreaTravelTimes( void ) {
|
|||
for ( l = 0; l < settings->numreachableareas; l++, reach++ )
|
||||
{
|
||||
( *aasworld ).areatraveltimes[i][l] = (unsigned short *) ptr;
|
||||
ptr += revreach->numlinks * sizeof( unsigned short );
|
||||
ptr += PAD(revreach->numlinks, sizeof(long)) * sizeof(unsigned short);
|
||||
//reachability link
|
||||
//
|
||||
for ( n = 0, revlink = revreach->first; revlink; revlink = revlink->next, n++ )
|
||||
|
@ -826,7 +831,7 @@ void AAS_InitRoutingUpdate( void ) {
|
|||
//===========================================================================
|
||||
|
||||
void AAS_CreateAllRoutingCache( void ) {
|
||||
int i, j, k, t, tfl, numroutingareas;
|
||||
int i, j, k, tfl, numroutingareas;
|
||||
aas_areasettings_t *areasettings;
|
||||
aas_reachability_t *reach;
|
||||
|
||||
|
@ -867,10 +872,8 @@ void AAS_CreateAllRoutingCache( void ) {
|
|||
if ( !( ( *aasworld ).areasettings[j].areaflags & AREA_USEFORROUTING ) ) {
|
||||
continue;
|
||||
}
|
||||
t = AAS_AreaTravelTimeToGoalArea( j, ( *aasworld ).areawaypoints[j], i, tfl );
|
||||
AAS_AreaTravelTimeToGoalArea( j, ( *aasworld ).areawaypoints[j], i, tfl );
|
||||
( *aasworld ).frameroutingupdates = 0;
|
||||
//if (t) break;
|
||||
//Log_Write("traveltime from %d to %d is %d", i, j, t);
|
||||
} //end for
|
||||
} //end for
|
||||
} //end of the function AAS_CreateAllRoutingCache
|
||||
|
@ -880,6 +883,43 @@ void AAS_CreateAllRoutingCache( void ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void AAS_WriteCache( fileHandle_t fp, aas_routingcache_t *nativecache ) {
|
||||
int i, size, numtraveltimes;
|
||||
aas_routingcache_32_t *cache;
|
||||
unsigned char *cache_reachabilities;
|
||||
|
||||
size = nativecache->size + sizeof (aas_routingcache_32_t) - sizeof (aas_routingcache_t);
|
||||
|
||||
cache = GetClearedMemory( size );
|
||||
cache->size = LittleLong( size );
|
||||
cache->time = LittleFloat( nativecache->time );
|
||||
cache->cluster = LittleLong( nativecache->cluster );
|
||||
cache->areanum = LittleLong( nativecache->areanum );
|
||||
cache->origin[0] = LittleFloat( nativecache->origin[0] );
|
||||
cache->origin[1] = LittleFloat( nativecache->origin[1] );
|
||||
cache->origin[2] = LittleFloat( nativecache->origin[2] );
|
||||
cache->starttraveltime = LittleFloat( nativecache->starttraveltime );
|
||||
cache->travelflags = LittleLong( nativecache->travelflags );
|
||||
|
||||
numtraveltimes = ( size - sizeof( aas_routingcache_32_t ) ) / 3;
|
||||
for ( i = 0; i < numtraveltimes; i++ ) {
|
||||
cache->traveltimes[i] = LittleShort( nativecache->traveltimes[i] );
|
||||
}
|
||||
|
||||
cache_reachabilities = (unsigned char *) cache + sizeof( aas_routingcache_32_t ) + numtraveltimes * sizeof (cache->traveltimes[0]);
|
||||
for ( i = 0; i < numtraveltimes; i++ ) {
|
||||
cache_reachabilities[i] = nativecache->reachabilities[i];
|
||||
}
|
||||
|
||||
botimport.FS_Write( cache, size, fp );
|
||||
FreeMemory( cache );
|
||||
} //end of the function AAS_WriteCache
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
unsigned short CRC_ProcessString( unsigned char *data, int length );
|
||||
|
||||
//the route cache header
|
||||
|
@ -912,6 +952,7 @@ void AAS_WriteRouteCache( void ) {
|
|||
char filename[MAX_QPATH];
|
||||
routecacheheader_t routecacheheader;
|
||||
byte *buf;
|
||||
vec3_t waypoint;
|
||||
|
||||
buf = (byte *) GetClearedMemory( ( *aasworld ).numareas * 2 * sizeof( byte ) ); // in case it ends up bigger than the decompressedvis, which is rare but possible
|
||||
|
||||
|
@ -943,15 +984,15 @@ void AAS_WriteRouteCache( void ) {
|
|||
return;
|
||||
} //end if
|
||||
//create the header
|
||||
routecacheheader.ident = RCID;
|
||||
routecacheheader.version = RCVERSION;
|
||||
routecacheheader.numareas = ( *aasworld ).numareas;
|
||||
routecacheheader.numclusters = ( *aasworld ).numclusters;
|
||||
routecacheheader.areacrc = CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas );
|
||||
routecacheheader.clustercrc = CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters );
|
||||
routecacheheader.reachcrc = CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize );
|
||||
routecacheheader.numportalcache = numportalcache;
|
||||
routecacheheader.numareacache = numareacache;
|
||||
routecacheheader.ident = LittleLong( RCID );
|
||||
routecacheheader.version = LittleLong( RCVERSION );
|
||||
routecacheheader.numareas = LittleLong( ( *aasworld ).numareas );
|
||||
routecacheheader.numclusters = LittleLong( ( *aasworld ).numclusters );
|
||||
routecacheheader.areacrc = LittleLong( CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) );
|
||||
routecacheheader.clustercrc = LittleLong( CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters ) );
|
||||
routecacheheader.reachcrc = LittleLong( CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize ) );
|
||||
routecacheheader.numportalcache = LittleLong( numportalcache );
|
||||
routecacheheader.numareacache = LittleLong( numareacache );
|
||||
//write the header
|
||||
botimport.FS_Write( &routecacheheader, sizeof( routecacheheader_t ), fp );
|
||||
//write all the cache
|
||||
|
@ -959,7 +1000,7 @@ void AAS_WriteRouteCache( void ) {
|
|||
{
|
||||
for ( cache = ( *aasworld ).portalcache[i]; cache; cache = cache->next )
|
||||
{
|
||||
botimport.FS_Write( cache, cache->size, fp );
|
||||
AAS_WriteCache( fp, cache );
|
||||
} //end for
|
||||
} //end for
|
||||
for ( i = 0; i < ( *aasworld ).numclusters; i++ )
|
||||
|
@ -969,7 +1010,7 @@ void AAS_WriteRouteCache( void ) {
|
|||
{
|
||||
for ( cache = ( *aasworld ).clusterareacache[i][j]; cache; cache = cache->next )
|
||||
{
|
||||
botimport.FS_Write( cache, cache->size, fp );
|
||||
AAS_WriteCache( fp, cache );
|
||||
} //end for
|
||||
} //end for
|
||||
} //end for
|
||||
|
@ -977,17 +1018,24 @@ void AAS_WriteRouteCache( void ) {
|
|||
for ( i = 0; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
if ( !( *aasworld ).areavisibility[i] ) {
|
||||
size = 0;
|
||||
size = LittleLong( 0 );
|
||||
botimport.FS_Write( &size, sizeof( int ), fp );
|
||||
continue;
|
||||
}
|
||||
AAS_DecompressVis( ( *aasworld ).areavisibility[i], ( *aasworld ).numareas, ( *aasworld ).decompressedvis );
|
||||
size = AAS_CompressVis( ( *aasworld ).decompressedvis, ( *aasworld ).numareas, buf );
|
||||
LL( size );
|
||||
botimport.FS_Write( &size, sizeof( int ), fp );
|
||||
LL( size ); // convert back to native endian
|
||||
botimport.FS_Write( buf, size, fp );
|
||||
}
|
||||
// write the waypoints
|
||||
botimport.FS_Write( ( *aasworld ).areawaypoints, sizeof( vec3_t ) * ( *aasworld ).numareas, fp );
|
||||
for ( i = 0; i < ( *aasworld ).numareas; i++ ) {
|
||||
waypoint[0] = LittleFloat( ( *aasworld ).areawaypoints[i][0] );
|
||||
waypoint[1] = LittleFloat( ( *aasworld ).areawaypoints[i][1] );
|
||||
waypoint[2] = LittleFloat( ( *aasworld ).areawaypoints[i][2] );
|
||||
botimport.FS_Write( waypoint, sizeof( vec3_t ), fp );
|
||||
}
|
||||
//
|
||||
botimport.FS_FCloseFile( fp );
|
||||
botimport.Print( PRT_MESSAGE, "\nroute cache written to %s\n", filename );
|
||||
|
@ -999,37 +1047,58 @@ void AAS_WriteRouteCache( void ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
aas_routingcache_t *AAS_ReadCache( fileHandle_t fp ) {
|
||||
int i, size;
|
||||
aas_routingcache_t *cache;
|
||||
int i, size, numtraveltimes;
|
||||
aas_routingcache_t *nativecache;
|
||||
aas_routingcache_32_t *cache;
|
||||
unsigned char *cache_reachabilities;
|
||||
|
||||
botimport.FS_Read( &size, sizeof( size ), fp );
|
||||
size = LittleLong( size );
|
||||
cache = (aas_routingcache_t *) AAS_RoutingGetMemory( size );
|
||||
LL( size );
|
||||
cache = (aas_routingcache_32_t *) AAS_RoutingGetMemory( size );
|
||||
cache->size = size;
|
||||
botimport.FS_Read( (unsigned char *)cache + sizeof( size ), size - sizeof( size ), fp );
|
||||
|
||||
if ( 1 != LittleLong( 1 ) ) {
|
||||
cache->time = LittleFloat( cache->time );
|
||||
cache->cluster = LittleLong( cache->cluster );
|
||||
cache->areanum = LittleLong( cache->areanum );
|
||||
cache->origin[0] = LittleFloat( cache->origin[0] );
|
||||
cache->origin[1] = LittleFloat( cache->origin[1] );
|
||||
cache->origin[2] = LittleFloat( cache->origin[2] );
|
||||
cache->starttraveltime = LittleFloat( cache->starttraveltime );
|
||||
cache->travelflags = LittleLong( cache->travelflags );
|
||||
numtraveltimes = ( size - sizeof( aas_routingcache_32_t ) ) / 3;
|
||||
|
||||
if ( sizeof (intptr_t) == 4 ) {
|
||||
nativecache = (aas_routingcache_t *) cache;
|
||||
} else {
|
||||
int nativesize = size - sizeof (aas_routingcache_32_t) + sizeof (aas_routingcache_t);
|
||||
nativecache = (aas_routingcache_t *) AAS_RoutingGetMemory( nativesize );
|
||||
nativecache->size = nativesize;
|
||||
}
|
||||
|
||||
// cache->reachabilities = (unsigned char *) cache + sizeof(aas_routingcache_t) - sizeof(unsigned short) +
|
||||
// (size - sizeof(aas_routingcache_t) + sizeof(unsigned short)) / 3 * 2;
|
||||
cache->reachabilities = (unsigned char *) cache + sizeof( aas_routingcache_t ) +
|
||||
( ( size - sizeof( aas_routingcache_t ) ) / 3 ) * 2;
|
||||
// copy to native structure and/or swap
|
||||
if ( sizeof (intptr_t) != 4 || 1 != LittleLong( 1 ) ) {
|
||||
nativecache->time = LittleFloat( cache->time );
|
||||
nativecache->cluster = LittleLong( cache->cluster );
|
||||
nativecache->areanum = LittleLong( cache->areanum );
|
||||
nativecache->origin[0] = LittleFloat( cache->origin[0] );
|
||||
nativecache->origin[1] = LittleFloat( cache->origin[1] );
|
||||
nativecache->origin[2] = LittleFloat( cache->origin[2] );
|
||||
nativecache->starttraveltime = LittleFloat( cache->starttraveltime );
|
||||
nativecache->travelflags = LittleLong( cache->travelflags );
|
||||
|
||||
//DAJ BUGFIX for missing byteswaps for traveltimes
|
||||
size = ( size - sizeof( aas_routingcache_t ) ) / 3 + 1;
|
||||
for ( i = 0; i < size; i++ ) {
|
||||
cache->traveltimes[i] = LittleShort( cache->traveltimes[i] );
|
||||
//DAJ BUGFIX for missing byteswaps for traveltimes
|
||||
for ( i = 0; i < numtraveltimes; i++ ) {
|
||||
nativecache->traveltimes[i] = LittleShort( cache->traveltimes[i] );
|
||||
}
|
||||
}
|
||||
return cache;
|
||||
|
||||
nativecache->reachabilities = (unsigned char *) nativecache + sizeof( aas_routingcache_t ) + numtraveltimes * sizeof (nativecache->traveltimes[0]);
|
||||
|
||||
// copy reachabilities to native structure, free original cache
|
||||
if ( sizeof (intptr_t) != 4 ) {
|
||||
cache_reachabilities = (unsigned char *) cache + sizeof( aas_routingcache_32_t ) + numtraveltimes * sizeof (cache->traveltimes[0]);
|
||||
|
||||
for ( i = 0; i < numtraveltimes; i++ ) {
|
||||
nativecache->reachabilities[i] = cache_reachabilities[i];
|
||||
}
|
||||
|
||||
AAS_RoutingFreeMemory(cache);
|
||||
}
|
||||
|
||||
return nativecache;
|
||||
} //end of the function AAS_ReadCache
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -1050,9 +1119,6 @@ int AAS_ReadRouteCache( void ) {
|
|||
return qfalse;
|
||||
} //end if
|
||||
botimport.FS_Read( &routecacheheader, sizeof( routecacheheader_t ), fp );
|
||||
|
||||
// GJD: route cache data MUST be written on a PC because I've not altered the writing code.
|
||||
|
||||
routecacheheader.areacrc = LittleLong( routecacheheader.areacrc );
|
||||
routecacheheader.clustercrc = LittleLong( routecacheheader.clustercrc );
|
||||
routecacheheader.ident = LittleLong( routecacheheader.ident );
|
||||
|
@ -1071,7 +1137,7 @@ int AAS_ReadRouteCache( void ) {
|
|||
|
||||
if ( routecacheheader.version != RCVERSION ) {
|
||||
botimport.FS_FCloseFile( fp );
|
||||
Com_Printf( "route cache dump has wrong version %d, should be %d", routecacheheader.version, RCVERSION );
|
||||
Com_Printf( "route cache dump has wrong version %d, should be %d\n", routecacheheader.version, RCVERSION );
|
||||
return qfalse;
|
||||
} //end if
|
||||
if ( routecacheheader.numareas != ( *aasworld ).numareas ) {
|
||||
|
@ -1084,26 +1150,27 @@ int AAS_ReadRouteCache( void ) {
|
|||
//AAS_Error("route cache dump has wrong number of clusters\n");
|
||||
return qfalse;
|
||||
} //end if
|
||||
#ifdef _WIN32 // crc code is only good on intel machines
|
||||
if ( routecacheheader.areacrc !=
|
||||
CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) ) {
|
||||
botimport.FS_FCloseFile( fp );
|
||||
//AAS_Error("route cache dump area CRC incorrect\n");
|
||||
return qfalse;
|
||||
// crc code is only good on little endian machines
|
||||
if ( 1 == LittleLong( 1 ) ) {
|
||||
if ( routecacheheader.areacrc !=
|
||||
CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) ) {
|
||||
botimport.FS_FCloseFile( fp );
|
||||
//AAS_Error("route cache dump area CRC incorrect\n");
|
||||
return qfalse;
|
||||
} //end if
|
||||
if ( routecacheheader.clustercrc !=
|
||||
CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters ) ) {
|
||||
botimport.FS_FCloseFile( fp );
|
||||
//AAS_Error("route cache dump cluster CRC incorrect\n");
|
||||
return qfalse;
|
||||
} //end if
|
||||
if ( routecacheheader.reachcrc !=
|
||||
CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize ) ) {
|
||||
botimport.FS_FCloseFile( fp );
|
||||
//AAS_Error("route cache dump reachability CRC incorrect\n");
|
||||
return qfalse;
|
||||
} //end if
|
||||
} //end if
|
||||
if ( routecacheheader.clustercrc !=
|
||||
CRC_ProcessString( (unsigned char *)( *aasworld ).clusters, sizeof( aas_cluster_t ) * ( *aasworld ).numclusters ) ) {
|
||||
botimport.FS_FCloseFile( fp );
|
||||
//AAS_Error("route cache dump cluster CRC incorrect\n");
|
||||
return qfalse;
|
||||
} //end if
|
||||
if ( routecacheheader.reachcrc !=
|
||||
CRC_ProcessString( (unsigned char *)( *aasworld ).reachability, sizeof( aas_reachability_t ) * ( *aasworld ).reachabilitysize ) ) {
|
||||
botimport.FS_FCloseFile( fp );
|
||||
//AAS_Error("route cache dump reachability CRC incorrect\n");
|
||||
return qfalse;
|
||||
} //end if
|
||||
#endif
|
||||
//read all the portal cache
|
||||
for ( i = 0; i < routecacheheader.numportalcache; i++ )
|
||||
{
|
||||
|
@ -1133,7 +1200,7 @@ int AAS_ReadRouteCache( void ) {
|
|||
for ( i = 0; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
botimport.FS_Read( &size, sizeof( size ), fp );
|
||||
size = LittleLong( size );
|
||||
LL( size );
|
||||
if ( size ) {
|
||||
( *aasworld ).areavisibility[i] = (byte *) GetMemory( size );
|
||||
botimport.FS_Read( ( *aasworld ).areavisibility[i], size, fp );
|
||||
|
@ -1238,27 +1305,6 @@ void AAS_FreeRoutingCaches( void ) {
|
|||
( *aasworld ).areawaypoints = NULL;
|
||||
} //end of the function AAS_FreeRoutingCaches
|
||||
//===========================================================================
|
||||
// this function could be replaced by a bubble sort or for even faster
|
||||
// routing by a B+ tree
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
__inline void AAS_AddUpdateToList( aas_routingupdate_t **updateliststart,
|
||||
aas_routingupdate_t **updatelistend,
|
||||
aas_routingupdate_t *update ) {
|
||||
if ( !update->inlist ) {
|
||||
if ( *updatelistend ) {
|
||||
( *updatelistend )->next = update;
|
||||
} else { *updateliststart = update;}
|
||||
update->prev = *updatelistend;
|
||||
update->next = NULL;
|
||||
*updatelistend = update;
|
||||
update->inlist = qtrue;
|
||||
} //end if
|
||||
} //end of the function AAS_AddUpdateToList
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
|
@ -1613,20 +1659,23 @@ int AAS_AreaRouteToGoalArea( int areanum, vec3_t origin, int goalareanum, int tr
|
|||
*reachnum = 0;
|
||||
return qtrue;
|
||||
} //end if
|
||||
//
|
||||
//check !AAS_AreaReachability(areanum) with custom developer-only debug message
|
||||
if ( areanum <= 0 || areanum >= ( *aasworld ).numareas ) {
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_ERROR, "AAS_AreaTravelTimeToGoalArea: areanum %d out of range\n", areanum );
|
||||
} //end if
|
||||
return qfalse;
|
||||
} //end if
|
||||
if ( goalareanum <= 0 || goalareanum >= ( *aasworld ).numareas ) {
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_ERROR, "AAS_AreaTravelTimeToGoalArea: goalareanum %d out of range\n", goalareanum );
|
||||
} //end if
|
||||
return qfalse;
|
||||
} //end if
|
||||
|
||||
if ( !( *aasworld ).areasettings[areanum].numreachableareas || !( *aasworld ).areasettings[goalareanum].numreachableareas )
|
||||
{
|
||||
return qfalse;
|
||||
} //end if
|
||||
//make sure the routing cache doesn't grow to large
|
||||
while ( routingcachesize > max_routingcachesize ) {
|
||||
if ( !AAS_FreeOldestCache() ) {
|
||||
|
@ -1800,7 +1849,7 @@ int AAS_AreaRouteToGoalArea( int areanum, vec3_t origin, int goalareanum, int tr
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
int AAS_AreaTravelTimeToGoalArea( int areanum, vec3_t origin, int goalareanum, int travelflags ) {
|
||||
int traveltime, reachnum;
|
||||
int traveltime, reachnum = 0;
|
||||
|
||||
if ( AAS_AreaRouteToGoalArea( areanum, origin, goalareanum, travelflags, &traveltime, &reachnum ) ) {
|
||||
return traveltime;
|
||||
|
@ -1814,7 +1863,7 @@ int AAS_AreaTravelTimeToGoalArea( int areanum, vec3_t origin, int goalareanum, i
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
int AAS_AreaTravelTimeToGoalAreaCheckLoop( int areanum, vec3_t origin, int goalareanum, int travelflags, int loopareanum ) {
|
||||
int traveltime, reachnum;
|
||||
int traveltime, reachnum = 0;
|
||||
aas_reachability_t *reach;
|
||||
|
||||
if ( AAS_AreaRouteToGoalArea( areanum, origin, goalareanum, travelflags, &traveltime, &reachnum ) ) {
|
||||
|
@ -1833,7 +1882,7 @@ int AAS_AreaTravelTimeToGoalAreaCheckLoop( int areanum, vec3_t origin, int goala
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
int AAS_AreaReachabilityToGoalArea( int areanum, vec3_t origin, int goalareanum, int travelflags ) {
|
||||
int traveltime, reachnum;
|
||||
int traveltime, reachnum = 0;
|
||||
|
||||
if ( AAS_AreaRouteToGoalArea( areanum, origin, goalareanum, travelflags, &traveltime, &reachnum ) ) {
|
||||
return reachnum;
|
||||
|
@ -2022,26 +2071,16 @@ int AAS_CompressVis( byte *vis, int numareas, byte *dest ) {
|
|||
void AAS_DecompressVis( byte *in, int numareas, byte *decompressed ) {
|
||||
byte c;
|
||||
byte *out;
|
||||
//int row;
|
||||
byte *end;
|
||||
|
||||
// initialize the vis data, only set those that are visible
|
||||
memset( decompressed, 0, numareas );
|
||||
|
||||
//row = (numareas+7)>>3;
|
||||
out = decompressed;
|
||||
end = ( byte * )( (int)decompressed + numareas );
|
||||
end = ( byte * )( decompressed + numareas );
|
||||
|
||||
do
|
||||
{
|
||||
/*
|
||||
if (*in)
|
||||
{
|
||||
*out++ = *in++;
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
|
||||
c = in[1];
|
||||
if ( !c ) {
|
||||
AAS_Error( "DecompressVis: 0 repeat" );
|
||||
|
@ -2050,13 +2089,6 @@ void AAS_DecompressVis( byte *in, int numareas, byte *decompressed ) {
|
|||
memset( out, 1, c );
|
||||
}
|
||||
in += 2;
|
||||
/*
|
||||
while (c)
|
||||
{
|
||||
*out++ = 0;
|
||||
c--;
|
||||
}
|
||||
*/
|
||||
out += c;
|
||||
} while ( out < end );
|
||||
} //end of the function AAS_DecompressVis
|
||||
|
@ -2185,7 +2217,7 @@ float VectorDistance( vec3_t v1, vec3_t v2 );
|
|||
extern void ProjectPointOntoVector( vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj ) ;
|
||||
int AAS_NearestHideArea( int srcnum, vec3_t origin, int areanum, int enemynum, vec3_t enemyorigin, int enemyareanum, int travelflags ) {
|
||||
int i, j, nextareanum, badtravelflags, numreach, bestarea;
|
||||
unsigned short int t, besttraveltime, enemytraveltime;
|
||||
unsigned short int t, besttraveltime;
|
||||
aas_routingupdate_t *updateliststart, *updatelistend, *curupdate, *nextupdate;
|
||||
aas_reachability_t *reach;
|
||||
float dist1, dist2;
|
||||
|
@ -2222,7 +2254,7 @@ int AAS_NearestHideArea( int srcnum, vec3_t origin, int areanum, int enemynum, v
|
|||
besttraveltime = 0;
|
||||
bestarea = 0;
|
||||
if ( enemyareanum ) {
|
||||
enemytraveltime = AAS_AreaTravelTimeToGoalArea( areanum, origin, enemyareanum, travelflags );
|
||||
AAS_AreaTravelTimeToGoalArea( areanum, origin, enemyareanum, travelflags );
|
||||
}
|
||||
VectorSubtract( enemyorigin, origin, enemyVec );
|
||||
enemytraveldist = VectorNormalize( enemyVec );
|
||||
|
@ -2406,7 +2438,7 @@ int AAS_NearestHideArea( int srcnum, vec3_t origin, int areanum, int enemynum, v
|
|||
//===========================================================================
|
||||
int AAS_FindAttackSpotWithinRange( int srcnum, int rangenum, int enemynum, float rangedist, int travelflags, float *outpos ) {
|
||||
int i, nextareanum, badtravelflags, numreach, bestarea;
|
||||
unsigned short int t, besttraveltime, enemytraveltime;
|
||||
unsigned short int t, besttraveltime;
|
||||
aas_routingupdate_t *updateliststart, *updatelistend, *curupdate, *nextupdate;
|
||||
aas_reachability_t *reach;
|
||||
vec3_t srcorg, rangeorg, enemyorg;
|
||||
|
@ -2447,7 +2479,7 @@ int AAS_FindAttackSpotWithinRange( int srcnum, int rangenum, int enemynum, float
|
|||
//
|
||||
besttraveltime = 0;
|
||||
bestarea = 0;
|
||||
enemytraveltime = AAS_AreaTravelTimeToGoalArea( srcarea, srcorg, enemyarea, travelflags );
|
||||
AAS_AreaTravelTimeToGoalArea( srcarea, srcorg, enemyarea, travelflags );
|
||||
//
|
||||
badtravelflags = ~travelflags;
|
||||
//
|
||||
|
@ -2637,4 +2669,4 @@ qboolean AAS_GetRouteFirstVisPos( vec3_t srcpos, vec3_t destpos, int travelflags
|
|||
//
|
||||
// unsuccessful
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_def.h"
|
||||
|
|
|
@ -42,11 +42,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_libvar.h"
|
||||
#include "l_utils.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_aas_def.h"
|
||||
|
||||
#define LL(x) x=LittleLong(x)
|
||||
#define LS(x) x=LittleShort(x)
|
||||
|
||||
// ugly hack to turn off route-tables, can't find a way to check cvar's
|
||||
int disable_routetable = 0;
|
||||
|
||||
|
@ -103,7 +106,7 @@ void AAS_RT_FreeMemory( void *ptr ) {
|
|||
memorycount -= before - totalmemorysize;
|
||||
}
|
||||
|
||||
void AAS_RT_PrintMemoryUsage() {
|
||||
void AAS_RT_PrintMemoryUsage( void ) {
|
||||
#ifdef AAS_RT_MEMORY_USAGE
|
||||
|
||||
botimport.Print( PRT_MESSAGE, "\n" );
|
||||
|
@ -245,7 +248,7 @@ void AAS_RT_WriteByte( int si, fileHandle_t fp ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void AAS_RT_WriteRouteTable() {
|
||||
void AAS_RT_WriteRouteTable( void ) {
|
||||
int ident, version;
|
||||
unsigned short crc_aas;
|
||||
fileHandle_t fp;
|
||||
|
@ -339,7 +342,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) {
|
|||
|
||||
// check ident
|
||||
AAS_RT_DBG_Read( &ident, sizeof( ident ), fp );
|
||||
ident = LittleLong( ident );
|
||||
LL( ident );
|
||||
|
||||
if ( ident != RTBID ) {
|
||||
AAS_Error( "File is not an RTB file\n" );
|
||||
|
@ -349,7 +352,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) {
|
|||
|
||||
// check version
|
||||
AAS_RT_DBG_Read( &version, sizeof( version ), fp );
|
||||
version = LittleLong( version );
|
||||
LL( version );
|
||||
|
||||
if ( version != RTBVERSION ) {
|
||||
AAS_Error( "File is version %i not %i\n", version, RTBVERSION );
|
||||
|
@ -359,7 +362,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) {
|
|||
|
||||
// read the CRC check on the AAS data
|
||||
AAS_RT_DBG_Read( &crc, sizeof( crc ), fp );
|
||||
crc = LittleShort( crc );
|
||||
LS( crc );
|
||||
|
||||
// calculate a CRC on the AAS areas
|
||||
crc_aas = CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas );
|
||||
|
@ -484,9 +487,7 @@ void AAS_CreateAllRoutingCache( void );
|
|||
|
||||
void AAS_RT_BuildRouteTable( void ) {
|
||||
int i,j,k;
|
||||
aas_area_t *srcarea;
|
||||
aas_areasettings_t *srcsettings;
|
||||
// vec3_t vec;
|
||||
unsigned int totalcount;
|
||||
unsigned int noroutecount;
|
||||
|
||||
|
@ -561,7 +562,6 @@ void AAS_RT_BuildRouteTable( void ) {
|
|||
AAS_CreateAllRoutingCache();
|
||||
for ( i = 0; i < ( *aasworld ).numareas; i++ )
|
||||
{
|
||||
srcarea = &( *aasworld ).areas[i];
|
||||
srcsettings = &( *aasworld ).areasettings[i];
|
||||
|
||||
#ifdef FILTERAREAS
|
||||
|
@ -592,7 +592,6 @@ void AAS_RT_BuildRouteTable( void ) {
|
|||
|
||||
for ( i = 0; i < childcount; i++ )
|
||||
{
|
||||
srcarea = &( *aasworld ).areas[filtered_areas[i]];
|
||||
srcsettings = &( *aasworld ).areasettings[filtered_areas[i]];
|
||||
|
||||
// allocate memory for this area
|
||||
|
@ -838,15 +837,12 @@ void AAS_RT_BuildRouteTable( void ) {
|
|||
aas_area_parent_t *apar;
|
||||
aas_parent_link_t *oplink;
|
||||
|
||||
int localRoutesCount, parentRoutesCount, parentChildrenCount, visibleParentsCount, parentLinkCount, routeIndexesCount;
|
||||
int parentChildrenCount, visibleParentsCount, parentLinkCount;
|
||||
|
||||
rt = ( *aasworld ).routetable;
|
||||
localRoutesCount = 0;
|
||||
parentRoutesCount = 0;
|
||||
parentChildrenCount = 0;
|
||||
visibleParentsCount = 0;
|
||||
parentLinkCount = 0;
|
||||
routeIndexesCount = 0;
|
||||
|
||||
// areaChildIndexes
|
||||
rt->areaChildIndexes = (unsigned short int *) AAS_RT_GetClearedMemory( ( *aasworld ).numareas * sizeof( unsigned short int ) );
|
||||
|
@ -965,7 +961,7 @@ void AAS_RT_BuildRouteTable( void ) {
|
|||
{
|
||||
// kill the parent links
|
||||
next = area_childlocaldata[i]->parentlink;
|
||||
// TTimo: suggest () around assignment used as truth value
|
||||
// TTimo gcc: suggests () around assignment used as truth value
|
||||
while ( ( trav = next ) )
|
||||
{
|
||||
next = next->next;
|
||||
|
@ -1109,7 +1105,7 @@ aas_rt_route_t *AAS_RT_GetRoute( int srcnum, vec3_t origin, int destnum ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
#include "../game/be_ai_goal.h"
|
||||
#include "be_ai_goal.h"
|
||||
int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
||||
int lastgoalareanum, int lastareanum,
|
||||
int *avoidreach, float *avoidreachtimes, int *avoidreachtries,
|
||||
|
@ -1386,7 +1382,7 @@ qboolean AAS_RT_GetHidePos( vec3_t srcpos, int srcnum, int srcarea, vec3_t destp
|
|||
if ( !destVisLookup[rt->parentLinks[travChild->startParentLinks].parent] ) {
|
||||
// success ?
|
||||
if ( !botimport.AICast_VisibleFromPos( destpos, destnum, ( *aasworld ).areas[pathArea].center, srcnum, qfalse ) ) {
|
||||
// SUCESS !!
|
||||
// SUCCESS !!
|
||||
travParent = &rt->parents[rt->parentLinks[travChild->startParentLinks].parent];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_aas_def.h"
|
||||
|
||||
|
@ -411,9 +411,11 @@ aas_trace_t AAS_TraceClientBBox( vec3_t start, vec3_t end, int presencetype,
|
|||
//exactly the same when they're both the start point
|
||||
if ( tstack_p->start[0] == start[0] &&
|
||||
tstack_p->start[1] == start[1] &&
|
||||
tstack_p->start[2] == start[2] ) {
|
||||
tstack_p->start[2] == start[2] )
|
||||
{
|
||||
trace.startsolid = qtrue;
|
||||
trace.fraction = 0.0;
|
||||
VectorClear(v1);
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
|
@ -460,9 +462,11 @@ aas_trace_t AAS_TraceClientBBox( vec3_t start, vec3_t end, int presencetype,
|
|||
//exactly the same when they're both the start point
|
||||
if ( tstack_p->start[0] == start[0] &&
|
||||
tstack_p->start[1] == start[1] &&
|
||||
tstack_p->start[2] == start[2] ) {
|
||||
tstack_p->start[2] == start[2] )
|
||||
{
|
||||
trace.startsolid = qtrue;
|
||||
trace.fraction = 0.0;
|
||||
VectorClear(v1);
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
|
@ -1244,7 +1248,7 @@ aas_link_t *AAS_LinkEntityClientBBox( vec3_t absmins, vec3_t absmaxs, int entnum
|
|||
//===========================================================================
|
||||
aas_plane_t *AAS_PlaneFromNum( int planenum ) {
|
||||
if ( !( *aasworld ).loaded ) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &( *aasworld ).planes[planenum];
|
||||
|
|
|
@ -44,11 +44,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_struct.h"
|
||||
#include "l_libvar.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "../game/be_ai_char.h"
|
||||
#include "be_ai_char.h"
|
||||
|
||||
#define MAX_CHARACTERISTICS 80
|
||||
|
||||
|
@ -108,8 +108,8 @@ bot_character_t *BotCharacterFromHandle( int handle ) {
|
|||
void BotDumpCharacter( bot_character_t *ch ) {
|
||||
int i;
|
||||
|
||||
Log_Write( "%s", ch->filename );
|
||||
Log_Write( "skill %d\n", ch->skill );
|
||||
Log_Write("%s\n", ch->filename);
|
||||
Log_Write("skill %d\n", ch->skill);
|
||||
Log_Write( "{\n" );
|
||||
for ( i = 0; i < MAX_CHARACTERISTICS; i++ )
|
||||
{
|
||||
|
@ -246,7 +246,7 @@ bot_character_t *BotLoadCharacterFromFile( char *charfile, int skill ) {
|
|||
break;
|
||||
}
|
||||
if ( token.type != TT_NUMBER || !( token.subtype & TT_INTEGER ) ) {
|
||||
SourceError( source, "expected integer index, found %s\n", token.string );
|
||||
SourceError( source, "expected integer index, found %s", token.string );
|
||||
FreeSource( source );
|
||||
BotFreeCharacterStrings( ch );
|
||||
FreeMemory( ch );
|
||||
|
@ -254,14 +254,14 @@ bot_character_t *BotLoadCharacterFromFile( char *charfile, int skill ) {
|
|||
} //end if
|
||||
index = token.intvalue;
|
||||
if ( index < 0 || index > MAX_CHARACTERISTICS ) {
|
||||
SourceError( source, "characteristic index out of range [0, %d]\n", MAX_CHARACTERISTICS );
|
||||
SourceError( source, "characteristic index out of range [0, %d]", MAX_CHARACTERISTICS );
|
||||
FreeSource( source );
|
||||
BotFreeCharacterStrings( ch );
|
||||
FreeMemory( ch );
|
||||
return NULL;
|
||||
} //end if
|
||||
if ( ch->c[index].type ) {
|
||||
SourceError( source, "characteristic %d already initialized\n", index );
|
||||
SourceError( source, "characteristic %d already initialized", index );
|
||||
FreeSource( source );
|
||||
BotFreeCharacterStrings( ch );
|
||||
FreeMemory( ch );
|
||||
|
@ -292,7 +292,7 @@ bot_character_t *BotLoadCharacterFromFile( char *charfile, int skill ) {
|
|||
} //end else if
|
||||
else
|
||||
{
|
||||
SourceError( source, "expected integer, float or string, found %s\n", token.string );
|
||||
SourceError( source, "expected integer, float or string, found %s", token.string );
|
||||
FreeSource( source );
|
||||
BotFreeCharacterStrings( ch );
|
||||
FreeMemory( ch );
|
||||
|
@ -322,7 +322,7 @@ bot_character_t *BotLoadCharacterFromFile( char *charfile, int skill ) {
|
|||
} //end if
|
||||
else
|
||||
{
|
||||
SourceError( source, "unknown definition %s\n", token.string );
|
||||
SourceError( source, "unknown definition %s", token.string );
|
||||
FreeSource( source );
|
||||
BotFreeCharacterStrings( ch );
|
||||
FreeMemory( ch );
|
||||
|
@ -399,7 +399,7 @@ int BotLoadCachedCharacter( char *charfile, int skill, int reload ) {
|
|||
//
|
||||
botimport.Print( PRT_MESSAGE, "loaded skill %d from %s\n", skill, charfile );
|
||||
#ifdef DEBUG
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "skill %d loaded in %d msec from %s\n", skill, Sys_MilliSeconds() - starttime, charfile );
|
||||
} //end if
|
||||
#endif //DEBUG
|
||||
|
@ -685,7 +685,7 @@ int Characteristic_Integer( int character, int index ) {
|
|||
} //end else if
|
||||
else
|
||||
{
|
||||
botimport.Print( PRT_ERROR, "characteristic %d is not a integer\n", index );
|
||||
botimport.Print( PRT_ERROR, "characteristic %d is not an integer\n", index );
|
||||
return 0;
|
||||
} //end else if
|
||||
// return 0;
|
||||
|
@ -738,14 +738,11 @@ void Characteristic_String( int character, int index, char *buf, int size ) {
|
|||
if ( ch->c[index].type == CT_STRING ) {
|
||||
strncpy( buf, ch->c[index].value.string, size - 1 );
|
||||
buf[size - 1] = '\0';
|
||||
return;
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
botimport.Print( PRT_ERROR, "characteristic %d is not a string\n", index );
|
||||
return;
|
||||
} //end else if
|
||||
return;
|
||||
} //end of the function Characteristic_String
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
53
Projects/Android/jni/rtcw/src/botlib/be_ai_char.h
Normal file
53
Projects/Android/jni/rtcw/src/botlib/be_ai_char.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ai_char.h
|
||||
*
|
||||
* desc: bot characters
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//loads a bot character from a file
|
||||
int BotLoadCharacter( char *charfile, int skill );
|
||||
//frees a bot character
|
||||
void BotFreeCharacter( int character );
|
||||
//float characteristic
|
||||
float Characteristic_Float( int character, int index );
|
||||
//bounded float characteristic
|
||||
float Characteristic_BFloat( int character, int index, float min, float max );
|
||||
//integer characteristic
|
||||
int Characteristic_Integer( int character, int index );
|
||||
//bounded integer characteristic
|
||||
int Characteristic_BInteger( int character, int index, int min, int max );
|
||||
//string characteristic
|
||||
void Characteristic_String( int character, int index, char *buf, int size );
|
||||
//free cached bot characters
|
||||
void BotShutdownCharacters( void );
|
|
@ -36,7 +36,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../game/q_shared.h"
|
||||
//#include "../server/server.h"
|
||||
#include "l_memory.h"
|
||||
#include "l_libvar.h"
|
||||
#include "l_script.h"
|
||||
|
@ -45,12 +44,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_utils.h"
|
||||
#include "l_log.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "../game/be_ea.h"
|
||||
#include "../game/be_ai_chat.h"
|
||||
#include "be_ea.h"
|
||||
#include "be_ai_chat.h"
|
||||
|
||||
|
||||
//escape character
|
||||
|
@ -355,7 +354,7 @@ void BotQueueConsoleMessage( int chatstate, int type, char *message ) {
|
|||
m->handle = cs->handle;
|
||||
m->time = AAS_Time();
|
||||
m->type = type;
|
||||
strncpy( m->message, message, MAX_MESSAGE_SIZE );
|
||||
Q_strncpyz( m->message, message, MAX_MESSAGE_SIZE );
|
||||
m->next = NULL;
|
||||
if ( cs->lastmessage ) {
|
||||
cs->lastmessage->next = m;
|
||||
|
@ -378,14 +377,27 @@ void BotQueueConsoleMessage( int chatstate, int type, char *message ) {
|
|||
//===========================================================================
|
||||
int BotNextConsoleMessage( int chatstate, bot_consolemessage_t *cm ) {
|
||||
bot_chatstate_t *cs;
|
||||
bot_consolemessage_t *firstmsg;
|
||||
|
||||
cs = BotChatStateFromHandle( chatstate );
|
||||
if ( !cs ) {
|
||||
return 0;
|
||||
}
|
||||
if ( cs->firstmessage ) {
|
||||
memcpy( cm, cs->firstmessage, sizeof( bot_consolemessage_t ) );
|
||||
cm->next = cm->prev = NULL;
|
||||
if ((firstmsg = cs->firstmessage)) {
|
||||
cm->handle = firstmsg->handle;
|
||||
cm->time = firstmsg->time;
|
||||
cm->type = firstmsg->type;
|
||||
Q_strncpyz(cm->message, firstmsg->message,
|
||||
sizeof(cm->message));
|
||||
|
||||
/* We omit setting the two pointers in cm because pointer
|
||||
* size in the VM differs between the size in the engine on
|
||||
* 64 bit machines, which would lead to a buffer overflow if
|
||||
* this functions is called from the VM. The pointers are
|
||||
* of no interest to functions calling
|
||||
* BotNextConsoleMessage anyways.
|
||||
*/
|
||||
|
||||
return cm->handle;
|
||||
} //end if
|
||||
return 0;
|
||||
|
@ -601,7 +613,7 @@ void BotDumpSynonymList( bot_synonymlist_t *synlist ) {
|
|||
}
|
||||
for ( syn = synlist; syn; syn = syn->next )
|
||||
{
|
||||
fprintf( fp, "%d : [", (int)syn->context );
|
||||
fprintf( fp, "%ld : [", syn->context );
|
||||
for ( synonym = syn->firstsynonym; synonym; synonym = synonym->next )
|
||||
{
|
||||
fprintf( fp, "(\"%s\", %1.2f)", synonym->string, synonym->weight );
|
||||
|
@ -678,7 +690,7 @@ bot_synonymlist_t *BotLoadSynonyms( char *filename ) {
|
|||
} //end if
|
||||
else if ( !strcmp( token.string, "[" ) ) {
|
||||
size += sizeof( bot_synonymlist_t );
|
||||
if ( pass ) {
|
||||
if ( pass && ptr ) {
|
||||
syn = (bot_synonymlist_t *) ptr;
|
||||
ptr += sizeof( bot_synonymlist_t );
|
||||
syn->context = context;
|
||||
|
@ -693,6 +705,7 @@ bot_synonymlist_t *BotLoadSynonyms( char *filename ) {
|
|||
lastsynonym = NULL;
|
||||
while ( 1 )
|
||||
{
|
||||
size_t len;
|
||||
if ( !PC_ExpectTokenString( source, "(" ) ||
|
||||
!PC_ExpectTokenType( source, TT_STRING, 0, &token ) ) {
|
||||
FreeSource( source );
|
||||
|
@ -700,16 +713,18 @@ bot_synonymlist_t *BotLoadSynonyms( char *filename ) {
|
|||
} //end if
|
||||
StripDoubleQuotes( token.string );
|
||||
if ( strlen( token.string ) <= 0 ) {
|
||||
SourceError( source, "empty string", token.string );
|
||||
SourceError( source, "empty string" );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
size += sizeof( bot_synonym_t ) + strlen( token.string ) + 1;
|
||||
if ( pass ) {
|
||||
len = strlen(token.string) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
size += sizeof(bot_synonym_t) + len;
|
||||
if ( pass && ptr ) {
|
||||
synonym = (bot_synonym_t *) ptr;
|
||||
ptr += sizeof( bot_synonym_t );
|
||||
synonym->string = ptr;
|
||||
ptr += strlen( token.string ) + 1;
|
||||
ptr += len;
|
||||
strcpy( synonym->string, token.string );
|
||||
//
|
||||
if ( lastsynonym ) {
|
||||
|
@ -724,7 +739,7 @@ bot_synonymlist_t *BotLoadSynonyms( char *filename ) {
|
|||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
if ( pass ) {
|
||||
if ( pass && ptr ) {
|
||||
synonym->weight = token.floatvalue;
|
||||
syn->totalweight += synonym->weight;
|
||||
} //end if
|
||||
|
@ -737,7 +752,7 @@ bot_synonymlist_t *BotLoadSynonyms( char *filename ) {
|
|||
} //end if
|
||||
} //end while
|
||||
if ( numsynonyms < 2 ) {
|
||||
SourceError( source, "synonym must have at least two entries\n" );
|
||||
SourceError( source, "synonym must have at least two entries" );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
|
@ -854,7 +869,6 @@ void BotReplaceReplySynonyms( char *string, unsigned long int context ) {
|
|||
}
|
||||
for ( synonym = syn->firstsynonym->next; synonym; synonym = synonym->next )
|
||||
{
|
||||
str2 = synonym->string;
|
||||
//if the synonym is not at the front of the string continue
|
||||
str2 = StringContainsWord( str1, synonym->string, qfalse );
|
||||
if ( !str2 || str2 != str1 ) {
|
||||
|
@ -909,7 +923,7 @@ int BotLoadChatMessage( source_t *source, char *chatmessagestring ) {
|
|||
if ( token.type == TT_STRING ) {
|
||||
StripDoubleQuotes( token.string );
|
||||
if ( strlen( ptr ) + strlen( token.string ) + 1 > MAX_MESSAGE_SIZE ) {
|
||||
SourceError( source, "chat message too long\n" );
|
||||
SourceError( source, "chat message too long" );
|
||||
return qfalse;
|
||||
} //end if
|
||||
strcat( ptr, token.string );
|
||||
|
@ -917,22 +931,22 @@ int BotLoadChatMessage( source_t *source, char *chatmessagestring ) {
|
|||
//variable string
|
||||
else if ( token.type == TT_NUMBER && ( token.subtype & TT_INTEGER ) ) {
|
||||
if ( strlen( ptr ) + 7 > MAX_MESSAGE_SIZE ) {
|
||||
SourceError( source, "chat message too long\n" );
|
||||
SourceError( source, "chat message too long" );
|
||||
return qfalse;
|
||||
} //end if
|
||||
sprintf( &ptr[strlen( ptr )], "%cv%d%c", ESCAPE_CHAR, (int)token.intvalue, ESCAPE_CHAR );
|
||||
sprintf( &ptr[strlen( ptr )], "%cv%ld%c", ESCAPE_CHAR, token.intvalue, ESCAPE_CHAR );
|
||||
} //end if
|
||||
//random string
|
||||
else if ( token.type == TT_NAME ) {
|
||||
if ( strlen( ptr ) + 7 > MAX_MESSAGE_SIZE ) {
|
||||
SourceError( source, "chat message too long\n" );
|
||||
SourceError( source, "chat message too long" );
|
||||
return qfalse;
|
||||
} //end if
|
||||
sprintf( &ptr[strlen( ptr )], "%cr%s%c", ESCAPE_CHAR, token.string, ESCAPE_CHAR );
|
||||
} //end else if
|
||||
else
|
||||
{
|
||||
SourceError( source, "unknown message component %s\n", token.string );
|
||||
SourceError( source, "unknown message component %s", token.string );
|
||||
return qfalse;
|
||||
} //end else
|
||||
if ( PC_CheckTokenString( source, ";" ) ) {
|
||||
|
@ -1012,17 +1026,20 @@ bot_randomlist_t *BotLoadRandomStrings( char *filename ) {
|
|||
//
|
||||
while ( PC_ReadToken( source, &token ) )
|
||||
{
|
||||
size_t len;
|
||||
if ( token.type != TT_NAME ) {
|
||||
SourceError( source, "unknown random %s", token.string );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
size += sizeof( bot_randomlist_t ) + strlen( token.string ) + 1;
|
||||
if ( pass ) {
|
||||
len = strlen(token.string) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
size += sizeof(bot_randomlist_t) + len;
|
||||
if ( pass && ptr ) {
|
||||
random = (bot_randomlist_t *) ptr;
|
||||
ptr += sizeof( bot_randomlist_t );
|
||||
random->string = ptr;
|
||||
ptr += strlen( token.string ) + 1;
|
||||
ptr += len;
|
||||
strcpy( random->string, token.string );
|
||||
random->firstrandomstring = NULL;
|
||||
random->numstrings = 0;
|
||||
|
@ -1043,12 +1060,14 @@ bot_randomlist_t *BotLoadRandomStrings( char *filename ) {
|
|||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
size += sizeof( bot_randomstring_t ) + strlen( chatmessagestring ) + 1;
|
||||
if ( pass ) {
|
||||
len = strlen(chatmessagestring) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
size += sizeof(bot_randomstring_t) + len;
|
||||
if ( pass && ptr ) {
|
||||
randomstring = (bot_randomstring_t *) ptr;
|
||||
ptr += sizeof( bot_randomstring_t );
|
||||
randomstring->string = ptr;
|
||||
ptr += strlen( chatmessagestring ) + 1;
|
||||
ptr += len;
|
||||
strcpy( randomstring->string, chatmessagestring );
|
||||
//
|
||||
random->numstrings++;
|
||||
|
@ -1180,14 +1199,14 @@ bot_matchpiece_t *BotLoadMatchPieces( source_t *source, char *endtoken ) {
|
|||
while ( PC_ReadToken( source, &token ) )
|
||||
{
|
||||
if ( token.type == TT_NUMBER && ( token.subtype & TT_INTEGER ) ) {
|
||||
if ( token.intvalue < 0 || token.intvalue >= MAX_MATCHVARIABLES ) {
|
||||
SourceError( source, "can't have more than %d match variables\n", MAX_MATCHVARIABLES );
|
||||
if (token.intvalue >= MAX_MATCHVARIABLES) {
|
||||
SourceError( source, "can't have more than %d match variables", MAX_MATCHVARIABLES );
|
||||
FreeSource( source );
|
||||
BotFreeMatchPieces( firstpiece );
|
||||
return NULL;
|
||||
} //end if
|
||||
if ( lastwasvariable ) {
|
||||
SourceError( source, "not allowed to have adjacent variables\n" );
|
||||
SourceError( source, "not allowed to have adjacent variables" );
|
||||
FreeSource( source );
|
||||
BotFreeMatchPieces( firstpiece );
|
||||
return NULL;
|
||||
|
@ -1247,7 +1266,7 @@ bot_matchpiece_t *BotLoadMatchPieces( source_t *source, char *endtoken ) {
|
|||
} //end if
|
||||
else
|
||||
{
|
||||
SourceError( source, "invalid token %s\n", token.string );
|
||||
SourceError( source, "invalid token %s", token.string );
|
||||
FreeSource( source );
|
||||
BotFreeMatchPieces( firstpiece );
|
||||
return NULL;
|
||||
|
@ -1303,7 +1322,7 @@ bot_matchtemplate_t *BotLoadMatchTemplates( char *matchfile ) {
|
|||
while ( PC_ReadToken( source, &token ) )
|
||||
{
|
||||
if ( token.type != TT_NUMBER || !( token.subtype & TT_INTEGER ) ) {
|
||||
SourceError( source, "expected integer, found %s\n", token.string );
|
||||
SourceError( source, "expected integer, found %s", token.string );
|
||||
BotFreeMatchTemplates( matches );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
|
@ -1449,7 +1468,7 @@ int BotFindMatch( char *str, bot_match_t *match, unsigned long int context ) {
|
|||
int i;
|
||||
bot_matchtemplate_t *ms;
|
||||
|
||||
strncpy( match->string, str, MAX_MESSAGE_SIZE );
|
||||
Q_strncpyz( match->string, str, MAX_MESSAGE_SIZE );
|
||||
//remove any trailing enters
|
||||
while ( strlen( match->string ) &&
|
||||
match->string[strlen( match->string ) - 1] == '\n' )
|
||||
|
@ -1497,7 +1516,6 @@ void BotMatchVariable( bot_match_t *match, int variable, char *buf, int size ) {
|
|||
{
|
||||
strcpy( buf, "" );
|
||||
} //end else
|
||||
return;
|
||||
} //end of the function BotMatchVariable
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -1880,7 +1898,7 @@ bot_replychat_t *BotLoadReplyChat( char *filename ) {
|
|||
botimport.Print( PRT_MESSAGE, "loaded %s\n", filename );
|
||||
//
|
||||
//BotDumpReplyChat(replychatlist);
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
BotCheckReplyChatIntegrety( replychatlist );
|
||||
} //end if
|
||||
//
|
||||
|
@ -1965,7 +1983,7 @@ bot_chat_t *BotLoadInitialChat( char *chatfile, char *chatname ) {
|
|||
return NULL;
|
||||
} //end if
|
||||
StripDoubleQuotes( token.string );
|
||||
//after the chat name we expect a opening brace
|
||||
//after the chat name we expect an opening brace
|
||||
if ( !PC_ExpectTokenString( source, "{" ) ) {
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
|
@ -1984,7 +2002,7 @@ bot_chat_t *BotLoadInitialChat( char *chatfile, char *chatname ) {
|
|||
break;
|
||||
}
|
||||
if ( strcmp( token.string, "type" ) ) {
|
||||
SourceError( source, "expected type found %s\n", token.string );
|
||||
SourceError( source, "expected type found %s", token.string );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
|
@ -1995,9 +2013,9 @@ bot_chat_t *BotLoadInitialChat( char *chatfile, char *chatname ) {
|
|||
return NULL;
|
||||
} //end if
|
||||
StripDoubleQuotes( token.string );
|
||||
if ( pass ) {
|
||||
if ( pass && ptr ) {
|
||||
chattype = (bot_chattype_t *) ptr;
|
||||
strncpy( chattype->name, token.string, MAX_CHATTYPE_NAME );
|
||||
Q_strncpyz( chattype->name, token.string, MAX_CHATTYPE_NAME );
|
||||
chattype->firstchatmessage = NULL;
|
||||
//add the chat type to the chat
|
||||
chattype->next = chat->types;
|
||||
|
@ -2009,11 +2027,14 @@ bot_chat_t *BotLoadInitialChat( char *chatfile, char *chatname ) {
|
|||
//read the chat messages
|
||||
while ( !PC_CheckTokenString( source, "}" ) )
|
||||
{
|
||||
size_t len;
|
||||
if ( !BotLoadChatMessage( source, chatmessagestring ) ) {
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
if ( pass ) {
|
||||
len = strlen(chatmessagestring) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
if ( pass && ptr ) {
|
||||
chatmessage = (bot_chatmessage_t *) ptr;
|
||||
chatmessage->time = -2 * CHATMESSAGE_RECENTTIME;
|
||||
//put the chat message in the list
|
||||
|
@ -2023,11 +2044,11 @@ bot_chat_t *BotLoadInitialChat( char *chatfile, char *chatname ) {
|
|||
ptr += sizeof( bot_chatmessage_t );
|
||||
chatmessage->chatmessage = ptr;
|
||||
strcpy( chatmessage->chatmessage, chatmessagestring );
|
||||
ptr += strlen( chatmessagestring ) + 1;
|
||||
ptr += len;
|
||||
//the number of chat messages increased
|
||||
chattype->numchatmessages++;
|
||||
} //end if
|
||||
size += sizeof( bot_chatmessage_t ) + strlen( chatmessagestring ) + 1;
|
||||
size += sizeof(bot_chatmessage_t) + len;
|
||||
} //end if
|
||||
} //end while
|
||||
} //end if
|
||||
|
@ -2050,7 +2071,7 @@ bot_chat_t *BotLoadInitialChat( char *chatfile, char *chatname ) {
|
|||
} //end if
|
||||
else
|
||||
{
|
||||
SourceError( source, "unknown definition %s\n", token.string );
|
||||
SourceError( source, "unknown definition %s", token.string );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end else
|
||||
|
@ -2067,13 +2088,13 @@ bot_chat_t *BotLoadInitialChat( char *chatfile, char *chatname ) {
|
|||
botimport.Print( PRT_MESSAGE, "loaded %s from %s\n", chatname, chatfile );
|
||||
//
|
||||
//BotDumpInitialChat(chat);
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
BotCheckInitialChatIntegrety( chat );
|
||||
} //end if
|
||||
#ifdef DEBUG
|
||||
botimport.Print( PRT_MESSAGE, "initial chats loaded in %d msec\n", Sys_MilliSeconds() - starttime );
|
||||
#endif //DEBUG
|
||||
//character was read succesfully
|
||||
//character was read successfully
|
||||
return chat;
|
||||
} //end of the function BotLoadInitialChat
|
||||
//===========================================================================
|
||||
|
@ -2733,7 +2754,7 @@ void BotSetChatName( int chatstate, char *name ) {
|
|||
return;
|
||||
}
|
||||
memset( cs->name, 0, sizeof( cs->name ) );
|
||||
strncpy( cs->name, name, sizeof( cs->name ) );
|
||||
strncpy( cs->name, name, sizeof( cs->name ) - 1 );
|
||||
cs->name[sizeof( cs->name ) - 1] = '\0';
|
||||
} //end of the function BotSetChatName
|
||||
//===========================================================================
|
||||
|
@ -2779,7 +2800,6 @@ int BotAllocChatState( void ) {
|
|||
// Changes Globals: -
|
||||
//========================================================================
|
||||
void BotFreeChatState( int handle ) {
|
||||
bot_chatstate_t *cs;
|
||||
bot_consolemessage_t m;
|
||||
int h;
|
||||
|
||||
|
@ -2791,7 +2811,6 @@ void BotFreeChatState( int handle ) {
|
|||
botimport.Print( PRT_FATAL, "invalid chat state %d\n", handle );
|
||||
return;
|
||||
} //end if
|
||||
cs = botchatstates[handle];
|
||||
if ( LibVarGetValue( "bot_reloadcharacters" ) ) {
|
||||
BotFreeChatFile( handle );
|
||||
} //end if
|
||||
|
|
118
Projects/Android/jni/rtcw/src/botlib/be_ai_chat.h
Normal file
118
Projects/Android/jni/rtcw/src/botlib/be_ai_chat.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ai_chat.h
|
||||
*
|
||||
* desc: char AI
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define MAX_MESSAGE_SIZE 150 //limit in game dll
|
||||
#define MAX_CHATTYPE_NAME 32
|
||||
#define MAX_MATCHVARIABLES 8
|
||||
|
||||
#define CHAT_GENDERLESS 0
|
||||
#define CHAT_GENDERFEMALE 1
|
||||
#define CHAT_GENDERMALE 2
|
||||
|
||||
#define CHAT_ALL 0
|
||||
#define CHAT_TEAM 1
|
||||
|
||||
//a console message
|
||||
typedef struct bot_consolemessage_s
|
||||
{
|
||||
int handle;
|
||||
float time; //message time
|
||||
int type; //message type
|
||||
char message[MAX_MESSAGE_SIZE]; //message
|
||||
struct bot_consolemessage_s *prev, *next; //prev and next in list
|
||||
} bot_consolemessage_t;
|
||||
|
||||
//match variable
|
||||
typedef struct bot_matchvariable_s
|
||||
{
|
||||
char *ptr;
|
||||
int length;
|
||||
} bot_matchvariable_t;
|
||||
//returned to AI when a match is found
|
||||
typedef struct bot_match_s
|
||||
{
|
||||
char string[MAX_MESSAGE_SIZE];
|
||||
int type;
|
||||
int subtype;
|
||||
bot_matchvariable_t variables[MAX_MATCHVARIABLES];
|
||||
} bot_match_t;
|
||||
|
||||
//setup the chat AI
|
||||
int BotSetupChatAI( void );
|
||||
//shutdown the chat AI
|
||||
void BotShutdownChatAI( void );
|
||||
//returns the handle to a newly allocated chat state
|
||||
int BotAllocChatState( void );
|
||||
//frees the chatstate
|
||||
void BotFreeChatState( int handle );
|
||||
//adds a console message to the chat state
|
||||
void BotQueueConsoleMessage( int chatstate, int type, char *message );
|
||||
//removes the console message from the chat state
|
||||
void BotRemoveConsoleMessage( int chatstate, int handle );
|
||||
//returns the next console message from the state
|
||||
int BotNextConsoleMessage( int chatstate, bot_consolemessage_t *cm );
|
||||
//returns the number of console messages currently stored in the state
|
||||
int BotNumConsoleMessages( int chatstate );
|
||||
//enters a chat message of the given type
|
||||
void BotInitialChat( int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
|
||||
//returns the number of initial chat messages of the given type
|
||||
int BotNumInitialChats( int chatstate, char *type );
|
||||
//find a reply for the given message
|
||||
int BotReplyChat( int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
|
||||
//returns the length of the currently selected chat message
|
||||
int BotChatLength( int chatstate );
|
||||
//enters the selected chat message
|
||||
void BotEnterChat( int chatstate, int client, int sendto );
|
||||
//get the chat message ready to be output
|
||||
void BotGetChatMessage( int chatstate, char *buf, int size );
|
||||
//checks if the first string contains the second one, returns index into first string or -1 if not found
|
||||
int StringContains( char *str1, char *str2, int casesensitive );
|
||||
//finds a match for the given string
|
||||
int BotFindMatch( char *str, bot_match_t *match, unsigned long int context );
|
||||
//returns a variable from a match
|
||||
void BotMatchVariable( bot_match_t *match, int variable, char *buf, int size );
|
||||
//unify all the white spaces in the string
|
||||
void UnifyWhiteSpaces( char *string );
|
||||
//replace all the context related synonyms in the string
|
||||
void BotReplaceSynonyms( char *string, unsigned long int context );
|
||||
//loads a chat file for the chat state
|
||||
int BotLoadChatFile( int chatstate, char *chatfile, char *chatname );
|
||||
//store the gender of the bot in the chat state
|
||||
void BotSetChatGender( int chatstate, int gender );
|
||||
//store the bot name in the chat state
|
||||
void BotSetChatName( int chatstate, char *name );
|
||||
|
|
@ -43,11 +43,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "../game/be_ai_gen.h"
|
||||
#include "be_ai_gen.h"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -56,7 +56,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
int GeneticSelection( int numranks, float *rankings ) {
|
||||
float sum, select;
|
||||
float sum;
|
||||
int i, index;
|
||||
|
||||
sum = 0;
|
||||
|
@ -70,7 +70,7 @@ int GeneticSelection( int numranks, float *rankings ) {
|
|||
if ( sum > 0 ) {
|
||||
//select a bot where the ones with the higest rankings have
|
||||
//the highest chance of being selected
|
||||
select = random() * sum;
|
||||
//sum *= random();
|
||||
for ( i = 0; i < numranks; i++ )
|
||||
{
|
||||
if ( rankings[i] < 0 ) {
|
||||
|
|
38
Projects/Android/jni/rtcw/src/botlib/be_ai_gen.h
Normal file
38
Projects/Android/jni/rtcw/src/botlib/be_ai_gen.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ai_gen.h
|
||||
*
|
||||
* desc: genetic selection
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
int GeneticParentsAndChildSelection( int numranks, float *ranks, int *parent1, int *parent2, int *child );
|
|
@ -44,13 +44,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_ai_weight.h"
|
||||
#include "../game/be_ai_goal.h"
|
||||
#include "../game/be_ai_move.h"
|
||||
#include "be_ai_goal.h"
|
||||
#include "be_ai_move.h"
|
||||
|
||||
//#define DEBUG_AI_GOAL
|
||||
#ifdef RANDOMIZE
|
||||
|
@ -137,7 +137,7 @@ typedef struct iteminfo_s
|
|||
int number; //number of the item info
|
||||
} iteminfo_t;
|
||||
|
||||
#define ITEMINFO_OFS( x ) (int)&( ( (iteminfo_t *)0 )->x )
|
||||
#define ITEMINFO_OFS(x) (size_t)&(((iteminfo_t *)0)->x)
|
||||
|
||||
fielddef_t iteminfo_fields[] =
|
||||
{
|
||||
|
@ -228,6 +228,9 @@ void BotInterbreedGoalFuzzyLogic( int parent1, int parent2, int child ) {
|
|||
p2 = BotGoalStateFromHandle( parent2 );
|
||||
c = BotGoalStateFromHandle( child );
|
||||
|
||||
if (!p1 || !p2 || !c)
|
||||
return;
|
||||
|
||||
InterbreedWeightConfigs( p1->itemweightconfig, p2->itemweightconfig,
|
||||
c->itemweightconfig );
|
||||
} //end of the function BotInterbreedingGoalFuzzyLogic
|
||||
|
@ -238,10 +241,11 @@ void BotInterbreedGoalFuzzyLogic( int parent1, int parent2, int child ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void BotSaveGoalFuzzyLogic( int goalstate, char *filename ) {
|
||||
bot_goalstate_t *gs;
|
||||
//bot_goalstate_t *gs;
|
||||
|
||||
gs = BotGoalStateFromHandle( goalstate );
|
||||
//gs = BotGoalStateFromHandle( goalstate );
|
||||
|
||||
//if (!gs) return;
|
||||
//WriteWeightConfig(filename, gs->itemweightconfig);
|
||||
} //end of the function BotSaveGoalFuzzyLogic
|
||||
//===========================================================================
|
||||
|
@ -255,6 +259,7 @@ void BotMutateGoalFuzzyLogic( int goalstate, float range ) {
|
|||
|
||||
gs = BotGoalStateFromHandle( goalstate );
|
||||
|
||||
if (!gs) return;
|
||||
EvolveWeightConfig( gs->itemweightconfig );
|
||||
} //end of the function BotMutateGoalFuzzyLogic
|
||||
//===========================================================================
|
||||
|
@ -266,7 +271,7 @@ void BotMutateGoalFuzzyLogic( int goalstate, float range ) {
|
|||
itemconfig_t *LoadItemConfig( char *filename ) {
|
||||
int max_iteminfo;
|
||||
token_t token;
|
||||
char path[MAX_PATH];
|
||||
char path[MAX_QPATH];
|
||||
source_t *source;
|
||||
itemconfig_t *ic;
|
||||
iteminfo_t *ii;
|
||||
|
@ -278,7 +283,7 @@ itemconfig_t *LoadItemConfig( char *filename ) {
|
|||
LibVarSet( "max_iteminfo", "128" );
|
||||
}
|
||||
|
||||
strncpy( path, filename, MAX_PATH );
|
||||
Q_strncpyz( path, filename, sizeof( path ) );
|
||||
source = LoadSourceFile( path );
|
||||
if ( !source ) {
|
||||
botimport.Print( PRT_ERROR, "counldn't load %s\n", path );
|
||||
|
@ -294,7 +299,7 @@ itemconfig_t *LoadItemConfig( char *filename ) {
|
|||
{
|
||||
if ( !strcmp( token.string, "iteminfo" ) ) {
|
||||
if ( ic->numiteminfo >= max_iteminfo ) {
|
||||
SourceError( source, "more than %d item info defined\n", max_iteminfo );
|
||||
SourceError( source, "more than %d item info defined", max_iteminfo );
|
||||
FreeMemory( ic );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
|
@ -303,11 +308,11 @@ itemconfig_t *LoadItemConfig( char *filename ) {
|
|||
memset( ii, 0, sizeof( iteminfo_t ) );
|
||||
if ( !PC_ExpectTokenType( source, TT_STRING, 0, &token ) ) {
|
||||
FreeMemory( ic );
|
||||
FreeMemory( source );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
} //end if
|
||||
StripDoubleQuotes( token.string );
|
||||
strncpy( ii->classname, token.string, sizeof( ii->classname ) - 1 );
|
||||
Q_strncpyz( ii->classname, token.string, sizeof( ii->classname ) );
|
||||
if ( !ReadStructure( source, &iteminfo_struct, (char *) ii ) ) {
|
||||
FreeMemory( ic );
|
||||
FreeSource( source );
|
||||
|
@ -318,7 +323,7 @@ itemconfig_t *LoadItemConfig( char *filename ) {
|
|||
} //end if
|
||||
else
|
||||
{
|
||||
SourceError( source, "unknown definition %s\n", token.string );
|
||||
SourceError( source, "unknown definition %s", token.string );
|
||||
FreeMemory( ic );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
|
@ -512,7 +517,7 @@ void BotInitInfoEntities( void ) {
|
|||
numcampspots++;
|
||||
} //end else if
|
||||
} //end for
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "%d map locations\n", numlocations );
|
||||
botimport.Print( PRT_MESSAGE, "%d camp spots\n", numcampspots );
|
||||
} //end if
|
||||
|
@ -636,13 +641,11 @@ void BotGoalName( int number, char *name, int size ) {
|
|||
for ( li = levelitems; li; li = li->next )
|
||||
{
|
||||
if ( li->number == number ) {
|
||||
strncpy( name, itemconfig->iteminfo[li->iteminfo].name, size - 1 );
|
||||
name[size - 1] = '\0';
|
||||
Q_strncpyz( name, itemconfig->iteminfo[li->iteminfo].name, size );
|
||||
return;
|
||||
} //end for
|
||||
} //end for
|
||||
strcpy( name, "" );
|
||||
return;
|
||||
} //end of the function BotGoalName
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -788,6 +791,7 @@ int BotGetLevelItemGoal( int index, char *name, bot_goal_t *goal ) {
|
|||
VectorCopy( itemconfig->iteminfo[li->iteminfo].mins, goal->mins );
|
||||
VectorCopy( itemconfig->iteminfo[li->iteminfo].maxs, goal->maxs );
|
||||
goal->number = li->number;
|
||||
goal->iteminfo = li->iteminfo;
|
||||
//botimport.Print(PRT_MESSAGE, "found li %s\n", itemconfig->iteminfo[li->iteminfo].name);
|
||||
return li->number;
|
||||
} //end if
|
||||
|
@ -812,6 +816,9 @@ int BotGetMapLocationGoal( char *name, bot_goal_t *goal ) {
|
|||
goal->entitynum = 0;
|
||||
VectorCopy( mins, goal->mins );
|
||||
VectorCopy( maxs, goal->maxs );
|
||||
goal->number = 0;
|
||||
goal->flags = 0;
|
||||
goal->iteminfo = 0;
|
||||
return qtrue;
|
||||
} //end if
|
||||
} //end for
|
||||
|
@ -840,6 +847,9 @@ int BotGetNextCampSpotGoal( int num, bot_goal_t *goal ) {
|
|||
goal->entitynum = 0;
|
||||
VectorCopy( mins, goal->mins );
|
||||
VectorCopy( maxs, goal->maxs );
|
||||
goal->number = 0;
|
||||
goal->flags = 0;
|
||||
goal->iteminfo = 0;
|
||||
return num + 1;
|
||||
} //end if
|
||||
} //end for
|
||||
|
@ -866,7 +876,7 @@ void BotUpdateEntityItems( void ) {
|
|||
for ( li = levelitems; li; li = nextli )
|
||||
{
|
||||
nextli = li->next;
|
||||
//if it is a item that will time out
|
||||
//if it is an item that will time out
|
||||
if ( li->timeout ) {
|
||||
//timeout the item
|
||||
if ( li->timeout < AAS_Time() ) {
|
||||
|
|
117
Projects/Android/jni/rtcw/src/botlib/be_ai_goal.h
Normal file
117
Projects/Android/jni/rtcw/src/botlib/be_ai_goal.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ai_goal.h
|
||||
*
|
||||
* desc: goal AI
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define MAX_AVOIDGOALS 64
|
||||
#define MAX_GOALSTACK 8
|
||||
|
||||
#define GFL_NONE 0
|
||||
#define GFL_ITEM 1
|
||||
#define GFL_ROAM 2
|
||||
#define GFL_NOSLOWAPPROACH 4
|
||||
|
||||
//a bot goal
|
||||
typedef struct bot_goal_s
|
||||
{
|
||||
vec3_t origin; //origin of the goal
|
||||
int areanum; //area number of the goal
|
||||
vec3_t mins, maxs; //mins and maxs of the goal
|
||||
int entitynum; //number of the goal entity
|
||||
int number; //goal number
|
||||
int flags; //goal flags
|
||||
int iteminfo; //item information
|
||||
} bot_goal_t;
|
||||
|
||||
//reset the whole goal state, but keep the item weights
|
||||
void BotResetGoalState( int goalstate );
|
||||
//reset avoid goals
|
||||
void BotResetAvoidGoals( int goalstate );
|
||||
//remove the goal with the given number from the avoid goals
|
||||
void BotRemoveFromAvoidGoals( int goalstate, int number );
|
||||
//push a goal
|
||||
void BotPushGoal( int goalstate, bot_goal_t *goal );
|
||||
//pop a goal
|
||||
void BotPopGoal( int goalstate );
|
||||
//makes the bot's goal stack empty
|
||||
void BotEmptyGoalStack( int goalstate );
|
||||
//dump the avoid goals
|
||||
void BotDumpAvoidGoals( int goalstate );
|
||||
//dump the goal stack
|
||||
void BotDumpGoalStack( int goalstate );
|
||||
//name of the goal
|
||||
void BotGoalName( int number, char *name, int size );
|
||||
//get goal from top of stack
|
||||
int BotGetTopGoal( int goalstate, bot_goal_t *goal );
|
||||
int BotGetSecondGoal( int goalstate, bot_goal_t *goal );
|
||||
//choose the best long term goal item for the bot
|
||||
int BotChooseLTGItem( int goalstate, vec3_t origin, int *inventory, int travelflags );
|
||||
//choose the best nearby goal item for the bot
|
||||
int BotChooseNBGItem( int goalstate, vec3_t origin, int *inventory, int travelflags,
|
||||
bot_goal_t *ltg, float maxtime );
|
||||
//returns true if the bot touches the goal
|
||||
int BotTouchingGoal( vec3_t origin, bot_goal_t *goal );
|
||||
//returns true if the goal should be visible but isn't
|
||||
int BotItemGoalInVisButNotVisible( int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t *goal );
|
||||
//get some info about a level item
|
||||
int BotGetLevelItemGoal( int index, char *classname, bot_goal_t *goal );
|
||||
//get the next camp spot in the map
|
||||
int BotGetNextCampSpotGoal( int num, bot_goal_t *goal );
|
||||
//get the map location with the given name
|
||||
int BotGetMapLocationGoal( char *name, bot_goal_t *goal );
|
||||
//returns the avoid goal time
|
||||
float BotAvoidGoalTime( int goalstate, int number );
|
||||
//initializes the items in the level
|
||||
void BotInitLevelItems( void );
|
||||
//regularly update dynamic entity items (dropped weapons, flags etc.)
|
||||
void BotUpdateEntityItems( void );
|
||||
//interbreed the goal fuzzy logic
|
||||
void BotInterbreedGoalFuzzyLogic( int parent1, int parent2, int child );
|
||||
//save the goal fuzzy logic to disk
|
||||
void BotSaveGoalFuzzyLogic( int goalstate, char *filename );
|
||||
//mutate the goal fuzzy logic
|
||||
void BotMutateGoalFuzzyLogic( int goalstate, float range );
|
||||
//loads item weights for the bot
|
||||
int BotLoadItemWeights( int goalstate, char *filename );
|
||||
//frees the item weights of the bot
|
||||
void BotFreeItemWeights( int goalstate );
|
||||
//returns the handle of a newly allocated goal state
|
||||
int BotAllocGoalState( int client );
|
||||
//free the given goal state
|
||||
void BotFreeGoalState( int handle );
|
||||
//setup the goal AI
|
||||
int BotSetupGoalAI( void );
|
||||
//shut down the goal AI
|
||||
void BotShutdownGoalAI( void );
|
|
@ -43,14 +43,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
|
||||
#include "../game/be_ea.h"
|
||||
#include "../game/be_ai_goal.h"
|
||||
#include "../game/be_ai_move.h"
|
||||
#include "be_ea.h"
|
||||
#include "be_ai_goal.h"
|
||||
#include "be_ai_move.h"
|
||||
|
||||
|
||||
//#define DEBUG_AI_MOVE
|
||||
|
@ -282,7 +282,6 @@ int BotFuzzyPointReachabilityArea( vec3_t origin ) {
|
|||
} //end for
|
||||
bestdist = 999999;
|
||||
bestareanum = 0;
|
||||
//z = 0;
|
||||
for ( z = 1; z >= -1; z -= 1 )
|
||||
{
|
||||
for ( x = 1; x >= -1; x -= 2 )
|
||||
|
@ -548,7 +547,7 @@ void BotSetBrushModelTypes( void ) {
|
|||
modelnum = atoi( model + 1 );
|
||||
} else { modelnum = 0;}
|
||||
|
||||
if ( modelnum < 0 || modelnum > MAX_MODELS ) {
|
||||
if ( modelnum < 0 || modelnum >= MAX_MODELS ) {
|
||||
botimport.Print( PRT_MESSAGE, "entity %s model number out of range\n", classname );
|
||||
continue;
|
||||
} //end if
|
||||
|
@ -636,7 +635,7 @@ void BotAddToAvoidReach( bot_movestate_t *ms, int number, float avoidtime ) {
|
|||
int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
||||
int lastgoalareanum, int lastareanum,
|
||||
int *avoidreach, float *avoidreachtimes, int *avoidreachtries,
|
||||
bot_goal_t *goal, int travelflags, int movetravelflags ) {
|
||||
bot_goal_t *goal, int travelflags ) {
|
||||
int t, besttime, bestreachnum, reachnum;
|
||||
aas_reachability_t reach;
|
||||
|
||||
|
@ -647,11 +646,9 @@ int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
|||
//
|
||||
if ( AAS_AreaDoNotEnter( areanum ) || AAS_AreaDoNotEnter( goal->areanum ) ) {
|
||||
travelflags |= TFL_DONOTENTER;
|
||||
movetravelflags |= TFL_DONOTENTER;
|
||||
} //end if
|
||||
if ( AAS_AreaDoNotEnterLarge( areanum ) || AAS_AreaDoNotEnterLarge( goal->areanum ) ) {
|
||||
travelflags |= TFL_DONOTENTER_LARGE;
|
||||
movetravelflags |= TFL_DONOTENTER_LARGE;
|
||||
} //end if
|
||||
//use the routing to find the next area to go to
|
||||
besttime = 0;
|
||||
|
@ -662,7 +659,7 @@ int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
|||
{
|
||||
#ifdef AVOIDREACH
|
||||
int i;
|
||||
//check if it isn't an reachability to avoid
|
||||
//check if it isn't a reachability to avoid
|
||||
for ( i = 0; i < MAX_AVOIDREACH; i++ )
|
||||
{
|
||||
if ( avoidreach[i] == reachnum && avoidreachtimes[i] >= AAS_Time() ) {
|
||||
|
@ -671,7 +668,7 @@ int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
|||
} //end for
|
||||
if ( i != MAX_AVOIDREACH && avoidreachtries[i] > AVOIDREACH_TRIES ) {
|
||||
#ifdef DEBUG
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "avoiding reachability %d\n", avoidreach[i] );
|
||||
} //end if
|
||||
#endif //DEBUG
|
||||
|
@ -687,7 +684,7 @@ int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
|||
}
|
||||
//if (AAS_AreaContentsTravelFlag(reach.areanum) & ~travelflags) continue;
|
||||
//if the travel isn't valid
|
||||
if ( !BotValidTravel( origin, &reach, movetravelflags ) ) {
|
||||
if ( !BotValidTravel( origin, &reach, travelflags ) ) {
|
||||
continue;
|
||||
}
|
||||
//RF, ignore disabled areas
|
||||
|
@ -708,8 +705,8 @@ int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
|||
//add the travel time towards the area
|
||||
// Ridah, not sure why this was disabled, but it causes looped links in the route-cache
|
||||
// RF, update.. seems to work better like this....
|
||||
t += reach.traveltime; // + AAS_AreaTravelTime(areanum, origin, reach.start);
|
||||
//t += reach.traveltime + AAS_AreaTravelTime(areanum, origin, reach.start);
|
||||
t += reach.traveltime; // + AAS_AreaTravelTime( areanum, origin, reach.start );
|
||||
//t += reach.traveltime + AAS_AreaTravelTime( areanum, origin, reach.start );
|
||||
|
||||
// Ridah, if there exists other entities in this area, avoid it
|
||||
// if (reach.areanum != goal->areanum && AAS_IsEntityInArea( entnum, goal->entitynum, reach.areanum )) {
|
||||
|
@ -761,7 +758,6 @@ int BotMovementViewTarget( int movestate, bot_goal_t *goal, int travelflags, flo
|
|||
if ( !ms ) {
|
||||
return qfalse;
|
||||
}
|
||||
reachnum = 0;
|
||||
//if the bot has no goal or no last reachability
|
||||
if ( !ms->lastreachnum || !goal ) {
|
||||
return qfalse;
|
||||
|
@ -792,7 +788,7 @@ int BotMovementViewTarget( int movestate, bot_goal_t *goal, int travelflags, flo
|
|||
reachnum = BotGetReachabilityToGoal( reach.end, reach.areanum, -1,
|
||||
ms->lastgoalareanum, lastareanum,
|
||||
ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries,
|
||||
goal, travelflags, travelflags );
|
||||
goal, travelflags );
|
||||
VectorCopy( reach.end, end );
|
||||
lastareanum = reach.areanum;
|
||||
if ( lastareanum == goal->areanum ) {
|
||||
|
@ -856,7 +852,7 @@ int BotPredictVisiblePosition( vec3_t origin, int areanum, bot_goal_t *goal, int
|
|||
reachnum = BotGetReachabilityToGoal( end, areanum, -1,
|
||||
lastgoalareanum, lastareanum,
|
||||
avoidreach, avoidreachtimes, avoidreachtries,
|
||||
goal, travelflags, travelflags );
|
||||
goal, travelflags );
|
||||
if ( !reachnum ) {
|
||||
return qfalse;
|
||||
}
|
||||
|
@ -915,12 +911,13 @@ void MoverBottomCenter( aas_reachability_t *reach, vec3_t bottomcenter ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
float BotGapDistance( vec3_t origin, vec3_t hordir, int entnum ) {
|
||||
float dist, startz;
|
||||
int dist;
|
||||
float startz;
|
||||
vec3_t start, end;
|
||||
aas_trace_t trace;
|
||||
|
||||
//do gap checking
|
||||
startz = origin[2];
|
||||
//startz = origin[2];
|
||||
//this enables walking down stairs more fluidly
|
||||
{
|
||||
VectorCopy( origin, start );
|
||||
|
@ -951,7 +948,7 @@ float BotGapDistance( vec3_t origin, vec3_t hordir, int entnum ) {
|
|||
}
|
||||
// if (AAS_PointContents(end) & CONTENTS_WATER) break;
|
||||
//if a gap is found slow down
|
||||
//botimport.Print(PRT_MESSAGE, "gap at %f\n", dist);
|
||||
//botimport.Print(PRT_MESSAGE, "gap at %i\n", dist);
|
||||
return dist;
|
||||
} //end if
|
||||
startz = trace.endpos[2];
|
||||
|
@ -1213,11 +1210,11 @@ int Intersection( vec2_t p1, vec2_t p2, vec2_t p3, vec2_t p4, vec2_t out ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void BotCheckBlocked( bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_moveresult_t *result ) {
|
||||
vec3_t mins, maxs, end, up = {0, 0, 1};
|
||||
bsp_trace_t trace;
|
||||
|
||||
// RF, not required for Wolf AI
|
||||
return;
|
||||
#if 0
|
||||
vec3_t mins, maxs, end, up = {0, 0, 1};
|
||||
bsp_trace_t trace;
|
||||
|
||||
//test for entities obstructing the bot's path
|
||||
AAS_PresenceTypeBoundingBox( ms->presencetype, mins, maxs );
|
||||
|
@ -1251,6 +1248,7 @@ void BotCheckBlocked( bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_move
|
|||
#endif //DEBUG
|
||||
} //end if
|
||||
} //end else
|
||||
#endif
|
||||
} //end of the function BotCheckBlocked
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -1258,26 +1256,11 @@ void BotCheckBlocked( bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_move
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void BotClearMoveResult( bot_moveresult_t *moveresult ) {
|
||||
moveresult->failure = qfalse;
|
||||
moveresult->type = 0;
|
||||
moveresult->blocked = qfalse;
|
||||
moveresult->blockentity = 0;
|
||||
moveresult->traveltype = 0;
|
||||
moveresult->flags = 0;
|
||||
} //end of the function BotClearMoveResult
|
||||
//===========================================================================
|
||||
//
|
||||
// Parameter: -
|
||||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
bot_moveresult_t BotTravel_Walk( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
float dist, speed;
|
||||
vec3_t hordir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//first walk straight to the reachability start
|
||||
hordir[0] = reach->start[0] - ms->origin[0];
|
||||
hordir[1] = reach->start[1] - ms->origin[1];
|
||||
|
@ -1336,9 +1319,8 @@ bot_moveresult_t BotTravel_Walk( bot_movestate_t *ms, aas_reachability_t *reach
|
|||
bot_moveresult_t BotFinishTravel_Walk( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t hordir;
|
||||
float dist, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//if not on the ground and changed areas... don't walk back!!
|
||||
//(doesn't seem to help)
|
||||
/*
|
||||
|
@ -1375,9 +1357,8 @@ bot_moveresult_t BotFinishTravel_Walk( bot_movestate_t *ms, aas_reachability_t *
|
|||
bot_moveresult_t BotTravel_Crouch( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
float speed;
|
||||
vec3_t hordir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
speed = 400;
|
||||
//walk straight to reachability end
|
||||
|
@ -1404,9 +1385,8 @@ bot_moveresult_t BotTravel_Crouch( bot_movestate_t *ms, aas_reachability_t *reac
|
|||
bot_moveresult_t BotTravel_BarrierJump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
float dist, speed;
|
||||
vec3_t hordir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//walk straight to reachability start
|
||||
hordir[0] = reach->start[0] - ms->origin[0];
|
||||
hordir[1] = reach->start[1] - ms->origin[1];
|
||||
|
@ -1450,9 +1430,8 @@ bot_moveresult_t BotTravel_BarrierJump( bot_movestate_t *ms, aas_reachability_t
|
|||
bot_moveresult_t BotFinishTravel_BarrierJump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
float dist, speed;
|
||||
vec3_t hordir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//if near the top or going down
|
||||
if ( ms->velocity[2] < 250 ) {
|
||||
// Ridah, extend the end point a bit, so we strive to get over the ledge more
|
||||
|
@ -1490,9 +1469,8 @@ bot_moveresult_t BotFinishTravel_BarrierJump( bot_movestate_t *ms, aas_reachabil
|
|||
//===========================================================================
|
||||
bot_moveresult_t BotTravel_Swim( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t dir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//swim straight to reachability end
|
||||
VectorSubtract( reach->start, ms->origin, dir );
|
||||
VectorNormalize( dir );
|
||||
|
@ -1516,9 +1494,8 @@ bot_moveresult_t BotTravel_Swim( bot_movestate_t *ms, aas_reachability_t *reach
|
|||
bot_moveresult_t BotTravel_WaterJump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t dir, hordir;
|
||||
float dist;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//swim straight to reachability end
|
||||
VectorSubtract( reach->end, ms->origin, dir );
|
||||
VectorCopy( dir, hordir );
|
||||
|
@ -1550,11 +1527,9 @@ bot_moveresult_t BotTravel_WaterJump( bot_movestate_t *ms, aas_reachability_t *r
|
|||
//===========================================================================
|
||||
bot_moveresult_t BotFinishTravel_WaterJump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t dir, pnt;
|
||||
float dist;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
//botimport.Print(PRT_MESSAGE, "BotFinishTravel_WaterJump\n");
|
||||
BotClearMoveResult( &result );
|
||||
//if waterjumping there's nothing to do
|
||||
if ( ms->moveflags & MFL_WATERJUMP ) {
|
||||
return result;
|
||||
|
@ -1571,7 +1546,6 @@ bot_moveresult_t BotFinishTravel_WaterJump( bot_movestate_t *ms, aas_reachabilit
|
|||
dir[0] += crandom() * 10;
|
||||
dir[1] += crandom() * 10;
|
||||
dir[2] += 70 + crandom() * 10;
|
||||
dist = VectorNormalize( dir );
|
||||
//elemantary actions
|
||||
EA_Move( ms->client, dir, 400 );
|
||||
//set the ideal view angles
|
||||
|
@ -1591,9 +1565,8 @@ bot_moveresult_t BotFinishTravel_WaterJump( bot_movestate_t *ms, aas_reachabilit
|
|||
bot_moveresult_t BotTravel_WalkOffLedge( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t hordir, dir;
|
||||
float dist, speed, reachhordist;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//check if the bot is blocked by anything
|
||||
VectorSubtract( reach->start, ms->origin, dir );
|
||||
VectorNormalize( dir );
|
||||
|
@ -1628,8 +1601,7 @@ bot_moveresult_t BotTravel_WalkOffLedge( bot_movestate_t *ms, aas_reachability_t
|
|||
VectorNormalize( hordir );
|
||||
//
|
||||
if ( reachhordist < 20 ) {
|
||||
//speed = 100;
|
||||
speed = 200; // RF, increased this to speed up travel speed down steps
|
||||
speed = 200; // RF, increased this to speed up travel speed down steps
|
||||
} //end if
|
||||
else if ( !AAS_HorizontalVelocityForJump( 0, reach->start, reach->end, &speed ) ) {
|
||||
speed = 400;
|
||||
|
@ -1643,7 +1615,6 @@ bot_moveresult_t BotTravel_WalkOffLedge( bot_movestate_t *ms, aas_reachability_t
|
|||
if ( dist > 64 ) {
|
||||
dist = 64;
|
||||
}
|
||||
//speed = 400 - (256 - 4 * dist);
|
||||
speed = 400 - ( 256 - 4 * dist ) * 0.5; // RF changed this for steps
|
||||
} //end if
|
||||
else
|
||||
|
@ -1709,9 +1680,8 @@ int BotAirControl( vec3_t origin, vec3_t velocity, vec3_t goal, vec3_t dir, floa
|
|||
bot_moveresult_t BotFinishTravel_WalkOffLedge( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t dir, hordir, end, v;
|
||||
float dist, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
VectorSubtract( reach->end, ms->origin, dir );
|
||||
BotCheckBlocked( ms, dir, qtrue, &result );
|
||||
|
@ -1728,7 +1698,6 @@ bot_moveresult_t BotFinishTravel_WalkOffLedge( bot_movestate_t *ms, aas_reachabi
|
|||
VectorCopy( dir, hordir );
|
||||
hordir[2] = 0;
|
||||
//
|
||||
dist = VectorNormalize( hordir );
|
||||
speed = 400;
|
||||
} //end if
|
||||
//
|
||||
|
@ -1750,9 +1719,8 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
|
|||
{
|
||||
vec3_t hordir;
|
||||
float dist, gapdist, speed, horspeed, sv_jumpvel;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult(&result);
|
||||
//
|
||||
sv_jumpvel = botlibglobals.sv_jumpvel->value;
|
||||
//walk straight to the reachability start
|
||||
|
@ -1798,11 +1766,11 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
|
|||
bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
|
||||
{
|
||||
vec3_t hordir, dir1, dir2, mins, maxs, start, end;
|
||||
int gapdist;
|
||||
float dist1, dist2, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
bsp_trace_t trace;
|
||||
|
||||
BotClearMoveResult(&result);
|
||||
//
|
||||
hordir[0] = reach->start[0] - reach->end[0];
|
||||
hordir[1] = reach->start[1] - reach->end[1];
|
||||
|
@ -1819,13 +1787,13 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
|
|||
trace = AAS_Trace(start, mins, maxs, end, ms->entitynum, MASK_PLAYERSOLID);
|
||||
if (trace.startsolid) VectorCopy(start, trace.endpos);
|
||||
//check for a gap
|
||||
for (dist1 = 0; dist1 < 80; dist1 += 10)
|
||||
for (gapdist = 0; gapdist < 80; gapdist += 10)
|
||||
{
|
||||
VectorMA(start, dist1+10, hordir, end);
|
||||
VectorMA(start, gapdist+10, hordir, end);
|
||||
end[2] += 1;
|
||||
if (AAS_PointAreaNum(end) != ms->reachareanum) break;
|
||||
} //end for
|
||||
if (dist1 < 80) VectorMA(reach->start, dist1, hordir, trace.endpos);
|
||||
if (gapdist < 80) VectorMA(reach->start, gapdist, hordir, trace.endpos);
|
||||
// dist1 = BotGapDistance(start, hordir, ms->entitynum);
|
||||
// if (dist1 && dist1 <= trace.fraction * 80) VectorMA(reach->start, dist1-20, hordir, trace.endpos);
|
||||
//
|
||||
|
@ -1870,10 +1838,10 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
|
|||
bot_moveresult_t BotTravel_Jump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t hordir, dir1, dir2, start, end, runstart;
|
||||
// vec3_t runstart, dir1, dir2, hordir;
|
||||
int gapdist;
|
||||
float dist1, dist2, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
AAS_JumpReachRunStart( reach, runstart );
|
||||
//*
|
||||
|
@ -1886,16 +1854,16 @@ bot_moveresult_t BotTravel_Jump( bot_movestate_t *ms, aas_reachability_t *reach
|
|||
start[2] += 1;
|
||||
VectorMA( reach->start, 80, hordir, runstart );
|
||||
//check for a gap
|
||||
for ( dist1 = 0; dist1 < 80; dist1 += 10 )
|
||||
for (gapdist = 0; gapdist < 80; gapdist += 10)
|
||||
{
|
||||
VectorMA( start, dist1 + 10, hordir, end );
|
||||
VectorMA(start, gapdist+10, hordir, end);
|
||||
end[2] += 1;
|
||||
if ( AAS_PointAreaNum( end ) != ms->reachareanum ) {
|
||||
break;
|
||||
}
|
||||
} //end for
|
||||
if ( dist1 < 80 ) {
|
||||
VectorMA( reach->start, dist1, hordir, runstart );
|
||||
if ( gapdist < 80 ) {
|
||||
VectorMA( reach->start, gapdist, hordir, runstart );
|
||||
}
|
||||
//
|
||||
VectorSubtract( ms->origin, reach->start, dir1 );
|
||||
|
@ -1948,9 +1916,8 @@ bot_moveresult_t BotTravel_Jump( bot_movestate_t *ms, aas_reachability_t *reach
|
|||
bot_moveresult_t BotFinishTravel_Jump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t hordir, hordir2;
|
||||
float speed, dist;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//if not jumped yet
|
||||
if ( !ms->jumpreach ) {
|
||||
return result;
|
||||
|
@ -1988,12 +1955,11 @@ bot_moveresult_t BotTravel_Ladder( bot_movestate_t *ms, aas_reachability_t *reac
|
|||
vec3_t dir, viewdir, hordir, pos, p, v1, v2, vec, right;
|
||||
vec3_t origin = {0, 0, 0};
|
||||
// vec3_t up = {0, 0, 1};
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
float dist, speed;
|
||||
|
||||
// RF, heavily modified, wolf has different ladder movement
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
if ( ( ms->moveflags & MFL_AGAINSTLADDER )
|
||||
//NOTE: not a good idea for ladders starting in water
|
||||
|
@ -2053,14 +2019,14 @@ bot_moveresult_t BotTravel_Ladder( bot_movestate_t *ms, aas_reachability_t *reac
|
|||
// project our position onto the vector
|
||||
ProjectPointOntoVector( ms->origin, pos, reach->start, p );
|
||||
VectorSubtract( p, ms->origin, dir );
|
||||
//make sure the horizontal movement is large anough
|
||||
//make sure the horizontal movement is large enough
|
||||
VectorCopy( dir, hordir );
|
||||
hordir[2] = 0;
|
||||
dist = VectorNormalize( hordir );
|
||||
if ( dist < 8 ) { // within range, go for the end
|
||||
//botimport.Print(PRT_MESSAGE, "found base, moving towards ladder top\n");
|
||||
VectorSubtract( reach->end, ms->origin, dir );
|
||||
//make sure the horizontal movement is large anough
|
||||
//make sure the horizontal movement is large enough
|
||||
VectorCopy( dir, hordir );
|
||||
hordir[2] = 0;
|
||||
dist = VectorNormalize( hordir );
|
||||
|
@ -2105,9 +2071,8 @@ bot_moveresult_t BotTravel_Ladder( bot_movestate_t *ms, aas_reachability_t *reac
|
|||
bot_moveresult_t BotTravel_Teleport( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t hordir;
|
||||
float dist;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//if the bot is being teleported
|
||||
if ( ms->moveflags & MFL_TELEPORTED ) {
|
||||
return result;
|
||||
|
@ -2142,16 +2107,15 @@ bot_moveresult_t BotTravel_Teleport( bot_movestate_t *ms, aas_reachability_t *re
|
|||
bot_moveresult_t BotTravel_Elevator( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t dir, dir1, dir2, hordir, bottomcenter;
|
||||
float dist, dist1, dist2, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//if standing on the plat
|
||||
if ( BotOnMover( ms->origin, ms->entitynum, reach ) ) {
|
||||
#ifdef DEBUG_ELEVATOR
|
||||
botimport.Print( PRT_MESSAGE, "bot on elevator\n" );
|
||||
#endif //DEBUG_ELEVATOR
|
||||
//if vertically not too far from the end point
|
||||
if ( abs( ms->origin[2] - reach->end[2] ) < sv_maxbarrier ) {
|
||||
if ( fabs( ms->origin[2] - reach->end[2] ) < sv_maxbarrier ) {
|
||||
#ifdef DEBUG_ELEVATOR
|
||||
botimport.Print( PRT_MESSAGE, "bot moving to end\n" );
|
||||
#endif //DEBUG_ELEVATOR
|
||||
|
@ -2304,9 +2268,8 @@ bot_moveresult_t BotTravel_Elevator( bot_movestate_t *ms, aas_reachability_t *re
|
|||
//===========================================================================
|
||||
bot_moveresult_t BotFinishTravel_Elevator( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t bottomcenter, bottomdir, topdir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
MoverBottomCenter( reach, bottomcenter );
|
||||
VectorSubtract( bottomcenter, ms->origin, bottomdir );
|
||||
|
@ -2391,9 +2354,8 @@ void BotFuncBobStartEnd( aas_reachability_t *reach, vec3_t start, vec3_t end, ve
|
|||
bot_moveresult_t BotTravel_FuncBobbing( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t dir, dir1, dir2, hordir, bottomcenter, bob_start, bob_end, bob_origin;
|
||||
float dist, dist1, dist2, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
BotFuncBobStartEnd( reach, bob_start, bob_end, bob_origin );
|
||||
//if standing ontop of the func_bobbing
|
||||
|
@ -2476,7 +2438,7 @@ bot_moveresult_t BotTravel_FuncBobbing( bot_movestate_t *ms, aas_reachability_t
|
|||
dir1[2] = 0;
|
||||
}
|
||||
dist1 = VectorNormalize( dir1 );
|
||||
//if func_bobbing is Not it's start position
|
||||
//if func_bobbing is Not its start position
|
||||
VectorSubtract( bob_origin, bob_start, dir );
|
||||
if ( VectorLength( dir ) > 16 ) {
|
||||
#ifdef DEBUG_FUNCBOB
|
||||
|
@ -2559,10 +2521,9 @@ bot_moveresult_t BotTravel_FuncBobbing( bot_movestate_t *ms, aas_reachability_t
|
|||
//===========================================================================
|
||||
bot_moveresult_t BotFinishTravel_FuncBobbing( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t bob_origin, bob_start, bob_end, dir, hordir, bottomcenter;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
float dist, speed;
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
BotFuncBobStartEnd( reach, bob_start, bob_end, bob_origin );
|
||||
//
|
||||
|
@ -2729,7 +2690,7 @@ void BotResetGrapple( bot_movestate_t *ms ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
bot_moveresult_t BotTravel_Grapple( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
float dist, speed;
|
||||
vec3_t dir, viewdir, org;
|
||||
int state, areanum;
|
||||
|
@ -2742,7 +2703,6 @@ bot_moveresult_t BotTravel_Grapple( bot_movestate_t *ms, aas_reachability_t *rea
|
|||
botimport.DebugLineShow( debugline, reach->start, reach->end, LINECOLOR_BLUE );
|
||||
#endif //DEBUG_GRAPPLE
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
if ( ms->moveflags & MFL_GRAPPLERESET ) {
|
||||
EA_Command( ms->client, CMD_HOOKOFF );
|
||||
|
@ -2853,10 +2813,9 @@ bot_moveresult_t BotTravel_Grapple( bot_movestate_t *ms, aas_reachability_t *rea
|
|||
bot_moveresult_t BotTravel_RocketJump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t hordir;
|
||||
float dist, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
//botimport.Print(PRT_MESSAGE, "BotTravel_RocketJump: bah\n");
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
hordir[0] = reach->start[0] - ms->origin[0];
|
||||
hordir[1] = reach->start[1] - ms->origin[1];
|
||||
|
@ -2889,10 +2848,9 @@ bot_moveresult_t BotTravel_RocketJump( bot_movestate_t *ms, aas_reachability_t *
|
|||
/*
|
||||
vec3_t hordir, dir1, dir2, start, end, runstart;
|
||||
float dist1, dist2, speed;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
botimport.Print(PRT_MESSAGE, "BotTravel_RocketJump: bah\n");
|
||||
BotClearMoveResult(&result);
|
||||
AAS_JumpReachRunStart(reach, runstart);
|
||||
//
|
||||
hordir[0] = runstart[0] - reach->start[0];
|
||||
|
@ -2945,7 +2903,8 @@ bot_moveresult_t BotTravel_RocketJump( bot_movestate_t *ms, aas_reachability_t *
|
|||
if (dist2 > 80) dist2 = 80;
|
||||
speed = 400 - (400 - 5 * dist2);
|
||||
EA_Move(ms->client, hordir, speed);
|
||||
} //end else*/
|
||||
} //end else
|
||||
*/
|
||||
//look in the movement direction
|
||||
Vector2Angles( hordir, result.ideal_viewangles );
|
||||
//look straight down
|
||||
|
@ -2971,10 +2930,8 @@ bot_moveresult_t BotTravel_RocketJump( bot_movestate_t *ms, aas_reachability_t *
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
bot_moveresult_t BotTravel_BFGJump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//
|
||||
return result;
|
||||
} //end of the function BotTravel_BFGJump
|
||||
//===========================================================================
|
||||
|
@ -2985,9 +2942,8 @@ bot_moveresult_t BotTravel_BFGJump( bot_movestate_t *ms, aas_reachability_t *rea
|
|||
//===========================================================================
|
||||
bot_moveresult_t BotFinishTravel_WeaponJump( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
vec3_t hordir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//if not jumped yet
|
||||
if ( !ms->jumpreach ) {
|
||||
return result;
|
||||
|
@ -3010,21 +2966,17 @@ bot_moveresult_t BotFinishTravel_WeaponJump( bot_movestate_t *ms, aas_reachabili
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
bot_moveresult_t BotTravel_JumpPad( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
float dist, speed;
|
||||
vec3_t hordir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
//first walk straight to the reachability start
|
||||
hordir[0] = reach->start[0] - ms->origin[0];
|
||||
hordir[1] = reach->start[1] - ms->origin[1];
|
||||
hordir[2] = 0;
|
||||
dist = VectorNormalize( hordir );
|
||||
//
|
||||
BotCheckBlocked( ms, hordir, qtrue, &result );
|
||||
speed = 400;
|
||||
//elemantary action move in direction
|
||||
EA_Move( ms->client, hordir, speed );
|
||||
EA_Move( ms->client, hordir, 400 );
|
||||
VectorCopy( hordir, result.movedir );
|
||||
//
|
||||
return result;
|
||||
|
@ -3038,9 +2990,8 @@ bot_moveresult_t BotTravel_JumpPad( bot_movestate_t *ms, aas_reachability_t *rea
|
|||
bot_moveresult_t BotFinishTravel_JumpPad( bot_movestate_t *ms, aas_reachability_t *reach ) {
|
||||
float speed;
|
||||
vec3_t hordir;
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
|
||||
BotClearMoveResult( &result );
|
||||
if ( !BotAirControl( ms->origin, ms->velocity, reach->end, hordir, &speed ) ) {
|
||||
hordir[0] = reach->end[0] - ms->origin[0];
|
||||
hordir[1] = reach->end[1] - ms->origin[1];
|
||||
|
@ -3094,7 +3045,7 @@ int BotReachabilityTime( aas_reachability_t *reach ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
bot_moveresult_t BotMoveInGoalArea( bot_movestate_t *ms, bot_goal_t *goal ) {
|
||||
bot_moveresult_t result;
|
||||
bot_moveresult_t_cleared( result );
|
||||
vec3_t dir;
|
||||
float dist, speed;
|
||||
|
||||
|
@ -3103,7 +3054,6 @@ bot_moveresult_t BotMoveInGoalArea( bot_movestate_t *ms, bot_goal_t *goal ) {
|
|||
//AAS_ClearShownDebugLines();
|
||||
//AAS_DebugLine(ms->origin, goal->origin, LINECOLOR_RED);
|
||||
#endif //DEBUG
|
||||
BotClearMoveResult( &result );
|
||||
//walk straight to the goal origin
|
||||
dir[0] = goal->origin[0] - ms->origin[0];
|
||||
dir[1] = goal->origin[1] - ms->origin[1];
|
||||
|
@ -3155,21 +3105,27 @@ bot_moveresult_t BotMoveInGoalArea( bot_movestate_t *ms, bot_goal_t *goal ) {
|
|||
int AAS_AreaRouteToGoalArea( int areanum, vec3_t origin, int goalareanum, int travelflags, int *traveltime, int *reachnum );
|
||||
extern float VectorDistance( vec3_t v1, vec3_t v2 );
|
||||
void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, int travelflags ) {
|
||||
int reachnum = 0, lastreachnum, foundjumppad, ent; // TTimo: init
|
||||
int reachnum = 0; // TTimo (might be used uninitialized in this function)
|
||||
int lastreachnum, foundjumppad, ent;
|
||||
aas_reachability_t reach, lastreach;
|
||||
bot_movestate_t *ms;
|
||||
//vec3_t mins, maxs, up = {0, 0, 1};
|
||||
//bsp_trace_t trace;
|
||||
//static int debugline;
|
||||
|
||||
BotClearMoveResult( result );
|
||||
result->failure = qfalse;
|
||||
result->type = 0;
|
||||
result->blocked = qfalse;
|
||||
result->blockentity = 0;
|
||||
result->traveltype = 0;
|
||||
result->flags = 0;
|
||||
//
|
||||
ms = BotMoveStateFromHandle( movestate );
|
||||
if ( !ms ) {
|
||||
return;
|
||||
}
|
||||
//reset the grapple before testing if the bot has a valid goal
|
||||
//because the bot could loose all it's goals when stuck to a wall
|
||||
//because the bot could lose all its goals when stuck to a wall
|
||||
BotResetGrapple( ms );
|
||||
//
|
||||
if ( !goal ) {
|
||||
|
@ -3214,7 +3170,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
} //end if
|
||||
else
|
||||
{
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "client %d: on func_plat without reachability\n", ms->client );
|
||||
} //end if
|
||||
result->blocked = qtrue;
|
||||
|
@ -3240,7 +3196,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
} //end if
|
||||
else
|
||||
{
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "client %d: on func_bobbing without reachability\n", ms->client );
|
||||
} //end if
|
||||
result->blocked = qtrue;
|
||||
|
@ -3306,7 +3262,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
} //end if
|
||||
//special elevator case
|
||||
else if ( reach.traveltype == TRAVEL_ELEVATOR || reach.traveltype == TRAVEL_FUNCBOB ) {
|
||||
if ( ( result->flags & MOVERESULT_ONTOPOF_FUNCBOB ) ||
|
||||
if ( ( result->flags & MOVERESULT_ONTOPOF_ELEVATOR ) ||
|
||||
( result->flags & MOVERESULT_ONTOPOF_FUNCBOB ) ) {
|
||||
ms->reachability_time = AAS_Time() + 5;
|
||||
} //end if
|
||||
|
@ -3319,7 +3275,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
if ( ms->reachability_time < AAS_Time() ) {
|
||||
botimport.Print( PRT_MESSAGE, "client %d: reachability timeout in ", ms->client );
|
||||
AAS_PrintTravelType( reach.traveltype );
|
||||
|
@ -3348,7 +3304,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
//if the area has no reachability links
|
||||
if ( !AAS_AreaReachability( ms->areanum ) ) {
|
||||
#ifdef DEBUG
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "area %d no reachability\n", ms->areanum );
|
||||
} //end if
|
||||
#endif //DEBUG
|
||||
|
@ -3357,7 +3313,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
reachnum = BotGetReachabilityToGoal( ms->origin, ms->areanum, ms->entitynum,
|
||||
ms->lastgoalareanum, ms->lastareanum,
|
||||
ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries,
|
||||
goal, travelflags, travelflags );
|
||||
goal, travelflags );
|
||||
//the area number the reachability starts in
|
||||
ms->reachareanum = ms->areanum;
|
||||
//reset some state variables
|
||||
|
@ -3376,11 +3332,11 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
} //end if
|
||||
#ifdef DEBUG
|
||||
|
||||
else if ( bot_developer ) {
|
||||
else if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "goal not reachable\n" );
|
||||
memset( &reach, 0, sizeof( aas_reachability_t ) ); //make compiler happy
|
||||
} //end else
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
//if still going for the same goal
|
||||
if ( ms->lastgoalareanum == goal->areanum ) {
|
||||
if ( ms->lastareanum == reach.areanum ) {
|
||||
|
@ -3441,7 +3397,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
memset( &reach, 0, sizeof( aas_reachability_t ) );
|
||||
} //end else
|
||||
#ifdef DEBUG
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
if ( result->failure ) {
|
||||
botimport.Print( PRT_MESSAGE, "client %d: movement failure in ", ms->client );
|
||||
AAS_PrintTravelType( reach.traveltype );
|
||||
|
@ -3467,7 +3423,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
lastreachnum = BotGetReachabilityToGoal( end, areas[i], ms->entitynum,
|
||||
ms->lastgoalareanum, ms->lastareanum,
|
||||
ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries,
|
||||
goal, travelflags, TFL_JUMPPAD );
|
||||
goal, travelflags );
|
||||
if ( lastreachnum ) {
|
||||
ms->lastreachnum = lastreachnum;
|
||||
ms->lastareanum = areas[i];
|
||||
|
@ -3485,7 +3441,6 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
ms->lastreachnum = lastreachnum;
|
||||
ms->lastareanum = areas[i];
|
||||
//botimport.Print(PRT_MESSAGE, "found jumppad reachability hard!!\n");
|
||||
break;
|
||||
} //end if
|
||||
} //end for
|
||||
if ( lastreachnum ) {
|
||||
|
@ -3494,7 +3449,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
} //end else
|
||||
} //end if
|
||||
} //end for
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
//if a jumppad is found with the trace but no reachability is found
|
||||
if ( foundjumppad && !ms->lastreachnum ) {
|
||||
botimport.Print( PRT_MESSAGE, "client %d didn't find jumppad reachability\n", ms->client );
|
||||
|
@ -3535,7 +3490,7 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
} //end case
|
||||
} //end switch
|
||||
#ifdef DEBUG
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
if ( result->failure ) {
|
||||
botimport.Print( PRT_MESSAGE, "client %d: movement failure in finish ", ms->client );
|
||||
AAS_PrintTravelType( reach.traveltype );
|
||||
|
@ -3593,9 +3548,6 @@ void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, i
|
|||
result->flags |= MOVERESULT_FUTUREVIEW;
|
||||
}
|
||||
}
|
||||
|
||||
//return the movement result
|
||||
return;
|
||||
} //end of the function BotMoveToGoal
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -3645,7 +3597,7 @@ void BotResetLastAvoidReach( int movestate ) {
|
|||
} //end for
|
||||
if ( latesttime ) {
|
||||
ms->avoidreachtimes[latest] = 0;
|
||||
if ( ms->avoidreachtries[i] > 0 ) {
|
||||
if ( ms->avoidreachtries[latest] > 0 ) {
|
||||
ms->avoidreachtries[latest]--;
|
||||
}
|
||||
} //end if
|
||||
|
|
135
Projects/Android/jni/rtcw/src/botlib/be_ai_move.h
Normal file
135
Projects/Android/jni/rtcw/src/botlib/be_ai_move.h
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ai_move.h
|
||||
*
|
||||
* desc: movement AI
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//movement types
|
||||
#define MOVE_WALK 1
|
||||
#define MOVE_CROUCH 2
|
||||
#define MOVE_JUMP 4
|
||||
#define MOVE_GRAPPLE 8
|
||||
#define MOVE_ROCKETJUMP 16
|
||||
#define MOVE_BFGJUMP 32
|
||||
//move flags
|
||||
#define MFL_BARRIERJUMP 1 //bot is performing a barrier jump
|
||||
#define MFL_ONGROUND 2 //bot is in the ground
|
||||
#define MFL_SWIMMING 4 //bot is swimming
|
||||
#define MFL_AGAINSTLADDER 8 //bot is against a ladder
|
||||
#define MFL_WATERJUMP 16 //bot is waterjumping
|
||||
#define MFL_TELEPORTED 32 //bot is being teleported
|
||||
#define MFL_ACTIVEGRAPPLE 64 //bot is using the grapple hook
|
||||
#define MFL_GRAPPLERESET 128 //bot has reset the grapple
|
||||
#define MFL_WALK 256 //bot should walk slowly
|
||||
//move result flags
|
||||
#define MOVERESULT_MOVEMENTVIEW 1 //bot uses view for movement
|
||||
#define MOVERESULT_SWIMVIEW 2 //bot uses view for swimming
|
||||
#define MOVERESULT_WAITING 4 //bot is waiting for something
|
||||
#define MOVERESULT_MOVEMENTVIEWSET 8 //bot has set the view in movement code
|
||||
#define MOVERESULT_MOVEMENTWEAPON 16 //bot uses weapon for movement
|
||||
#define MOVERESULT_ONTOPOFOBSTACLE 32 //bot is ontop of obstacle
|
||||
#define MOVERESULT_ONTOPOF_FUNCBOB 64 //bot is ontop of a func_bobbing
|
||||
#define MOVERESULT_ONTOPOF_ELEVATOR 128 //bot is ontop of an elevator (func_plat)
|
||||
#define MOVERESULT_FUTUREVIEW 256 // RF, if we want to look ahead of time, this is a good direction
|
||||
|
||||
//
|
||||
#define MAX_AVOIDREACH 1
|
||||
//
|
||||
#define RESULTTYPE_ELEVATORUP 1
|
||||
#define RESULTTYPE_INVISIBLEGRAPPLE 2
|
||||
|
||||
//structure used to initialize the movement state
|
||||
//the or_moveflags MFL_ONGROUND, MFL_TELEPORTED and MFL_WATERJUMP come from the playerstate
|
||||
typedef struct bot_initmove_s
|
||||
{
|
||||
vec3_t origin; //origin of the bot
|
||||
vec3_t velocity; //velocity of the bot
|
||||
vec3_t viewoffset; //view offset
|
||||
int entitynum; //entity number of the bot
|
||||
int client; //client number of the bot
|
||||
float thinktime; //time the bot thinks
|
||||
int presencetype; //presencetype of the bot
|
||||
vec3_t viewangles; //view angles of the bot
|
||||
int or_moveflags; //values ored to the movement flags
|
||||
} bot_initmove_t;
|
||||
|
||||
//NOTE: the ideal_viewangles are only valid if MFL_MOVEMENTVIEW is set
|
||||
typedef struct bot_moveresult_s
|
||||
{
|
||||
int failure; //true if movement failed all together
|
||||
int type; //failure or blocked type
|
||||
int blocked; //true if blocked by an entity
|
||||
int blockentity; //entity blocking the bot
|
||||
int traveltype; //last executed travel type
|
||||
int flags; //result flags
|
||||
int weapon; //weapon used for movement
|
||||
vec3_t movedir; //movement direction
|
||||
vec3_t ideal_viewangles; //ideal viewangles for the movement
|
||||
} bot_moveresult_t;
|
||||
|
||||
#define bot_moveresult_t_cleared(x) bot_moveresult_t (x) = {0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, {0, 0, 0}}
|
||||
|
||||
//resets the whole movestate
|
||||
void BotResetMoveState( int movestate );
|
||||
//moves the bot to the given goal
|
||||
void BotMoveToGoal( bot_moveresult_t *result, int movestate, bot_goal_t *goal, int travelflags );
|
||||
//moves the bot in the specified direction
|
||||
int BotMoveInDirection( int movestate, vec3_t dir, float speed, int type );
|
||||
//reset avoid reachability
|
||||
void BotResetAvoidReach( int movestate );
|
||||
//resets the last avoid reachability
|
||||
void BotResetLastAvoidReach( int movestate );
|
||||
//returns a reachability area if the origin is in one
|
||||
int BotReachabilityArea( vec3_t origin, int client );
|
||||
//view target based on movement
|
||||
int BotMovementViewTarget( int movestate, bot_goal_t *goal, int travelflags, float lookahead, vec3_t target );
|
||||
//predict the position of a player
|
||||
int BotPredictVisiblePosition( vec3_t origin, int areanum, bot_goal_t *goal, int travelflags, vec3_t target );
|
||||
//returns the handle of a newly allocated movestate
|
||||
int BotAllocMoveState( void );
|
||||
//frees the movestate with the given handle
|
||||
void BotFreeMoveState( int handle );
|
||||
//initialize movement state
|
||||
void BotInitMoveState( int handle, bot_initmove_t *initmove );
|
||||
//must be called every map change
|
||||
void BotSetBrushModelTypes( void );
|
||||
//setup movement AI
|
||||
int BotSetupMoveAI( void );
|
||||
//shutdown movement AI
|
||||
void BotShutdownMoveAI( void );
|
||||
|
||||
// Ridah
|
||||
//initialize avoid reachabilities
|
||||
void BotInitAvoidReach( int handle );
|
||||
// done.
|
|
@ -44,18 +44,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_ai_weight.h" //fuzzy weights
|
||||
#include "../game/be_ai_weap.h"
|
||||
#include "be_ai_weap.h"
|
||||
|
||||
//#define DEBUG_AI_WEAP
|
||||
|
||||
//structure field offsets
|
||||
#define WEAPON_OFS( x ) (int)&( ( (weaponinfo_t *)0 )->x )
|
||||
#define PROJECTILE_OFS( x ) (int)&( ( (projectileinfo_t *)0 )->x )
|
||||
#define WEAPON_OFS(x) (size_t)&(((weaponinfo_t *)0)->x)
|
||||
#define PROJECTILE_OFS(x) (size_t)&(((projectileinfo_t *)0)->x)
|
||||
|
||||
//weapon definition
|
||||
fielddef_t weaponinfo_fields[] =
|
||||
|
@ -89,7 +89,7 @@ fielddef_t weaponinfo_fields[] =
|
|||
fielddef_t projectileinfo_fields[] =
|
||||
{
|
||||
{"name", PROJECTILE_OFS( name ), FT_STRING}, //name of the projectile
|
||||
{"model", WEAPON_OFS( model ), FT_STRING}, //model of the projectile
|
||||
{"model", PROJECTILE_OFS(model), FT_STRING}, //model of the projectile
|
||||
{"flags", PROJECTILE_OFS( flags ), FT_INT}, //special flags
|
||||
{"gravity", PROJECTILE_OFS( gravity ), FT_FLOAT}, //amount of gravity applied to the projectile [0,1]
|
||||
{"damage", PROJECTILE_OFS( damage ), FT_INT}, //damage of the projectile
|
||||
|
@ -155,11 +155,11 @@ int BotValidWeaponNumber( int weaponnum ) {
|
|||
//========================================================================
|
||||
bot_weaponstate_t *BotWeaponStateFromHandle( int handle ) {
|
||||
if ( handle <= 0 || handle > MAX_CLIENTS ) {
|
||||
botimport.Print( PRT_FATAL, "move state handle %d out of range\n", handle );
|
||||
botimport.Print( PRT_FATAL, "weapon state handle %d out of range\n", handle );
|
||||
return NULL;
|
||||
} //end if
|
||||
if ( !botweaponstates[handle] ) {
|
||||
botimport.Print( PRT_FATAL, "invalid move state %d\n", handle );
|
||||
botimport.Print( PRT_FATAL, "invalid weapon state %d\n", handle );
|
||||
return NULL;
|
||||
} //end if
|
||||
return botweaponstates[handle];
|
||||
|
@ -200,7 +200,7 @@ void DumpWeaponConfig( weaponconfig_t *wc ) {
|
|||
weaponconfig_t *LoadWeaponConfig( char *filename ) {
|
||||
int max_weaponinfo, max_projectileinfo;
|
||||
token_t token;
|
||||
char path[MAX_PATH];
|
||||
char path[MAX_QPATH];
|
||||
int i, j;
|
||||
source_t *source;
|
||||
weaponconfig_t *wc;
|
||||
|
@ -218,7 +218,7 @@ weaponconfig_t *LoadWeaponConfig( char *filename ) {
|
|||
max_projectileinfo = 32;
|
||||
LibVarSet( "max_projectileinfo", "32" );
|
||||
} //end if
|
||||
strncpy( path, filename, MAX_PATH );
|
||||
Q_strncpyz( path, filename, sizeof( path ) );
|
||||
source = LoadSourceFile( path );
|
||||
if ( !source ) {
|
||||
botimport.Print( PRT_ERROR, "counldn't load %s\n", path );
|
||||
|
@ -449,20 +449,6 @@ int BotChooseBestFightWeapon( int weaponstate, int *inventory ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void BotResetWeaponState( int weaponstate ) {
|
||||
struct weightconfig_s *weaponweightconfig;
|
||||
int *weaponweightindex;
|
||||
bot_weaponstate_t *ws;
|
||||
|
||||
ws = BotWeaponStateFromHandle( weaponstate );
|
||||
if ( !ws ) {
|
||||
return;
|
||||
}
|
||||
weaponweightconfig = ws->weaponweightconfig;
|
||||
weaponweightindex = ws->weaponweightindex;
|
||||
|
||||
//memset(ws, 0, sizeof(bot_weaponstate_t));
|
||||
ws->weaponweightconfig = weaponweightconfig;
|
||||
ws->weaponweightindex = weaponweightindex;
|
||||
} //end of the function BotResetWeaponState
|
||||
//========================================================================
|
||||
//
|
||||
|
@ -490,11 +476,11 @@ int BotAllocWeaponState( void ) {
|
|||
//========================================================================
|
||||
void BotFreeWeaponState( int handle ) {
|
||||
if ( handle <= 0 || handle > MAX_CLIENTS ) {
|
||||
botimport.Print( PRT_FATAL, "move state handle %d out of range\n", handle );
|
||||
botimport.Print( PRT_FATAL, "weapon state handle %d out of range\n", handle );
|
||||
return;
|
||||
} //end if
|
||||
if ( !botweaponstates[handle] ) {
|
||||
botimport.Print( PRT_FATAL, "invalid move state %d\n", handle );
|
||||
botimport.Print( PRT_FATAL, "invalid weapon state %d\n", handle );
|
||||
return;
|
||||
} //end if
|
||||
BotFreeWeaponWeights( handle );
|
||||
|
|
109
Projects/Android/jni/rtcw/src/botlib/be_ai_weap.h
Normal file
109
Projects/Android/jni/rtcw/src/botlib/be_ai_weap.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ai_weap.h
|
||||
*
|
||||
* desc: weapon AI
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//projectile flags
|
||||
#define PFL_WINDOWDAMAGE 1 //projectile damages through window
|
||||
#define PFL_RETURN 2 //set when projectile returns to owner
|
||||
//weapon flags
|
||||
#define WFL_FIRERELEASED 1 //set when projectile is fired with key-up event
|
||||
//damage types
|
||||
#define DAMAGETYPE_IMPACT 1 //damage on impact
|
||||
#define DAMAGETYPE_RADIAL 2 //radial damage
|
||||
#define DAMAGETYPE_VISIBLE 4 //damage to all entities visible to the projectile
|
||||
|
||||
typedef struct projectileinfo_s
|
||||
{
|
||||
char name[MAX_STRINGFIELD];
|
||||
char model[MAX_STRINGFIELD];
|
||||
int flags;
|
||||
float gravity;
|
||||
int damage;
|
||||
float radius;
|
||||
int visdamage;
|
||||
int damagetype;
|
||||
int healthinc;
|
||||
float push;
|
||||
float detonation;
|
||||
float bounce;
|
||||
float bouncefric;
|
||||
float bouncestop;
|
||||
} projectileinfo_t;
|
||||
|
||||
typedef struct weaponinfo_s
|
||||
{
|
||||
int valid; //true if the weapon info is valid
|
||||
int number; //number of the weapon
|
||||
char name[MAX_STRINGFIELD];
|
||||
char model[MAX_STRINGFIELD];
|
||||
int level;
|
||||
int weaponindex;
|
||||
int flags;
|
||||
char projectile[MAX_STRINGFIELD];
|
||||
int numprojectiles;
|
||||
float hspread;
|
||||
float vspread;
|
||||
float speed;
|
||||
float acceleration;
|
||||
vec3_t recoil;
|
||||
vec3_t offset;
|
||||
vec3_t angleoffset;
|
||||
float extrazvelocity;
|
||||
int ammoamount;
|
||||
int ammoindex;
|
||||
float activate;
|
||||
float reload;
|
||||
float spinup;
|
||||
float spindown;
|
||||
projectileinfo_t proj; //pointer to the used projectile
|
||||
} weaponinfo_t;
|
||||
|
||||
//setup the weapon AI
|
||||
int BotSetupWeaponAI( void );
|
||||
//shut down the weapon AI
|
||||
void BotShutdownWeaponAI( void );
|
||||
//returns the best weapon to fight with
|
||||
int BotChooseBestFightWeapon( int weaponstate, int *inventory );
|
||||
//returns the information of the current weapon
|
||||
void BotGetWeaponInfo( int weaponstate, int weapon, weaponinfo_t *weaponinfo );
|
||||
//loads the weapon weights
|
||||
int BotLoadWeaponWeights( int weaponstate, char *filename );
|
||||
//returns a handle to a newly allocated weapon state
|
||||
int BotAllocWeaponState( void );
|
||||
//frees the weapon state
|
||||
void BotFreeWeaponState( int weaponstate );
|
||||
//resets the whole weapon state
|
||||
void BotResetWeaponState( int weaponstate );
|
|
@ -44,8 +44,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_struct.h"
|
||||
#include "l_libvar.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_ai_weight.h"
|
||||
|
@ -69,15 +69,19 @@ int ReadValue( source_t *source, float *value ) {
|
|||
return qfalse;
|
||||
}
|
||||
if ( !strcmp( token.string, "-" ) ) {
|
||||
SourceWarning( source, "negative value set to zero\n" );
|
||||
if ( !PC_ExpectTokenType( source, TT_NUMBER, 0, &token ) ) {
|
||||
SourceWarning(source, "negative value set to zero");
|
||||
|
||||
if(!PC_ExpectAnyToken(source, &token))
|
||||
{
|
||||
SourceError(source, "Missing return value");
|
||||
return qfalse;
|
||||
}
|
||||
} //end if
|
||||
}
|
||||
if ( token.type != TT_NUMBER ) {
|
||||
SourceError( source, "invalid return value %s\n", token.string );
|
||||
SourceError( source, "invalid return value %s", token.string );
|
||||
return qfalse;
|
||||
} //end if
|
||||
}
|
||||
|
||||
*value = token.floatvalue;
|
||||
return qtrue;
|
||||
} //end of the function ReadValue
|
||||
|
@ -216,7 +220,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r( source_t *source ) {
|
|||
lastfs = fs;
|
||||
if ( def ) {
|
||||
if ( founddefault ) {
|
||||
SourceError( source, "switch already has a default\n" );
|
||||
SourceError( source, "switch already has a default" );
|
||||
FreeFuzzySeperators_r( firstfs );
|
||||
return NULL;
|
||||
} //end if
|
||||
|
@ -258,7 +262,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r( source_t *source ) {
|
|||
} //end else if
|
||||
else
|
||||
{
|
||||
SourceError( source, "invalid name %s\n", token.string );
|
||||
SourceError( source, "invalid name %s", token.string );
|
||||
return NULL;
|
||||
} //end else
|
||||
if ( newindent ) {
|
||||
|
@ -271,7 +275,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r( source_t *source ) {
|
|||
else
|
||||
{
|
||||
FreeFuzzySeperators_r( firstfs );
|
||||
SourceError( source, "invalid name %s\n", token.string );
|
||||
SourceError( source, "invalid name %s", token.string );
|
||||
return NULL;
|
||||
} //end else
|
||||
if ( !PC_ExpectAnyToken( source, &token ) ) {
|
||||
|
@ -281,7 +285,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r( source_t *source ) {
|
|||
} while ( strcmp( token.string, "}" ) );
|
||||
//
|
||||
if ( !founddefault ) {
|
||||
SourceWarning( source, "switch without default\n" );
|
||||
SourceWarning( source, "switch without default" );
|
||||
fs = (fuzzyseperator_t *) GetClearedMemory( sizeof( fuzzyseperator_t ) );
|
||||
fs->index = index;
|
||||
fs->value = MAX_INVENTORYVALUE;
|
||||
|
@ -291,7 +295,6 @@ fuzzyseperator_t *ReadFuzzySeperators_r( source_t *source ) {
|
|||
if ( lastfs ) {
|
||||
lastfs->next = fs;
|
||||
} else { firstfs = fs;}
|
||||
lastfs = fs;
|
||||
} //end if
|
||||
//
|
||||
return firstfs;
|
||||
|
@ -351,7 +354,7 @@ weightconfig_t *ReadWeightConfig( char *filename ) {
|
|||
{
|
||||
if ( !strcmp( token.string, "weight" ) ) {
|
||||
if ( config->numweights >= MAX_WEIGHTS ) {
|
||||
SourceWarning( source, "too many fuzzy weights\n" );
|
||||
SourceWarning( source, "too many fuzzy weights" );
|
||||
break;
|
||||
} //end if
|
||||
if ( !PC_ExpectTokenType( source, TT_STRING, 0, &token ) ) {
|
||||
|
@ -401,7 +404,7 @@ weightconfig_t *ReadWeightConfig( char *filename ) {
|
|||
} //end else if
|
||||
else
|
||||
{
|
||||
SourceError( source, "invalid name %s\n", token.string );
|
||||
SourceError( source, "invalid name %s", token.string );
|
||||
FreeWeightConfig( config );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
|
@ -417,7 +420,7 @@ weightconfig_t *ReadWeightConfig( char *filename ) {
|
|||
} //end if
|
||||
else
|
||||
{
|
||||
SourceError( source, "invalid name %s\n", token.string );
|
||||
SourceError( source, "invalid name %s", token.string );
|
||||
FreeWeightConfig( config );
|
||||
FreeSource( source );
|
||||
return NULL;
|
||||
|
@ -428,7 +431,7 @@ weightconfig_t *ReadWeightConfig( char *filename ) {
|
|||
//if the file was located in a pak file
|
||||
botimport.Print( PRT_MESSAGE, "loaded %s\n", filename );
|
||||
#ifdef DEBUG
|
||||
if ( bot_developer ) {
|
||||
if ( botDeveloper ) {
|
||||
botimport.Print( PRT_MESSAGE, "weights loaded in %d msec\n", Sys_MilliSeconds() - starttime );
|
||||
} //end if
|
||||
#endif //DEBUG
|
||||
|
@ -654,9 +657,12 @@ float FuzzyWeight_r( int *inventory, fuzzyseperator_t *fs ) {
|
|||
w2 = FuzzyWeight_r( inventory, fs->next->child );
|
||||
} else { w2 = fs->next->weight;}
|
||||
//the scale factor
|
||||
scale = ( inventory[fs->index] - fs->value ) / ( fs->next->value - fs->value );
|
||||
if(fs->next->value == MAX_INVENTORYVALUE) // is fs->next the default case?
|
||||
return w2; // can't interpolate, return default weight
|
||||
else
|
||||
scale = (float) (inventory[fs->index] - fs->value) / (fs->next->value - fs->value);
|
||||
//scale between the two weights
|
||||
return scale * w1 + ( 1 - scale ) * w2;
|
||||
return (1 - scale) * w1 + scale * w2;
|
||||
} //end if
|
||||
return FuzzyWeight_r( inventory, fs->next );
|
||||
} //end else if
|
||||
|
@ -687,9 +693,12 @@ float FuzzyWeightUndecided_r( int *inventory, fuzzyseperator_t *fs ) {
|
|||
w2 = FuzzyWeight_r( inventory, fs->next->child );
|
||||
} else { w2 = fs->next->minweight + random() * ( fs->next->maxweight - fs->next->minweight );}
|
||||
//the scale factor
|
||||
scale = ( inventory[fs->index] - fs->value ) / ( fs->next->value - fs->value );
|
||||
if(fs->next->value == MAX_INVENTORYVALUE) // is fs->next the default case?
|
||||
return w2; // can't interpolate, return default weight
|
||||
else
|
||||
scale = (float) (inventory[fs->index] - fs->value) / (fs->next->value - fs->value);
|
||||
//scale between the two weights
|
||||
return scale * w1 + ( 1 - scale ) * w2;
|
||||
return (1 - scale) * w1 + scale * w2;
|
||||
} //end if
|
||||
return FuzzyWeightUndecided_r( inventory, fs->next );
|
||||
} //end else if
|
||||
|
@ -813,7 +822,7 @@ void ScaleFuzzySeperator_r( fuzzyseperator_t *fs, float scale ) {
|
|||
} //end if
|
||||
else if ( fs->type == WT_BALANCE ) {
|
||||
//
|
||||
fs->weight = ( fs->maxweight + fs->minweight ) * scale;
|
||||
fs->weight = (float) (fs->maxweight + fs->minweight) * scale;
|
||||
//get the weight between bounds
|
||||
if ( fs->weight < fs->minweight ) {
|
||||
fs->weight = fs->minweight;
|
||||
|
|
|
@ -40,12 +40,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_script.h"
|
||||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "botlib.h"
|
||||
#include "be_interface.h"
|
||||
#include "be_ea.h"
|
||||
|
||||
#define MAX_USERMOVE 400
|
||||
#define MAX_COMMANDARGUMENTS 10
|
||||
#define ACTION_JUMPEDLASTFRAME 128
|
||||
#define ACTION_JUMPEDLASTFRAME 128
|
||||
|
||||
bot_input_t *botinputs;
|
||||
|
||||
|
@ -385,24 +385,6 @@ void EA_View( int client, vec3_t viewangles ) {
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void EA_EndRegular( int client, float thinktime ) {
|
||||
/*
|
||||
bot_input_t *bi;
|
||||
int jumped = qfalse;
|
||||
|
||||
bi = &botinputs[client];
|
||||
|
||||
bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
|
||||
|
||||
bi->thinktime = thinktime;
|
||||
botimport.BotInput(client, bi);
|
||||
|
||||
bi->thinktime = 0;
|
||||
VectorClear(bi->dir);
|
||||
bi->speed = 0;
|
||||
jumped = bi->actionflags & ACTION_JUMP;
|
||||
bi->actionflags = 0;
|
||||
if (jumped) bi->actionflags |= ACTION_JUMPEDLASTFRAME;
|
||||
*/
|
||||
} //end of the function EA_EndRegular
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -412,23 +394,12 @@ void EA_EndRegular( int client, float thinktime ) {
|
|||
//===========================================================================
|
||||
void EA_GetInput( int client, float thinktime, bot_input_t *input ) {
|
||||
bot_input_t *bi;
|
||||
// int jumped = qfalse;
|
||||
|
||||
bi = &botinputs[client];
|
||||
|
||||
// bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
|
||||
|
||||
bi->thinktime = thinktime;
|
||||
memcpy( input, bi, sizeof( bot_input_t ) );
|
||||
|
||||
/*
|
||||
bi->thinktime = 0;
|
||||
VectorClear(bi->dir);
|
||||
bi->speed = 0;
|
||||
jumped = bi->actionflags & ACTION_JUMP;
|
||||
bi->actionflags = 0;
|
||||
if (jumped) bi->actionflags |= ACTION_JUMPEDLASTFRAME;
|
||||
*/
|
||||
} //end of the function EA_GetInput
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -441,7 +412,6 @@ void EA_ResetInput( int client, bot_input_t *init ) {
|
|||
int jumped = qfalse;
|
||||
|
||||
bi = &botinputs[client];
|
||||
bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
|
||||
|
||||
bi->thinktime = 0;
|
||||
VectorClear( bi->dir );
|
||||
|
|
72
Projects/Android/jni/rtcw/src/botlib/be_ea.h
Normal file
72
Projects/Android/jni/rtcw/src/botlib/be_ea.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ea.h
|
||||
*
|
||||
* desc: elementary actions
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//ClientCommand elementary actions
|
||||
void EA_Say( int client, char *str );
|
||||
void EA_SayTeam( int client, char *str );
|
||||
void EA_UseItem( int client, char *it );
|
||||
void EA_DropItem( int client, char *it );
|
||||
void EA_UseInv( int client, char *inv );
|
||||
void EA_DropInv( int client, char *inv );
|
||||
void EA_Command( int client, char *command );
|
||||
//regular elementary actions
|
||||
void EA_SelectWeapon( int client, int weapon );
|
||||
void EA_Attack( int client );
|
||||
void EA_Reload( int client );
|
||||
void EA_Respawn( int client );
|
||||
void EA_Talk( int client );
|
||||
void EA_Gesture( int client );
|
||||
void EA_Use( int client );
|
||||
void EA_Jump( int client );
|
||||
void EA_DelayedJump( int client );
|
||||
void EA_Crouch( int client );
|
||||
void EA_Walk( int client );
|
||||
void EA_MoveUp( int client );
|
||||
void EA_MoveDown( int client );
|
||||
void EA_MoveForward( int client );
|
||||
void EA_MoveBack( int client );
|
||||
void EA_MoveLeft( int client );
|
||||
void EA_MoveRight( int client );
|
||||
void EA_Move( int client, vec3_t dir, float speed );
|
||||
void EA_View( int client, vec3_t viewangles );
|
||||
//send regular input to the server
|
||||
void EA_EndRegular( int client, float thinktime );
|
||||
void EA_GetInput( int client, float thinktime, bot_input_t *input );
|
||||
void EA_ResetInput( int client, bot_input_t *init );
|
||||
//setup and shutdown routines
|
||||
int EA_Setup( void );
|
||||
void EA_Shutdown( void );
|
|
@ -43,20 +43,20 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
#include "aasfile.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../game/be_aas.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_aas_funcs.h"
|
||||
#include "be_aas_def.h"
|
||||
#include "be_interface.h"
|
||||
|
||||
#include "../game/be_ea.h"
|
||||
#include "be_ea.h"
|
||||
#include "be_ai_weight.h"
|
||||
#include "../game/be_ai_goal.h"
|
||||
#include "../game/be_ai_move.h"
|
||||
#include "../game/be_ai_weap.h"
|
||||
#include "../game/be_ai_chat.h"
|
||||
#include "../game/be_ai_char.h"
|
||||
#include "../game/be_ai_gen.h"
|
||||
#include "be_ai_goal.h"
|
||||
#include "be_ai_move.h"
|
||||
#include "be_ai_weap.h"
|
||||
#include "be_ai_chat.h"
|
||||
#include "be_ai_char.h"
|
||||
#include "be_ai_gen.h"
|
||||
|
||||
//library globals in a structure
|
||||
botlib_globals_t botlibglobals;
|
||||
|
@ -64,7 +64,7 @@ botlib_globals_t botlibglobals;
|
|||
botlib_export_t be_botlib_export;
|
||||
botlib_import_t botimport;
|
||||
//
|
||||
int bot_developer;
|
||||
int botDeveloper;
|
||||
//qtrue if the library is setup
|
||||
int botlibsetup = qfalse;
|
||||
|
||||
|
@ -82,10 +82,7 @@ int botlibsetup = qfalse;
|
|||
//===========================================================================
|
||||
// Ridah, faster Win32 code
|
||||
#ifdef _WIN32
|
||||
#undef MAX_PATH // this is an ugly hack, to temporarily ignore the current definition, since it's also defined in windows.h
|
||||
#include <windows.h>
|
||||
#undef MAX_PATH
|
||||
#define MAX_PATH MAX_QPATH
|
||||
#endif
|
||||
|
||||
int Sys_MilliSeconds( void ) {
|
||||
|
@ -159,11 +156,16 @@ qboolean BotLibSetup( char *str ) {
|
|||
int Export_BotLibSetup( void ) {
|
||||
int errnum;
|
||||
|
||||
bot_developer = LibVarGetValue( "bot_developer" );
|
||||
botDeveloper = LibVarGetValue("bot_developer");
|
||||
memset( &botlibglobals, 0, sizeof(botlibglobals) );
|
||||
//initialize byte swapping (litte endian etc.)
|
||||
Swap_Init();
|
||||
Log_Open( "botlib.log" );
|
||||
//
|
||||
// Swap_Init();
|
||||
|
||||
if( botDeveloper )
|
||||
{
|
||||
Log_Open( "botlib.log" );
|
||||
}
|
||||
|
||||
botimport.Print( PRT_MESSAGE, "------- BotLib Initialization -------\n" );
|
||||
//
|
||||
botlibglobals.maxclients = (int) LibVarValue( "maxclients", "128" );
|
||||
|
@ -247,7 +249,7 @@ int Export_BotLibShutdown( void ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
int Export_BotLibVarSet( char *var_name, char *value ) {
|
||||
int Export_BotLibVarSet( const char *var_name, const char *value ) {
|
||||
LibVarSet( var_name, value );
|
||||
return BLERR_NOERROR;
|
||||
} //end of the function Export_BotLibVarSet
|
||||
|
@ -257,7 +259,7 @@ int Export_BotLibVarSet( char *var_name, char *value ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
int Export_BotLibVarGet( char *var_name, char *value, int size ) {
|
||||
int Export_BotLibVarGet( const char *var_name, char *value, int size ) {
|
||||
char *varvalue;
|
||||
|
||||
varvalue = LibVarGetString( var_name );
|
||||
|
@ -337,7 +339,7 @@ void ElevatorBottomCenter( aas_reachability_t *reach, vec3_t bottomcenter );
|
|||
int BotGetReachabilityToGoal( vec3_t origin, int areanum, int entnum,
|
||||
int lastgoalareanum, int lastareanum,
|
||||
int *avoidreach, float *avoidreachtimes, int *avoidreachtries,
|
||||
bot_goal_t *goal, int travelflags, int movetravelflags );
|
||||
bot_goal_t *goal, int travelflags );
|
||||
|
||||
int AAS_PointLight( vec3_t origin, int *red, int *green, int *blue );
|
||||
|
||||
|
@ -904,7 +906,9 @@ GetBotLibAPI
|
|||
============
|
||||
*/
|
||||
botlib_export_t *GetBotLibAPI( int apiVersion, botlib_import_t *import ) {
|
||||
assert(import);
|
||||
botimport = *import;
|
||||
assert(botimport.Print);
|
||||
|
||||
memset( &be_botlib_export, 0, sizeof( be_botlib_export ) );
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ typedef struct botlib_globals_s
|
|||
|
||||
extern botlib_globals_t botlibglobals;
|
||||
extern botlib_import_t botimport;
|
||||
extern int bot_developer; //true if developer is on
|
||||
extern int botDeveloper; //true if developer is on
|
||||
|
||||
//
|
||||
int Sys_MilliSeconds( void );
|
||||
|
|
110
Projects/Android/jni/rtcw/src/botlib/botai.h
Normal file
110
Projects/Android/jni/rtcw/src/botlib/botai.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Name: botai.h
|
||||
// Function: bot AI
|
||||
// Programmer: Mr Elusive (MrElusive@idsoftware.com)
|
||||
// Last update: 1999-08-18
|
||||
// Tab Size: 3
|
||||
//===========================================================================
|
||||
|
||||
//debug line colors
|
||||
#define LINECOLOR_NONE -1
|
||||
#define LINECOLOR_RED 1
|
||||
#define LINECOLOR_GREEN 2
|
||||
#define LINECOLOR_BLUE 3
|
||||
#define LINECOLOR_YELLOW 4
|
||||
#define LINECOLOR_ORANGE 5
|
||||
|
||||
//Print types
|
||||
#define PRT_MESSAGE 1
|
||||
#define PRT_WARNING 2
|
||||
#define PRT_ERROR 3
|
||||
#define PRT_FATAL 4
|
||||
#define PRT_EXIT 5
|
||||
|
||||
//console message types
|
||||
#define CMS_NORMAL 0
|
||||
#define CMS_CHAT 1
|
||||
|
||||
//some maxs
|
||||
#define MAX_NETNAME 36
|
||||
#define MAX_CLIENTSKINNAME 128
|
||||
#define MAX_FILEPATH 144
|
||||
#define MAX_CHARACTERNAME 144
|
||||
|
||||
#ifndef BSPTRACE
|
||||
|
||||
//bsp_trace_t hit surface
|
||||
typedef struct bsp_surface_s
|
||||
{
|
||||
char name[16];
|
||||
int flags;
|
||||
int value;
|
||||
} bsp_surface_t;
|
||||
|
||||
//remove the bsp_trace_s structure definition l8r on
|
||||
//a trace is returned when a box is swept through the world
|
||||
typedef struct bsp_trace_s
|
||||
{
|
||||
qboolean allsolid; // if true, plane is not valid
|
||||
qboolean startsolid; // if true, the initial point was in a solid area
|
||||
float fraction; // time completed, 1.0 = didn't hit anything
|
||||
vec3_t endpos; // final position
|
||||
cplane_t plane; // surface normal at impact
|
||||
float exp_dist; // expanded plane distance
|
||||
int sidenum; // number of the brush side hit
|
||||
bsp_surface_t surface; // the hit point surface
|
||||
int contents; // contents on other side of surface hit
|
||||
int ent; // number of entity hit
|
||||
} bsp_trace_t;
|
||||
|
||||
#define BSPTRACE
|
||||
#endif // BSPTRACE
|
||||
|
||||
//
|
||||
// imported functions used for the BotAI
|
||||
//
|
||||
|
||||
|
||||
// from the server
|
||||
/*
|
||||
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags );
|
||||
void trap_Cvar_Update( vmCvar_t *cvar );
|
||||
void trap_Cvar_Set( const char *var_name, const char *value );
|
||||
int trap_Cvar_VariableIntegerValue( const char *var_name );
|
||||
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
|
||||
void trap_GetConfigstring( int num, char *buffer, int bufferSize );
|
||||
void trap_GetServerinfo( char *buffer, int bufferSize );
|
||||
int trap_PointContents( const vec3_t point, int passEntityNum );
|
||||
qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 );
|
||||
int trap_BotAllocateClient( void );
|
||||
void trap_BotFreeClient( int clientNum );
|
||||
*/
|
|
@ -28,12 +28,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
//===========================================================================
|
||||
//
|
||||
// Name: botlib.h
|
||||
// Function: bot AI Library
|
||||
// Programmer: Mr Elusive (MrElusive@idsoftware.com)
|
||||
// Last update: 1999-08-18
|
||||
// Tab Size: 3
|
||||
//===========================================================================
|
||||
/*****************************************************************************
|
||||
* name: botlib.h
|
||||
*
|
||||
* desc: bot AI library
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define BOTLIB_API_VERSION 2
|
||||
|
||||
|
@ -117,8 +118,9 @@ struct weaponinfo_s;
|
|||
#define ACTION_TALK 1024
|
||||
#define ACTION_GESTURE 2048
|
||||
#define ACTION_WALK 4096
|
||||
#define ACTION_RELOAD 8192
|
||||
|
||||
//the bot input, will be converted to an usercmd_t
|
||||
//the bot input, will be converted to a usercmd_t
|
||||
typedef struct bot_input_s
|
||||
{
|
||||
float thinktime; //time since last output (in seconds)
|
||||
|
@ -187,7 +189,7 @@ typedef struct bot_entitystate_s
|
|||
typedef struct botlib_import_s
|
||||
{
|
||||
//print messages from the bot library
|
||||
void ( QDECL * Print )( int type, char *fmt, ... );
|
||||
void (QDECL *Print)(int type, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
//trace a bbox through the world
|
||||
void ( *Trace )( bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask );
|
||||
//trace a bbox against a specific entity
|
||||
|
@ -205,7 +207,6 @@ typedef struct botlib_import_s
|
|||
//memory allocation
|
||||
void *( *GetMemory )( int size );
|
||||
void ( *FreeMemory )( void *ptr );
|
||||
void ( *FreeZoneMemory )( void );
|
||||
void *( *HunkAlloc )( int size );
|
||||
//file system access
|
||||
int ( *FS_FOpenFile )( const char *qpath, fileHandle_t *file, fsMode_t mode );
|
||||
|
@ -281,6 +282,7 @@ typedef struct aas_export_s
|
|||
void ( *AAS_RT_ShowRoute )( vec3_t srcpos, int srcnum, int destnum );
|
||||
qboolean ( *AAS_RT_GetHidePos )( vec3_t srcpos, int srcnum, int srcarea, vec3_t destpos, int destnum, int destarea, vec3_t returnPos );
|
||||
int ( *AAS_FindAttackSpotWithinRange )( int srcnum, int rangenum, int enemynum, float rangedist, int travelflags, float *outpos );
|
||||
qboolean ( *AAS_GetRouteFirstVisPos )( vec3_t srcpos, vec3_t destpos, int travelflags, vec3_t retpos );
|
||||
void ( *AAS_SetAASBlockingEntity )( vec3_t absmin, vec3_t absmax, qboolean blocking );
|
||||
// done.
|
||||
|
||||
|
@ -305,6 +307,7 @@ typedef struct ea_export_s
|
|||
void ( *EA_SelectWeapon )( int client, int weapon );
|
||||
void ( *EA_Talk )( int client );
|
||||
void ( *EA_Attack )( int client );
|
||||
void ( *EA_Reload )( int client );
|
||||
void ( *EA_Use )( int client );
|
||||
void ( *EA_Respawn )( int client );
|
||||
void ( *EA_Jump )( int client );
|
||||
|
@ -437,11 +440,17 @@ typedef struct botlib_export_s
|
|||
//shutdown the bot library, returns BLERR_
|
||||
int ( *BotLibShutdown )( void );
|
||||
//sets a library variable returns BLERR_
|
||||
int ( *BotLibVarSet )( char *var_name, char *value );
|
||||
int ( *BotLibVarSet )( const char *var_name, const char *value );
|
||||
//gets a library variable returns BLERR_
|
||||
int ( *BotLibVarGet )( char *var_name, char *value, int size );
|
||||
int ( *BotLibVarGet )( const char *var_name, char *value, int size );
|
||||
|
||||
//sets a C-like define returns BLERR_
|
||||
int ( *BotLibDefine )( char *string );
|
||||
int ( *PC_AddGlobalDefine )( char *string );
|
||||
int ( *PC_LoadSourceHandle )( const char *filename );
|
||||
int ( *PC_FreeSourceHandle )( int handle );
|
||||
int ( *PC_ReadTokenHandle )( int handle, pc_token_t *pc_token );
|
||||
int ( *PC_SourceFileAndLine )( int handle, char *filename, int *line );
|
||||
|
||||
//start a frame in the bot library
|
||||
int ( *BotLibStartFrame )( float time );
|
||||
//load a new map in the bot library
|
||||
|
@ -459,14 +468,16 @@ botlib_export_t *GetBotLibAPI( int apiVersion, botlib_import_t *import );
|
|||
|
||||
name: default: module(s): description:
|
||||
|
||||
"basedir" "" l_utils.c Quake2 base directory
|
||||
"gamedir" "" l_utils.c Quake2 game directory
|
||||
"cddir" "" l_utils.c Quake2 CD directory
|
||||
"basedir" "" - base directory
|
||||
"homedir" "" be_interface.c game directory
|
||||
"gamedir" "" be_interface.c game directory
|
||||
"basegame" "" be_interface.c game directory
|
||||
|
||||
"autolaunchbspc" "0" be_aas_load.c automatically launch (Win)BSPC
|
||||
"log" "0" l_log.c enable/disable creating a log file
|
||||
"maxclients" "4" be_interface.c maximum number of clients
|
||||
"maxentities" "1024" be_interface.c maximum number of entities
|
||||
"maxentities" "2048" be_interface.c maximum number of entities
|
||||
"bot_developer" "0" be_interface.c bot developer mode (it's "botDeveloper" in C to prevent symbol clash).
|
||||
|
||||
"sv_friction" "6" be_aas_move.c ground friction
|
||||
"sv_stopspeed" "100" be_aas_move.c stop speed
|
||||
|
|
|
@ -1,911 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="botlib"
|
||||
ProjectGUID="{86691FDD-E0C6-4D71-9FFD-E0F30F19AA3E}"
|
||||
TargetFrameworkVersion="0"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;BOTLIB;_CRT_SECURE_NO_WARNINGS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/botlib.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\Release\botlib.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/botlib.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;BOTLIB;DEBUG;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\Debug/botlib.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\Debug\botlib.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Debug/botlib.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="be_aas_bspq3.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_cluster.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_debug.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_entity.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_file.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_main.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_move.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_optimize.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_reach.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_route.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_routealt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_routetable.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_sample.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_char.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_chat.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_gen.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_goal.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_move.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_weap.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_weight.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ea.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_interface.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_crc.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_libvar.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_log.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_memory.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_precomp.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_script.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_struct.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="aasfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_aas.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_bsp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_cluster.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_debug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_def.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_entity.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_file.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_funcs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_main.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_move.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_optimize.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_reach.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_route.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_routealt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_routetable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_aas_sample.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_ai_char.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_ai_chat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_ai_gen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_ai_goal.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_ai_move.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_ai_weap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_ai_weight.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\be_ea.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="be_interface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\botlib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_crc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_libvar.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_log.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_precomp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_script.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_struct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="l_utils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\q_shared.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\game\surfaceflags.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,182 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{86691FDD-E0C6-4D71-9FFD-E0F30F19AA3E}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>.\Release\</OutDir>
|
||||
<IntDir>.\Release\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>.\Debug\</OutDir>
|
||||
<IntDir>.\Debug\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;BOTLIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Release/botlib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>.\Release\botlib.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release/botlib.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;BOTLIB;DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/botlib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>.\Debug\botlib.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug/botlib.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="be_aas_bspq3.c" />
|
||||
<ClCompile Include="be_aas_cluster.c" />
|
||||
<ClCompile Include="be_aas_debug.c" />
|
||||
<ClCompile Include="be_aas_entity.c" />
|
||||
<ClCompile Include="be_aas_file.c" />
|
||||
<ClCompile Include="be_aas_main.c" />
|
||||
<ClCompile Include="be_aas_move.c" />
|
||||
<ClCompile Include="be_aas_optimize.c" />
|
||||
<ClCompile Include="be_aas_reach.c" />
|
||||
<ClCompile Include="be_aas_route.c" />
|
||||
<ClCompile Include="be_aas_routealt.c" />
|
||||
<ClCompile Include="be_aas_routetable.c" />
|
||||
<ClCompile Include="be_aas_sample.c" />
|
||||
<ClCompile Include="be_ai_char.c" />
|
||||
<ClCompile Include="be_ai_chat.c" />
|
||||
<ClCompile Include="be_ai_gen.c" />
|
||||
<ClCompile Include="be_ai_goal.c" />
|
||||
<ClCompile Include="be_ai_move.c" />
|
||||
<ClCompile Include="be_ai_weap.c" />
|
||||
<ClCompile Include="be_ai_weight.c" />
|
||||
<ClCompile Include="be_ea.c" />
|
||||
<ClCompile Include="be_interface.c" />
|
||||
<ClCompile Include="l_crc.c" />
|
||||
<ClCompile Include="l_libvar.c" />
|
||||
<ClCompile Include="l_log.c" />
|
||||
<ClCompile Include="l_memory.c" />
|
||||
<ClCompile Include="l_precomp.c" />
|
||||
<ClCompile Include="l_script.c" />
|
||||
<ClCompile Include="l_struct.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="aasfile.h" />
|
||||
<ClInclude Include="..\game\be_aas.h" />
|
||||
<ClInclude Include="be_aas_bsp.h" />
|
||||
<ClInclude Include="be_aas_cluster.h" />
|
||||
<ClInclude Include="be_aas_debug.h" />
|
||||
<ClInclude Include="be_aas_def.h" />
|
||||
<ClInclude Include="be_aas_entity.h" />
|
||||
<ClInclude Include="be_aas_file.h" />
|
||||
<ClInclude Include="be_aas_funcs.h" />
|
||||
<ClInclude Include="be_aas_main.h" />
|
||||
<ClInclude Include="be_aas_move.h" />
|
||||
<ClInclude Include="be_aas_optimize.h" />
|
||||
<ClInclude Include="be_aas_reach.h" />
|
||||
<ClInclude Include="be_aas_route.h" />
|
||||
<ClInclude Include="be_aas_routealt.h" />
|
||||
<ClInclude Include="be_aas_routetable.h" />
|
||||
<ClInclude Include="be_aas_sample.h" />
|
||||
<ClInclude Include="..\game\be_ai_char.h" />
|
||||
<ClInclude Include="..\game\be_ai_chat.h" />
|
||||
<ClInclude Include="..\game\be_ai_gen.h" />
|
||||
<ClInclude Include="..\game\be_ai_goal.h" />
|
||||
<ClInclude Include="..\game\be_ai_move.h" />
|
||||
<ClInclude Include="..\game\be_ai_weap.h" />
|
||||
<ClInclude Include="be_ai_weight.h" />
|
||||
<ClInclude Include="..\game\be_ea.h" />
|
||||
<ClInclude Include="be_interface.h" />
|
||||
<ClInclude Include="..\game\botlib.h" />
|
||||
<ClInclude Include="l_crc.h" />
|
||||
<ClInclude Include="l_libvar.h" />
|
||||
<ClInclude Include="l_log.h" />
|
||||
<ClInclude Include="l_memory.h" />
|
||||
<ClInclude Include="l_precomp.h" />
|
||||
<ClInclude Include="l_script.h" />
|
||||
<ClInclude Include="l_struct.h" />
|
||||
<ClInclude Include="l_utils.h" />
|
||||
<ClInclude Include="..\game\q_shared.h" />
|
||||
<ClInclude Include="..\game\surfaceflags.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,215 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{24c141db-c4a4-4901-8516-8d8cfc8fa793}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{22df568f-e0ff-497f-a95c-218be479c431}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="be_aas_bspq3.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_cluster.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_debug.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_entity.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_file.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_move.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_optimize.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_reach.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_route.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_routealt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_routetable.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_aas_sample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ai_char.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ai_chat.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ai_gen.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ai_goal.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ai_move.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ai_weap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ai_weight.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_ea.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="be_interface.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="l_crc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="l_libvar.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="l_log.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="l_memory.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="l_precomp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="l_script.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="l_struct.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="aasfile.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_aas.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_bsp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_cluster.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_debug.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_def.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_entity.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_file.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_funcs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_move.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_optimize.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_reach.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_route.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_routealt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_routetable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_aas_sample.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_ai_char.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_ai_chat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_ai_gen.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_ai_goal.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_ai_move.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_ai_weap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_ai_weight.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\be_ea.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="be_interface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\botlib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_crc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_libvar.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_log.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_memory.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_precomp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_script.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_struct.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="l_utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\q_shared.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\surfaceflags.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -40,9 +40,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include <string.h>
|
||||
|
||||
#include "../game/q_shared.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "botlib.h"
|
||||
#include "be_interface.h" //for botimport.Print
|
||||
|
||||
#include "l_crc.h"
|
||||
|
||||
// FIXME: byte swap?
|
||||
|
||||
|
@ -87,7 +87,7 @@ unsigned short crctable[257] =
|
|||
0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
|
||||
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
|
||||
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0,
|
||||
0x0000 // because process string allows value 256 through and it was undefined
|
||||
0x0000 // code reaches element 256
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "l_libvar.h"
|
||||
|
||||
//list with library variables
|
||||
libvar_t *libvarlist;
|
||||
libvar_t *libvarlist = NULL;
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -48,7 +48,7 @@ libvar_t *libvarlist;
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
float LibVarStringValue( char *string ) {
|
||||
float LibVarStringValue( const char *string ) {
|
||||
int dotfound = 0;
|
||||
float value = 0;
|
||||
|
||||
|
@ -82,12 +82,12 @@ float LibVarStringValue( char *string ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
libvar_t *LibVarAlloc( char *var_name ) {
|
||||
libvar_t *LibVarAlloc( const char *var_name ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = (libvar_t *) GetMemory( sizeof( libvar_t ) + strlen( var_name ) + 1 );
|
||||
v = (libvar_t *) GetMemory(sizeof(libvar_t));
|
||||
memset( v, 0, sizeof( libvar_t ) );
|
||||
v->name = (char *) v + sizeof( libvar_t );
|
||||
v->name = (char *) GetMemory(strlen(var_name)+1);
|
||||
strcpy( v->name, var_name );
|
||||
//add the variable in the list
|
||||
v->next = libvarlist;
|
||||
|
@ -104,6 +104,7 @@ void LibVarDeAlloc( libvar_t *v ) {
|
|||
if ( v->string ) {
|
||||
FreeMemory( v->string );
|
||||
}
|
||||
FreeMemory(v->name);
|
||||
FreeMemory( v );
|
||||
} //end of the function LibVarDeAlloc
|
||||
//===========================================================================
|
||||
|
@ -128,7 +129,7 @@ void LibVarDeAllocAll( void ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
libvar_t *LibVarGet( char *var_name ) {
|
||||
libvar_t *LibVarGet( const char *var_name ) {
|
||||
libvar_t *v;
|
||||
|
||||
for ( v = libvarlist; v; v = v->next )
|
||||
|
@ -145,7 +146,7 @@ libvar_t *LibVarGet( char *var_name ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
char *LibVarGetString( char *var_name ) {
|
||||
char *LibVarGetString( const char *var_name ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = LibVarGet( var_name );
|
||||
|
@ -163,7 +164,7 @@ char *LibVarGetString( char *var_name ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
float LibVarGetValue( char *var_name ) {
|
||||
float LibVarGetValue( const char *var_name ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = LibVarGet( var_name );
|
||||
|
@ -181,7 +182,7 @@ float LibVarGetValue( char *var_name ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
libvar_t *LibVar( char *var_name, char *value ) {
|
||||
libvar_t *LibVar( const char *var_name, const char *value ) {
|
||||
libvar_t *v;
|
||||
v = LibVarGet( var_name );
|
||||
if ( v ) {
|
||||
|
@ -205,7 +206,7 @@ libvar_t *LibVar( char *var_name, char *value ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
char *LibVarString( char *var_name, char *value ) {
|
||||
char *LibVarString( const char *var_name, const char *value ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = LibVar( var_name, value );
|
||||
|
@ -217,7 +218,7 @@ char *LibVarString( char *var_name, char *value ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
float LibVarValue( char *var_name, char *value ) {
|
||||
float LibVarValue( const char *var_name, const char *value ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = LibVar( var_name, value );
|
||||
|
@ -229,7 +230,7 @@ float LibVarValue( char *var_name, char *value ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void LibVarSet( char *var_name, char *value ) {
|
||||
void LibVarSet( const char *var_name, const char *value ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = LibVarGet( var_name );
|
||||
|
@ -254,7 +255,7 @@ void LibVarSet( char *var_name, char *value ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
qboolean LibVarChanged( char *var_name ) {
|
||||
qboolean LibVarChanged( const char *var_name ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = LibVarGet( var_name );
|
||||
|
@ -272,7 +273,7 @@ qboolean LibVarChanged( char *var_name ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void LibVarSetNotModified( char *var_name ) {
|
||||
void LibVarSetNotModified( const char *var_name ) {
|
||||
libvar_t *v;
|
||||
|
||||
v = LibVarGet( var_name );
|
||||
|
|
|
@ -49,21 +49,21 @@ typedef struct libvar_s
|
|||
//removes all library variables
|
||||
void LibVarDeAllocAll( void );
|
||||
//gets the library variable with the given name
|
||||
libvar_t *LibVarGet( char *var_name );
|
||||
libvar_t *LibVarGet( const char *var_name );
|
||||
//gets the string of the library variable with the given name
|
||||
char *LibVarGetString( char *var_name );
|
||||
char *LibVarGetString( const char *var_name );
|
||||
//gets the value of the library variable with the given name
|
||||
float LibVarGetValue( char *var_name );
|
||||
float LibVarGetValue( const char *var_name );
|
||||
//creates the library variable if not existing already and returns it
|
||||
libvar_t *LibVar( char *var_name, char *value );
|
||||
libvar_t *LibVar( const char *var_name, const char *value );
|
||||
//creates the library variable if not existing already and returns the value
|
||||
float LibVarValue( char *var_name, char *value );
|
||||
float LibVarValue( const char *var_name, const char *value );
|
||||
//creates the library variable if not existing already and returns the value string
|
||||
char *LibVarString( char *var_name, char *value );
|
||||
char *LibVarString( const char *var_name, const char *value );
|
||||
//sets the library variable
|
||||
void LibVarSet( char *var_name, char *value );
|
||||
void LibVarSet( const char *var_name, const char *value );
|
||||
//returns true if the library variable has been modified
|
||||
qboolean LibVarChanged( char *var_name );
|
||||
qboolean LibVarChanged( const char *var_name );
|
||||
//sets the library variable to unmodified
|
||||
void LibVarSetNotModified( char *var_name );
|
||||
void LibVarSetNotModified( const char *var_name );
|
||||
|
||||
|
|
|
@ -40,9 +40,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include <string.h>
|
||||
|
||||
#include "../game/q_shared.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
#include "botlib.h"
|
||||
#include "be_interface.h" //for botimport.Print
|
||||
#include "l_libvar.h"
|
||||
#include "l_log.h"
|
||||
|
||||
#define MAX_LOGFILENAMESIZE 1024
|
||||
|
||||
|
@ -62,6 +64,8 @@ static logfile_t logfile;
|
|||
// Changes Globals: -
|
||||
//===========================================================================
|
||||
void Log_AlwaysOpen( char *filename ) {
|
||||
char *ospath;
|
||||
|
||||
if ( !filename || !strlen( filename ) ) {
|
||||
botimport.Print( PRT_MESSAGE, "openlog <filename>\n" );
|
||||
return;
|
||||
|
@ -70,12 +74,13 @@ void Log_AlwaysOpen( char *filename ) {
|
|||
botimport.Print( PRT_ERROR, "log file %s is already opened\n", logfile.filename );
|
||||
return;
|
||||
} //end if
|
||||
logfile.fp = fopen( filename, "wb" );
|
||||
ospath = FS_BuildOSPath( Cvar_VariableString( "fs_homepath" ), Cvar_VariableString( "fs_game" ), filename );
|
||||
logfile.fp = fopen(ospath, "wb");
|
||||
if ( !logfile.fp ) {
|
||||
botimport.Print( PRT_ERROR, "can't open the log file %s\n", filename );
|
||||
return;
|
||||
} //end if
|
||||
strncpy( logfile.filename, filename, MAX_LOGFILENAMESIZE );
|
||||
Q_strncpyz( logfile.filename, filename, MAX_LOGFILENAMESIZE );
|
||||
botimport.Print( PRT_MESSAGE, "Opened log %s\n", logfile.filename );
|
||||
} //end of the function Log_Create
|
||||
//===========================================================================
|
||||
|
|
|
@ -44,9 +44,9 @@ void Log_Close( void );
|
|||
//close log file if present
|
||||
void Log_Shutdown( void );
|
||||
//write to the current opened log file
|
||||
void QDECL Log_Write( char *fmt, ... );
|
||||
void QDECL Log_Write(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
//write to the current opened log file with a time stamp
|
||||
void QDECL Log_WriteTimeStamped( char *fmt, ... );
|
||||
void QDECL Log_WriteTimeStamped(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
//returns a pointer to the log file
|
||||
FILE *Log_FilePointer( void );
|
||||
//flush log file
|
||||
|
|
|
@ -36,8 +36,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../game/q_shared.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "botlib.h"
|
||||
#include "l_log.h"
|
||||
#include "l_memory.h"
|
||||
#include "be_interface.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -26,8 +26,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
// Copyright (C) 1999-2000 Id Software, Inc.
|
||||
//
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_precomp.c
|
||||
|
@ -61,7 +59,7 @@ typedef enum {qfalse, qtrue} qboolean;
|
|||
|
||||
#ifdef BOTLIB
|
||||
#include "../game/q_shared.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "botlib.h"
|
||||
#include "be_interface.h"
|
||||
#include "l_memory.h"
|
||||
#include "l_script.h"
|
||||
|
@ -91,10 +89,18 @@ typedef enum {qfalse, qtrue} qboolean;
|
|||
|
||||
#define qtrue true
|
||||
#define qfalse false
|
||||
#define Q_stricmp strcasecmp
|
||||
#define Q_stricmp stricmp
|
||||
|
||||
#define MAX_TOKENLENGTH 1024
|
||||
|
||||
typedef struct pc_token_s
|
||||
{
|
||||
int type;
|
||||
int subtype;
|
||||
int intvalue;
|
||||
float floatvalue;
|
||||
char string[MAX_TOKENLENGTH];
|
||||
} pc_token_t;
|
||||
#endif //BSPC
|
||||
|
||||
#if defined( QUAKE ) && !defined( BSPC )
|
||||
|
@ -139,7 +145,7 @@ void QDECL SourceError( source_t *source, char *str, ... ) {
|
|||
va_list ap;
|
||||
|
||||
va_start( ap, str );
|
||||
vsprintf( text, str, ap );
|
||||
vsnprintf(text, sizeof(text), str, ap);
|
||||
va_end( ap );
|
||||
#ifdef BOTLIB
|
||||
botimport.Print( PRT_ERROR, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text );
|
||||
|
@ -162,7 +168,7 @@ void QDECL SourceWarning( source_t *source, char *str, ... ) {
|
|||
va_list ap;
|
||||
|
||||
va_start( ap, str );
|
||||
vsprintf( text, str, ap );
|
||||
vsnprintf(text, sizeof(text), str, ap);
|
||||
va_end( ap );
|
||||
#ifdef BOTLIB
|
||||
botimport.Print( PRT_WARNING, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text );
|
||||
|
@ -273,9 +279,9 @@ token_t *PC_CopyToken( token_t *token ) {
|
|||
// t = freetokens;
|
||||
if ( !t ) {
|
||||
#ifdef BSPC
|
||||
Error( "out of token space\n" );
|
||||
Error( "out of token space" );
|
||||
#else
|
||||
Com_Error( ERR_FATAL, "out of token space\n" );
|
||||
Com_Error( ERR_FATAL, "out of token space" );
|
||||
#endif
|
||||
return NULL;
|
||||
} //end if
|
||||
|
@ -411,7 +417,6 @@ int PC_ReadDefineParms( source_t *source, define_t *define, token_t **parms, int
|
|||
if ( lastcomma ) {
|
||||
SourceWarning( source, "too many comma's" );
|
||||
}
|
||||
lastcomma = 1;
|
||||
break;
|
||||
} //end if
|
||||
} //end if
|
||||
|
@ -461,9 +466,9 @@ int PC_StringizeTokens( token_t *tokens, token_t *token ) {
|
|||
strcat( token->string, "\"" );
|
||||
for ( t = tokens; t; t = t->next )
|
||||
{
|
||||
strncat( token->string, t->string, MAX_TOKEN - strlen( token->string ) );
|
||||
strncat( token->string, t->string, MAX_TOKEN - strlen( token->string ) - 1 );
|
||||
} //end for
|
||||
strncat( token->string, "\"", MAX_TOKEN - strlen( token->string ) );
|
||||
strncat( token->string, "\"", MAX_TOKEN - strlen( token->string ) - 1 );
|
||||
return qtrue;
|
||||
} //end of the function PC_StringizeTokens
|
||||
//============================================================================
|
||||
|
@ -536,7 +541,7 @@ void PC_PrintDefineHashTable( define_t **definehash ) {
|
|||
//char primes[16] = {1, 3, 5, 7, 11, 13, 17, 19, 23, 27, 29, 31, 37, 41, 43, 47};
|
||||
|
||||
int PC_NameHash( char *name ) {
|
||||
int register hash, i;
|
||||
int hash, i;
|
||||
|
||||
hash = 0;
|
||||
for ( i = 0; name[i] != '\0'; i++ )
|
||||
|
@ -641,6 +646,7 @@ void PC_FreeDefine( define_t *define ) {
|
|||
PC_FreeToken( t );
|
||||
} //end for
|
||||
//free the define
|
||||
FreeMemory(define->name);
|
||||
FreeMemory( define );
|
||||
} //end of the function PC_FreeDefine
|
||||
//============================================================================
|
||||
|
@ -661,15 +667,15 @@ void PC_AddBuiltinDefines( source_t *source ) {
|
|||
{ "__FILE__", BUILTIN_FILE },
|
||||
{ "__DATE__", BUILTIN_DATE },
|
||||
{ "__TIME__", BUILTIN_TIME },
|
||||
// "__STDC__", BUILTIN_STDC,
|
||||
// { "__STDC__", BUILTIN_STDC },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
for ( i = 0; builtin[i].string; i++ )
|
||||
{
|
||||
define = (define_t *) GetMemory( sizeof( define_t ) + strlen( builtin[i].string ) + 1 );
|
||||
define = (define_t *) GetMemory(sizeof(define_t));
|
||||
memset( define, 0, sizeof( define_t ) );
|
||||
define->name = (char *) define + sizeof( define_t );
|
||||
define->name = (char *) GetMemory(strlen(builtin[i].string) + 1);
|
||||
strcpy( define->name, builtin[i].string );
|
||||
define->flags |= DEFINE_FIXED;
|
||||
define->builtin = builtin[i].builtin;
|
||||
|
@ -691,7 +697,7 @@ void PC_AddBuiltinDefines( source_t *source ) {
|
|||
int PC_ExpandBuiltinDefine( source_t *source, token_t *deftoken, define_t *define,
|
||||
token_t **firsttoken, token_t **lasttoken ) {
|
||||
token_t *token;
|
||||
unsigned long t; // time_t t; //to prevent LCC warning
|
||||
time_t t;
|
||||
char *curtime;
|
||||
|
||||
token = PC_CopyToken( deftoken );
|
||||
|
@ -766,7 +772,7 @@ int PC_ExpandBuiltinDefine( source_t *source, token_t *deftoken, define_t *defin
|
|||
//============================================================================
|
||||
int PC_ExpandDefine( source_t *source, token_t *deftoken, define_t *define,
|
||||
token_t **firsttoken, token_t **lasttoken ) {
|
||||
token_t *parms[MAX_DEFINEPARMS], *dt, *pt, *t;
|
||||
token_t *parms[MAX_DEFINEPARMS] = { NULL }, *dt, *pt, *t;
|
||||
token_t *t1, *t2, *first, *last, *nextpt, token;
|
||||
int parmnum, i;
|
||||
|
||||
|
@ -925,7 +931,7 @@ void PC_ConvertPath( char *path ) {
|
|||
{
|
||||
if ( ( *ptr == '\\' || *ptr == '/' ) &&
|
||||
( *( ptr + 1 ) == '\\' || *( ptr + 1 ) == '/' ) ) {
|
||||
strcpy( ptr, ptr + 1 );
|
||||
memmove(ptr, ptr+1, strlen(ptr));
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
|
@ -950,7 +956,7 @@ void PC_ConvertPath( char *path ) {
|
|||
int PC_Directive_include( source_t *source ) {
|
||||
script_t *script;
|
||||
token_t token;
|
||||
char path[_MAX_PATH];
|
||||
char path[MAX_QPATH];
|
||||
#ifdef QUAKE
|
||||
foundfile_t file;
|
||||
#endif //QUAKE
|
||||
|
@ -972,13 +978,13 @@ int PC_Directive_include( source_t *source ) {
|
|||
PC_ConvertPath( token.string );
|
||||
script = LoadScriptFile( token.string );
|
||||
if ( !script ) {
|
||||
strcpy( path, source->includepath );
|
||||
strcat( path, token.string );
|
||||
Q_strncpyz(path, source->includepath, sizeof(path));
|
||||
Q_strcat(path, sizeof(path), token.string);
|
||||
script = LoadScriptFile( path );
|
||||
} //end if
|
||||
} //end if
|
||||
else if ( token.type == TT_PUNCTUATION && *token.string == '<' ) {
|
||||
strcpy( path, source->includepath );
|
||||
Q_strncpyz(path, source->includepath, sizeof(path));
|
||||
while ( PC_ReadSourceToken( source, &token ) )
|
||||
{
|
||||
if ( token.linescrossed > 0 ) {
|
||||
|
@ -988,7 +994,7 @@ int PC_Directive_include( source_t *source ) {
|
|||
if ( token.type == TT_PUNCTUATION && *token.string == '>' ) {
|
||||
break;
|
||||
}
|
||||
strncat( path, token.string, _MAX_PATH );
|
||||
Q_strcat(path, sizeof(path), token.string);
|
||||
} //end while
|
||||
if ( *token.string != '>' ) {
|
||||
SourceWarning( source, "#include missing trailing >" );
|
||||
|
@ -1010,7 +1016,7 @@ int PC_Directive_include( source_t *source ) {
|
|||
memset( &file, 0, sizeof( foundfile_t ) );
|
||||
script = LoadScriptFile( path );
|
||||
if ( script ) {
|
||||
strncpy( script->filename, path, _MAX_PATH );
|
||||
Q_strncpyz( script->filename, path, sizeof( script->filename ) );
|
||||
}
|
||||
} //end if
|
||||
#endif //QUAKE
|
||||
|
@ -1177,17 +1183,11 @@ int PC_Directive_define( source_t *source ) {
|
|||
if ( !PC_Directive_undef( source ) ) {
|
||||
return qfalse;
|
||||
}
|
||||
//if the define was not removed (define->flags & DEFINE_FIXED)
|
||||
#if DEFINEHASHING
|
||||
define = PC_FindHashedDefine( source->definehash, token.string );
|
||||
#else
|
||||
define = PC_FindDefine( source->defines, token.string );
|
||||
#endif //DEFINEHASHING
|
||||
} //end if
|
||||
//allocate define
|
||||
define = (define_t *) GetMemory( sizeof( define_t ) + strlen( token.string ) + 1 );
|
||||
//allocate define
|
||||
define = (define_t *) GetMemory(sizeof(define_t));
|
||||
memset( define, 0, sizeof( define_t ) );
|
||||
define->name = (char *) define + sizeof( define_t );
|
||||
define->name = (char *) GetMemory(strlen(token.string) + 1);
|
||||
strcpy( define->name, token.string );
|
||||
//add the define to the source
|
||||
#if DEFINEHASHING
|
||||
|
@ -1295,7 +1295,7 @@ define_t *PC_DefineFromString( char *string ) {
|
|||
script = LoadScriptMemory( string, strlen( string ), "*extern" );
|
||||
//create a new source
|
||||
memset( &src, 0, sizeof( source_t ) );
|
||||
strncpy( src.filename, "*extern", _MAX_PATH );
|
||||
Q_strncpyz( src.filename, "*extern", sizeof( src.filename ) );
|
||||
src.scriptstack = script;
|
||||
#if DEFINEHASHING
|
||||
src.definehash = GetClearedMemory( DEFINEHASHSIZE * sizeof( define_t * ) );
|
||||
|
@ -1326,7 +1326,7 @@ define_t *PC_DefineFromString( char *string ) {
|
|||
#endif //DEFINEHASHING
|
||||
//
|
||||
FreeScript( script );
|
||||
//if the define was created succesfully
|
||||
//if the define was created successfully
|
||||
if ( res > 0 ) {
|
||||
return def;
|
||||
}
|
||||
|
@ -1419,9 +1419,9 @@ define_t *PC_CopyDefine( source_t *source, define_t *define ) {
|
|||
define_t *newdefine;
|
||||
token_t *token, *newtoken, *lasttoken;
|
||||
|
||||
newdefine = (define_t *) GetMemory( sizeof( define_t ) + strlen( define->name ) + 1 );
|
||||
newdefine = (define_t *) GetMemory(sizeof(define_t));
|
||||
//copy the define name
|
||||
newdefine->name = (char *) newdefine + sizeof( define_t );
|
||||
newdefine->name = (char *) GetMemory(strlen(define->name) + 1);
|
||||
strcpy( newdefine->name, define->name );
|
||||
newdefine->flags = define->flags;
|
||||
newdefine->builtin = define->builtin;
|
||||
|
@ -1574,7 +1574,7 @@ typedef struct operator_s
|
|||
typedef struct value_s
|
||||
{
|
||||
signed long int intvalue;
|
||||
double floatvalue;
|
||||
float floatvalue;
|
||||
int parentheses;
|
||||
struct value_s *prev, *next;
|
||||
} value_t;
|
||||
|
@ -1622,7 +1622,7 @@ int PC_OperatorPriority( int op ) {
|
|||
#define MAX_OPERATORS 64
|
||||
#define AllocValue( val ) \
|
||||
if ( numvalues >= MAX_VALUES ) { \
|
||||
SourceError( source, "out of value space\n" ); \
|
||||
SourceError( source, "out of value space" ); \
|
||||
error = 1; \
|
||||
break; \
|
||||
} \
|
||||
|
@ -1632,7 +1632,7 @@ int PC_OperatorPriority( int op ) {
|
|||
//
|
||||
#define AllocOperator( op ) \
|
||||
if ( numoperators >= MAX_OPERATORS ) { \
|
||||
SourceError( source, "out of operator space\n" ); \
|
||||
SourceError( source, "out of operator space" ); \
|
||||
error = 1; \
|
||||
break; \
|
||||
} \
|
||||
|
@ -1641,7 +1641,7 @@ int PC_OperatorPriority( int op ) {
|
|||
#define FreeOperator( op )
|
||||
|
||||
int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intvalue,
|
||||
double *floatvalue, int integer ) {
|
||||
float *floatvalue, int integer ) {
|
||||
operator_t *o, *firstoperator, *lastoperator;
|
||||
value_t *v, *firstvalue, *lastvalue, *v1, *v2;
|
||||
token_t *t;
|
||||
|
@ -1651,9 +1651,8 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
|
|||
int lastwasvalue = 0;
|
||||
int negativevalue = 0;
|
||||
int questmarkintvalue = 0;
|
||||
double questmarkfloatvalue = 0;
|
||||
float questmarkfloatvalue = 0;
|
||||
int gotquestmarkvalue = qfalse;
|
||||
int lastoperatortype = 0;
|
||||
//
|
||||
operator_t operator_heap[MAX_OPERATORS];
|
||||
int numoperators = 0;
|
||||
|
@ -1786,7 +1785,7 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
|
|||
t->subtype == P_RSHIFT || t->subtype == P_LSHIFT ||
|
||||
t->subtype == P_BIN_AND || t->subtype == P_BIN_OR ||
|
||||
t->subtype == P_BIN_XOR ) {
|
||||
SourceError( source, "illigal operator %s on floating point operands\n", t->string );
|
||||
SourceError( source, "illigal operator %s on floating point operands", t->string );
|
||||
error = 1;
|
||||
break;
|
||||
} //end if
|
||||
|
@ -1957,14 +1956,14 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
|
|||
case P_MUL: v1->intvalue *= v2->intvalue;
|
||||
v1->floatvalue *= v2->floatvalue; break;
|
||||
case P_DIV: if ( !v2->intvalue || !v2->floatvalue ) {
|
||||
SourceError( source, "divide by zero in #if/#elif\n" );
|
||||
SourceError( source, "divide by zero in #if/#elif" );
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
v1->intvalue /= v2->intvalue;
|
||||
v1->floatvalue /= v2->floatvalue; break;
|
||||
case P_MOD: if ( !v2->intvalue ) {
|
||||
SourceError( source, "divide by zero in #if/#elif\n" );
|
||||
SourceError( source, "divide by zero in #if/#elif" );
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -2041,7 +2040,6 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
|
|||
if ( error ) {
|
||||
break;
|
||||
}
|
||||
lastoperatortype = o->operator;
|
||||
//if not an operator with arity 1
|
||||
if ( o->operator != P_LOGIC_NOT
|
||||
&& o->operator != P_BIN_NOT ) {
|
||||
|
@ -2050,12 +2048,12 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
|
|||
v = v->next;
|
||||
}
|
||||
//
|
||||
if ( v->prev ) {
|
||||
v->prev->next = v->next;
|
||||
} else { firstvalue = v->next;}
|
||||
if ( v->next ) {
|
||||
v->next->prev = v->prev;
|
||||
} else { lastvalue = v->prev;}
|
||||
if (v)
|
||||
{
|
||||
if (v->prev) v->prev->next = v->next;
|
||||
else firstvalue = v->next;
|
||||
if (v->next) v->next->prev = v->prev;
|
||||
}
|
||||
//FreeMemory(v);
|
||||
FreeValue( v );
|
||||
} //end if
|
||||
|
@ -2065,7 +2063,7 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
|
|||
} else { firstoperator = o->next;}
|
||||
if ( o->next ) {
|
||||
o->next->prev = o->prev;
|
||||
} else { lastoperator = o->prev;}
|
||||
}
|
||||
//FreeMemory(o);
|
||||
FreeOperator( o );
|
||||
} //end while
|
||||
|
@ -2107,7 +2105,7 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
|
|||
// Changes Globals: -
|
||||
//============================================================================
|
||||
int PC_Evaluate( source_t *source, signed long int *intvalue,
|
||||
double *floatvalue, int integer ) {
|
||||
float *floatvalue, int integer ) {
|
||||
token_t token, *firsttoken, *lasttoken;
|
||||
token_t *t, *nexttoken;
|
||||
define_t *define;
|
||||
|
@ -2211,7 +2209,7 @@ int PC_Evaluate( source_t *source, signed long int *intvalue,
|
|||
// Changes Globals: -
|
||||
//============================================================================
|
||||
int PC_DollarEvaluate( source_t *source, signed long int *intvalue,
|
||||
double *floatvalue, int integer ) {
|
||||
float *floatvalue, int integer ) {
|
||||
int indent, defined = qfalse;
|
||||
token_t token, *firsttoken, *lasttoken;
|
||||
token_t *t, *nexttoken;
|
||||
|
@ -2433,7 +2431,7 @@ int PC_Directive_eval( source_t *source ) {
|
|||
token.whitespace_p = source->scriptstack->script_p;
|
||||
token.endwhitespace_p = source->scriptstack->script_p;
|
||||
token.linescrossed = 0;
|
||||
sprintf( token.string, "%d", abs( value ) );
|
||||
sprintf( token.string, "%ld", labs( value ) );
|
||||
token.type = TT_NUMBER;
|
||||
token.subtype = TT_INTEGER | TT_LONG | TT_DECIMAL;
|
||||
PC_UnreadSourceToken( source, &token );
|
||||
|
@ -2449,7 +2447,7 @@ int PC_Directive_eval( source_t *source ) {
|
|||
// Changes Globals: -
|
||||
//============================================================================
|
||||
int PC_Directive_evalfloat( source_t *source ) {
|
||||
double value;
|
||||
float value;
|
||||
token_t token;
|
||||
|
||||
if ( !PC_Evaluate( source, NULL, &value, qfalse ) ) {
|
||||
|
@ -2539,12 +2537,12 @@ int PC_DollarDirective_evalint( source_t *source ) {
|
|||
token.whitespace_p = source->scriptstack->script_p;
|
||||
token.endwhitespace_p = source->scriptstack->script_p;
|
||||
token.linescrossed = 0;
|
||||
sprintf( token.string, "%d", abs( value ) );
|
||||
sprintf( token.string, "%ld", labs( value ) );
|
||||
token.type = TT_NUMBER;
|
||||
token.subtype = TT_INTEGER | TT_LONG | TT_DECIMAL;
|
||||
#ifdef NUMBERVALUE
|
||||
token.intvalue = value;
|
||||
token.floatvalue = value;
|
||||
token.intvalue = labs(value);
|
||||
token.floatvalue = token.intvalue;
|
||||
#endif //NUMBERVALUE
|
||||
PC_UnreadSourceToken( source, &token );
|
||||
if ( value < 0 ) {
|
||||
|
@ -2559,7 +2557,7 @@ int PC_DollarDirective_evalint( source_t *source ) {
|
|||
// Changes Globals: -
|
||||
//============================================================================
|
||||
int PC_DollarDirective_evalfloat( source_t *source ) {
|
||||
double value;
|
||||
float value;
|
||||
token_t token;
|
||||
|
||||
if ( !PC_DollarEvaluate( source, NULL, &value, qfalse ) ) {
|
||||
|
@ -2573,8 +2571,8 @@ int PC_DollarDirective_evalfloat( source_t *source ) {
|
|||
token.type = TT_NUMBER;
|
||||
token.subtype = TT_FLOAT | TT_LONG | TT_DECIMAL;
|
||||
#ifdef NUMBERVALUE
|
||||
token.intvalue = (unsigned long) value;
|
||||
token.floatvalue = value;
|
||||
token.floatvalue = fabs(value);
|
||||
token.intvalue = (unsigned long) token.floatvalue;
|
||||
#endif //NUMBERVALUE
|
||||
PC_UnreadSourceToken( source, &token );
|
||||
if ( value < 0 ) {
|
||||
|
@ -2723,7 +2721,7 @@ int PC_ReadToken( source_t *source, token_t *token ) {
|
|||
if ( newtoken.type == TT_STRING ) {
|
||||
token->string[strlen( token->string ) - 1] = '\0';
|
||||
if ( strlen( token->string ) + strlen( newtoken.string + 1 ) + 1 >= MAX_TOKEN ) {
|
||||
SourceError( source, "string longer than MAX_TOKEN %d\n", MAX_TOKEN );
|
||||
SourceError( source, "string longer than MAX_TOKEN %d", MAX_TOKEN );
|
||||
return qfalse;
|
||||
}
|
||||
strcat( token->string, newtoken.string + 1 );
|
||||
|
@ -2816,6 +2814,7 @@ int PC_ExpectTokenType( source_t *source, int type, int subtype, token_t *token
|
|||
} //end if
|
||||
if ( token->type == TT_NUMBER ) {
|
||||
if ( ( token->subtype & subtype ) != subtype ) {
|
||||
strcpy(str, "");
|
||||
if ( subtype & TT_DECIMAL ) {
|
||||
strcpy( str, "decimal" );
|
||||
}
|
||||
|
@ -2952,10 +2951,15 @@ void PC_UnreadToken( source_t *source, token_t *token ) {
|
|||
// Changes Globals: -
|
||||
//============================================================================
|
||||
void PC_SetIncludePath( source_t *source, char *path ) {
|
||||
strncpy( source->includepath, path, _MAX_PATH );
|
||||
size_t len;
|
||||
|
||||
Q_strncpyz( source->includepath, path, sizeof( source->includepath ) - 1 );
|
||||
|
||||
len = strlen(source->includepath);
|
||||
//add trailing path seperator
|
||||
if ( source->includepath[strlen( source->includepath ) - 1] != '\\' &&
|
||||
source->includepath[strlen( source->includepath ) - 1] != '/' ) {
|
||||
if (len > 0 && source->includepath[len-1] != '\\' &&
|
||||
source->includepath[len-1] != '/')
|
||||
{
|
||||
strcat( source->includepath, PATHSEPERATOR_STR );
|
||||
} //end if
|
||||
} //end of the function PC_SetIncludePath
|
||||
|
@ -2990,7 +2994,7 @@ source_t *LoadSourceFile( const char *filename ) {
|
|||
source = (source_t *) GetMemory( sizeof( source_t ) );
|
||||
memset( source, 0, sizeof( source_t ) );
|
||||
|
||||
strncpy( source->filename, filename, _MAX_PATH );
|
||||
Q_strncpyz( source->filename, filename, sizeof( source->filename ) );
|
||||
source->scriptstack = script;
|
||||
source->tokens = NULL;
|
||||
source->defines = NULL;
|
||||
|
@ -3024,7 +3028,7 @@ source_t *LoadSourceMemory( char *ptr, int length, char *name ) {
|
|||
source = (source_t *) GetMemory( sizeof( source_t ) );
|
||||
memset( source, 0, sizeof( source_t ) );
|
||||
|
||||
strncpy( source->filename, name, _MAX_PATH );
|
||||
Q_strncpyz( source->filename, name, sizeof( source->filename ) );
|
||||
source->scriptstack = script;
|
||||
source->tokens = NULL;
|
||||
source->defines = NULL;
|
||||
|
|
|
@ -35,10 +35,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _MAX_PATH
|
||||
#define MAX_PATH MAX_QPATH
|
||||
#endif
|
||||
|
||||
#ifndef PATH_SEPERATORSTR
|
||||
#if defined( WIN32 ) | defined( _WIN32 ) | defined( __NT__ ) | defined( __WINDOWS__ ) | defined( __WINDOWS_386__ )
|
||||
#define PATHSEPERATOR_STR "\\"
|
||||
|
@ -96,8 +92,8 @@ typedef struct indent_s
|
|||
//source file
|
||||
typedef struct source_s
|
||||
{
|
||||
char filename[_MAX_PATH]; //file name of the script
|
||||
char includepath[_MAX_PATH]; //path to include files
|
||||
char filename[MAX_QPATH]; //file name of the script
|
||||
char includepath[MAX_QPATH]; //path to include files
|
||||
punctuation_t *punctuations; //punctuations to use
|
||||
script_t *scriptstack; //stack with scripts of the source
|
||||
token_t *tokens; //tokens to read first
|
||||
|
@ -119,7 +115,7 @@ int PC_ExpectTokenType( source_t *source, int type, int subtype, token_t *token
|
|||
int PC_ExpectAnyToken( source_t *source, token_t *token );
|
||||
//returns true when the token is available
|
||||
int PC_CheckTokenString( source_t *source, char *string );
|
||||
//returns true an reads the token when a token with the given type is available
|
||||
//returns true and reads the token when a token with the given type is available
|
||||
int PC_CheckTokenType( source_t *source, int type, int subtype, token_t *token );
|
||||
//skip tokens until the given token string is read
|
||||
int PC_SkipUntilString( source_t *source, char *string );
|
||||
|
@ -154,25 +150,9 @@ source_t *LoadSourceMemory( char *ptr, int length, char *name );
|
|||
//free the given source
|
||||
void FreeSource( source_t *source );
|
||||
//print a source error
|
||||
void QDECL SourceError( source_t *source, char *str, ... );
|
||||
void QDECL SourceError(source_t *source, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
//print a source warning
|
||||
void QDECL SourceWarning( source_t *source, char *str, ... );
|
||||
|
||||
#ifdef BSPC
|
||||
// some of BSPC source does include game/q_shared.h and some does not
|
||||
// we define pc_token_s pc_token_t if needed (yes, it's ugly)
|
||||
#ifndef __Q_SHARED_H
|
||||
#define MAX_TOKENLENGTH 1024
|
||||
typedef struct pc_token_s
|
||||
{
|
||||
int type;
|
||||
int subtype;
|
||||
int intvalue;
|
||||
float floatvalue;
|
||||
char string[MAX_TOKENLENGTH];
|
||||
} pc_token_t;
|
||||
#endif //!_Q_SHARED_H
|
||||
#endif //BSPC
|
||||
void QDECL SourceWarning(source_t *source, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
//
|
||||
int PC_LoadSourceHandle( const char *filename );
|
||||
|
|
|
@ -35,19 +35,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//#define SCREWUP
|
||||
//#define BOTLIB
|
||||
//#define MEQCC
|
||||
//#define BSPC
|
||||
|
||||
#ifdef SCREWUP
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "../botlib/l_memory.h"
|
||||
#include "../botlib/l_script.h"
|
||||
#include "l_memory.h"
|
||||
#include "l_script.h"
|
||||
|
||||
typedef enum {qfalse, qtrue} qboolean;
|
||||
|
||||
|
@ -56,7 +51,7 @@ typedef enum {qfalse, qtrue} qboolean;
|
|||
#ifdef BOTLIB
|
||||
//include files for usage in the bot library
|
||||
#include "../game/q_shared.h"
|
||||
#include "../game/botlib.h"
|
||||
#include "botlib.h"
|
||||
#include "be_interface.h"
|
||||
#include "l_script.h"
|
||||
#include "l_memory.h"
|
||||
|
@ -80,7 +75,6 @@ typedef enum {qfalse, qtrue} qboolean;
|
|||
#include "../bspc/qbsp.h"
|
||||
#include "../bspc/l_log.h"
|
||||
#include "../bspc/l_mem.h"
|
||||
int COM_Compress( char *data_p );
|
||||
|
||||
#define qtrue true
|
||||
#define qfalse false
|
||||
|
@ -167,9 +161,7 @@ punctuation_t default_punctuations[] =
|
|||
{NULL, 0}
|
||||
};
|
||||
|
||||
#ifdef BSPC
|
||||
char basefolder[MAX_PATH];
|
||||
#else
|
||||
#ifdef BOTLIB
|
||||
char basefolder[MAX_QPATH];
|
||||
#endif
|
||||
|
||||
|
@ -246,7 +238,7 @@ void QDECL ScriptError( script_t *script, char *str, ... ) {
|
|||
}
|
||||
|
||||
va_start( ap, str );
|
||||
vsprintf( text, str, ap );
|
||||
vsnprintf(text, sizeof(text), str, ap);
|
||||
va_end( ap );
|
||||
#ifdef BOTLIB
|
||||
botimport.Print( PRT_ERROR, "file %s, line %d: %s\n", script->filename, script->line, text );
|
||||
|
@ -273,7 +265,7 @@ void QDECL ScriptWarning( script_t *script, char *str, ... ) {
|
|||
}
|
||||
|
||||
va_start( ap, str );
|
||||
vsprintf( text, str, ap );
|
||||
vsnprintf(text, sizeof(text), str, ap);
|
||||
va_end( ap );
|
||||
#ifdef BOTLIB
|
||||
botimport.Print( PRT_WARNING, "file %s, line %d: %s\n", script->filename, script->line, text );
|
||||
|
@ -448,7 +440,7 @@ int PS_ReadEscapeCharacter( script_t *script, char *ch ) {
|
|||
script->script_p++;
|
||||
//store the escape character
|
||||
*ch = c;
|
||||
//succesfully read escape character
|
||||
//successfully read escape character
|
||||
return 1;
|
||||
} //end of the function PS_ReadEscapeCharacter
|
||||
//============================================================================
|
||||
|
@ -458,7 +450,7 @@ int PS_ReadEscapeCharacter( script_t *script, char *ch ) {
|
|||
//
|
||||
// Parameter: script : script to read from
|
||||
// token : buffer to store the string
|
||||
// Returns: qtrue when a string was read succesfully
|
||||
// Returns: qtrue when a string was read successfully
|
||||
// Changes Globals: -
|
||||
//============================================================================
|
||||
int PS_ReadString( script_t *script, token_t *token, int quote ) {
|
||||
|
@ -573,7 +565,7 @@ int PS_ReadName( script_t *script, token_t *token ) {
|
|||
// Changes Globals: -
|
||||
//============================================================================
|
||||
void NumberValue( char *string, int subtype, unsigned long int *intvalue,
|
||||
long double *floatvalue ) {
|
||||
float *floatvalue ) {
|
||||
unsigned long int dotfound = 0;
|
||||
|
||||
*intvalue = 0;
|
||||
|
@ -590,13 +582,12 @@ void NumberValue( char *string, int subtype, unsigned long int *intvalue,
|
|||
string++;
|
||||
} //end if
|
||||
if ( dotfound ) {
|
||||
*floatvalue = *floatvalue + ( long double )( *string - '0' ) /
|
||||
(long double) dotfound;
|
||||
*floatvalue = *floatvalue + (float)(*string - '0') / (float) dotfound;
|
||||
dotfound *= 10;
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
*floatvalue = *floatvalue * 10.0 + ( long double )( *string - '0' );
|
||||
*floatvalue = *floatvalue * 10.0 + ( float )( *string - '0' );
|
||||
} //end else
|
||||
string++;
|
||||
} //end while
|
||||
|
@ -645,7 +636,7 @@ int PS_ReadNumber( script_t *script, token_t *token ) {
|
|||
int octal, dot;
|
||||
char c;
|
||||
// unsigned long int intvalue = 0;
|
||||
// long double floatvalue = 0;
|
||||
// double floatvalue = 0;
|
||||
|
||||
token->type = TT_NUMBER;
|
||||
//check for a hexadecimal number
|
||||
|
@ -658,7 +649,7 @@ int PS_ReadNumber( script_t *script, token_t *token ) {
|
|||
//hexadecimal
|
||||
while ( ( c >= '0' && c <= '9' ) ||
|
||||
( c >= 'a' && c <= 'f' ) ||
|
||||
( c >= 'A' && c <= 'A' ) )
|
||||
( c >= 'A' && c <= 'F' ) )
|
||||
{
|
||||
token->string[len++] = *script->script_p++;
|
||||
if ( len >= MAX_TOKEN ) {
|
||||
|
@ -724,20 +715,12 @@ int PS_ReadNumber( script_t *script, token_t *token ) {
|
|||
{
|
||||
c = *script->script_p;
|
||||
//check for a LONG number
|
||||
// TTimo: gcc: suggest parentheses around && within ||
|
||||
// initial line:
|
||||
// if (c == 'l' || c == 'L' && !(token->subtype & TT_LONG))
|
||||
// changed behaviour
|
||||
if ( ( c == 'l' || c == 'L' ) &&
|
||||
!( token->subtype & TT_LONG ) ) {
|
||||
script->script_p++;
|
||||
token->subtype |= TT_LONG;
|
||||
} //end if
|
||||
//check for an UNSIGNED number
|
||||
// TTimo: gcc: suggest parentheses around && within ||
|
||||
// initial line:
|
||||
// else if (c == 'u' || c == 'U' && !(token->subtype & (TT_UNSIGNED | TT_FLOAT)))
|
||||
// changed behaviour
|
||||
else if ( ( c == 'u' || c == 'U' ) &&
|
||||
!( token->subtype & ( TT_UNSIGNED | TT_FLOAT ) ) ) {
|
||||
script->script_p++;
|
||||
|
@ -827,7 +810,7 @@ int PS_ReadPunctuation( script_t *script, token_t *token ) {
|
|||
if ( script->script_p + len <= script->end_p ) {
|
||||
//if the script contains the punctuation
|
||||
if ( !strncmp( script->script_p, p, len ) ) {
|
||||
strncpy( token->string, p, MAX_TOKEN );
|
||||
Q_strncpyz( token->string, p, MAX_TOKEN );
|
||||
script->script_p += len;
|
||||
token->type = TT_PUNCTUATION;
|
||||
//sub type is the number of the punctuation
|
||||
|
@ -850,7 +833,7 @@ int PS_ReadPrimitive( script_t *script, token_t *token ) {
|
|||
len = 0;
|
||||
while ( *script->script_p > ' ' && *script->script_p != ';' )
|
||||
{
|
||||
if ( len >= MAX_TOKEN ) {
|
||||
if ( len >= MAX_TOKEN - 1 ) {
|
||||
ScriptError( script, "primitive token longer than MAX_TOKEN = %d", MAX_TOKEN );
|
||||
return 0;
|
||||
} //end if
|
||||
|
@ -901,7 +884,7 @@ int PS_ReadToken( script_t *script, token_t *token ) {
|
|||
return 0;
|
||||
}
|
||||
} //end if
|
||||
//if an literal
|
||||
//if a literal
|
||||
else if ( *script->script_p == '\'' ) {
|
||||
//if (!PS_ReadLiteral(script, token)) return 0;
|
||||
if ( !PS_ReadString( script, token, '\'' ) ) {
|
||||
|
@ -935,7 +918,7 @@ int PS_ReadToken( script_t *script, token_t *token ) {
|
|||
} //end if
|
||||
//copy the token into the script structure
|
||||
memcpy( &script->token, token, sizeof( token_t ) );
|
||||
//succesfully read a token
|
||||
//successfully read a token
|
||||
return 1;
|
||||
} //end of the function PS_ReadToken
|
||||
//============================================================================
|
||||
|
@ -973,6 +956,7 @@ int PS_ExpectTokenType( script_t *script, int type, int subtype, token_t *token
|
|||
} //end if
|
||||
|
||||
if ( token->type != type ) {
|
||||
strcpy(str, "");
|
||||
if ( type == TT_STRING ) {
|
||||
strcpy( str, "string" );
|
||||
}
|
||||
|
@ -993,6 +977,7 @@ int PS_ExpectTokenType( script_t *script, int type, int subtype, token_t *token
|
|||
} //end if
|
||||
if ( token->type == TT_NUMBER ) {
|
||||
if ( ( token->subtype & subtype ) != subtype ) {
|
||||
strcpy(str, "");
|
||||
if ( subtype & TT_DECIMAL ) {
|
||||
strcpy( str, "decimal" );
|
||||
}
|
||||
|
@ -1028,7 +1013,7 @@ int PS_ExpectTokenType( script_t *script, int type, int subtype, token_t *token
|
|||
} //end if
|
||||
if ( token->subtype != subtype ) {
|
||||
ScriptError( script, "expected %s, found %s",
|
||||
script->punctuations[subtype], token->string );
|
||||
script->punctuations[subtype].p, token->string);
|
||||
return 0;
|
||||
} //end if
|
||||
} //end else if
|
||||
|
@ -1152,7 +1137,7 @@ char PS_NextWhiteSpaceChar( script_t *script ) {
|
|||
//============================================================================
|
||||
void StripDoubleQuotes( char *string ) {
|
||||
if ( *string == '\"' ) {
|
||||
strcpy( string, string + 1 );
|
||||
memmove(string, string+1, strlen(string));
|
||||
} //end if
|
||||
if ( string[strlen( string ) - 1] == '\"' ) {
|
||||
string[strlen( string ) - 1] = '\0';
|
||||
|
@ -1166,7 +1151,7 @@ void StripDoubleQuotes( char *string ) {
|
|||
//============================================================================
|
||||
void StripSingleQuotes( char *string ) {
|
||||
if ( *string == '\'' ) {
|
||||
strcpy( string, string + 1 );
|
||||
memmove(string, string+1, strlen(string));
|
||||
} //end if
|
||||
if ( string[strlen( string ) - 1] == '\'' ) {
|
||||
string[strlen( string ) - 1] = '\0';
|
||||
|
@ -1178,18 +1163,27 @@ void StripSingleQuotes( char *string ) {
|
|||
// Returns: -
|
||||
// Changes Globals: -
|
||||
//============================================================================
|
||||
long double ReadSignedFloat( script_t *script ) {
|
||||
float ReadSignedFloat( script_t *script ) {
|
||||
token_t token;
|
||||
long double sign = 1;
|
||||
float sign = 1.0;
|
||||
|
||||
PS_ExpectAnyToken( script, &token );
|
||||
if ( !strcmp( token.string, "-" ) ) {
|
||||
sign = -1;
|
||||
PS_ExpectTokenType( script, TT_NUMBER, 0, &token );
|
||||
} //end if
|
||||
else if ( token.type != TT_NUMBER ) {
|
||||
ScriptError( script, "expected float value, found %s\n", token.string );
|
||||
} //end else if
|
||||
if(!PS_ExpectAnyToken(script, &token))
|
||||
{
|
||||
ScriptError(script, "Missing float value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sign = -1.0;
|
||||
}
|
||||
|
||||
if (token.type != TT_NUMBER)
|
||||
{
|
||||
ScriptError(script, "expected float value, found %s", token.string);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sign * token.floatvalue;
|
||||
} //end of the function ReadSignedFloat
|
||||
//============================================================================
|
||||
|
@ -1204,12 +1198,20 @@ signed long int ReadSignedInt( script_t *script ) {
|
|||
|
||||
PS_ExpectAnyToken( script, &token );
|
||||
if ( !strcmp( token.string, "-" ) ) {
|
||||
if(!PS_ExpectAnyToken(script, &token))
|
||||
{
|
||||
ScriptError(script, "Missing integer value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sign = -1;
|
||||
PS_ExpectTokenType( script, TT_NUMBER, TT_INTEGER, &token );
|
||||
} //end if
|
||||
else if ( token.type != TT_NUMBER || token.subtype == TT_FLOAT ) {
|
||||
ScriptError( script, "expected integer value, found %s\n", token.string );
|
||||
} //end else if
|
||||
}
|
||||
|
||||
if ( token.type != TT_NUMBER || token.subtype == TT_FLOAT ) {
|
||||
ScriptError(script, "expected integer value, found %s", token.string);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sign * token.intvalue;
|
||||
} //end of the function ReadSignedInt
|
||||
//============================================================================
|
||||
|
@ -1354,8 +1356,8 @@ script_t *LoadScriptFile( const char *filename ) {
|
|||
|
||||
buffer = GetClearedMemory( sizeof( script_t ) + length + 1 );
|
||||
script = (script_t *) buffer;
|
||||
memset( script, 0, sizeof( script_t ) );
|
||||
strcpy( script->filename, filename );
|
||||
Com_Memset(script, 0, sizeof(script_t));
|
||||
Q_strncpyz(script->filename, filename, sizeof(script->filename));
|
||||
script->buffer = (char *) buffer + sizeof( script_t );
|
||||
script->buffer[length] = 0;
|
||||
script->length = length;
|
||||
|
@ -1383,8 +1385,6 @@ script_t *LoadScriptFile( const char *filename ) {
|
|||
} //end if
|
||||
fclose( fp );
|
||||
#endif
|
||||
//
|
||||
script->length = COM_Compress( script->buffer );
|
||||
|
||||
return script;
|
||||
} //end of the function LoadScriptFile
|
||||
|
@ -1400,8 +1400,8 @@ script_t *LoadScriptMemory( char *ptr, int length, char *name ) {
|
|||
|
||||
buffer = GetClearedMemory( sizeof( script_t ) + length + 1 );
|
||||
script = (script_t *) buffer;
|
||||
memset( script, 0, sizeof( script_t ) );
|
||||
strcpy( script->filename, name );
|
||||
Com_Memset(script, 0, sizeof(script_t));
|
||||
Q_strncpyz(script->filename, name, sizeof(script->filename));
|
||||
script->buffer = (char *) buffer + sizeof( script_t );
|
||||
script->buffer[length] = 0;
|
||||
script->length = length;
|
||||
|
@ -1419,7 +1419,7 @@ script_t *LoadScriptMemory( char *ptr, int length, char *name ) {
|
|||
//
|
||||
SetScriptPunctuations( script, NULL );
|
||||
//
|
||||
memcpy( script->buffer, ptr, length );
|
||||
Com_Memcpy(script->buffer, ptr, length);
|
||||
//
|
||||
return script;
|
||||
} //end of the function LoadScriptMemory
|
||||
|
@ -1444,9 +1444,7 @@ void FreeScript( script_t *script ) {
|
|||
// Changes Globals: -
|
||||
//============================================================================
|
||||
void PS_SetBaseFolder( char *path ) {
|
||||
#ifdef BSPC
|
||||
sprintf( basefolder, path );
|
||||
#else
|
||||
Com_sprintf( basefolder, sizeof( basefolder ), path );
|
||||
#ifdef BOTLIB
|
||||
Com_sprintf(basefolder, sizeof(basefolder), "%s", path);
|
||||
#endif
|
||||
} //end of the function PS_SetBaseFolder
|
||||
|
|
|
@ -57,12 +57,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
//maximum token length
|
||||
#define MAX_TOKEN 1024
|
||||
//maximum path length
|
||||
#ifndef _MAX_PATH
|
||||
// TTimo: used to be MAX_QPATH, which is the game filesystem max len, and not the OS max len
|
||||
#define _MAX_PATH 1024
|
||||
#endif
|
||||
|
||||
|
||||
//script flags
|
||||
#define SCFL_NOERRORS 0x0001
|
||||
|
@ -181,7 +175,7 @@ typedef struct token_s
|
|||
int subtype; //last read token sub type
|
||||
#ifdef NUMBERVALUE
|
||||
unsigned long int intvalue; //integer value
|
||||
long double floatvalue; //floating point value
|
||||
float floatvalue; //floating point value
|
||||
#endif //NUMBERVALUE
|
||||
char *whitespace_p; //start of white space before token
|
||||
char *endwhitespace_p; //start of white space before token
|
||||
|
@ -193,8 +187,8 @@ typedef struct token_s
|
|||
//script file
|
||||
typedef struct script_s
|
||||
{
|
||||
char filename[_MAX_PATH]; //file name of the script
|
||||
char *buffer; //buffer containing the script
|
||||
char filename[MAX_QPATH]; //file name of the script
|
||||
char *buffer; //buffer containing the script
|
||||
char *script_p; //current pointer in the script
|
||||
char *end_p; //pointer to the end of the script
|
||||
char *lastscript_p; //script pointer before reading token
|
||||
|
@ -221,7 +215,7 @@ int PS_ExpectTokenType( script_t *script, int type, int subtype, token_t *token
|
|||
int PS_ExpectAnyToken( script_t *script, token_t *token );
|
||||
//returns true when the token is available
|
||||
int PS_CheckTokenString( script_t *script, char *string );
|
||||
//returns true an reads the token when a token with the given type is available
|
||||
//returns true and reads the token when a token with the given type is available
|
||||
int PS_CheckTokenType( script_t *script, int type, int subtype, token_t *token );
|
||||
//skip tokens until the given token string is read
|
||||
int PS_SkipUntilString( script_t *script, char *string );
|
||||
|
@ -238,7 +232,7 @@ void StripSingleQuotes( char *string );
|
|||
//read a possible signed integer
|
||||
signed long int ReadSignedInt( script_t *script );
|
||||
//read a possible signed floating point number
|
||||
long double ReadSignedFloat( script_t *script );
|
||||
float ReadSignedFloat( script_t *script );
|
||||
//set an array with punctuations, NULL restores default C/C++ set
|
||||
void SetScriptPunctuations( script_t *script, punctuation_t *p );
|
||||
//set script flags
|
||||
|
@ -260,9 +254,6 @@ void FreeScript( script_t *script );
|
|||
//set the base folder to load files from
|
||||
void PS_SetBaseFolder( char *path );
|
||||
//print a script error with filename and line number
|
||||
void QDECL ScriptError( script_t *script, char *str, ... );
|
||||
void QDECL ScriptError(script_t *script, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
//print a script warning with filename and line number
|
||||
void QDECL ScriptWarning( script_t *script, char *str, ... );
|
||||
|
||||
|
||||
|
||||
void QDECL ScriptWarning(script_t *script, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
|
|
@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#ifdef BOTLIB
|
||||
#include "../game/q_shared.h"
|
||||
#include "../game/botlib.h" //for the include of be_interface.h
|
||||
#include "botlib.h" //for the include of be_interface.h
|
||||
#include "l_script.h"
|
||||
#include "l_precomp.h"
|
||||
#include "l_struct.h"
|
||||
|
@ -153,14 +153,14 @@ qboolean ReadNumber( source_t *source, fielddef_t *fd, void *p ) {
|
|||
intmax = Minimum( intmax, fd->floatmax );
|
||||
} //end if
|
||||
if ( intval < intmin || intval > intmax ) {
|
||||
SourceError( source, "value %d out of range [%d, %d]", intval, intmin, intmax );
|
||||
SourceError( source, "value %ld out of range [%ld, %ld]", intval, intmin, intmax );
|
||||
return 0;
|
||||
} //end if
|
||||
} //end if
|
||||
else if ( ( fd->type & FT_TYPE ) == FT_FLOAT ) {
|
||||
if ( fd->type & FT_BOUNDED ) {
|
||||
if ( intval < fd->floatmin || intval > fd->floatmax ) {
|
||||
SourceError( source, "value %d out of range [%f, %f]", intval, fd->floatmin, fd->floatmax );
|
||||
SourceError( source, "value %ld out of range [%f, %f]", intval, fd->floatmin, fd->floatmax );
|
||||
return 0;
|
||||
} //end if
|
||||
} //end if
|
||||
|
@ -223,7 +223,7 @@ int ReadString( source_t *source, fielddef_t *fd, void *p ) {
|
|||
//remove the double quotes
|
||||
StripDoubleQuotes( token.string );
|
||||
//copy the string
|
||||
strncpy( (char *) p, token.string, MAX_STRINGFIELD );
|
||||
strncpy( (char *) p, token.string, MAX_STRINGFIELD - 1 );
|
||||
//make sure the string is closed with a zero
|
||||
( (char *)p )[MAX_STRINGFIELD - 1] = '\0';
|
||||
//
|
||||
|
@ -363,7 +363,7 @@ int WriteFloat( FILE *fp, float value ) {
|
|||
char buf[128];
|
||||
int l;
|
||||
|
||||
sprintf( buf, "%f", value );
|
||||
Com_sprintf(buf, sizeof(buf), "%f", value);
|
||||
l = strlen( buf );
|
||||
//strip any trailing zeros
|
||||
while ( l-- > 1 )
|
||||
|
|
|
@ -36,6 +36,5 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*****************************************************************************/
|
||||
|
||||
#define Vector2Angles( v,a ) vectoangles( v,a )
|
||||
#define MAX_PATH MAX_QPATH
|
||||
#define Maximum( x,y ) ( x > y ? x : y )
|
||||
#define Minimum( x,y ) ( x < y ? x : y )
|
||||
|
|
|
@ -117,7 +117,6 @@ localEntity_t *CG_SmokePuff( const vec3_t p, const vec3_t vel,
|
|||
int fadeInTime,
|
||||
int leFlags,
|
||||
qhandle_t hShader ) {
|
||||
static int seed = 0x92;
|
||||
localEntity_t *le;
|
||||
refEntity_t *re;
|
||||
|
||||
|
@ -126,6 +125,7 @@ localEntity_t *CG_SmokePuff( const vec3_t p, const vec3_t vel,
|
|||
le->radius = radius;
|
||||
|
||||
re = &le->refEntity;
|
||||
static int seed = 0x92;
|
||||
re->rotation = Q_random( &seed ) * 360;
|
||||
re->radius = radius;
|
||||
re->shaderTime = startTime / 1000.0f;
|
||||
|
|
|
@ -58,13 +58,13 @@ This must be the very first function compiled into the .q3vm file
|
|||
#if defined( __MACOS__ ) // TTimo: guarding
|
||||
#pragma export on
|
||||
#endif
|
||||
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
|
||||
intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export off
|
||||
#endif
|
||||
switch ( command ) {
|
||||
case CG_GET_TAG:
|
||||
return CG_GetTag( arg0, (char *)arg1, (orientation_t *)arg2 );
|
||||
return CG_GetTag( arg0, (char *)VM_PointerArg(arg1, arg2), (orientation_t *)VM_PointerArg(arg3, arg4) );
|
||||
case CG_DRAW_ACTIVE_FRAME:
|
||||
CG_DrawActiveFrame( arg0, arg1, arg2 );
|
||||
return 0;
|
||||
|
@ -91,8 +91,9 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
|
|||
cgDC.cursory = cgs.cursorY;
|
||||
CG_MouseEvent( arg0, arg1 );
|
||||
return 0;
|
||||
case CG_SET_VR_CLIENT_INFO:
|
||||
cgVR = (vr_client_info_t*)arg0;
|
||||
case CG_SET_VR_CLIENT_INFO:{
|
||||
cgVR = (vr_client_info_t *)VM_PointerArg(arg0, arg1);
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
CG_Error( "vmMain: unknown command %i", command );
|
||||
|
|
|
@ -30,13 +30,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// cg_syscalls.asm is included instead when building a qvm
|
||||
#include "cg_local.h"
|
||||
|
||||
static int ( QDECL * syscall )( int arg, ... ) = ( int ( QDECL * )( int, ... ) ) - 1;
|
||||
static intptr_t ( QDECL * syscall )( intptr_t arg, ... ) = ( intptr_t ( QDECL * )( intptr_t, ... ) ) - 1;
|
||||
|
||||
// TTimo: guarding
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export on
|
||||
#endif
|
||||
void dllEntry( int ( QDECL *syscallptr )( int arg,... ) ) {
|
||||
void dllEntry( intptr_t ( QDECL *syscallptr )( intptr_t arg,... ) ) {
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export off
|
||||
#endif
|
||||
|
@ -45,9 +45,9 @@ void dllEntry( int ( QDECL *syscallptr )( int arg,... ) ) {
|
|||
|
||||
|
||||
int PASSFLOAT( float x ) {
|
||||
float floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
void trap_Print( const char *fmt ) {
|
||||
|
|
|
@ -447,10 +447,20 @@ CL_CgameSystemCalls
|
|||
The cgame module is making a system call
|
||||
====================
|
||||
*/
|
||||
|
||||
|
||||
void *VM_ArgPtr( intptr_t intValue );
|
||||
//#define VMA( x ) VM_ArgPtr( args[x] )
|
||||
#define VMA( x ) ( (void *) args[x] )
|
||||
#define VMF( x ) ( (float *)args )[x]
|
||||
int CL_CgameSystemCalls( int *args ) {
|
||||
#define VMA(x) VM_ArgPtr(args[x])
|
||||
static ID_INLINE float _vmf(intptr_t x)
|
||||
{
|
||||
floatint_t fi;
|
||||
fi.i = (int) x;
|
||||
return fi.f;
|
||||
}
|
||||
#define VMF(x) _vmf(args[x])
|
||||
|
||||
int CL_CgameSystemCalls( intptr_t *args ) {
|
||||
switch ( args[0] ) {
|
||||
case CG_PRINT:
|
||||
Com_Printf( "%s", VMA( 1 ) );
|
||||
|
@ -1095,7 +1105,7 @@ CL_CGameRendering
|
|||
=====================
|
||||
*/
|
||||
void CL_CGameSetVRClientInfo() {
|
||||
VM_Call( cgvm, CG_SET_VR_CLIENT_INFO, &vr );
|
||||
VM_Call( cgvm, CG_SET_VR_CLIENT_INFO, LO_ARG(&vr), HI_ARG(&vr) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1343,5 +1353,5 @@ qboolean CL_GetTag( int clientNum, char *tagname, orientation_t *or ) {
|
|||
return qfalse;
|
||||
}
|
||||
|
||||
return VM_Call( cgvm, CG_GET_TAG, clientNum, tagname, or );
|
||||
return VM_Call( cgvm, CG_GET_TAG, clientNum, LO_ARG(tagname), HI_ARG(tagname), LO_ARG(or), HI_ARG(or) );
|
||||
}
|
||||
|
|
|
@ -29,10 +29,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// cl.input.c -- builds an intended movement command to send to the server
|
||||
|
||||
#include "client.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
unsigned frame_msec;
|
||||
int old_com_frameTime;
|
||||
|
||||
extern vr_client_info_t vr;
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
@ -804,6 +805,8 @@ void CL_FinishMove( usercmd_t *cmd ) {
|
|||
// can be determined without allowing cheating
|
||||
cmd->serverTime = cl.serverTime;
|
||||
|
||||
vr.clientNum = cl.snap.ps.clientNum;
|
||||
|
||||
for ( i = 0 ; i < 3 ; i++ ) {
|
||||
cmd->angles[i] = ANGLE2SHORT( cl.viewangles[i] );
|
||||
}
|
||||
|
|
|
@ -779,10 +779,16 @@ static int FloatAsInt( float f ) {
|
|||
return temp;
|
||||
}
|
||||
|
||||
void *VM_ArgPtr( int intValue );
|
||||
void *VM_ArgPtr( intptr_t intValue );
|
||||
//#define VMA( x ) VM_ArgPtr( args[x] )
|
||||
#define VMA( x ) ( (void *) args[x] )
|
||||
#define VMF( x ) ( (float *)args )[x]
|
||||
#define VMA(x) VM_ArgPtr(args[x])
|
||||
static ID_INLINE float _vmf(intptr_t x)
|
||||
{
|
||||
floatint_t fi;
|
||||
fi.i = (int) x;
|
||||
return fi.f;
|
||||
}
|
||||
#define VMF(x) _vmf(args[x])
|
||||
|
||||
|
||||
extern void showKeyboard(int val);
|
||||
|
@ -794,7 +800,7 @@ CL_UISystemCalls
|
|||
The ui module is making a system call
|
||||
====================
|
||||
*/
|
||||
int CL_UISystemCalls( int *args ) {
|
||||
int CL_UISystemCalls( intptr_t *args ) {
|
||||
switch ( args[0] ) {
|
||||
case UI_ERROR:
|
||||
Com_Error( ERR_DROP, "%s", VMA( 1 ) );
|
||||
|
|
|
@ -3753,7 +3753,23 @@ void PM_UpdateViewAngles( playerState_t *ps, usercmd_t *cmd, void( trace ) ( tra
|
|||
|
||||
// circularly clamp the angles with deltas
|
||||
for ( i = 0 ; i < 3 ; i++ ) {
|
||||
temp = cmd->angles[i] + (i == YAW ? ps->delta_angles[i] : 0);
|
||||
#ifdef CGAMEDLL
|
||||
if (cgVR != NULL && cgVR->clientNum == ps->clientNum)
|
||||
#endif
|
||||
#ifdef GAMEDLL
|
||||
if (gVR != NULL && gVR->clientNum == ps->clientNum)
|
||||
#endif
|
||||
{
|
||||
//Client is the VR player in the singleplayer game
|
||||
temp = cmd->angles[i] + (i == YAW ? ps->delta_angles[i] : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Client is either a BOT or we are running multiplayer, or
|
||||
//the vr player playing on a remote server (since this is shared code by game and cgame)
|
||||
temp = cmd->angles[i] + ps->delta_angles[i];
|
||||
}
|
||||
|
||||
if ( i == PITCH ) {
|
||||
// don't let the player look up or down more than 90 degrees
|
||||
if ( temp > 16000 ) {
|
||||
|
|
|
@ -987,7 +987,7 @@ extern void trap_Endgame ( void ) ;
|
|||
extern void trap_Error ( const char * fmt ) ;
|
||||
extern void trap_Printf ( const char * fmt ) ;
|
||||
extern int PASSFLOAT ( float x ) ;
|
||||
extern void dllEntry ( int ( QDECL * syscallptr ) ( int arg , ... ) ) ;
|
||||
extern void dllEntry ( intptr_t ( QDECL * syscallptr ) ( intptr_t arg , ... ) ) ;
|
||||
extern void G_RunFrame ( int levelTime ) ;
|
||||
extern void G_RunThink ( gentity_t * ent ) ;
|
||||
extern void CheckCvars ( void ) ;
|
||||
|
|
|
@ -282,7 +282,7 @@ This must be the very first function compiled into the .q3vm file
|
|||
#if defined( __MACOS__ )
|
||||
#pragma export on
|
||||
#endif
|
||||
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) {
|
||||
intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export off
|
||||
#endif
|
||||
|
@ -294,7 +294,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
|
|||
G_ShutdownGame( arg0 );
|
||||
return 0;
|
||||
case GAME_CLIENT_CONNECT:
|
||||
return (int)ClientConnect( arg0, arg1, arg2 );
|
||||
return (intptr_t)ClientConnect( arg0, arg1, arg2 );
|
||||
case GAME_CLIENT_THINK:
|
||||
ClientThink( arg0 );
|
||||
return 0;
|
||||
|
@ -319,19 +319,20 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
|
|||
return BotAIStartFrame( arg0 );
|
||||
// Ridah, Cast AI
|
||||
case AICAST_VISIBLEFROMPOS:
|
||||
return AICast_VisibleFromPos( (float *)arg0, arg1, (float *)arg2, arg3, arg4 );
|
||||
return AICast_VisibleFromPos( (float *)VM_PointerArg(arg0, arg1), arg2, (float *)VM_PointerArg(arg3, arg4), arg5, arg6 );
|
||||
case AICAST_CHECKATTACKATPOS:
|
||||
return AICast_CheckAttackAtPos( arg0, arg1, (float *)arg2, arg3, arg4 );
|
||||
return AICast_CheckAttackAtPos( arg0, arg1, (float *)VM_PointerArg(arg2, arg3), arg4, arg5 );
|
||||
// done.
|
||||
|
||||
case GAME_RETRIEVE_MOVESPEEDS_FROM_CLIENT:
|
||||
G_RetrieveMoveSpeedsFromClient( arg0, (char *)arg1 );
|
||||
G_RetrieveMoveSpeedsFromClient( arg0, (char *)VM_PointerArg(arg1, arg2) );
|
||||
return 0;
|
||||
case GAME_GETMODELINFO:
|
||||
return G_GetModelInfo( arg0, (char *)arg1, (animModelInfo_t **)arg2 );
|
||||
return G_GetModelInfo( arg0, (char *)VM_PointerArg(arg1, arg2), (animModelInfo_t **)VM_PointerArg(arg3, arg4) );
|
||||
|
||||
case GAME_SET_VR_CLIENT_INFO:
|
||||
gVR = (vr_client_info_t*)arg0;
|
||||
case GAME_SET_VR_CLIENT_INFO: {
|
||||
gVR = (vr_client_info_t *)VM_PointerArg(arg0, arg1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// this file is only included when building a dll
|
||||
// g_syscalls.asm is included instead when building a qvm
|
||||
|
||||
static int ( QDECL * syscall )( int arg, ... ) = ( int ( QDECL * )( int, ... ) ) - 1;
|
||||
static intptr_t ( QDECL * syscall )( intptr_t arg, ... ) = ( intptr_t ( QDECL * )( intptr_t, ... ) ) - 1;
|
||||
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export on
|
||||
#endif
|
||||
void dllEntry( int ( QDECL *syscallptr )( int arg,... ) ) {
|
||||
void dllEntry( intptr_t ( QDECL *syscallptr )( intptr_t arg,... ) ) {
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export off
|
||||
#endif
|
||||
|
@ -46,9 +46,9 @@ void dllEntry( int ( QDECL *syscallptr )( int arg,... ) ) {
|
|||
}
|
||||
|
||||
int PASSFLOAT( float x ) {
|
||||
float floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
void trap_Printf( const char *fmt ) {
|
||||
|
|
|
@ -278,7 +278,8 @@ void Swap_Init( void ) {
|
|||
byte swaptest[2] = {1,0};
|
||||
|
||||
// set the byte swapping variables in a portable manner
|
||||
if ( *(short *)swaptest == 1 ) {
|
||||
// if ( *(short *)swaptest == 1 )
|
||||
{
|
||||
_BigShort = ShortSwap;
|
||||
_LittleShort = ShortNoSwap;
|
||||
_BigLong = LongSwap;
|
||||
|
@ -287,7 +288,7 @@ void Swap_Init( void ) {
|
|||
_LittleLong64 = Long64NoSwap;
|
||||
_BigFloat = FloatSwap;
|
||||
_LittleFloat = FloatNoSwap;
|
||||
} else
|
||||
}/* else
|
||||
{
|
||||
_BigShort = ShortNoSwap;
|
||||
_LittleShort = ShortSwap;
|
||||
|
@ -298,10 +299,17 @@ void Swap_Init( void ) {
|
|||
_BigFloat = FloatNoSwap;
|
||||
_LittleFloat = FloatSwap;
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//For 64-bit
|
||||
intptr_t VM_PointerArg(int arg0, int arg1)
|
||||
{
|
||||
int ptr[2] = {arg0, arg1};
|
||||
return (intptr_t) (*(long *) (ptr));
|
||||
}
|
||||
|
||||
/*
|
||||
============================================================================
|
||||
|
||||
|
|
|
@ -235,6 +235,13 @@ void Sys_PumpEvents( void );
|
|||
typedef unsigned char byte;
|
||||
|
||||
typedef enum {qfalse, qtrue} qboolean;
|
||||
|
||||
typedef union {
|
||||
float f;
|
||||
int i;
|
||||
unsigned int ui;
|
||||
} floatint_t;
|
||||
|
||||
#if defined( __MACOS__ )
|
||||
#define qboolean int //DAJ
|
||||
#endif
|
||||
|
@ -244,6 +251,12 @@ typedef int sfxHandle_t;
|
|||
typedef int fileHandle_t;
|
||||
typedef int clipHandle_t;
|
||||
|
||||
#define LO_ARG(x) ((int)(((intptr_t)(x)) & 0xffffffff))
|
||||
#define HI_ARG(x) ((int)((((intptr_t)(x)) & 0xffffffff00000000) >> 32))
|
||||
intptr_t VM_PointerArg(int arg0, int arg1);
|
||||
|
||||
#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
#ifndef ID_INLINE
|
||||
#ifdef _WIN32
|
||||
#define ID_INLINE __inline
|
||||
|
@ -494,6 +507,9 @@ extern vec3_t axisDefault[3];
|
|||
#define nanmask ( 255 << 23 )
|
||||
#define IS_NAN( x ) ( ( ( *(int *)&x ) & nanmask ) == nanmask )
|
||||
|
||||
#define PAD(base, alignment) (((base)+(alignment)-1) & ~((alignment)-1))
|
||||
#define PADLEN(base, alignment) (PAD((base), (alignment)) - (base))
|
||||
|
||||
// TTimo
|
||||
// handy stuff when tracking isnan problems
|
||||
#ifndef NDEBUG
|
||||
|
|
|
@ -36,9 +36,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#define MAX_NUM_ARGVS 50
|
||||
|
||||
#define MIN_DEDICATED_COMHUNKMEGS 1
|
||||
#define MIN_COMHUNKMEGS 64 // RF, optimizing
|
||||
#define DEF_COMHUNKMEGS "128"
|
||||
#define MIN_DEDICATED_COMHUNKMEGS 2
|
||||
#define MIN_COMHUNKMEGS 128 // RF, optimizing
|
||||
#define DEF_COMHUNKMEGS "512"
|
||||
#define DEF_COMZONEMEGS "30"
|
||||
|
||||
int com_argc;
|
||||
|
@ -1098,7 +1098,8 @@ void Com_InitHunkMemory( void ) {
|
|||
Com_Error( ERR_FATAL, "Hunk data failed to allocate %i megs", s_hunkTotal / ( 1024 * 1024 ) );
|
||||
}
|
||||
// cacheline align
|
||||
s_hunkData = ( byte * )( ( (int)s_hunkData + 31 ) & ~31 );
|
||||
s_hunkData = (byte *) ( ( (intptr_t)s_hunkData + 31 ) & ~31 );
|
||||
//s_hunkData = ( byte * )( ( (int)s_hunkData + 31 ) & ~31 );
|
||||
Hunk_Clear();
|
||||
|
||||
Cmd_AddCommand( "meminfo", Com_Meminfo_f );
|
||||
|
|
|
@ -1930,7 +1930,7 @@ static pack_t *FS_LoadZipFile( char *zipfile, const char *basename ) {
|
|||
}
|
||||
|
||||
pack->checksum = Com_BlockChecksum( fs_headerLongs, 4 * fs_numHeaderLongs );
|
||||
pack->pure_checksum = Com_BlockChecksumKey( fs_headerLongs, 4 * fs_numHeaderLongs, LittleLong( fs_checksumFeed ) );
|
||||
pack->pure_checksum = Com_BlockChecksum( fs_headerLongs, 4 * fs_numHeaderLongs );
|
||||
pack->checksum = LittleLong( pack->checksum );
|
||||
pack->pure_checksum = LittleLong( pack->pure_checksum );
|
||||
|
||||
|
|
|
@ -1,312 +1,207 @@
|
|||
/*
|
||||
===========================================================================
|
||||
mdfour.c
|
||||
|
||||
Return to Castle Wolfenstein single player GPL Source Code
|
||||
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
|
||||
An implementation of MD4 designed for use in the samba SMB
|
||||
authentication protocol
|
||||
|
||||
This file is part of the Return to Castle Wolfenstein single player GPL Source Code (“RTCW SP Source Code”).
|
||||
Copyright (C) 1997-1998 Andrew Tridgell
|
||||
|
||||
RTCW SP Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
RTCW SP Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
===========================================================================
|
||||
$Id: mdfour.c,v 1.1 2002/08/23 22:03:27 abster Exp $
|
||||
*/
|
||||
|
||||
/* GLOBAL.H - RSAREF types and constants */
|
||||
#include "../game/q_shared.h"
|
||||
#include "qcommon.h"
|
||||
|
||||
#include <string.h>
|
||||
#if defined( _WIN32 )
|
||||
#pragma warning(disable : 4711) // selected for automatic inline expansion
|
||||
#endif
|
||||
|
||||
/* POINTER defines a generic pointer type */
|
||||
typedef unsigned char *POINTER;
|
||||
|
||||
/* UINT2 defines a two byte word */
|
||||
typedef unsigned short int UINT2;
|
||||
|
||||
/* UINT4 defines a four byte word */
|
||||
typedef unsigned long int UINT4;
|
||||
|
||||
|
||||
/* MD4.H - header file for MD4C.C */
|
||||
|
||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it is identified as the “RSA Data Security, Inc. MD4 Message-Digest Algorithm” in all material mentioning or referencing this software or this function.
|
||||
License is also granted to make and use derivative works provided that such works are identified as “derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm” in all material mentioning or referencing the derived work.
|
||||
RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided “as is” without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this documentation and/or software. */
|
||||
|
||||
/* MD4 context. */
|
||||
typedef struct {
|
||||
UINT4 state[4]; /* state (ABCD) */
|
||||
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
} MD4_CTX;
|
||||
|
||||
void MD4Init( MD4_CTX * );
|
||||
void MD4Update( MD4_CTX *, const unsigned char *, unsigned int );
|
||||
void MD4Final( unsigned char [16], MD4_CTX * );
|
||||
|
||||
void Com_Memset( void* dest, const int val, const size_t count );
|
||||
void Com_Memcpy( void* dest, const void* src, const size_t count );
|
||||
|
||||
/* MD4C.C - RSA Data Security, Inc., MD4 message-digest algorithm */
|
||||
/* Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it is identified as the
|
||||
RSA Data Security, Inc. MD4 Message-Digest Algorithm
|
||||
in all material mentioning or referencing this software or this function.
|
||||
License is also granted to make and use derivative works provided that such works are identified as
|
||||
derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm
|
||||
in all material mentioning or referencing the derived work.
|
||||
RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided
|
||||
as is without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this documentation and/or software. */
|
||||
|
||||
/* Constants for MD4Transform routine. */
|
||||
#define S11 3
|
||||
#define S12 7
|
||||
#define S13 11
|
||||
#define S14 19
|
||||
#define S21 3
|
||||
#define S22 5
|
||||
#define S23 9
|
||||
#define S24 13
|
||||
#define S31 3
|
||||
#define S32 9
|
||||
#define S33 11
|
||||
#define S34 15
|
||||
|
||||
static void MD4Transform( UINT4 [4], const unsigned char [64] );
|
||||
static void Encode( unsigned char *, UINT4 *, unsigned int );
|
||||
static void Decode( UINT4 *, const unsigned char *, unsigned int );
|
||||
|
||||
static unsigned char PADDING[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
struct mdfour {
|
||||
uint32_t A, B, C, D;
|
||||
uint32_t totalN;
|
||||
};
|
||||
|
||||
/* F, G and H are basic MD4 functions. */
|
||||
#define F( x, y, z ) ( ( ( x ) & ( y ) ) | ( ( ~x ) & ( z ) ) )
|
||||
#define G( x, y, z ) ( ( ( x ) & ( y ) ) | ( ( x ) & ( z ) ) | ( ( y ) & ( z ) ) )
|
||||
#define H( x, y, z ) ( ( x ) ^ ( y ) ^ ( z ) )
|
||||
|
||||
/* ROTATE_LEFT rotates x left n bits. */
|
||||
#define ROTATE_LEFT( x, n ) ( ( ( x ) << ( n ) ) | ( ( x ) >> ( 32 - ( n ) ) ) )
|
||||
/* NOTE: This code makes no attempt to be fast!
|
||||
|
||||
/* FF, GG and HH are transformations for rounds 1, 2 and 3 */
|
||||
/* Rotation is separate from addition to prevent recomputation */
|
||||
#define FF( a, b, c, d, x, s ) {( a ) += F( ( b ), ( c ), ( d ) ) + ( x ); ( a ) = ROTATE_LEFT( ( a ), ( s ) );}
|
||||
It assumes that an int is at least 32 bits long
|
||||
*/
|
||||
|
||||
#define GG( a, b, c, d, x, s ) {( a ) += G( ( b ), ( c ), ( d ) ) + ( x ) + (UINT4)0x5a827999; ( a ) = ROTATE_LEFT( ( a ), ( s ) );}
|
||||
static struct mdfour *m;
|
||||
|
||||
#define HH( a, b, c, d, x, s ) {( a ) += H( ( b ), ( c ), ( d ) ) + ( x ) + (UINT4)0x6ed9eba1; ( a ) = ROTATE_LEFT( ( a ), ( s ) );}
|
||||
#define F(X,Y,Z) (((X)&(Y)) | ((~(X))&(Z)))
|
||||
#define G(X,Y,Z) (((X)&(Y)) | ((X)&(Z)) | ((Y)&(Z)))
|
||||
#define H(X,Y,Z) ((X)^(Y)^(Z))
|
||||
#define lshift(x,s) (((x)<<(s)) | ((x)>>(32-(s))))
|
||||
|
||||
#define ROUND1(a,b,c,d,k,s) a = lshift(a + F(b,c,d) + X[k], s)
|
||||
#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + 0x5A827999,s)
|
||||
#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,s)
|
||||
|
||||
/* MD4 initialization. Begins an MD4 operation, writing a new context. */
|
||||
void MD4Init( MD4_CTX *context ) {
|
||||
context->count[0] = context->count[1] = 0;
|
||||
/* this applies md4 to 64 byte chunks */
|
||||
static void mdfour64(uint32_t *M)
|
||||
{
|
||||
int j;
|
||||
uint32_t AA, BB, CC, DD;
|
||||
uint32_t X[16];
|
||||
uint32_t A,B,C,D;
|
||||
|
||||
/* Load magic initialization constants.*/
|
||||
context->state[0] = 0x67452301;
|
||||
context->state[1] = 0xefcdab89;
|
||||
context->state[2] = 0x98badcfe;
|
||||
context->state[3] = 0x10325476;
|
||||
for (j=0;j<16;j++)
|
||||
X[j] = M[j];
|
||||
|
||||
A = m->A; B = m->B; C = m->C; D = m->D;
|
||||
AA = A; BB = B; CC = C; DD = D;
|
||||
|
||||
ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7);
|
||||
ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19);
|
||||
ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7);
|
||||
ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19);
|
||||
ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7);
|
||||
ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19);
|
||||
ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7);
|
||||
ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19);
|
||||
|
||||
ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5);
|
||||
ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13);
|
||||
ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5);
|
||||
ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13);
|
||||
ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5);
|
||||
ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13);
|
||||
ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5);
|
||||
ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13);
|
||||
|
||||
ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9);
|
||||
ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15);
|
||||
ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9);
|
||||
ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15);
|
||||
ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9);
|
||||
ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15);
|
||||
ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9);
|
||||
ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15);
|
||||
|
||||
A += AA; B += BB; C += CC; D += DD;
|
||||
|
||||
for (j=0;j<16;j++)
|
||||
X[j] = 0;
|
||||
|
||||
m->A = A; m->B = B; m->C = C; m->D = D;
|
||||
}
|
||||
|
||||
/* MD4 block update operation. Continues an MD4 message-digest operation, processing another message block, and updating the context. */
|
||||
void MD4Update( MD4_CTX *context, const unsigned char *input, unsigned int inputLen ) {
|
||||
unsigned int i, index, partLen;
|
||||
static void copy64(uint32_t *M, byte *in)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
index = ( unsigned int )( ( context->count[0] >> 3 ) & 0x3F );
|
||||
for (i=0;i<16;i++)
|
||||
M[i] =
|
||||
((uint32_t)in[i*4+3] << 24) |
|
||||
((uint32_t)in[i*4+2] << 16) |
|
||||
((uint32_t)in[i*4+1] << 8) |
|
||||
((uint32_t)in[i*4+0] << 0) ;
|
||||
}
|
||||
|
||||
/* Update number of bits */
|
||||
if ( ( context->count[0] += ( (UINT4)inputLen << 3 ) ) < ( (UINT4)inputLen << 3 ) ) {
|
||||
context->count[1]++;
|
||||
}
|
||||
static void copy4(byte *out,uint32_t x)
|
||||
{
|
||||
out[0] = x&0xFF;
|
||||
out[1] = (x>>8)&0xFF;
|
||||
out[2] = (x>>16)&0xFF;
|
||||
out[3] = (x>>24)&0xFF;
|
||||
}
|
||||
|
||||
context->count[1] += ( (UINT4)inputLen >> 29 );
|
||||
void mdfour_begin(struct mdfour *md)
|
||||
{
|
||||
md->A = 0x67452301;
|
||||
md->B = 0xefcdab89;
|
||||
md->C = 0x98badcfe;
|
||||
md->D = 0x10325476;
|
||||
md->totalN = 0;
|
||||
}
|
||||
|
||||
partLen = 64 - index;
|
||||
|
||||
/* Transform as many times as possible.*/
|
||||
if ( inputLen >= partLen ) {
|
||||
Com_Memcpy( (POINTER)&context->buffer[index], (POINTER)input, partLen );
|
||||
MD4Transform( context->state, context->buffer );
|
||||
static void mdfour_tail(byte *in, int n)
|
||||
{
|
||||
byte buf[128];
|
||||
uint32_t M[16];
|
||||
uint32_t b;
|
||||
|
||||
for ( i = partLen; i + 63 < inputLen; i += 64 )
|
||||
MD4Transform( context->state, &input[i] );
|
||||
m->totalN += n;
|
||||
|
||||
index = 0;
|
||||
b = m->totalN * 8;
|
||||
|
||||
Com_Memset(buf, 0, 128);
|
||||
if (n) Com_Memcpy(buf, in, n);
|
||||
buf[n] = 0x80;
|
||||
|
||||
if (n <= 55) {
|
||||
copy4(buf+56, b);
|
||||
copy64(M, buf);
|
||||
mdfour64(M);
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
/* Buffer remaining input */
|
||||
Com_Memcpy( (POINTER)&context->buffer[index], (POINTER)&input[i], inputLen - i );
|
||||
}
|
||||
|
||||
|
||||
/* MD4 finalization. Ends an MD4 message-digest operation, writing the the message digest and zeroizing the context. */
|
||||
void MD4Final( unsigned char digest[16], MD4_CTX *context ) {
|
||||
unsigned char bits[8];
|
||||
unsigned int index, padLen;
|
||||
|
||||
/* Save number of bits */
|
||||
Encode( bits, context->count, 8 );
|
||||
|
||||
/* Pad out to 56 mod 64.*/
|
||||
index = ( unsigned int )( ( context->count[0] >> 3 ) & 0x3f );
|
||||
padLen = ( index < 56 ) ? ( 56 - index ) : ( 120 - index );
|
||||
MD4Update( context, PADDING, padLen );
|
||||
|
||||
/* Append length (before padding) */
|
||||
MD4Update( context, bits, 8 );
|
||||
|
||||
/* Store state in digest */
|
||||
Encode( digest, context->state, 16 );
|
||||
|
||||
/* Zeroize sensitive information.*/
|
||||
Com_Memset( (POINTER)context, 0, sizeof( *context ) );
|
||||
}
|
||||
|
||||
|
||||
/* MD4 basic transformation. Transforms state based on block. */
|
||||
static void MD4Transform( UINT4 state[4], const unsigned char block[64] ) {
|
||||
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
||||
|
||||
Decode( x, block, 64 );
|
||||
|
||||
/* Round 1 */
|
||||
FF( a, b, c, d, x[ 0], S11 ); /* 1 */
|
||||
FF( d, a, b, c, x[ 1], S12 ); /* 2 */
|
||||
FF( c, d, a, b, x[ 2], S13 ); /* 3 */
|
||||
FF( b, c, d, a, x[ 3], S14 ); /* 4 */
|
||||
FF( a, b, c, d, x[ 4], S11 ); /* 5 */
|
||||
FF( d, a, b, c, x[ 5], S12 ); /* 6 */
|
||||
FF( c, d, a, b, x[ 6], S13 ); /* 7 */
|
||||
FF( b, c, d, a, x[ 7], S14 ); /* 8 */
|
||||
FF( a, b, c, d, x[ 8], S11 ); /* 9 */
|
||||
FF( d, a, b, c, x[ 9], S12 ); /* 10 */
|
||||
FF( c, d, a, b, x[10], S13 ); /* 11 */
|
||||
FF( b, c, d, a, x[11], S14 ); /* 12 */
|
||||
FF( a, b, c, d, x[12], S11 ); /* 13 */
|
||||
FF( d, a, b, c, x[13], S12 ); /* 14 */
|
||||
FF( c, d, a, b, x[14], S13 ); /* 15 */
|
||||
FF( b, c, d, a, x[15], S14 ); /* 16 */
|
||||
|
||||
/* Round 2 */
|
||||
GG( a, b, c, d, x[ 0], S21 ); /* 17 */
|
||||
GG( d, a, b, c, x[ 4], S22 ); /* 18 */
|
||||
GG( c, d, a, b, x[ 8], S23 ); /* 19 */
|
||||
GG( b, c, d, a, x[12], S24 ); /* 20 */
|
||||
GG( a, b, c, d, x[ 1], S21 ); /* 21 */
|
||||
GG( d, a, b, c, x[ 5], S22 ); /* 22 */
|
||||
GG( c, d, a, b, x[ 9], S23 ); /* 23 */
|
||||
GG( b, c, d, a, x[13], S24 ); /* 24 */
|
||||
GG( a, b, c, d, x[ 2], S21 ); /* 25 */
|
||||
GG( d, a, b, c, x[ 6], S22 ); /* 26 */
|
||||
GG( c, d, a, b, x[10], S23 ); /* 27 */
|
||||
GG( b, c, d, a, x[14], S24 ); /* 28 */
|
||||
GG( a, b, c, d, x[ 3], S21 ); /* 29 */
|
||||
GG( d, a, b, c, x[ 7], S22 ); /* 30 */
|
||||
GG( c, d, a, b, x[11], S23 ); /* 31 */
|
||||
GG( b, c, d, a, x[15], S24 ); /* 32 */
|
||||
|
||||
/* Round 3 */
|
||||
HH( a, b, c, d, x[ 0], S31 ); /* 33 */
|
||||
HH( d, a, b, c, x[ 8], S32 ); /* 34 */
|
||||
HH( c, d, a, b, x[ 4], S33 ); /* 35 */
|
||||
HH( b, c, d, a, x[12], S34 ); /* 36 */
|
||||
HH( a, b, c, d, x[ 2], S31 ); /* 37 */
|
||||
HH( d, a, b, c, x[10], S32 ); /* 38 */
|
||||
HH( c, d, a, b, x[ 6], S33 ); /* 39 */
|
||||
HH( b, c, d, a, x[14], S34 ); /* 40 */
|
||||
HH( a, b, c, d, x[ 1], S31 ); /* 41 */
|
||||
HH( d, a, b, c, x[ 9], S32 ); /* 42 */
|
||||
HH( c, d, a, b, x[ 5], S33 ); /* 43 */
|
||||
HH( b, c, d, a, x[13], S34 ); /* 44 */
|
||||
HH( a, b, c, d, x[ 3], S31 ); /* 45 */
|
||||
HH( d, a, b, c, x[11], S32 ); /* 46 */
|
||||
HH( c, d, a, b, x[ 7], S33 ); /* 47 */
|
||||
HH( b, c, d, a, x[15], S34 ); /* 48 */
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
|
||||
/* Zeroize sensitive information.*/
|
||||
Com_Memset( (POINTER)x, 0, sizeof( x ) );
|
||||
}
|
||||
|
||||
|
||||
/* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */
|
||||
static void Encode( unsigned char *output, UINT4 *input, unsigned int len ) {
|
||||
unsigned int i, j;
|
||||
|
||||
for ( i = 0, j = 0; j < len; i++, j += 4 ) {
|
||||
output[j] = ( unsigned char )( input[i] & 0xff );
|
||||
output[j + 1] = ( unsigned char )( ( input[i] >> 8 ) & 0xff );
|
||||
output[j + 2] = ( unsigned char )( ( input[i] >> 16 ) & 0xff );
|
||||
output[j + 3] = ( unsigned char )( ( input[i] >> 24 ) & 0xff );
|
||||
copy4(buf+120, b);
|
||||
copy64(M, buf);
|
||||
mdfour64(M);
|
||||
copy64(M, buf+64);
|
||||
mdfour64(M);
|
||||
}
|
||||
}
|
||||
|
||||
static void mdfour_update(struct mdfour *md, byte *in, int n)
|
||||
{
|
||||
uint32_t M[16];
|
||||
|
||||
/* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */
|
||||
static void Decode( UINT4 *output, const unsigned char *input, unsigned int len ) {
|
||||
unsigned int i, j;
|
||||
m = md;
|
||||
|
||||
for ( i = 0, j = 0; j < len; i++, j += 4 )
|
||||
output[i] = ( (UINT4)input[j] ) | ( ( (UINT4)input[j + 1] ) << 8 ) | ( ( (UINT4)input[j + 2] ) << 16 ) | ( ( (UINT4)input[j + 3] ) << 24 );
|
||||
if (n == 0) mdfour_tail(in, n);
|
||||
|
||||
while (n >= 64) {
|
||||
copy64(M, in);
|
||||
mdfour64(M);
|
||||
in += 64;
|
||||
n -= 64;
|
||||
m->totalN += 64;
|
||||
}
|
||||
|
||||
mdfour_tail(in, n);
|
||||
}
|
||||
|
||||
|
||||
static void mdfour_result(struct mdfour *md, byte *out)
|
||||
{
|
||||
copy4(out, md->A);
|
||||
copy4(out+4, md->B);
|
||||
copy4(out+8, md->C);
|
||||
copy4(out+12, md->D);
|
||||
}
|
||||
|
||||
static void mdfour(byte *out, byte *in, int n)
|
||||
{
|
||||
struct mdfour md;
|
||||
mdfour_begin(&md);
|
||||
mdfour_update(&md, in, n);
|
||||
mdfour_result(&md, out);
|
||||
}
|
||||
|
||||
//===================================================================
|
||||
|
||||
unsigned Com_BlockChecksum( void *buffer, int length ) {
|
||||
int digest[4];
|
||||
unsigned val;
|
||||
MD4_CTX ctx;
|
||||
unsigned Com_BlockChecksum (const void *buffer, int length)
|
||||
{
|
||||
int digest[4];
|
||||
unsigned val;
|
||||
|
||||
MD4Init( &ctx );
|
||||
MD4Update( &ctx, (unsigned char *)buffer, length );
|
||||
MD4Final( (unsigned char *)digest, &ctx );
|
||||
|
||||
val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3];
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
unsigned Com_BlockChecksumKey( void *buffer, int length, int key ) {
|
||||
int digest[4];
|
||||
unsigned val;
|
||||
MD4_CTX ctx;
|
||||
|
||||
MD4Init( &ctx );
|
||||
MD4Update( &ctx, (unsigned char *)&key, 4 );
|
||||
MD4Update( &ctx, (unsigned char *)buffer, length );
|
||||
MD4Final( (unsigned char *)digest, &ctx );
|
||||
mdfour( (byte *)digest, (byte *)buffer, length );
|
||||
|
||||
val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3];
|
||||
|
||||
|
|
|
@ -334,12 +334,12 @@ void VM_Free( vm_t *vm );
|
|||
void VM_Clear( void );
|
||||
vm_t *VM_Restart( vm_t *vm );
|
||||
|
||||
int QDECL VM_Call( vm_t *vm, int callNum, ... );
|
||||
intptr_t QDECL VM_Call( vm_t *vm, int callNum, ... );
|
||||
|
||||
void VM_Debug( int level );
|
||||
|
||||
void *VM_ArgPtr( int intValue );
|
||||
void *VM_ExplicitArgPtr( vm_t *vm, int intValue );
|
||||
void *VM_ArgPtr( intptr_t intValue );
|
||||
void *VM_ExplicitArgPtr( vm_t *vm, intptr_t intValue );
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
@ -703,7 +703,6 @@ void Com_Quit_f( void );
|
|||
int Com_EventLoop( void );
|
||||
int Com_Milliseconds( void ); // will be journaled properly
|
||||
unsigned Com_BlockChecksum( const void *buffer, int length );
|
||||
unsigned Com_BlockChecksumKey( void *buffer, int length, int key );
|
||||
int Com_HashKey( char *string, int maxlen );
|
||||
int Com_Filter( char *filter, char *name, int casesensitive );
|
||||
int Com_FilterPath( char *filter, char *name, int casesensitive );
|
||||
|
@ -938,8 +937,8 @@ void Sys_EnterCriticalSection( void *ptr );
|
|||
void Sys_LeaveCriticalSection( void *ptr );
|
||||
|
||||
// general development dll loading for virtual machine testing
|
||||
void * QDECL Sys_LoadDll( const char *name, int( QDECL * *entryPoint ) ( int, ... ),
|
||||
int ( QDECL * systemcalls )( int, ... ) );
|
||||
void * QDECL Sys_LoadDll( const char *name, intptr_t( QDECL * *entryPoint ) ( intptr_t, ... ),
|
||||
intptr_t ( QDECL * systemcalls )( intptr_t, ... ) );
|
||||
void Sys_UnloadDll( void *dllHandle );
|
||||
|
||||
void Sys_UnloadGame( void );
|
||||
|
|
|
@ -331,24 +331,24 @@ Dlls will call this directly
|
|||
|
||||
============
|
||||
*/
|
||||
int QDECL VM_DllSyscall( int arg, ... ) {
|
||||
//#if ( ( defined __linux__ ) && ( defined __powerpc__ ) )
|
||||
intptr_t QDECL VM_DllSyscall( intptr_t arg, ... ) {
|
||||
#if !id386 || defined __clang__
|
||||
// rcg010206 - see commentary above
|
||||
int args[16];
|
||||
intptr_t args[MAX_VMSYSCALL_ARGS];
|
||||
int i;
|
||||
va_list ap;
|
||||
|
||||
args[0] = arg;
|
||||
|
||||
va_start( ap, arg );
|
||||
for ( i = 1; i < sizeof( args ) / sizeof( args[i] ); i++ )
|
||||
args[i] = va_arg( ap, int );
|
||||
va_end( ap );
|
||||
va_start(ap, arg);
|
||||
for (i = 1; i < ARRAY_LEN (args); i++)
|
||||
args[i] = va_arg(ap, intptr_t);
|
||||
va_end(ap);
|
||||
|
||||
return currentVM->systemCall( args );
|
||||
//#else // original id code
|
||||
// return currentVM->systemCall( &arg );
|
||||
//#endif
|
||||
#else // original id code
|
||||
return currentVM->systemCall( &arg );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -620,37 +620,37 @@ void VM_Clear( void ) {
|
|||
lastVM = NULL;
|
||||
}
|
||||
|
||||
void *VM_ArgPtr( int intValue ) {
|
||||
void *VM_ArgPtr( intptr_t intValue ) {
|
||||
if ( !intValue ) {
|
||||
return NULL;
|
||||
}
|
||||
// bk001220 - currentVM is missing on reconnect
|
||||
if ( currentVM == NULL ) {
|
||||
// currentVM is missing on reconnect
|
||||
if ( currentVM==NULL )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( currentVM->entryPoint ) {
|
||||
return ( void * )( currentVM->dataBase + intValue );
|
||||
} else {
|
||||
return ( void * )( currentVM->dataBase + ( intValue & currentVM->dataMask ) );
|
||||
return (void *)(currentVM->dataBase + intValue);
|
||||
}
|
||||
else {
|
||||
return (void *)(currentVM->dataBase + (intValue & currentVM->dataMask));
|
||||
}
|
||||
}
|
||||
|
||||
void *VM_ExplicitArgPtr( vm_t *vm, int intValue ) {
|
||||
void *VM_ExplicitArgPtr( vm_t *vm, intptr_t intValue ) {
|
||||
if ( !intValue ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// bk010124 - currentVM is missing on reconnect here as well?
|
||||
if ( currentVM == NULL ) {
|
||||
// currentVM is missing on reconnect here as well?
|
||||
if ( currentVM==NULL )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
if ( vm->entryPoint ) {
|
||||
return ( void * )( vm->dataBase + intValue );
|
||||
} else {
|
||||
return ( void * )( vm->dataBase + ( intValue & vm->dataMask ) );
|
||||
return (void *)(vm->dataBase + intValue);
|
||||
}
|
||||
else {
|
||||
return (void *)(vm->dataBase + (intValue & vm->dataMask));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -681,7 +681,7 @@ locals from sp
|
|||
#define MAX_STACK 256
|
||||
#define STACK_MASK ( MAX_STACK - 1 )
|
||||
|
||||
int QDECL VM_Call( vm_t *vm, int callnum, ... ) {
|
||||
intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
|
||||
vm_t *oldVM;
|
||||
int r;
|
||||
//rcg010207 see dissertation at top of VM_DllSyscall() in this file.
|
||||
|
|
|
@ -317,7 +317,7 @@ locals from sp
|
|||
|
||||
#define DEBUGSTR va( "%s%i", VM_Indent( vm ), opStack - stack )
|
||||
|
||||
int VM_CallInterpreted( vm_t *vm, int *args ) {
|
||||
intptr_t VM_CallInterpreted( vm_t *vm, int *args ) {
|
||||
int stack[MAX_STACK];
|
||||
int *opStack;
|
||||
int programCounter;
|
||||
|
|
|
@ -117,6 +117,13 @@ typedef enum {
|
|||
} opcode_t;
|
||||
|
||||
|
||||
// Max number of arguments to pass from engine to vm's vmMain function.
|
||||
// command number + 12 arguments
|
||||
#define MAX_VMMAIN_ARGS 13
|
||||
|
||||
// Max number of arguments to pass from a vm to engine's syscall handler function for the vm.
|
||||
// syscall number + 15 arguments
|
||||
#define MAX_VMSYSCALL_ARGS 16
|
||||
|
||||
typedef int vmptr_t;
|
||||
|
||||
|
@ -175,7 +182,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header );
|
|||
int VM_CallCompiled( vm_t *vm, int *args );
|
||||
|
||||
void VM_PrepareInterpreter( vm_t *vm, vmHeader_t *header );
|
||||
int VM_CallInterpreted( vm_t *vm, int *args );
|
||||
intptr_t VM_CallInterpreted( vm_t *vm, int *args );
|
||||
|
||||
vmSymbol_t *VM_ValueToFunctionSymbol( vm_t *vm, int value );
|
||||
int VM_SymbolToValue( vm_t *vm, const char *symbol );
|
||||
|
|
|
@ -407,49 +407,49 @@ void R_AddAnimSurfaces( trRefEntity_t *ent ) {
|
|||
}
|
||||
}
|
||||
|
||||
__inline void LocalMatrixTransformVector( vec3_t in, vec3_t mat[ 3 ], vec3_t out ) {
|
||||
void LocalMatrixTransformVector( vec3_t in, vec3_t mat[ 3 ], vec3_t out ) {
|
||||
out[ 0 ] = in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ];
|
||||
out[ 1 ] = in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ];
|
||||
out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ];
|
||||
}
|
||||
|
||||
__inline void LocalMatrixTransformVectorTranslate( vec3_t in, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
void LocalMatrixTransformVectorTranslate( vec3_t in, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
out[ 0 ] = in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ];
|
||||
out[ 1 ] = in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ];
|
||||
out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ];
|
||||
}
|
||||
|
||||
__inline void LocalScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) {
|
||||
void LocalScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) {
|
||||
out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] );
|
||||
out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] );
|
||||
out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] );
|
||||
}
|
||||
|
||||
__inline void LocalScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
void LocalScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] );
|
||||
out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] );
|
||||
out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] );
|
||||
}
|
||||
|
||||
__inline void LocalScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
void LocalScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ];
|
||||
out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ];
|
||||
out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ];
|
||||
}
|
||||
|
||||
__inline void LocalAddScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
void LocalAddScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ];
|
||||
out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ];
|
||||
out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ];
|
||||
}
|
||||
|
||||
__inline void LocalAddScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
void LocalAddScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) {
|
||||
out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] );
|
||||
out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] );
|
||||
out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] );
|
||||
}
|
||||
|
||||
__inline void LocalAddScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) {
|
||||
void LocalAddScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) {
|
||||
out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] );
|
||||
out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] );
|
||||
out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] );
|
||||
|
@ -461,7 +461,7 @@ static float sp, sy;
|
|||
//static float cr; // TTimo: unused
|
||||
static float cp, cy;
|
||||
|
||||
__inline void LocalAngleVector( vec3_t angles, vec3_t forward ) {
|
||||
void LocalAngleVector( vec3_t angles, vec3_t forward ) {
|
||||
LAVangle = angles[YAW] * ( M_PI * 2 / 360 );
|
||||
sy = sin( LAVangle );
|
||||
cy = cos( LAVangle );
|
||||
|
@ -474,7 +474,7 @@ __inline void LocalAngleVector( vec3_t angles, vec3_t forward ) {
|
|||
forward[2] = -sp;
|
||||
}
|
||||
|
||||
__inline void LocalVectorMA( vec3_t org, float dist, vec3_t vec, vec3_t out ) {
|
||||
void LocalVectorMA( vec3_t org, float dist, vec3_t vec, vec3_t out ) {
|
||||
out[0] = org[0] + dist * vec[0];
|
||||
out[1] = org[1] + dist * vec[1];
|
||||
out[2] = org[2] + dist * vec[2];
|
||||
|
@ -482,7 +482,7 @@ __inline void LocalVectorMA( vec3_t org, float dist, vec3_t vec, vec3_t out ) {
|
|||
|
||||
#define ANGLES_SHORT_TO_FLOAT( pf, sh ) { *( pf++ ) = SHORT2ANGLE( *( sh++ ) ); *( pf++ ) = SHORT2ANGLE( *( sh++ ) ); *( pf++ ) = SHORT2ANGLE( *( sh++ ) ); }
|
||||
|
||||
__inline void SLerp_Normal( vec3_t from, vec3_t to, float tt, vec3_t out ) {
|
||||
void SLerp_Normal( vec3_t from, vec3_t to, float tt, vec3_t out ) {
|
||||
float ft = 1.0 - tt;
|
||||
|
||||
out[0] = from[0] * ft + to[0] * tt;
|
||||
|
@ -500,7 +500,7 @@ __inline void SLerp_Normal( vec3_t from, vec3_t to, float tt, vec3_t out ) {
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
__inline void Matrix4Multiply( const vec4_t a[4], const vec4_t b[4], vec4_t dst[4] ) {
|
||||
void Matrix4Multiply( const vec4_t a[4], const vec4_t b[4], vec4_t dst[4] ) {
|
||||
dst[0][0] = a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0] + a[0][3] * b[3][0];
|
||||
dst[0][1] = a[0][0] * b[0][1] + a[0][1] * b[1][1] + a[0][2] * b[2][1] + a[0][3] * b[3][1];
|
||||
dst[0][2] = a[0][0] * b[0][2] + a[0][1] * b[1][2] + a[0][2] * b[2][2] + a[0][3] * b[3][2];
|
||||
|
@ -541,7 +541,7 @@ void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4], /*const*/ vec4
|
|||
t[2] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3];
|
||||
}
|
||||
|
||||
__inline void Matrix4Transpose( const vec4_t matrix[4], vec4_t transpose[4] ) {
|
||||
void Matrix4Transpose( const vec4_t matrix[4], vec4_t transpose[4] ) {
|
||||
int i, j;
|
||||
for ( i = 0; i < 4; i++ ) {
|
||||
for ( j = 0; j < 4; j++ ) {
|
||||
|
@ -550,7 +550,7 @@ __inline void Matrix4Transpose( const vec4_t matrix[4], vec4_t transpose[4] ) {
|
|||
}
|
||||
}
|
||||
|
||||
__inline void Matrix4FromAxis( const vec3_t axis[3], vec4_t dst[4] ) {
|
||||
void Matrix4FromAxis( const vec3_t axis[3], vec4_t dst[4] ) {
|
||||
int i, j;
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
|
@ -562,7 +562,7 @@ __inline void Matrix4FromAxis( const vec3_t axis[3], vec4_t dst[4] ) {
|
|||
dst[3][3] = 1;
|
||||
}
|
||||
|
||||
__inline void Matrix4FromScaledAxis( const vec3_t axis[3], const float scale, vec4_t dst[4] ) {
|
||||
void Matrix4FromScaledAxis( const vec3_t axis[3], const float scale, vec4_t dst[4] ) {
|
||||
int i, j;
|
||||
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
|
@ -578,7 +578,7 @@ __inline void Matrix4FromScaledAxis( const vec3_t axis[3], const float scale, ve
|
|||
dst[3][3] = 1;
|
||||
}
|
||||
|
||||
__inline void Matrix4FromTranslation( const vec3_t t, vec4_t dst[4] ) {
|
||||
void Matrix4FromTranslation( const vec3_t t, vec4_t dst[4] ) {
|
||||
int i, j;
|
||||
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
|
@ -598,7 +598,7 @@ __inline void Matrix4FromTranslation( const vec3_t t, vec4_t dst[4] ) {
|
|||
// can put an axis rotation followed by a translation directly into one matrix
|
||||
// TTimo: const vec_t ** would require explicit casts for ANSI C conformance
|
||||
// see unix/const-arg.c in Wolf MP source
|
||||
__inline void Matrix4FromAxisPlusTranslation( /*const*/ vec3_t axis[3], const vec3_t t, vec4_t dst[4] ) {
|
||||
void Matrix4FromAxisPlusTranslation( /*const*/ vec3_t axis[3], const vec3_t t, vec4_t dst[4] ) {
|
||||
int i, j;
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
|
@ -613,7 +613,7 @@ __inline void Matrix4FromAxisPlusTranslation( /*const*/ vec3_t axis[3], const ve
|
|||
// can put a scaled axis rotation followed by a translation directly into one matrix
|
||||
// TTimo: const vec_t ** would require explicit casts for ANSI C conformance
|
||||
// see unix/const-arg.c in Wolf MP source
|
||||
__inline void Matrix4FromScaledAxisPlusTranslation( /*const*/ vec3_t axis[3], const float scale, const vec3_t t, vec4_t dst[4] ) {
|
||||
void Matrix4FromScaledAxisPlusTranslation( /*const*/ vec3_t axis[3], const float scale, const vec3_t t, vec4_t dst[4] ) {
|
||||
int i, j;
|
||||
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
|
@ -629,7 +629,7 @@ __inline void Matrix4FromScaledAxisPlusTranslation( /*const*/ vec3_t axis[3], co
|
|||
dst[3][3] = 1;
|
||||
}
|
||||
|
||||
__inline void Matrix4FromScale( const float scale, vec4_t dst[4] ) {
|
||||
void Matrix4FromScale( const float scale, vec4_t dst[4] ) {
|
||||
int i, j;
|
||||
|
||||
for ( i = 0; i < 4; i++ ) {
|
||||
|
@ -644,7 +644,7 @@ __inline void Matrix4FromScale( const float scale, vec4_t dst[4] ) {
|
|||
dst[3][3] = 1;
|
||||
}
|
||||
|
||||
__inline void Matrix4TransformVector( const vec4_t m[4], const vec3_t src, vec3_t dst ) {
|
||||
void Matrix4TransformVector( const vec4_t m[4], const vec3_t src, vec3_t dst ) {
|
||||
dst[0] = m[0][0] * src[0] + m[0][1] * src[1] + m[0][2] * src[2] + m[0][3];
|
||||
dst[1] = m[1][0] * src[0] + m[1][1] * src[1] + m[1][2] * src[2] + m[1][3];
|
||||
dst[2] = m[2][0] * src[0] + m[2][1] * src[1] + m[2][2] * src[2] + m[2][3];
|
||||
|
@ -658,7 +658,7 @@ __inline void Matrix4TransformVector( const vec4_t m[4], const vec3_t src, vec3_
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
__inline void Matrix3Transpose( const vec3_t matrix[3], vec3_t transpose[3] ) {
|
||||
void Matrix3Transpose( const vec3_t matrix[3], vec3_t transpose[3] ) {
|
||||
int i, j;
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
|
|
|
@ -1592,6 +1592,66 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader,
|
|||
*atiTess = ( sort >> QSORT_ATI_TESS_SHIFT ) & 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================================
|
||||
|
||||
DRAWSURF SORTING
|
||||
|
||||
==========================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
===============
|
||||
R_Radix
|
||||
===============
|
||||
*/
|
||||
static ID_INLINE void R_Radix( int byte, int size, drawSurf_t *source, drawSurf_t *dest )
|
||||
{
|
||||
int count[ 256 ] = { 0 };
|
||||
int index[ 256 ];
|
||||
int i;
|
||||
unsigned char *sortKey = NULL;
|
||||
unsigned char *end = NULL;
|
||||
|
||||
sortKey = ( (unsigned char *)&source[ 0 ].sort ) + byte;
|
||||
end = sortKey + ( size * sizeof( drawSurf_t ) );
|
||||
for( ; sortKey < end; sortKey += sizeof( drawSurf_t ) )
|
||||
++count[ *sortKey ];
|
||||
|
||||
index[ 0 ] = 0;
|
||||
|
||||
for( i = 1; i < 256; ++i )
|
||||
index[ i ] = index[ i - 1 ] + count[ i - 1 ];
|
||||
|
||||
sortKey = ( (unsigned char *)&source[ 0 ].sort ) + byte;
|
||||
for( i = 0; i < size; ++i, sortKey += sizeof( drawSurf_t ) )
|
||||
dest[ index[ *sortKey ]++ ] = source[ i ];
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_RadixSort
|
||||
|
||||
Radix sort with 4 byte size buckets
|
||||
===============
|
||||
*/
|
||||
static void R_RadixSort( drawSurf_t *source, int size )
|
||||
{
|
||||
static drawSurf_t scratch[ MAX_DRAWSURFS ];
|
||||
#ifdef Q3_LITTLE_ENDIAN
|
||||
R_Radix( 0, size, source, scratch );
|
||||
R_Radix( 1, size, scratch, source );
|
||||
R_Radix( 2, size, source, scratch );
|
||||
R_Radix( 3, size, scratch, source );
|
||||
#else
|
||||
R_Radix( 3, size, source, scratch );
|
||||
R_Radix( 2, size, scratch, source );
|
||||
R_Radix( 1, size, source, scratch );
|
||||
R_Radix( 0, size, scratch, source );
|
||||
#endif //Q3_LITTLE_ENDIAN
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_SortDrawSurfs
|
||||
|
@ -1621,7 +1681,8 @@ void R_SortDrawSurfs( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
}
|
||||
|
||||
// sort the drawsurfs by sort type, then orientation, then shader
|
||||
qsortFast( drawSurfs, numDrawSurfs, sizeof( drawSurf_t ) );
|
||||
// qsortFast( drawSurfs, numDrawSurfs, sizeof( drawSurf_t ) );
|
||||
R_RadixSort( drawSurfs, numDrawSurfs );
|
||||
|
||||
// check for any pass through drawing, which
|
||||
// may cause another view to be rendered first
|
||||
|
|
|
@ -544,9 +544,11 @@ void SV_BotInitCvars( void ) {
|
|||
BotImport_AICast_VisibleFromPos
|
||||
===============
|
||||
*/
|
||||
|
||||
qboolean BotImport_AICast_VisibleFromPos( vec3_t srcpos, int srcnum,
|
||||
vec3_t destpos, int destnum, qboolean updateVisPos ) {
|
||||
return VM_Call( gvm, AICAST_VISIBLEFROMPOS, (int)srcpos, srcnum, (int)destpos, destnum, updateVisPos );
|
||||
|
||||
return VM_Call( gvm, AICAST_VISIBLEFROMPOS, LO_ARG(srcpos), HI_ARG(srcpos), srcnum, LO_ARG(destpos), HI_ARG(destpos), destnum, updateVisPos );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -555,7 +557,7 @@ BotImport_AICast_CheckAttackAtPos
|
|||
===============
|
||||
*/
|
||||
qboolean BotImport_AICast_CheckAttackAtPos( int entnum, int enemy, vec3_t pos, qboolean ducking, qboolean allowHitWorld ) {
|
||||
return VM_Call( gvm, AICAST_CHECKATTACKATPOS, entnum, enemy, (int)pos, ducking, allowHitWorld );
|
||||
return VM_Call( gvm, AICAST_CHECKATTACKATPOS, entnum, enemy, LO_ARG(pos), HI_ARG(pos), ducking, allowHitWorld );
|
||||
}
|
||||
// done.
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ gotnewcl:
|
|||
denied = (char *)VM_Call( gvm, GAME_CLIENT_CONNECT, clientNum, qtrue, qfalse ); // firstTime = qtrue
|
||||
if ( denied ) {
|
||||
// we can't just use VM_ArgPtr, because that is only valid inside a VM_Call
|
||||
denied = VM_ExplicitArgPtr( gvm, (int)denied );
|
||||
denied = VM_ExplicitArgPtr( gvm, (intptr_t)denied );
|
||||
|
||||
NET_OutOfBandPrint( NS_SERVER, from, "print\n%s\n", denied );
|
||||
Com_DPrintf( "Game rejected a connection: %s.\n", denied );
|
||||
|
|
|
@ -319,16 +319,20 @@ SV_GameSystemCalls
|
|||
The module is making a system call
|
||||
====================
|
||||
*/
|
||||
//rcg010207 - see my comments in VM_DllSyscall(), in qcommon/vm.c ...
|
||||
//#if ( ( defined __linux__ ) && ( defined __powerpc__ ) )
|
||||
#define VMA( x ) ( (void *) args[x] )
|
||||
//#else
|
||||
|
||||
|
||||
void *VM_ArgPtr( intptr_t intValue );
|
||||
//#define VMA( x ) VM_ArgPtr( args[x] )
|
||||
//#endif
|
||||
#define VMA(x) VM_ArgPtr(args[x])
|
||||
static ID_INLINE float _vmf(intptr_t x)
|
||||
{
|
||||
floatint_t fi;
|
||||
fi.i = (int) x;
|
||||
return fi.f;
|
||||
}
|
||||
#define VMF(x) _vmf(args[x])
|
||||
|
||||
#define VMF( x ) ( (float *)args )[x]
|
||||
|
||||
int SV_GameSystemCalls( int *args ) {
|
||||
int SV_GameSystemCalls( intptr_t *args ) {
|
||||
switch ( args[0] ) {
|
||||
case G_PRINT:
|
||||
Com_Printf( "%s", VMA( 1 ) );
|
||||
|
@ -1043,7 +1047,7 @@ void SV_SendMoveSpeedsToGame( int entnum, char *text ) {
|
|||
if ( !gvm ) {
|
||||
return;
|
||||
}
|
||||
VM_Call( gvm, GAME_RETRIEVE_MOVESPEEDS_FROM_CLIENT, entnum, text );
|
||||
VM_Call( gvm, GAME_RETRIEVE_MOVESPEEDS_FROM_CLIENT, entnum, LO_ARG(text), HI_ARG(text) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1071,5 +1075,5 @@ SV_GetModelInfo
|
|||
===================
|
||||
*/
|
||||
qboolean SV_GetModelInfo( int clientNum, char *modelName, animModelInfo_t **modelInfo ) {
|
||||
return VM_Call( gvm, GAME_GETMODELINFO, clientNum, modelName, modelInfo );
|
||||
return VM_Call( gvm, GAME_GETMODELINFO, clientNum, LO_ARG(modelName), HI_ARG(modelName), LO_ARG(modelInfo), HI_ARG(modelInfo) );
|
||||
}
|
|
@ -826,7 +826,8 @@ void SV_Frame( int msec ) {
|
|||
}
|
||||
|
||||
//Ensure the game library has our VR client info
|
||||
VM_Call( gvm, GAME_SET_VR_CLIENT_INFO, &vr );
|
||||
//Ensure the game library has our VR client info
|
||||
VM_Call( gvm, GAME_SET_VR_CLIENT_INFO, LO_ARG(&vr), HI_ARG(&vr) );
|
||||
|
||||
if ( com_speeds->integer ) {
|
||||
startTime = Sys_Milliseconds();
|
||||
|
|
|
@ -187,7 +187,7 @@ qboolean _UI_IsFullscreen( void );
|
|||
#if defined( __MACOS__ )
|
||||
#pragma export on
|
||||
#endif
|
||||
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
|
||||
intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export off
|
||||
#endif
|
||||
|
|
|
@ -31,22 +31,16 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// this file is only included when building a dll
|
||||
// syscalls.asm is included instead when building a qvm
|
||||
|
||||
static int ( QDECL * syscall )( int arg, ... ) = ( int ( QDECL * )( int, ... ) ) - 1;
|
||||
static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1;
|
||||
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export on
|
||||
#endif
|
||||
void dllEntry( int ( QDECL *syscallptr )( int arg,... ) ) {
|
||||
#if defined( __MACOS__ )
|
||||
#pragma export off
|
||||
#endif
|
||||
void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
|
||||
syscall = syscallptr;
|
||||
}
|
||||
|
||||
int PASSFLOAT( float x ) {
|
||||
float floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
void trap_Print( const char *string ) {
|
||||
|
|
|
@ -433,7 +433,7 @@ void Sys_ConsoleInputInit() {
|
|||
characters EOF, EOL, EOL2, ERASE, KILL, REPRINT,
|
||||
STATUS, and WERASE, and buffers by lines.
|
||||
ISIG: when any of the characters INTR, QUIT, SUSP, or
|
||||
DSUSP are received, generate the corresponding sig
|
||||
DSUSP are received, generate the corresponding sig<EFBFBD>
|
||||
nal
|
||||
*/
|
||||
tc.c_lflag &= ~( ECHO | ICANON );
|
||||
|
@ -634,12 +634,12 @@ void *Sys_LoadDll_Wrapped( const char *name,
|
|||
int ( *systemcalls )( int, ... ) )
|
||||
#else
|
||||
void *Sys_LoadDll( const char *name,
|
||||
int( **entryPoint ) ( int, ... ),
|
||||
int ( *systemcalls )( int, ... ) )
|
||||
intptr_t( **entryPoint ) ( intptr_t, ... ),
|
||||
intptr_t ( *systemcalls )( intptr_t, ... ) )
|
||||
#endif
|
||||
{
|
||||
void *libHandle;
|
||||
void ( *dllEntry )( int ( *syscallptr )( int, ... ) );
|
||||
void ( *dllEntry )( intptr_t ( *syscallptr )( intptr_t, ... ) );
|
||||
char fname[MAX_OSPATH];
|
||||
char *homepath;
|
||||
char *basepath;
|
||||
|
|
Loading…
Reference in a new issue