Skip to content

Commit

Permalink
Merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
ensiform committed Nov 20, 2024
2 parents 84b3f33 + 7bf5296 commit b8cf835
Show file tree
Hide file tree
Showing 327 changed files with 1,438 additions and 3,493 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/0.83/Omnibot/projects/msvc12/build/
/0.83/GameInterfaces/*/src/build/
/0.83/Installer/Files/rtcw/scripts/rtcw_autoexec_user.gm
/0.83/Omnibot/CMakeFiles
/0.83/Omnibot/CMakeCache.txt
38 changes: 26 additions & 12 deletions 0.83/GameInterfaces/ET/src/Jamfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
# Root project file for the ET interface.
# Root project file for the ET mod.
# Builds the game libraries.


project omnibot_et
: build-dir ./build
: requirements <toolset>msvc:<define>WIN32
: requirements <toolset>gcc:<define>__linux__
: requirements <variant>debug:<define>_DEBUG
: requirements <variant>release:<define>NDEBUG
: requirements
<toolset>msvc:<define>WIN32
<toolset>gcc:<define>__linux__
<variant>debug:<define>_DEBUG
<variant>release:<define>NDEBUG
<cflags>-fno-strict-aliasing
<warnings>off
;

# define external libs
lib dl_lib : : <name>dl ;

# target suffix
rule tag ( name : type ? : property-set )
{
if $(type) = SHARED_LIB
{
if [ $(property-set).get <address-model> ] = 64
if [ $(property-set).get <target-os> ] = darwin
{
return $(name)_mac ;
}
else if [ $(property-set).get <target-os> ] = windows
{
if [ $(property-set).get <address-model> ] = 64
{
return $(name)_mp_x64.dll ;
}
else
{
return $(name)_mp_x86.dll ;
}
}
else if [ $(property-set).get <address-model> ] = 64
{
return $(name).x86_64.so ;
return $(name).mp.x86_64.so ;
}
else
{
return $(name).i386.so ;
return $(name).mp.i386.so ;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions 0.83/GameInterfaces/ET/src/cgame/Jamfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# The client library.

project cgame
: requirements <define>CGAMEDLL
: requirements <include>../game
: requirements <include>../ui
: requirements <include>../../../../Omnibot/Common
: requirements
<define>CGAMEDLL
<include>../game
<include>../ui
<include>../../../../Omnibot/Common
;

SOURCES = [ glob ../game/bg_*.c ]
Expand All @@ -15,5 +16,4 @@ SOURCES = [ glob ../game/bg_*.c ]
../ui/ui_shared.c
;

lib cgame.mp.so : $(SOURCES) : <tag>@tag <toolset>gcc:<cflags>-w <cflags>-fno-strict-aliasing <linkflags>-pthread <linkflags>-lrt ;

lib cgame : $(SOURCES) : <tag>@tag ;
2 changes: 1 addition & 1 deletion 0.83/GameInterfaces/ET/src/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This must be the very first function compiled into the .q3vm file
#pragma export on
#endif
#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( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6, intptr_t arg7, intptr_t arg8, intptr_t arg9, intptr_t arg10, intptr_t arg11 ) {
#if defined(__MACOS__)
#ifndef __GNUC__
#pragma export off
Expand Down
4 changes: 2 additions & 2 deletions 0.83/GameInterfaces/ET/src/cgame/cg_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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;

#if defined(__MACOS__)
#ifndef __GNUC__
#pragma export on
#endif
#endif
void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
syscall = syscallptr;
}
#if defined(__MACOS__)
Expand Down
10 changes: 5 additions & 5 deletions 0.83/GameInterfaces/ET/src/cgame/cgame.rc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ END
//

1 VERSIONINFO
FILEVERSION 0, 9, 0, 0
PRODUCTVERSION 0, 9, 0, 0
FILEVERSION 0, 9, 1, 0
PRODUCTVERSION 0, 9, 1, 0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,12 +62,12 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Omni-bot mod for Enemy Territory"
VALUE "FileVersion", "0.9.0.0"
VALUE "FileVersion", "0.9.1.0"
VALUE "InternalName", "omnibot cgame"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "LegalCopyright", "Copyright (C) 2024"
VALUE "OriginalFilename", "cgame_mp_x86.dll"
VALUE "ProductName", "omnibot mod - client"
VALUE "ProductVersion", "0.9.0.0"
VALUE "ProductVersion", "0.9.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
18 changes: 9 additions & 9 deletions 0.83/GameInterfaces/ET/src/game/Jamfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# The server library.

project game
: requirements <define>GAMEDLL
: requirements <define>NO_BOT_SUPPORT
: requirements <variant>debug:<define>DEBUG
: requirements <include>../botai
: requirements <include>../../../../Omnibot/Common
: requirements <include>../../../../Omnibot/ET
: requirements
<define>GAMEDLL
<define>NO_BOT_SUPPORT
<variant>debug:<define>DEBUG
<include>../botai
<include>../../../../Omnibot/Common
<include>../../../../Omnibot/ET
;

SOURCES = [ glob ../botai/ai_*.c ]
[ glob bg_*.c ]
[ glob g_*.c ]
[ glob g_*.cpp ]
[ glob ../../../../Omnibot/Common/BotLoadLibrary.cpp ]
../../../../Omnibot/Common/BotLoadLibrary.cpp
q_math.c
q_shared.c
;

lib qagame.mp.so : $(SOURCES) ..//dl_lib : <tag>@tag <toolset>gcc:<cflags>-w <cflags>-fno-strict-aliasing ;

lib qagame : $(SOURCES) : <tag>@tag ;
2 changes: 1 addition & 1 deletion 0.83/GameInterfaces/ET/src/game/bg_animation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ int BG_GetConditionValue( int client, int condition, qboolean checkConversion )
}
else
// xkan, 1/14/2003 - must use COM_BitCheck on the result.
return (int)globalScriptData->clientConditions[client][condition];
return (intptr_t)globalScriptData->clientConditions[client][condition];
//BG_AnimParseError( "BG_GetConditionValue: internal error" );
}
else
Expand Down
3 changes: 2 additions & 1 deletion 0.83/GameInterfaces/ET/src/game/g_etbot_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5765,7 +5765,8 @@ void Bot_Interface_ConsoleCommand()
}

Arguments args;
for(int i = 0; i < trap_Argc(); ++i)
int n = min(trap_Argc(), Arguments::MaxArgs);
for(int i = 0; i < n; ++i)
{
trap_Argv(i, args.m_Args[args.m_NumArgs++], Arguments::MaxArgLength);
}
Expand Down
4 changes: 2 additions & 2 deletions 0.83/GameInterfaces/ET/src/game/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ This must be the very first function compiled into the .q3vm file
#pragma export on
#endif
#endif
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) {
intptr_t vmMain( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6 ) {
#if defined(__MACOS__)
#ifndef __GNUC__
#pragma export off
Expand All @@ -513,7 +513,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;
Expand Down
47 changes: 38 additions & 9 deletions 0.83/GameInterfaces/ET/src/game/g_svcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,43 @@ void ClearMaxLivesBans ()
Svcmd_EntityList_f
===================
*/
void Svcmd_EntityList_f (void) {

void Appendf( char **dest, int *size, const char *fmt, ... )
{
va_list argptr;
int ret;

va_start (argptr, fmt);
if(*size>0)
{
ret = Q_vsnprintf(*dest, *size, fmt, argptr);
if(ret<0) {
*dest += *size - 1;
*size = 0;
}
else {
*size -= ret;
*dest += ret;
}
}
va_end (argptr);
}

void Svcmd_EntityList_f() {
int e;
gentity_t *check;
char *dest;
int size;
char buf[256];

check = g_entities+1;
for (e = 1; e < level.num_entities ; e++, check++) {
if ( !check->inuse ) {
continue;
}
G_Printf("%3i:", e);
dest = buf;
size = sizeof(buf)-1;
Appendf(&dest, &size, "%3i:", e);

static char *typeName[] = {"ET_GENERAL", "ET_PLAYER", "ET_ITEM", "ET_MISSILE", "ET_MOVER", "ET_BEAM", "ET_PORTAL", "ET_SPEAKER", "ET_PUSH_TRIGGER", "ET_TELEPORT_TRIGGER",
"ET_INVISIBLE", "ET_CONCUSSIVE_TRIGGER", "ET_OID_TRIGGER", "ET_EXPLOSIVE_INDICATOR", "ET_EXPLOSIVE", "ET_EF_SPOTLIGHT", "ET_ALARMBOX", "ET_CORONA", "ET_TRAP", "ET_GAMEMODEL",
Expand All @@ -562,23 +589,25 @@ void Svcmd_EntityList_f (void) {
"ET_BOTGOAL_INDICATOR", "ET_CORPSE", "ET_SMOKER", "ET_TEMPHEAD", "ET_MG42_BARREL", "ET_TEMPLEGS", "ET_TRIGGER_MULTIPLE", "ET_TRIGGER_FLAGONLY", "ET_TRIGGER_FLAGONLY_MULTIPLE",
"ET_GAMEMANAGER", "ET_AAGUN", "ET_CABINET_H", "ET_CABINET_A", "ET_HEALER", "ET_SUPPLIER", "ET_LANDMINE_HINT", "ET_ATTRACTOR_HINT", "ET_SNIPER_HINT", "ET_LANDMINESPOT_HINT", "ET_COMMANDMAP_MARKER", "ET_WOLF_OBJECTIVE", "ET_EVENTS"};

if(check->s.eType >= ET_GENERAL && check->s.eType <= ET_EVENTS)
G_Printf("%-19s ", typeName[check->s.eType]);
if (check->s.eType >= ET_GENERAL && check->s.eType <= ET_EVENTS)
Appendf(&dest, &size, "%-19s ", typeName[check->s.eType]);
else
G_Printf("%3i ", check->s.eType);
Appendf(&dest, &size, "%-20i", check->s.eType);

if ( check->classname ) {
G_Printf("%s ", check->classname);
Appendf(&dest, &size, "%s ", check->classname);
}

if ( check->scriptName ) {
G_Printf("^3(script: %s)^7 ", check->scriptName);
Appendf(&dest, &size, "^3(script: %s)^7 ", check->scriptName);
}
if ( check->targetname ) {
G_Printf("^3(target: %s)^7", check->targetname);
Appendf(&dest, &size, "^3(target: %s)^7", check->targetname);
}

G_Printf("\n");
*dest++ = '\n';
*dest = 0;
trap_Printf(buf);
}
}

Expand Down
4 changes: 2 additions & 2 deletions 0.83/GameInterfaces/ET/src/game/g_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
// 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__)
#ifndef __GNUC__
#pragma export on
#endif
#endif
void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
syscall = syscallptr;
}
#if defined(__MACOS__)
Expand Down
10 changes: 5 additions & 5 deletions 0.83/GameInterfaces/ET/src/game/game.rc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ END
//

1 VERSIONINFO
FILEVERSION 0, 8, 4, 1048
PRODUCTVERSION 0, 8, 4, 1048
FILEVERSION 0, 9, 1, 0
PRODUCTVERSION 0, 9, 1, 0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,12 +62,12 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Omni-bot mod for Enemy Territory"
VALUE "FileVersion", "0.8.4.1048"
VALUE "FileVersion", "0.9.1.0"
VALUE "InternalName", "omnibot qagame"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "LegalCopyright", "Copyright (C) 2024"
VALUE "OriginalFilename", "qagame_mp_x86.dll"
VALUE "ProductName", "omnibot mod - server"
VALUE "ProductVersion", "0.8.4.1048"
VALUE "ProductVersion", "0.9.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion 0.83/GameInterfaces/ET/src/game/game.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
<Filter>omnibot</Filter>
</ClCompile>
<ClCompile Include="$(REPO_ROOT)\Omnibot\Common\BotLoadLibrary.cpp">
<Filter>Source Files</Filter>
<Filter>omnibot</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down
30 changes: 15 additions & 15 deletions 0.83/GameInterfaces/ET/src/game/q_math.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,23 +549,23 @@ void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out )

//============================================================================

/*
** float q_rsqrt( float number )
*/
float Q_rsqrt( float number )
typedef union
{
float f;
int32_t i;
uint32_t ui;
} floatint_t;

// 1/sqrt(f), fast but inaccurate
float Q_rsqrt(float f)
{
long i;
float x2, y;
const float threehalfs = 1.5F;

x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
floatint_t t;
float y;

t.f = f;
t.i = 0x5f3759df - (t.i >> 1); // evil floating point bit level hacking
y = t.f;
y = y * (1.5F - (f * 0.5F * y * y)); // iteration
return y;
}

Expand Down
1 change: 1 addition & 0 deletions 0.83/GameInterfaces/ET/src/game/q_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
#include <limits.h>
#include <sys/stat.h> // rain
#include <float.h>
#include <stdint.h>

#endif

Expand Down
Loading

0 comments on commit b8cf835

Please sign in to comment.