This commit is contained in:
Walter Julius Hennecke 2013-05-24 23:22:14 +02:00
parent f053e25e16
commit 696a1ad99d
6 changed files with 58 additions and 44 deletions

View File

@ -3,6 +3,7 @@
* bg_misc.c -- both games misc functions, all completely stateless
*/
#include "bg_misc.h"
#include "q_shared.h"
#include "bg_public.h"

6
code/game/bg_misc.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _BG_MISC_H
#define _BG_MISC_H
void BG_LanguageFilename(char *baseName,char *baseExtension,char *finalName);
#endif /* _BG_MISC_H */

View File

@ -940,22 +940,22 @@ G_Client_UserinfoChanged
*/
void G_Client_UserinfoChanged( int clientNum ) {
gentity_t *ent;
int i;
char *s;
char model[MAX_QPATH];
char oldname[MAX_STRING_CHARS];
gclient_t *client;
char userinfo[MAX_INFO_STRING];
qboolean reset;
float weight, height;
char age[MAX_NAME_LENGTH];
char race[MAX_NAME_LENGTH];
int modelOffset;
qboolean changeName = qtrue; //TiM : For the name filter
char sHeight[10];
char sWeight[10];
clientPersistant_t *pers;
clientSession_t *sess;
int i;
char* s;
char model[MAX_QPATH];
char oldname[MAX_STRING_CHARS];
gclient_t* client;
char userinfo[MAX_INFO_STRING];
qboolean reset;
float weight, height;
char age[MAX_NAME_LENGTH];
char race[MAX_NAME_LENGTH];
int modelOffset;
qboolean changeName = qtrue; //TiM : For the name filter
char sHeight[10];
char sWeight[10];
clientPersistant_t* pers = NULL;
clientSession_t* sess = NULL;
model[0] = 0;
@ -1006,7 +1006,7 @@ void G_Client_UserinfoChanged( int clientNum ) {
Q_CleanStr( activeName );
if ( g_entities[i].client->ps.clientNum != client->ps.clientNum
&& !Q_stricmp( newName, activeName ) )
&& Q_stricmp( newName, activeName ) == 0 )
{
trap_SendServerCommand( ent-g_entities, " print \"Unable to change name. A player already has that name on this server.\n\" ");
changeName = qfalse;
@ -1036,8 +1036,9 @@ void G_Client_UserinfoChanged( int clientNum ) {
}
pers->pms_height = atof( Info_ValueForKey( userinfo, "height" ) );
if ( !pers->pms_height )
if ( pers->pms_height == 0 ) {
pers->pms_height = 1.0f;
}
pers->maxHealth = atoi( Info_ValueForKey( userinfo, "handicap" ) );
if ( pers->maxHealth < 1 || pers->maxHealth > 100 ) {

View File

@ -725,9 +725,9 @@ typedef struct {
int numBrushEnts; /*!< number of entities in the level that use brushmodels */
/*@null@*/ list_p safezones; /*!< self destruct safezones list */
/*@null@*/ list_p locations; /*!< level locations list */
/*@null@*/ list_p timedMessages; /*!< timed messages list */
/*@shared@*/ /*@null@*/ list_p safezones; /*!< self destruct safezones list */
/*@shared@*/ /*@null@*/ list_p locations; /*!< level locations list */
/*@shared@*/ /*@null@*/ list_p timedMessages; /*!< timed messages list */
// other stuff
srvChangeData_t srvChangeData; /*!< Server change data */

View File

@ -6,6 +6,7 @@
#include "g_groups.h"
#include "bg_lex.h"
#include "g_cmds.h"
#include "bg_misc.h"
extern void BG_LoadItemNames(void);
extern qboolean BG_ParseRankNames ( char* fileName, rankNames_t rankNames[] );
@ -632,14 +633,14 @@ and transfer to clients
**************************/
static qboolean G_LoadClassData( char* fileName )
{
char *buffer;
char *textPtr, *token;
int fileLen;
fileHandle_t f;
char *buffer = NULL;
char *textPtr = NULL, *token = NULL;
int fileLen;
fileHandle_t f = 0;
qboolean classValid=qfalse;
int classIndex=0;
int weapon;
int i;
int classIndex=0;
int weapon;
int i;
//Init the storage place
memset( &g_classData, 0, sizeof ( g_classData ) );
@ -895,25 +896,26 @@ static qboolean G_LoadClassData( char* fileName )
}
}
void BG_LanguageFilename(char *baseName,char *baseExtension,char *finalName);
void SP_target_location (gentity_t *ent);
static void G_LoadTimedMessages(void) {
fileHandle_t f;
bgLex* lexer;
char* buffer;
fileHandle_t f = 0;
bgLex* lexer = NULL;
char* buffer = NULL;
int len;
len = trap_FS_FOpenFile("timedmessages.cfg", &f, FS_READ);
if(!len) return;
if(len == 0) {
return;
}
buffer = (char *)malloc(sizeof(char) * (len+1));
if(!buffer) {
if(buffer == NULL) {
G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i byte.\n", (len+1) * sizeof(char) );
trap_FS_FCloseFile(f);
return;
}
memset(buffer, 0, len+1);
memset(buffer, 0, (size_t)((len + 1) * sizeof(char)));
level.timedMessages = create_list();
if(level.timedMessages == NULL) {
@ -934,7 +936,7 @@ static void G_LoadTimedMessages(void) {
return;
}
while(bgLex_lex(lexer)) {
while(bgLex_lex(lexer) != 0) {
if(lexer->morphem->type == LMT_STRING) {
level.timedMessages->append(level.timedMessages, lexer->morphem->data.str, LT_STRING, strlen(lexer->morphem->data.str));
} else {
@ -951,12 +953,16 @@ holoData_t holoData;
static void G_LoadHolodeckFile(void) {
char fileRoute[MAX_QPATH];
char mapRoute[MAX_QPATH];
char *info;
fileHandle_t f;
char *buffer;
int file_len;
char *txtPtr, *token;
int numProgs = 0;
char* info = NULL;
fileHandle_t f = 0;
char* buffer = NULL;
int file_len;
char* txtPtr = NULL;
char* token = NULL;
int numProgs = 0;
memset(fileRoute, 0, sizeof(fileRoute));
memset(mapRoute, 0, sizeof(mapRoute));
info = (char *)malloc(MAX_INFO_STRING * sizeof(char));
if(!info) {

View File

@ -2,6 +2,8 @@
//
#include "g_local.h"
#include "list.h"
#include "bg_misc.h"
//#include <windows.h> //TiM : WTF?
//==========================================================
@ -1543,8 +1545,6 @@ static void target_turbolift_use( gentity_t *self, gentity_t *other, gentity_t *
trap_SendServerCommand( activator-g_entities, va("lift %d", self->health) );
}
extern void BG_LanguageFilename(char *baseName,char *baseExtension,char *finalName);
/*
QUAKED target_turbolift (.5 .5 .5) ? x x x x x x x x OFFLINE
-----DESCRIPTION-----