mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-02-15 16:41:16 +00:00
cleanup and fixes
* cleanup g_session.c, g_spawn.c, g_sql.c * fixed errors in md5 implementation
This commit is contained in:
parent
e57e8d9d27
commit
e2039624a1
5 changed files with 16 additions and 63 deletions
|
@ -22,7 +22,7 @@ G_WriteClientSessionData
|
|||
Called on game shutdown
|
||||
================
|
||||
*/
|
||||
void G_WriteClientSessionData( gclient_t *client ) {
|
||||
static void G_WriteClientSessionData( gclient_t *client ) {
|
||||
const char *s;
|
||||
const char *var;
|
||||
|
||||
|
@ -65,8 +65,8 @@ void G_ReadSessionData( gclient_t *client ) {
|
|||
&client->sess.wins,
|
||||
&client->sess.losses
|
||||
);
|
||||
client->sess.sessionTeam = team;
|
||||
client->sess.spectatorState = spec;
|
||||
client->sess.sessionTeam = (team_t)team;
|
||||
client->sess.spectatorState = (spectatorState_t)spec;
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,23 +94,7 @@ void G_InitSessionData( gclient_t *client, char *userinfo ) {
|
|||
sess->sessionTeam = TEAM_FREE;
|
||||
break;
|
||||
case GT_SINGLE_PLAYER:
|
||||
|
||||
sess->sessionTeam = TEAM_FREE;
|
||||
|
||||
//RPG-X: RedTechie - Not sure we need this
|
||||
/*if ( g_maxGameClients.integer > 0 &&
|
||||
level.numNonSpectatorClients >= g_maxGameClients.integer ) {
|
||||
sess->sessionTeam = TEAM_SPECTATOR;
|
||||
} else {
|
||||
if ( g_pModElimination.integer && numKilled > 0 )
|
||||
{//game already in progress
|
||||
sess->sessionTeam = TEAM_SPECTATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
sess->sessionTeam = TEAM_FREE;
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
case GT_TOURNAMENT:
|
||||
// if the game is full, go into a waiting mode
|
||||
|
|
|
@ -73,7 +73,6 @@ qboolean G_SpawnString( const char *key, const char *defaultString, char **out )
|
|||
|
||||
if ( !level.spawning ) {
|
||||
*out = (char *)defaultString;
|
||||
// G_Error( "G_SpawnString() called while not spawning" );
|
||||
}
|
||||
|
||||
for ( i = 0 ; i < level.numSpawnVars ; i++ ) {
|
||||
|
@ -140,7 +139,6 @@ void SP_func_timer (gentity_t *self);
|
|||
void SP_func_usable (gentity_t *self);
|
||||
void SP_func_breakable (gentity_t *self);
|
||||
void SP_func_door_rotating (gentity_t *ent);
|
||||
//void SP_func_roff_mover (gentity_t *ent);
|
||||
void SP_func_brushmodel(gentity_t *ent); // for brushmodel hijacking :D
|
||||
void SP_func_lightchange(gentity_t *ent); // "toggling" light
|
||||
void SP_func_targetmover(gentity_t *ent);
|
||||
|
@ -213,8 +211,6 @@ void SP_team_CTF_blueplayer( gentity_t *ent );
|
|||
void SP_team_CTF_redspawn( gentity_t *ent );
|
||||
void SP_team_CTF_bluespawn( gentity_t *ent );
|
||||
|
||||
//void SP_func_door_rotating( gentity_t *ent ); // VALKYRIE: for rotating doors
|
||||
|
||||
// extra Trek stuff
|
||||
void SP_fx_spark ( gentity_t *ent );
|
||||
void SP_fx_steam ( gentity_t *ent );
|
||||
|
@ -311,15 +307,6 @@ spawn_t spawns[] = {
|
|||
{"NPC_Buster", SP_info_player_start},
|
||||
{"NPC_Goodheart", SP_info_player_start},
|
||||
|
||||
/* {"NPC_Parasite", SP_info_player_start},
|
||||
{"NPC_Headbot", SP_info_player_start},
|
||||
{"NPC_scoutbot", SP_info_player_start},
|
||||
{"NPC_HKbot", SP_info_player_start},
|
||||
{"NPC_Harvester", SP_info_player_start},
|
||||
{"NPC_HunterSeeker", SP_info_player_start},
|
||||
{"NPC_warriorbot", SP_info_player_start},
|
||||
{"NPC_spawner", SP_info_player_start},*/
|
||||
|
||||
{"info_player_deathmatch", SP_info_player_deathmatch},
|
||||
{"info_player_intermission", SP_info_player_intermission},
|
||||
{"info_null", SP_info_null},
|
||||
|
@ -340,7 +327,6 @@ spawn_t spawns[] = {
|
|||
{"func_usable", SP_func_usable},
|
||||
{"func_breakable", SP_func_breakable},
|
||||
{"func_door_rotating", SP_func_door_rotating},
|
||||
//{"func_roff_mover", SP_func_roff_mover},
|
||||
{"func_brushmodel", SP_func_brushmodel}, // Hijack me haha
|
||||
{"func_lightchange", SP_func_lightchange},
|
||||
{"func_targetmover", SP_func_targetmover},
|
||||
|
@ -416,8 +402,6 @@ spawn_t spawns[] = {
|
|||
{"team_CTF_redspawn", SP_team_CTF_redspawn},
|
||||
{"team_CTF_bluespawn", SP_team_CTF_bluespawn},
|
||||
|
||||
//{"func_door_rotating", SP_func_door_rotating}, // VALKYRIE: for rotating doors
|
||||
|
||||
// extra Trek stuff
|
||||
{"fx_spark", SP_fx_spark},
|
||||
{"fx_steam", SP_fx_steam},
|
||||
|
@ -852,7 +836,6 @@ void SP_worldspawn( void ) {
|
|||
// see if we want a warmup time
|
||||
trap_SetConfigstring( CS_WARMUP, "" );
|
||||
if ( g_restarted.integer ) {
|
||||
// trap_Cvar_Set( "g_restarted", "0" );
|
||||
level.warmupTime = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,21 +6,10 @@
|
|||
#endif
|
||||
|
||||
#include "sqlite3.h"
|
||||
//#include "q_shared.h"
|
||||
#include "g_sql.h"
|
||||
#include "g_local.h"
|
||||
#include "md5.h"
|
||||
|
||||
//extern vmCvar_t sql_dbName;
|
||||
//extern vmCvar_t sql_use;
|
||||
//extern vmCvar_t sql_server;
|
||||
//extern vmCvar_t sql_user;
|
||||
//extern vmCvar_t sql_password;
|
||||
//extern vmCvar_t sql_port;
|
||||
|
||||
//extern void QDECL G_Printf( const char *fmt, ... );
|
||||
//extern void QDECL G_PrintfClient( gentity_t *ent, const char *fmt, ...);
|
||||
|
||||
sqlite3 *user_db;
|
||||
qboolean sql_ready = qfalse;
|
||||
|
||||
|
@ -84,8 +73,8 @@ static char *G_Sql_Md5(const char *s) {
|
|||
struct MD5Context md5c;
|
||||
|
||||
MD5Init(&md5c);
|
||||
MD5Update(&md5c, s, strlen(s));
|
||||
MD5Final(sig, &md5c);
|
||||
MD5Update(&md5c, (const unsigned char *)s, strlen(s));
|
||||
MD5Final(&md5c, sig);
|
||||
|
||||
res = (char *)malloc(sizeof(char)*MAX_QPATH);
|
||||
if(!res) {
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
/*
|
||||
* Note: this code is harmless on little-endian machines.
|
||||
*/
|
||||
void byteReverse(buf, longs)
|
||||
unsigned char *buf; unsigned longs;
|
||||
void byteReverse(unsigned char* buf, unsigned longs)
|
||||
{
|
||||
uint32 t;
|
||||
do {
|
||||
|
@ -47,8 +46,7 @@ void byteReverse(buf, longs)
|
|||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void MD5Init(ctx)
|
||||
struct MD5Context *ctx;
|
||||
void MD5Init(struct MD5Context *ctx)
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
|
@ -63,8 +61,7 @@ void MD5Init(ctx)
|
|||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Update(ctx, buf, len)
|
||||
struct MD5Context *ctx; unsigned char *buf; unsigned len;
|
||||
void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len)
|
||||
{
|
||||
uint32 t;
|
||||
|
||||
|
@ -112,8 +109,7 @@ void MD5Update(ctx, buf, len)
|
|||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void MD5Final(digest, ctx)
|
||||
unsigned char digest[16]; struct MD5Context *ctx;
|
||||
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
||||
{
|
||||
unsigned count;
|
||||
unsigned char *p;
|
||||
|
@ -172,8 +168,7 @@ void MD5Final(digest, ctx)
|
|||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void MD5Transform(buf, in)
|
||||
uint32 buf[4]; uint32 in[16];
|
||||
void MD5Transform(uint32 buf[4], uint32 in[16])
|
||||
{
|
||||
register uint32 a, b, c, d;
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
insures we work on new platforms regardless of their byte
|
||||
order. */
|
||||
|
||||
#include "q_shared.h"
|
||||
|
||||
#define HIGHFIRST
|
||||
|
||||
#ifdef __i386__
|
||||
|
@ -39,10 +41,10 @@ struct MD5Context {
|
|||
unsigned char in[64];
|
||||
};
|
||||
|
||||
extern void MD5Init();
|
||||
extern void MD5Update();
|
||||
extern void MD5Final();
|
||||
extern void MD5Transform();
|
||||
extern void MD5Init(struct MD5Context *ctx);
|
||||
extern void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len);
|
||||
extern void MD5Final(struct MD5Context *Ctx, unsigned char *digest);
|
||||
extern void MD5Transform(uint32 buf[4], uint32 in[16]);
|
||||
|
||||
/*
|
||||
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
||||
|
|
Loading…
Reference in a new issue