Revert of changes made by mistake

This commit is contained in:
Walter Julius Hennecke 2012-05-05 16:53:56 +02:00
parent 8bd25cb50b
commit d55b82fdc3
23 changed files with 1521 additions and 48 deletions

View file

@ -116,14 +116,10 @@ LUAOBJ = \
ifeq ($(DEBUG), 1)
DO_SOCC = $(CC) $(SOCFLAGS) -Wall -g3 $(DEFINES) -o $@ -c $<
else
DO_SOCC = $(CC) $(SOCFLAGS) -Wall -Wno-unused-but-set-variable $(DEFINES) -o $@ -c $<
DO_SOCC = $(CC) $(SOCFLAGS) -Wall $(DEFINES) -o $@ -c $<
endif
# do cc for lua
ifeq ($(DEBUF), 1)
DO_LUACC = $(CC) -O2 -Wall -g3 $(SOCFLAGS) -DLUA_COMPAT_ALL -o $@ -c $<
else
DO_LUACC = $(CC) -O2 -Wall $(SOCFLAGS) -DLUA_COMPAT_ALL -o $@ -c $<
endif
build_so: DO_CC=$(DO_SOCC)

View file

@ -954,24 +954,19 @@ void CG_InitConsoleCommands( void ) {
/* temp */
trap_AddCommand("ui_holodeck");
/*
* note:
* - some of these might get removed
* - some of these don't require rpgxEF anymore
* and will be merged into the non rpgxEF version
*/
#ifdef XTRA
trap_AddCommand("userlogin");
trap_AddCommand("userAdd");
trap_AddCommand("sql_setup");
trap_AddCommand("userMod");
trap_AddCommand("userDel");
#endif
/* lua */
#ifdef CG_LUA
trap_AddCommand("lua_status");
#endif
/* Cinematic Cam testing */
/* CCAM */
trap_AddCommand("camtest");
trap_AddCommand("camtestend");
}

View file

@ -2493,7 +2493,8 @@ void CG_InitLensFlare( vec3_t worldCoord,
//TiM - Allow parts of the lerp code to update the 3rd view if need be
void CG_ResetThirdPersonViewDamp ( void );
/* shader remapping */
#ifdef XTRA
void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
void CG_ShaderStateChanged(void);
#endif

View file

@ -1826,8 +1826,9 @@ void CG_Init( int serverMessageNum, int serverCommandSequence ) {
//TiM2 - Separated this out so class data has to be locally accessed now
//CG_ParseClassData();
/* shader remapping */
#ifdef XTRA
CG_ShaderStateChanged();
#endif
if(grp_berp.integer)
CG_Printf(S_COLOR_YELLOW "GSIO01 and Ubergames greet Brave Explorers.\n");

View file

@ -7,6 +7,9 @@
//
// rpgxEF?
#define XTRA 1
#define CMD_BACKUP 64
#define CMD_MASK (CMD_BACKUP - 1)
// allow a lot of command backups for very fast systems
@ -123,7 +126,10 @@ typedef enum {
CG_CEIL,
CG_TESTPRINTINT,
CG_TESTPRINTFLOAT,
#ifdef XTRA
CG_R_REMAP_SHADER = 200,
#endif
} cgameImport_t;
//these must match up with cg_syscalls.asm

View file

@ -340,9 +340,12 @@ static void CG_ConfigStringModified( void ) {
cgs.redflag = str[0] - '0';
cgs.blueflag = str[1] - '0';
}
#ifdef XTRA
else if(num == CS_SHADERSTATE) {
CG_ShaderStateChanged();
}
}
#endif
}
@ -615,6 +618,7 @@ char *ConcatArgs2( int start ) {
return line;
}
#ifdef XTRA
/*
=====================
CG_ShaderStateChanged
@ -657,6 +661,7 @@ void CG_ShaderStateChanged(void) {
}
}
}
#endif
/*
@ -861,7 +866,7 @@ static void CG_ServerCommand( void ) {
return;
}
/* shader remap */
#ifdef XTRA
if ( Q_stricmp (cmd, "remapShader") == 0 )
{
if (trap_Argc() == 4)
@ -879,6 +884,7 @@ static void CG_ServerCommand( void ) {
return;
}
#endif
if(!strcmp(cmd, "ui_transporter")) {
trap_SendConsoleCommand(va("ui_transporter %s", CG_Argv(1)));
@ -900,11 +906,12 @@ static void CG_ServerCommand( void ) {
return;
}
/* TODO remove me? */
#ifdef XTRA
if(!strcmp(cmd, "sqlkey")) {
trap_SendClientCommand(va("sqlkey %i", CG_Argv(1)));
return;
}
#endif
CG_Printf( "Unknown client game command: %s\n", cmd );
}

View file

@ -286,8 +286,8 @@ int trap_MemoryRemaining( void ) {
return syscall( CG_MEMORY_REMAINING );
}
/* shader remap */
#ifdef XTRA
void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) {
syscall( CG_R_REMAP_SHADER, oldShader, newShader, timeOffset );
}
#endif

View file

@ -6,7 +6,11 @@
#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
#ifndef XTRA
#define ENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing
#else
#define ENTITYNUM_BITS 11 // can't be increased without changing drawsurf bit packing
#endif
#define MAX_ENTITIES ((1<<ENTITYNUM_BITS) - 1)
// renderfx flags

View file

@ -19,15 +19,17 @@ endif
ifeq ($(PLATFORM), mingw32)
EXT=dll
ARCH=x86
LIBEXPAT=../libs/win32/expat/libexpat.a
else
EXT=so
LIBEXPAT=../libs/linux/$(ARCH)/libexpat.a
endif
# warning level
ifeq ($(DEBUG), 1)
WL=-Wall
else
WL=-Wall -Wno-unused-but-set-variable
WL=-Wall
endif
#defines
@ -145,11 +147,7 @@ else
DO_SOCC = $(CC) $(SOCFLAGS) $(WL) $(DEFINES) -o $@ -c $<
endif
# do cc for lua
ifeq ($(DEBUG), 1)
DO_LUACC = $(CC) -O2 -Wall -g3 $(SOCFLAGS) -DLUA_COMPAT_ALL -o $@ -c $<
else
DO_LUACC = $(CC) -O2 -Wall $(SOCFLAGS) -DLUA_COMPAT_ALL -o $@ -c $<
endif
build_so: DO_CC=$(DO_SOCC)
@ -252,9 +250,9 @@ lzio.o: lzio.c; $(DO_LUACC)
build_so: $(OBJ) $(SOOBJ) $(LUAOBJ)
ifeq ($(PLATFORM), mingw32)
$(CC) -shared -Wl,--export-all-symbols,-soname,qqgame$(ARCH).$(EXT) -o qagame$(ARCH).$(EXT) $(OBJ) $(SOOBJ) $(LUAOBJ) -lm
$(CC) -shared $(WL),--export-all-symbols,-soname,qqgame$(ARCH).$(EXT) -o qagame$(ARCH).$(EXT) $(OBJ) $(SOOBJ) $(LUAOBJ) $(LIBEXPAT) -lm
else
$(CC) -shared -Wl,--export-dynamic,-soname,qagame$(ARCH).$(EXT) -o qagame$(ARCH).$(EXT) $(OBJ) $(SOOBJ) $(LUAOBJ) -lm
$(CC) -shared $(WL),--export-dynamic,-soname,qagame$(ARCH).$(EXT) -o qagame$(ARCH).$(EXT) $(OBJ) $(SOOBJ) $(LUAOBJ) $(LIBEXPAT) -lm
endif
clean:

View file

@ -2,6 +2,8 @@
//
// bg_public.h -- definitions shared by both the server game and client game modules
// are we compiling for rpgxEF?
#define XTRA 1
// meh somehow preprocessor G_LUA won't work for me
#define G_LUA 1
#define CG_LUA 1
@ -167,8 +169,9 @@ typedef enum
#define CS_RED_GROUP 16 //!< used to send down what the group the red team is
#define CS_BLUE_GROUP 17 //!< used to send down what the group the blue team is
/** shader remapping info */
#ifdef XTRA
#define CS_SHADERSTATE 18
#endif
#define CS_ITEMS 27 //!< string of 0's and 1's that tell which items are present
//TiM: Ooooh! a gap between 27 + 32! Exploitationism!

View file

@ -773,6 +773,110 @@ given a race name, go find all the skins that use it, and randomly select one
/**
* given a race name, go find all the skins that use it, and randomly select one
*/
#ifdef Q3_VM
void randomSkin(const char* race, char* model, int current_team, int clientNum)
{
char skinsForRace[MAX_SKINS_FOR_RACE][128];
int howManySkins = 0;
int i,x;
int temp;
int skin_count_check;
char skinNamesAlreadyUsed[16][128];
int current_skin_count = 0;
gentity_t *ent = NULL;
char userinfo[MAX_INFO_STRING];
char temp_model[MAX_QPATH];
memset(skinsForRace, 0, sizeof(skinsForRace));
memset(skinNamesAlreadyUsed, 0, sizeof(skinNamesAlreadyUsed));
// first up, check to see if we want to select a skin from someone that's already playing on this guys team
skin_count_check = g_random_skin_limit.integer;
if (skin_count_check)
{
// sanity check the skins to compare against count
if (skin_count_check > 16)
{
skin_count_check = 16;
}
// now construct an array of the names already used
for (i=0; i<g_maxclients.integer; i++)
{
// did we find enough skins to grab a random one from yet?
if (current_skin_count == skin_count_check)
{
break;
}
ent = g_entities + i;
if (!ent->inuse || i == clientNum)
continue;
// no, so look at the next one, and see if it's in the list we are constructing
// same team?
if (ent->client && ent->client->sess.sessionTeam == current_team)
{
// so what's this clients model then?
trap_GetUserinfo( i, userinfo, sizeof( userinfo ) );
Q_strncpyz( temp_model, Info_ValueForKey (userinfo, "model"), sizeof( temp_model ) );
// check the name
for (x = 0; x< current_skin_count; x++)
{
// are we the same?
if (!Q_stricmp(skinNamesAlreadyUsed[x], temp_model))
{
// yeah - ok we already got this one
break;
}
}
// ok, did we match anything?
if (x == current_skin_count)
{
// no - better add this name in
Q_strncpyz(skinNamesAlreadyUsed[current_skin_count], temp_model, sizeof(skinNamesAlreadyUsed[current_skin_count]));
current_skin_count++;
}
}
}
// ok, array constructed. Did we get enough?
if (current_skin_count >= skin_count_check)
{
// yeah, we did - so select a skin from one of these then
temp = rand() % current_skin_count;
Q_strncpyz( model, skinNamesAlreadyUsed[temp], MAX_QPATH );
ForceClientSkin(model, "");
return;
}
}
// search through each and every skin we can find
for (i=0; i<group_count && howManySkins < MAX_SKINS_FOR_RACE; i++)
{
// if this models race list contains the race we want, then add it to the list
if (legalSkin(group_list[i].text, race))
{
Q_strncpyz( skinsForRace[howManySkins++], group_list[i].name , 128 );
}
}
// set model to a random one
if (howManySkins)
{
temp = rand() % howManySkins;
Q_strncpyz( model, skinsForRace[temp], MAX_QPATH );
}
else
{
model[0] = 0;
}
}
#else
void randomSkin(const char* race, char* model, int current_team, int clientNum)
{
char **skinsForRace;
@ -898,6 +1002,7 @@ void randomSkin(const char* race, char* model, int current_team, int clientNum)
free(skinNamesAlreadyUsed);
}
#endif
/*
===========
@ -1845,12 +1950,13 @@ void ClientBegin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qbool
}
/* TODO remove me? */
#ifdef XTRA
if(sql_use.integer) {
int key = (byte)irandom(4096, 65535);
ent->client->sqlkey = (byte)key;
trap_SendServerCommand(ent-g_entities, va("sqlkey \"%i\"", key));
}
#endif
}
// WEAPONS - PHENIX1

View file

@ -361,8 +361,10 @@ struct gentity_s {
//*core, // -->falsetarget
//*coreSwap; // -->bluename
#ifdef XTRA
char *targetShaderName; //!< shader to remap for shader remapping
char *targetShaderNewName; //!< shader to remap to for shader remapping
#endif
qboolean tmpEntity; //!< is this a temporal entity?
#ifdef G_LUA
@ -600,10 +602,12 @@ struct gclient_s {
qboolean *universalTrans;*/
languageData_t *languages;
#ifdef XTRA
// for sql
char *userName; //!< username (not player name) in the sql database
int uid; //!< uiser id of the player in the sql database
byte sqlkey; //!< random key used to make transmission of the username and password from the ui at least a bit safer
#endif
// CCAM
vec3_t origViewAngles;
@ -835,8 +839,9 @@ int G_GetEntityByTargetname(const char *targetname, gentity_t *entities[MAX_GENT
int G_GetEntityByTarget(const char *target, gentity_t *entities[MAX_GENTITIES]);
int G_GetEntityByBmodel(char *bmodel, gentity_t *entities[MAX_GENTITIES]);
/* shader remapping */
#ifdef XTRA
void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
#endif
//
// g_combat.c
@ -1541,7 +1546,7 @@ extern vmCvar_t rpg_server6;
// SP level change
extern vmCvar_t rpg_allowSPLevelChange;
/* TODO some can be removed */
#ifdef XTRA
extern vmCvar_t sql_dbName;
extern vmCvar_t sql_use;
extern vmCvar_t sql_server;
@ -1549,6 +1554,7 @@ extern vmCvar_t sql_user;
extern vmCvar_t sql_password;
extern vmCvar_t sql_port;
extern vmCvar_t sql_hash;
#endif
// developer tools
extern vmCvar_t dev_showTriggers;
@ -2030,10 +2036,12 @@ struct srvChangeData_s {
char bspname[16][MAX_QPATH];
};
#ifdef XTRA
/**
* Builds the config string for shader remapping.
*/
const char *BuildShaderStateConfig(void);
#endif
typedef struct luaAlertState_s luaAlertState_t;
struct luaAlertState_s {

View file

@ -338,7 +338,7 @@ vmCvar_t rpg_server6;
//! Allow target_levelchange to change the current level?
vmCvar_t rpg_allowSPLevelChange;
/* TODO some can be removed */
#ifdef XTRA
vmCvar_t sql_dbName; //!< Name of the SQL Database
vmCvar_t sql_use; //!< Use SQL? 1 = mysql, 2 = sqlite
vmCvar_t sql_server; //!< SQL server to connect to (only mysql)
@ -346,6 +346,7 @@ vmCvar_t sql_user; //!< SQL user for sql_server (only mysql)
vmCvar_t sql_password; //!< SQL password for sql_server (only mysql)
vmCvar_t sql_port; //!< SQL port to use to connect to sql_server (only mysql)
vmCvar_t sql_hash; //!< Specifies whether passwords should be hashed and what hash to use (only mysql)
#endif
// developer tools
vmCvar_t dev_showTriggers;
@ -612,7 +613,7 @@ static cvarTable_t gameCvarTable[] = {
{ &dev_showTriggers, "dev_showTriggers", "0", CVAR_ARCHIVE, 0, qfalse }
/* TODO some can be removed */
#ifdef XTRA
,
{ &sql_dbName, "sql_dbName", "rpgx", CVAR_ARCHIVE, 0, qfalse },
{ &sql_use, "sql_use", "0", CVAR_ARCHIVE, 0, qfalse },
@ -621,6 +622,7 @@ static cvarTable_t gameCvarTable[] = {
{ &sql_server, "sql_server", "", CVAR_ARCHIVE, 0, qfalse },
{ &sql_user, "sql_user", "rpgx", CVAR_ARCHIVE, 0, qfalse },
{ &sql_hash, "sql_hash", "0", CVAR_ARCHIVE, 0, qfalse }
#endif
#ifdef G_LUA
,
@ -786,6 +788,270 @@ and parses the class data
for utilization on the server
and transfer to clients
**************************/
#ifdef Q3_VM
static qboolean G_LoadClassData( char* fileName )
{
char buffer[32000];
char *textPtr, *token;
int fileLen;
fileHandle_t f;
qboolean classValid=qfalse;
int classIndex=0;
int weapon;
int i;
//Init the storage place
memset( &g_classData, 0, sizeof ( g_classData ) );
fileLen = trap_FS_FOpenFile( fileName, &f, FS_READ );
if ( !f ) {
G_Printf( S_COLOR_RED "ERROR: File %s not found.\n", fileName );
return qfalse;
}
if ( fileLen >= sizeof( buffer ) ) {
G_Printf( S_COLOR_RED "ERROR: File %s was way too big.\n", fileName );
trap_FS_FCloseFile( f );
return qfalse;
}
trap_FS_Read( buffer, fileLen, f );
buffer[fileLen] = 0;
trap_FS_FCloseFile( f );
COM_BeginParseSession();
textPtr = buffer;
token = COM_Parse( &textPtr );
if ( !token[0] ) {
G_Printf( S_COLOR_RED "ERROR: No data was found when going to parse the file!\n" );
return qfalse;
}
if ( Q_stricmpn( token, "{", 1 ) ) {
G_Printf( S_COLOR_RED "ERROR: File did not start with a '{' symbol!\n" );
return qfalse;
}
while ( 1 )
{
if ( classIndex >= MAX_CLASSES )
break;
if ( !Q_stricmpn( token, "{", 1 ) )
{
while ( 1 )
{
token = COM_Parse( &textPtr );
if (!token[0]) {
break;
}
if ( !Q_stricmpn( token, "consoleName", 11 ) )
{
if ( COM_ParseString( &textPtr, &token ) )
{
G_Printf( S_COLOR_RED "ERROR: Invalid class console name in class index: %i.\n", classIndex );
SkipBracedSection( &textPtr );
continue;
}
Q_strncpyz( g_classData[classIndex].consoleName, token, sizeof( g_classData[classIndex].consoleName ) );
classValid = qtrue;
//G_Printf( S_COLOR_RED "%s\n", g_classData[classIndex].consoleName );
continue;
}
if ( !Q_stricmpn( token, "formalName", 11 ) )
{
if ( COM_ParseString( &textPtr, &token ) )
{
G_Printf( S_COLOR_RED "ERROR: Invalid class formal name in class index: %i.\n", classIndex );
SkipBracedSection( &textPtr );
continue;
}
Q_strncpyz( g_classData[classIndex].formalName, token, sizeof( g_classData[classIndex].formalName ) );
classValid = qtrue;
//G_Printf( S_COLOR_RED "%s\n", g_classData[classIndex].consoleName );
continue;
}
if ( !Q_stricmpn( token, "message", 7 ) )
{
if ( COM_ParseString( &textPtr, &token ) )
{
G_Printf( S_COLOR_RED "ERROR: Invalid class message in class index: %i.\n", classIndex );
continue;
}
Q_strncpyz( g_classData[classIndex].message, token, sizeof( g_classData[classIndex].message ) );
continue;
}
if ( !Q_stricmpn( token, "modelSkin", 9 ) )
{
if ( COM_ParseString( &textPtr, &token ) )
{
G_Printf( S_COLOR_RED "ERROR: Invalid class skin color in class index: %i.\n", classIndex );
continue;
}
Q_strncpyz( g_classData[classIndex].modelSkin, token, sizeof( g_classData[classIndex].modelSkin ) );
continue;
}
if ( !Q_stricmpn( token, "weapons", 7) )
{
token = COM_Parse( &textPtr );
if ( Q_stricmpn( token, "{", 1 ) )
{
G_Printf( S_COLOR_RED "No opening bracket found for weapons field in class: %i.\n", classIndex );
SkipRestOfLine( &textPtr );
continue;
}
//sub loop
while ( 1 )
{
token = COM_Parse( &textPtr );
if ( !token[0] )
break;
if ( !Q_stricmpn( token, "|", 1 ) )
continue;
if ( !Q_stricmpn( token, "}", 1 ) )
break;
if( !Q_stricmpn( token, "WP_", 3 ) )
{
weapon = GetIDForString( WeaponTable, token );
if ( weapon >= 0 )
{
g_classData[classIndex].weaponsFlags |= ( 1 << weapon );
continue;
}
}
}
continue;
}
if ( !Q_stricmpn( token, "admin", 5 ) )
{
if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isAdmin ) )
{
G_Printf( S_COLOR_RED "ERROR: Class admin check for class %i was invalid.\n", classIndex );
continue;
}
continue;
}
if ( !Q_stricmpn( token, "marine", 6 ) )
{
if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMarine ) )
{
G_Printf( S_COLOR_RED "ERROR: Class marine check for class %i was invalid.\n", classIndex );
continue;
}
continue;
}
if ( !Q_stricmpn( token, "medical", 7 ) )
{
if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMedical ) )
{
G_Printf( S_COLOR_RED "ERROR: Class medic check for class %i was invalid.\n", classIndex );
continue;
}
continue;
}
if( !Q_stricmpn( token, "isBorg", 6 ) )
{
if( COM_ParseInt( &textPtr, &g_classData[classIndex].isBorg ) )
{
G_Printf( S_COLOR_RED "ERROR: Class borg check for class %i was invalid.\n", classIndex );
continue;
}
continue;
}
if ( !Q_stricmpn( token, "n00b", 4 ) )
{
if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isn00b ) )
{
G_Printf( S_COLOR_RED "ERROR: Class n00b check for class %i was invalid.\n", classIndex );
continue;
}
continue;
}
//skip the client-side specific entries since they interfere with the parsing
if ( !Q_stricmpn( token, "radarColor", 10 )
|| !Q_stricmpn( token, "iconColor", 9 )
|| !Q_stricmpn( token, "hasRanks", 8 )
|| !Q_stricmpn( token, "noShow", 6 )
)
{
SkipRestOfLine( &textPtr );
continue;
}
if ( !Q_stricmpn( token, "}", 1 ) )
{
break;
}
}
if ( classValid )
{
classIndex++;
classValid = qfalse;
}
}
token = COM_Parse( &textPtr );
if (!token[0])
{
break;
}
}
//build ourselves custom CVARs for each class
for ( i=0; g_classData[i].consoleName[0] && i < MAX_CLASSES; i++ )
{
trap_Cvar_Register( NULL, va("rpg_%sPass", g_classData[i].consoleName ), g_classData[i].consoleName, CVAR_ARCHIVE );
trap_Cvar_Register( NULL, va("rpg_%sFlags", g_classData[i].consoleName ), va("%i", g_classData[i].weaponsFlags), CVAR_ARCHIVE );
}
if ( classIndex > 0 )
{
return qtrue;
}
else
{
G_Printf( S_COLOR_RED "ERROR: No valid classes were found.\n");
return qfalse;
}
}
#else
static qboolean G_LoadClassData( char* fileName )
{
char *buffer;
@ -1060,12 +1326,137 @@ static qboolean G_LoadClassData( char* fileName )
return qfalse;
}
}
#endif
void BG_LanguageFilename(char *baseName,char *baseExtension,char *finalName);
void SP_target_location (gentity_t *ent);
holoData_t holoData;
#ifdef Q3_VM
void G_LoadHolodeckFile(void) {
char fileRoute[MAX_QPATH];
char mapRoute[MAX_QPATH];
char info[MAX_INFO_STRING];
fileHandle_t f;
char buffer[20000];
int file_len;
char *txtPtr, *token;
int numProgs = 0;
int i;
//get the map name out of the server data
trap_GetServerinfo( info, sizeof( info ) );
//setup the file route
Com_sprintf( mapRoute, sizeof( mapRoute ), "maps/%s", Info_ValueForKey( info, "mapname" ) );
BG_LanguageFilename( mapRoute, "holodeck", fileRoute );
file_len = trap_FS_FOpenFile( fileRoute, &f, FS_READ );
if ( !file_len )
return;
memset( buffer, 0, sizeof(buffer) );
trap_FS_Read( buffer, file_len, f );
if ( !buffer[0] )
{
G_Printf( S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute );
trap_FS_FCloseFile( f );
return;
}
buffer[file_len] = '\0';
trap_FS_FCloseFile( f );
COM_BeginParseSession();
txtPtr = buffer;
while(1) {
token = COM_Parse(&txtPtr);
if(!token[0]) break;
if(!Q_stricmpn(token, "HolodeckData", 12)) {
token = COM_Parse(&txtPtr);
if(Q_stricmpn(token, "{", 1)) {
G_Printf( S_COLOR_RED "ERROR: HolodeckData had no opening brace ( { )!\n");
continue;
}
while(Q_stricmpn(token, "}", 1)) {
token = COM_Parse(&txtPtr);
if(!token[0]) break;
if(!Q_stricmpn(token, "Program", 7)) {
token = COM_Parse(&txtPtr);
if(Q_stricmpn(token, "[", 1)) {
G_Printf( S_COLOR_RED "ERROR: Program had no opening brace ( [ )!\n");
continue;
}
// expected format:
// <string> - target notnull
// <string> - name
// <string> - desc1
// <string> - desc2
// <string> - image
// <string> - iTrigger
// <string> - dTrigger
while(Q_stricmpn(token, "]", 1)) {
if(!token[0]) break;
if(numProgs >= 5) return;
// targetname of info_notnull
token = COM_Parse(&txtPtr);
Q_strncpyz(holoData.target[numProgs], token, sizeof(holoData.target[numProgs]));
// parse name
token = COM_Parse(&txtPtr);
Q_strncpyz(holoData.name[numProgs], token, sizeof(holoData.name[numProgs]));
// parse desc1
token = COM_Parse(&txtPtr);
Q_strncpyz(holoData.desc1[numProgs], token, sizeof(holoData.desc1[numProgs]));
// parse desc2
token = COM_Parse(&txtPtr);
Q_strncpyz(holoData.desc2[numProgs], token, sizeof(holoData.desc2[numProgs]));
// parse image
token = COM_Parse(&txtPtr);
Q_strncpyz(holoData.image[numProgs], token, sizeof(holoData.image[numProgs]));
// parse iTrigger
token = COM_Parse(&txtPtr);
Q_strncpyz(holoData.iTrigger[numProgs+1], token, sizeof(holoData.iTrigger[numProgs+1]));
// parse dTrigger
token = COM_Parse(&txtPtr);
Q_strncpyz(holoData.dTrigger[numProgs+1], token, sizeof(holoData.dTrigger[numProgs+1]));
holoData.active = -1;
numProgs++;
token = COM_Parse(&txtPtr);
}
}
}
}
}
for(i = 0; i < MAX_GENTITIES; i++)
if(!strcmp("target_holodeck", &g_entities[i]->classname)) {
strcpy(holoData.iTrigger[0], &g_entities[i]->target);
strcpy(holoData.dTrigger[0], &g_entities[i]->redsound);
break;
}
holoData.numProgs = numProgs;
}
#else
void G_LoadHolodeckFile(void) {
char fileRoute[MAX_QPATH];
char mapRoute[MAX_QPATH];
@ -1191,9 +1582,107 @@ void G_LoadHolodeckFile(void) {
free(buffer);
}
#endif
srvChangeData_t srvChangeData;
#ifdef Q3_VM
static void G_LoadServerChangeFile(void) {
char fileRoute[MAX_QPATH];
//char mapRoute[MAX_QPATH];
char infoString[MAX_INFO_STRING];
fileHandle_t f;
char buffer[20000];
int file_len;
char *txtPtr, *token;
char *temp;
int cnt = 0;
int i = 0;
BG_LanguageFilename("serverchange", "cfg", fileRoute);
file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ);
if(!file_len)
return;
memset(buffer, 0, sizeof(buffer));
memset(infoString, 0, sizeof(infoString));
trap_FS_Read(buffer, file_len, f);
if ( !buffer[0] )
{
G_Printf( S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute );
trap_FS_FCloseFile( f );
return;
}
buffer[file_len] = '\0';
trap_FS_FCloseFile(f);
COM_BeginParseSession();
txtPtr = buffer;
while(1) {
token = COM_Parse(&txtPtr);
if(!token[0]) break;
if(!Q_stricmp(token, "ServerChangeConfig")) {
token = COM_Parse( &txtPtr );
if ( Q_strncmp( token, "{", 1 ) != 0 )
{
G_Printf( S_COLOR_RED "ERROR: ServerChangeConfig had no opening brace ( { )!\n" );
continue;
}
while(Q_strncmp(token, "}", 1)) {
token = COM_Parse(&txtPtr);
if(!token[0]) break;
if(!Q_stricmp(token, "Server")) {
token = COM_Parse(&txtPtr);
if ( Q_strncmp( token, "[", 1 ) != 0 )
{
G_Printf( S_COLOR_RED "ERROR: Server had no opening brace ( [ )!\n" );
continue;
}
token = COM_Parse(&txtPtr);
while(Q_strncmp(token, "]", 1)) {
if(!token[0]) break;
if(cnt > 12) break;
temp = G_NewString(token);
/*if(!infoString[0])
Com_sprintf(infoString, sizeof(infoString), "i%i\\%s\\", cnt, temp);
else {
if(cnt % 2 == 0)
Com_sprintf(infoString, sizeof(infoString), "%si%i\\%s\\", infoString, i, temp);
else
Com_sprintf(infoString, sizeof(infoString), "%sd%i\\%s\\", infoString, i, temp);
}*/
if(cnt % 2 == 0)
Q_strncpyz(srvChangeData.ip[i], token, sizeof(srvChangeData.ip[i]));
else
Q_strncpyz(srvChangeData.name[i], token, sizeof(srvChangeData.name[i]));
cnt++;
if(cnt % 2 == 0)
i++;
token = COM_Parse(&txtPtr);
}
}
}
}
}
//trap_SetConfigstring(CS_SERVERCHANGE, infoString);
}
#else
static void G_LoadServerChangeFile(void) {
char fileRoute[MAX_QPATH];
//char mapRoute[MAX_QPATH];
@ -1296,9 +1785,107 @@ static void G_LoadServerChangeFile(void) {
free(buffer);
//trap_SetConfigstring(CS_SERVERCHANGE, infoString);
}
#endif
mapChangeData_t mapChangeData;
#ifdef Q3_VM
static void G_LoadMapChangeFile(void) {
char fileRoute[MAX_QPATH];
//char mapRoute[MAX_QPATH];
char infoString[MAX_INFO_STRING];
fileHandle_t f;
char buffer[20000];
int file_len;
char *txtPtr, *token;
char *temp;
int cnt = 0;
int i = 0;
BG_LanguageFilename("mapchange", "cfg", fileRoute);
file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ);
if(!file_len)
return;
memset(buffer, 0, sizeof(buffer));
memset(infoString, 0, sizeof(infoString));
trap_FS_Read(buffer, file_len, f);
if ( !buffer[0] )
{
G_Printf( S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute );
trap_FS_FCloseFile( f );
return;
}
buffer[file_len] = '\0';
trap_FS_FCloseFile(f);
COM_BeginParseSession();
txtPtr = buffer;
while(1) {
token = COM_Parse(&txtPtr);
if(!token[0]) break;
if(!Q_stricmp(token, "MapChangeConfig")) {
token = COM_Parse( &txtPtr );
if ( Q_strncmp( token, "{", 1 ) != 0 )
{
G_Printf( S_COLOR_RED "ERROR: MapChangeConfig had no opening brace ( { )!\n" );
continue;
}
while(Q_strncmp(token, "}", 1)) {
token = COM_Parse(&txtPtr);
if(!token[0]) break;
if(!Q_stricmp(token, "Map")) {
token = COM_Parse(&txtPtr);
if ( Q_strncmp( token, "[", 1 ) != 0 )
{
G_Printf( S_COLOR_RED "ERROR: Server had no opening brace ( [ )!\n" );
continue;
}
token = COM_Parse(&txtPtr);
while(Q_strncmp(token, "]", 1)) {
if(!token[0]) break;
if(cnt > 12) break;
temp = G_NewString(token);
/*if(!infoString[0])
Com_sprintf(infoString, sizeof(infoString), "i%i\\%s\\", cnt, temp);
else {
if(cnt % 2 == 0)
Com_sprintf(infoString, sizeof(infoString), "%si%i\\%s\\", infoString, i, temp);
else
Com_sprintf(infoString, sizeof(infoString), "%sd%i\\%s\\", infoString, i, temp);
}*/
if(cnt % 2 == 0)
Q_strncpyz(mapChangeData.name[i], token, sizeof(mapChangeData.name[i]));
else
Q_strncpyz(mapChangeData.bspname[i], token, sizeof(mapChangeData.bspname[i]));
cnt++;
if(cnt % 2 == 0)
i++;
token = COM_Parse(&txtPtr);
}
}
}
}
}
//trap_SetConfigstring(CS_SERVERCHANGE, infoString);
}
#else
static void G_LoadMapChangeFile(void) {
char fileRoute[MAX_QPATH];
//char mapRoute[MAX_QPATH];
@ -1401,7 +1988,213 @@ static void G_LoadMapChangeFile(void) {
free(buffer);
//trap_SetConfigstring(CS_SERVERCHANGE, infoString);
}
#endif
#ifdef Q3_VM
static void G_LoadLocationsFile( void )
{
char fileRoute[MAX_QPATH];
char mapRoute[MAX_QPATH];
char serverInfo[MAX_TOKEN_CHARS];
fileHandle_t f;
char buffer[20000];
int file_len;
char *textPtr, *token;
vec3_t origin, angles;
gentity_t *ent;
char *desc;
int rest;
//get the map name out of the server data
trap_GetServerinfo( serverInfo, sizeof( serverInfo ) );
//setup the file route
Com_sprintf( mapRoute, sizeof( mapRoute ), "maps/%s", Info_ValueForKey( serverInfo, "mapname" ) );
BG_LanguageFilename( mapRoute, "locations", fileRoute );
file_len = trap_FS_FOpenFile( fileRoute, &f, FS_READ );
if ( !file_len )
return;
memset( buffer, 0, sizeof(buffer) );
trap_FS_Read( buffer, file_len, f );
if ( !buffer[0] )
{
G_Printf( S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute );
trap_FS_FCloseFile( f );
return;
}
buffer[file_len] = '\0';
trap_FS_FCloseFile( f );
G_Printf( "Locations file %s located. Proceeding to load scan data.\n", fileRoute ); //GSIO01: why did this say "Usables file ..."? lol
COM_BeginParseSession();
textPtr = buffer;
while( 1 )
{
token = COM_Parse( &textPtr );
if ( !token[0] )
break;
if(!Q_strncmp( token, "LocationsList2", 19 )) { // new style locations list with restricted locations
token = COM_Parse( &textPtr );
if ( Q_strncmp( token, "{", 1 ) != 0 )
{
G_Printf( S_COLOR_RED "ERROR: LocationsList2 had no opening brace ( { )!\n", fileRoute );
continue;
}
//expected format is "<origin> <angle> <int> <string>"
while ( Q_strncmp( token, "}", 1 ) )
{
if ( !token[0] )
break;
//Parse origin
if ( COM_ParseVec3( &textPtr, origin ) )
{
G_Printf( S_COLOR_RED "Invalid origin entry in %s!\n", fileRoute );
return;
}
//Parse angles
if ( COM_ParseVec3( &textPtr, angles ) )
{
G_Printf( S_COLOR_RED "Invalid origin entry in %s!\n", fileRoute );
return;
}
//Pars restriction value
if( COM_ParseInt( &textPtr, &rest ) )
{
G_Printf( S_COLOR_RED "Invalid restriction entry in %s!\n", fileRoute );
return;
}
//Parse Location string
token = COM_ParseExt( &textPtr, qfalse );
if ( !token[0] )
{
G_Printf( S_COLOR_RED "Invalid string desc entry in %s!\n", fileRoute );
return;
}
desc = token;
//create a new entity
ent = G_Spawn();
if ( !ent )
{
G_Printf( S_COLOR_RED "Couldn't create entity in %s!\n", fileRoute );
return;
}
ent->classname = "target_location";
//copy position data
VectorCopy( origin, ent->s.origin );
VectorCopy( angles, ent->s.angles );
//copy string
ent->message = G_NewString( desc );
//copy desc into target as well
ent->target = ent->targetname = G_NewString( desc );
// copy restriction value
ent->sound1to2 = rest;
//G_Printf( S_COLOR_RED "Added string %s to entity %i.\n", ent->message, (int)(ent-g_entities) );
//initiate it as a location ent
SP_target_location( ent );
//reset the ent
ent = NULL;
//--
token = COM_Parse( &textPtr );
}
} else if ( !Q_strncmp( token, "LocationsList", 18 ) ) // old stly locations file
{
token = COM_Parse( &textPtr );
if ( Q_strncmp( token, "{", 1 ) != 0 )
{
G_Printf( S_COLOR_RED "ERROR: LocationsList had no opening brace ( { )!\n", fileRoute );
continue;
}
//expected format is "<origin> <angle> <string>"
while ( Q_strncmp( token, "}", 1 ) )
{
if ( !token[0] )
break;
//Parse origin
if ( COM_ParseVec3( &textPtr, origin ) )
{
G_Printf( S_COLOR_RED "Invalid origin entry in %s!\n", fileRoute );
return;
}
//Parse angles
if ( COM_ParseVec3( &textPtr, angles ) )
{
G_Printf( S_COLOR_RED "Invalid origin entry in %s!\n", fileRoute );
return;
}
//Parse Location string
token = COM_ParseExt( &textPtr, qfalse );
if ( !token[0] )
{
G_Printf( S_COLOR_RED "Invalid string desc entry in %s!\n", fileRoute );
return;
}
desc = token;
//create a new entity
ent = G_Spawn();
if ( !ent )
{
G_Printf( S_COLOR_RED "Couldn't create entity in %s!\n", fileRoute );
return;
}
ent->classname = "target_location";
//copy position data
VectorCopy( origin, ent->s.origin );
VectorCopy( angles, ent->s.angles );
//copy string
ent->message = G_NewString( desc );
//copy desc into target as well
ent->target = ent->targetname = G_NewString( desc );
//G_Printf( S_COLOR_RED "Added string %s to entity %i.\n", ent->message, (int)(ent-g_entities) );
//initiate it as a location ent
SP_target_location( ent );
//reset the ent
ent = NULL;
//--
token = COM_Parse( &textPtr );
}
}
}
}
#else
static void G_LoadLocationsFile( void )
{
char fileRoute[MAX_QPATH];
@ -1630,6 +2423,7 @@ static void G_LoadLocationsFile( void )
free(buffer);
}
#endif
/*void G_initGroupsList(void)
{

View file

@ -183,8 +183,9 @@ void SP_target_warp(gentity_t *ent); //RPG-X | GSIO01 | 19/05/2009
void SP_target_deactivate(gentity_t *ent);
void SP_target_serverchange(gentity_t *ent);
void SP_target_levelchange(gentity_t *ent);
/* shader remap */
#ifdef XTRA
void SP_target_shaderremap(gentity_t *ent);
#endif
void SP_light (gentity_t *self);
void SP_info_null (gentity_t *self);
@ -387,8 +388,9 @@ spawn_t spawns[] = {
{"target_deactivate", SP_target_deactivate},
{"target_serverchange", SP_target_serverchange},
{"target_levelchange", SP_target_levelchange},
/* shader remap */
#ifdef XTRA
{"target_shaderremap", SP_target_shaderremap},
#endif
{"light", SP_light},
{"path_corner", SP_path_corner},

View file

@ -960,7 +960,10 @@ static void target_turbolift_endMove ( gentity_t *ent )
gentity_t* lights=NULL;
gentity_t* otherLift=NULL;
//gentity_t* tent=NULL;
#ifdef XTRA
float f = 0;
#endif
otherLift = &g_entities[ent->count];
if ( !otherLift )
@ -1060,7 +1063,8 @@ static void target_turbolift_endMove ( gentity_t *ent )
}
}
/* check for shader remaps */
#ifdef XTRA
// check for shader remaps
if(rpg_calcLiftTravelDuration.integer) {
if((ent->truename && otherLift->truename) || (ent->falsename && otherLift->falsename)) {
f = level.time * 0.001;
@ -1069,6 +1073,7 @@ static void target_turbolift_endMove ( gentity_t *ent )
}
trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig());
}
#endif
//next phase, teleport player
ent->nextthink = level.time + ent->sound1to2;
@ -1119,6 +1124,65 @@ static void TeleportPlayers ( gentity_t* ent, gentity_t* targetLift, int numEnts
}
}
#ifdef Q3_VM
static void target_turbolift_TeleportPlayers ( gentity_t *ent )
{
gentity_t *targetLift;
vec3_t mins, maxs;
float time;
//store both sets of data so they can be swapped at the same time
int liftTouch[MAX_GENTITIES];
int targetLiftTouch[MAX_GENTITIES];
int liftNumEnts;
int targetLiftNumEnts;
//teleport the players
targetLift = &g_entities[ent->count];
if ( !targetLift ) {
target_turbolift_unlock( ent );
return;
}
//scan the turbo region for players
//in the current lift
{
VectorCopy( ent->r.maxs, maxs );
VectorCopy( ent->r.mins, mins );
liftNumEnts = trap_EntitiesInBox( mins, maxs, liftTouch, MAX_GENTITIES );
}
//the target lift
{
VectorCopy( targetLift->r.maxs, maxs );
VectorCopy( targetLift->r.mins, mins );
targetLiftNumEnts = trap_EntitiesInBox( mins, maxs, targetLiftTouch, MAX_GENTITIES );
}
//TiM - Teleport the players from the other target to this one
TeleportPlayers( targetLift, ent, targetLiftNumEnts, targetLiftTouch );
//TiM - Teleport the main players
TeleportPlayers( ent, targetLift, liftNumEnts, liftTouch );
if(rpg_calcLiftTravelDuration.integer) {
time = targetLift->health - ent->health;
if(time < 0)
time *= -1;
time *= rpg_liftDurationModifier.value;
time *= 1000;
ent->think = target_turbolift_endMove;
ent->nextthink = level.time + (time * 0.5f);
} else {
//first thing's first
ent->think = target_turbolift_endMove;
ent->nextthink = level.time + (ent->wait*0.5f);
}
}
#else
static void target_turbolift_TeleportPlayers ( gentity_t *ent )
{
gentity_t *targetLift;
@ -1202,6 +1266,8 @@ static void target_turbolift_TeleportPlayers ( gentity_t *ent )
free(liftTouch);
free(targetLiftTouch);
}
#endif
static void target_turbolift_startSoundEnd(gentity_t *ent) {
ent->nextthink = -1;
@ -1215,7 +1281,10 @@ static void target_turbolift_startMove ( gentity_t *ent )
gentity_t* otherLift=NULL;
gentity_t* tent=NULL;
float time = 0, time2 = 0;
#ifdef XTRA
float f = 0;
#endif
otherLift = &g_entities[ent->count];
if ( !otherLift )
@ -1330,6 +1399,7 @@ static void target_turbolift_startMove ( gentity_t *ent )
}
}
#ifdef XTRA
// check for shader remaps
if(rpg_calcLiftTravelDuration.integer) {
if(time2 < 0 && ent->truename && otherLift->truename) {
@ -1343,6 +1413,7 @@ static void target_turbolift_startMove ( gentity_t *ent )
}
trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig());
}
#endif
if(rpg_calcLiftTravelDuration.integer) {
/*time = ent->health - otherLift->health;
@ -1695,6 +1766,295 @@ void SP_target_doorLock(gentity_t *ent) {
}
//RPG-X | GSIO01 | 11/05/2009 | MOD START
#ifndef XTRA
/*QUAKED target_alert (1 0 0) (-8 -8 -8) (8 8 8) SOUND_TOGGLE SOUND_OFF
This entity acts like 3-Alert-Conditions scripts.
Any of the func_usables that are used as buttons must have the NO_ACTIVATOR spawnflag.
SOUND_TOGGLE if set the alert sound can be toggled on/off by using the alerts trigger again.
SOUND_OFF if SOUND_TOGGLE is set, the alert will be silent at beginning
"greenname" the trigger for green alert should target this
"yellowname" the trigger for yellow alert should target this
"redname" the trigger for red alert should target this
"bluename" the trigger for blue alert should target this
"greentarget" anything that should be toggled when activating green alert
"yellowtarget" anything that should be toggled when activating yellow alert
"redtarget" anything that should be toggled when activating red alert
"bluetarget" anything that should be toggled when activating blue alert
"greensnd" targetname of target_speaker with sound for green alert
"yellowsnd" targetname of target_speaker with sound for yellow alert
"redsnd" targetname of target_speaker with sound for red alert
"bluesnd" targetname of target_speaker with sound for blue alert
*/
void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
if(!Q_stricmp(activator->target, ent->swapname)) {
if(ent->damage == 0) {
if(ent->spawnflags & 1) {
ent->health = !ent->health;
ent->target = ent->greensound;
G_UseTargets(ent, ent);
}
} else {
switch(ent->damage) {
case 1: // yellow
if(ent->health) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->falsetarget;
G_UseTargets(ent, ent);
break;
case 2: // red
if(ent->health) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->paintarget;
G_UseTargets(ent, ent);
break;
case 3: // blue
if(ent->health) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->targetname2;
G_UseTargets(ent, ent);
break;
}
if(!ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
} else if(ent->spawnflags & 2) {
ent->health = 0;
} else {
if(ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
ent->health = 1;
}
}
ent->target = ent->truetarget;
G_UseTargets(ent, ent);
ent->damage = 0;
}
} else if(!Q_stricmp(activator->target, ent->truename)) {
if(ent->damage == 1) {
if(ent->spawnflags & 1) {
ent->health = !ent->health;
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
}
} else {
switch(ent->damage) {
case 0: // green
if(ent->health) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->truetarget;
G_UseTargets(ent, ent);
break;
case 2: // red
if(ent->health) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->paintarget;
G_UseTargets(ent, ent);
break;
case 3: // blue
if(ent->health) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->targetname2;
G_UseTargets(ent, ent);
break;
}
if(!ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
} else if(ent->spawnflags & 2) {
ent->health = 0;
} else {
if(ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
ent->health = 1;
}
}
ent->target = ent->falsetarget;
G_UseTargets(ent, ent);
ent->damage = 1;
}
} else if(!Q_stricmp(activator->target, ent->falsename)) {
if(ent->damage == 2) {
if(ent->spawnflags & 1) {
ent->health = !ent->health;
ent->target = ent->redsound;
G_UseTargets(ent, ent);
}
} else {
switch(ent->damage) {
case 0: // green
if(ent->health) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->truetarget;
G_UseTargets(ent, ent);
break;
case 1: // ryellow
if(ent->health) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->falsetarget;
G_UseTargets(ent, ent);
break;
case 3: // blue
if(ent->health) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->targetname2;
G_UseTargets(ent, ent);
break;
}
if(!ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
} else if(ent->spawnflags & 2) {
ent->health = 0;
} else {
if(ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
ent->health = 1;
}
}
ent->target = ent->paintarget;
G_UseTargets(ent, ent);
ent->damage = 2;
}
} if(!Q_stricmp(activator->target, ent->bluename)) {
if(ent->damage == 3) {
if(ent->spawnflags & 1) {
ent->health = !ent->health;
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
}
} else {
switch(ent->damage) {
case 0: // green
if(ent->health) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->truetarget;
G_UseTargets(ent, ent);
break;
case 1: // yellow
if(ent->health) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->falsetarget;
G_UseTargets(ent, ent);
break;
case 2: // red
if(ent->health) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->paintarget;
G_UseTargets(ent, ent);
break;
}
if(!ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
} else if(ent->spawnflags & 2) {
ent->health = 0;
} else {
if(ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
ent->health = 1;
}
}
ent->target = ent->targetname2;
G_UseTargets(ent, ent);
ent->damage = 3;
}
}
// Free activator if no classname <-- alert command
if(!activator->classname)
G_FreeEntity(activator);
}
#else
/*QUAKED target_alert (1 0 0) (-8 -8 -8) (8 8 8) SOUND_TOGGLE SOUND_OFF
This entity acts like 3-Alert-Conditions scripts.
@ -2051,7 +2411,9 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
if(!activator->classname)
G_FreeEntity(activator);
}
#endif
#ifdef XTRA
void target_alert_parseShaders(gentity_t *ent) {
char buffer[BIG_INFO_STRING];
char *txtPtr;
@ -2133,6 +2495,7 @@ void target_alert_parseShaders(gentity_t *ent) {
}
}
}
#endif
void SP_target_alert(gentity_t *ent) {
//int errorNum = 0;
@ -2154,6 +2517,7 @@ void SP_target_alert(gentity_t *ent) {
G_SpawnString("bluetarget", "", &temp);
ent->targetname2 = G_NewString(temp);
#ifdef XTRA
if(G_SpawnString("greenshader", "", &temp))
ent->message = G_NewString(temp);
if(G_SpawnString("yellowshader", "", &temp))
@ -2164,6 +2528,7 @@ void SP_target_alert(gentity_t *ent) {
ent->model2 = G_NewString(temp);
target_alert_parseShaders(ent);
#endif
if(!ent->swapname || !ent->truename || !ent->falsename || !ent->bluename ||
!ent->truetarget || !ent->falsetarget || !ent->paintarget || !ent->targetname2) {
@ -2513,6 +2878,7 @@ void SP_target_holodeck(gentity_t *ent) {
}
//RPG-X | Harry Young | 15/10/2011 | MOD START
#ifdef XTRA
/*QUAKED target_shaderremap (1 0 0) (-8 -8 -8) (8 8 8)
This will remap the shader "falsename" with shader "truename" and vice versa.
It will save you some vfx-usables.
@ -2556,4 +2922,5 @@ void SP_target_shaderremap(gentity_t *ent) {
ent->use = target_shaderremap_use;
}
#endif
//RPG-X | Harry Young | 15/10/2011 | MOD END

View file

@ -49,12 +49,14 @@ void func_usable_think( gentity_t *self )
void func_usable_use (gentity_t *self, gentity_t *other, gentity_t *activator)
{//Toggle on and off
#ifdef XTRA
//Remap shader
if(self->targetShaderName && self->targetShaderNewName) {
float f = level.time * 0.001;
AddRemap(self->targetShaderName, self->targetShaderNewName, f);
trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig());
}
#endif
//RPG-X | GSIO01 | 09/05/2009:
@ -308,6 +310,139 @@ G_LoadMapConfigurations
* \return sucessfully loaded?
* \author Ubergames - TiM
*/
#ifdef Q3_VM
qboolean G_SetupUsablesStrings( void )
{
char serverInfo[MAX_TOKEN_CHARS];
char fileRoute[MAX_QPATH];
char buffer[20000];
int file_len;
char *textPtr, *token;
fileHandle_t f;
int i, j;
level.hasScannableFile = qfalse;
level.hasEntScannableFile = qfalse;
//get the map name out of the server data
trap_GetServerinfo( serverInfo, sizeof( serverInfo ) );
//setup the file route
Com_sprintf( fileRoute, sizeof( fileRoute ), "maps/%s.usables", Info_ValueForKey( serverInfo, "mapname" ) );
file_len = trap_FS_FOpenFile( fileRoute, &f, FS_READ );
//It's assumed most maps won't have this feature, so just exit 'gracefully'
if ( file_len<=1 )
{
trap_FS_FCloseFile( f );
//G_Printf( S_COLOR_YELLOW "WARNING: No file named %s was found.\n", fileRoute );
return qfalse;
}
//fill the buffer with the file data
memset( &buffer, 0, sizeof( buffer ) );
trap_FS_Read( buffer, file_len, f );
buffer[file_len] = '0';
trap_FS_FCloseFile( f );
if ( !buffer[0] )
{
G_Printf( S_COLOR_RED "ERROR: Attempted to load %s, but no data was inside!\n", fileRoute );
return qfalse;
}
G_Printf( "Usables file %s located. Proceeding to load scan data.\n", fileRoute );
COM_BeginParseSession();
textPtr = buffer;
i = 0; //used for the main arrays indices
while( 1 )
{
token = COM_Parse( &textPtr );
if ( !token[0] )
break;
if ( !Q_strncmp( token, "UsableDescriptions", 18 ) )
{
token = COM_Parse( &textPtr );
if ( Q_strncmp( token, "{", 1 ) != 0 )
{
G_Printf( S_COLOR_RED "ERROR: UsableDescriptions had no opening brace ( { )!\n", fileRoute );
continue;
}
level.hasScannableFile = qtrue;
token = COM_Parse( &textPtr );
//expected format is 'id' <space> 'string'
while ( Q_strncmp( token, "}", 1 ) )
{
if ( !token[0] )
break;
if ( !Q_strncmp( token, "UsableEntities", 14 ) )
{
token = COM_Parse( &textPtr );
if ( Q_strncmp( token, "{", 1 ) )
{
G_Printf( S_COLOR_RED "ERROR: UsableEntities had no opening brace ( { )!\n", fileRoute );
continue;
}
level.hasEntScannableFile = qtrue;
token = COM_Parse( &textPtr );
j = 0;
while( Q_strncmp( token, "}", 1 ) )
{
if ( !token[0] )
break;
if ( token[0] != 'e' )
{
SkipRestOfLine( &textPtr );
continue;
}
token++; //skip the 'e'
level.g_entScannables[j][0] = atoi( token );
token = COM_ParseExt( &textPtr, qfalse );
level.g_entScannables[j][1] = atoi( token );
//there's no way clients are scannable in here, so just validate the entry b4 proceeding
if ( level.g_entScannables[j][0] > MAX_CLIENTS-1 && level.g_entScannables[j][1] > 0 )
j++;
token = COM_Parse( &textPtr );
}
}
else
{
level.g_scannables[i] = atoi( token );
//ensure a valid number was passed, else ignore it
if ( level.g_scannables[i] > 0 )
i++;
//we don't need the text on the server side
SkipRestOfLine( &textPtr );
token = COM_Parse( &textPtr );
}
}
}
}
return qtrue;
}
#else
qboolean G_SetupUsablesStrings( void )
{
char *serverInfo;
@ -453,5 +588,5 @@ qboolean G_SetupUsablesStrings( void )
free(buffer);
return qtrue;
}
#endif

View file

@ -4,6 +4,7 @@
#include "g_local.h"
#ifdef XTRA
typedef struct {
char oldShader[MAX_QPATH];
char newShader[MAX_QPATH];
@ -46,6 +47,7 @@ const char *BuildShaderStateConfig(void) {
}
return buff;
}
#endif
/*
=========================================================================
@ -334,11 +336,13 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) {
return;
}
#ifdef XTRA
if (ent->targetShaderName && ent->targetShaderNewName) {
float f = level.time * 0.001;
AddRemap(ent->targetShaderName, ent->targetShaderNewName, f);
trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig());
}
#endif
if ( !target ) {
return;

View file

@ -905,6 +905,26 @@ char *Q_CleanStr( char *string ) {
return string;
}
#ifdef Q3_VM
void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
int len;
va_list argptr;
char bigbuffer[32000]; /* big, but small enough to fit in PPC stack */
va_start (argptr,fmt);
len = vsprintf (bigbuffer,fmt,argptr);
va_end (argptr);
if ( len >= sizeof( bigbuffer ) ) {
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
}
if (len >= size) {
Com_Printf ("Com_sprintf: overflow of %i in %i\n", len, size);
Com_Printf("Fmt: %s\n", fmt);
Com_Printf("BigBuffer: %s\n", bigbuffer);
}
Q_strncpyz (dest, bigbuffer, size );
}
#else
void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
int len;
va_list argptr;
@ -933,6 +953,7 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
}
Q_strncpyz (dest, bigbuffer, size );
}
#endif
/*
============

View file

@ -53,13 +53,16 @@
**********************************************************************/
// use this to specify whether the code is compile for rpgxEF or not
#define XTRA 1
// meh somehow preprocessor G_LUA won't work for me
#define G_LUA 1
#define CG_LUA 1
#ifdef Q3_VM
//#include "bg_lib.h"
#error "Q3_VM detected: QVMs are no longer supported by RPG-X2"
#include "bg_lib.h"
#else
#include <assert.h>
@ -82,8 +85,7 @@
// Needed for mods compiled in 64 bit shared objects.
#ifdef Q3_VM
// typedef int intptr_t;
#error "Q3_VM detected: QVMs are no longer supported by RPG-X2"
typedef int intptr_t;
#else
#ifdef _MSC_VER
#include <stddef.h>
@ -904,7 +906,13 @@ typedef enum {
//
#define MAX_CLIENTS 128 // absolute limit
#define MAX_LOCATIONS 64
#define GENTITYNUM_BITS 11
#ifndef XTRA
#define GENTITYNUM_BITS 10 // don't need to send any more
#else
#define GENTITYNUM_BITS 11 // XTRA
#endif
#define MAX_GENTITIES (1<<GENTITYNUM_BITS)
// entitynums are communicated with GENTITY_BITS, so any reserved
@ -914,7 +922,12 @@ typedef enum {
#define ENTITYNUM_WORLD (MAX_GENTITIES-2)
#define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2)
#define MAX_MODELS_BITS 9
#ifndef XTRA
#define MAX_MODELS_BITS 8
#else
#define MAX_MODELS_BITS 9 // XTRA
#endif
#define MAX_MODELS (1<<MAX_MODELS_BITS) // these are sent over the net as 8 bits <--- who cares xD
#define MAX_SOUNDS 256 // so they cannot be blindly increased
@ -922,7 +935,11 @@ typedef enum {
#define MAX_TRIC_STRINGS 64
#define MAX_DECOYS 64 //128
#ifndef XTRA
#define MAX_CONFIGSTRINGS 1024
#else
#define MAX_CONFIGSTRINGS 4096
#endif
// these are the only configstrings that the system reserves, all the
// other ones are strictly for servergame to clientgame communication
@ -931,7 +948,12 @@ typedef enum {
#define RESERVED_CONFIGSTRINGS 2 // game can't modify below this, only the system can
#ifndef XTRA
#define MAX_GAMESTATE_CHARS 16000
#else
#define MAX_GAMESTATE_CHARS 64000
#endif
typedef struct {
int stringOffsets[MAX_CONFIGSTRINGS];

View file

@ -78,13 +78,11 @@ OBJDEP = \
SOOBJ = \
ui_syscalls.o
# do cc for shared libraries
ifeq ($(DEBUG), 1)
DO_SOCC = $(CC) $(SOCFLAGS) -Wall -g3 $(DEFINES) -o $@ -c $<
else
DO_SOCC = $(CC) $(SOCFLAGS) -Wall -Wno-unused-but-set-variable $(DEFINES) -o $@ -c $<
DO_SOCC = $(CC) $(SOCFLAGS) -Wall $(DEFINES) -o $@ -c $<
endif
build_so: DO_CC=$(DO_SOCC)

View file

@ -1314,11 +1314,12 @@ qboolean UI_ConsoleCommand( void ) {
return qtrue;
}
/* TODO remove me? */
#ifdef XTRA
if ( Q_stricmp( cmd, "sqlkey" ) == 0) {
//UI_LoginSetSqlkey((int)UI_Argv(1));
return qtrue;
}
#endif
return qfalse;

View file

@ -1859,7 +1859,9 @@ extern void TransDataReceived(const char *data);
//
// ui_login.c
//
#ifdef XTRA
extern void UI_LoginSetSqlkey(int key);
#endif
//
// ui_demo2.c

View file

@ -5,7 +5,8 @@
**********************************************************************/
#include "ui_local.h"
/* TODO remove me? */
#ifdef XTRA
static byte sqlkey;
typedef struct {
@ -137,3 +138,4 @@ void UI_LoginMenu(void) {
Menu_AdjustCursor(&s_login.menu, 1);
}
#endif //XTRA