mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-01-23 10:00:41 +00:00
Cleanups of the new model code. Removed the spectator bar for zcam modes.
This commit is contained in:
parent
9095d7b66d
commit
c5b97df474
4 changed files with 269 additions and 269 deletions
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.35 2002/04/23 00:21:44 jbravo
|
||||||
|
// Cleanups of the new model code. Removed the spectator bar for zcam modes.
|
||||||
|
//
|
||||||
// Revision 1.34 2002/04/06 21:43:58 makro
|
// Revision 1.34 2002/04/06 21:43:58 makro
|
||||||
// New surfaceparm system
|
// New surfaceparm system
|
||||||
//
|
//
|
||||||
|
@ -2868,7 +2871,10 @@ static void CG_Draw2D( void ) {
|
||||||
cg.predictedPlayerState.pm_type == PM_SPECTATOR) {
|
cg.predictedPlayerState.pm_type == PM_SPECTATOR) {
|
||||||
//if (cg.snap->ps.persistant[PERS_SAVEDTEAM] != TEAM_RED && cg.snap->ps.persistant[PERS_SAVEDTEAM] != TEAM_BLUE)
|
//if (cg.snap->ps.persistant[PERS_SAVEDTEAM] != TEAM_RED && cg.snap->ps.persistant[PERS_SAVEDTEAM] != TEAM_BLUE)
|
||||||
// cg.predictedPlayerState.pm_type == PM_SPECTATOR
|
// cg.predictedPlayerState.pm_type == PM_SPECTATOR
|
||||||
|
// JBravo: no spectator bar for zcam modes.
|
||||||
|
if (!(cg.snap->ps.stats[STAT_RQ3] & RQ3_ZCAM)) {
|
||||||
CG_DrawSpectator();
|
CG_DrawSpectator();
|
||||||
|
}
|
||||||
CG_DrawCrosshair();
|
CG_DrawCrosshair();
|
||||||
CG_DrawCrosshairNames();
|
CG_DrawCrosshairNames();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.68 2002/04/23 00:21:44 jbravo
|
||||||
|
// Cleanups of the new model code. Removed the spectator bar for zcam modes.
|
||||||
|
//
|
||||||
// Revision 1.67 2002/04/22 02:27:57 jbravo
|
// Revision 1.67 2002/04/22 02:27:57 jbravo
|
||||||
// Dynamic model recognition
|
// Dynamic model recognition
|
||||||
//
|
//
|
||||||
|
@ -158,6 +161,7 @@ char rq3_breakables[RQ3_MAX_BREAKABLES][80];
|
||||||
|
|
||||||
// JBravo: for models
|
// JBravo: for models
|
||||||
extern legitmodel_t legitmodels[MAXMODELS];
|
extern legitmodel_t legitmodels[MAXMODELS];
|
||||||
|
qboolean RQ3_Validatemodel (char *model);
|
||||||
|
|
||||||
// g_client.c -- client functions that don't happen every frame
|
// g_client.c -- client functions that don't happen every frame
|
||||||
|
|
||||||
|
@ -869,7 +873,6 @@ void ClientUserinfoChanged( int clientNum ) {
|
||||||
int teamTask, teamLeader, team, health;
|
int teamTask, teamLeader, team, health;
|
||||||
char *s;
|
char *s;
|
||||||
char model[MAX_QPATH];
|
char model[MAX_QPATH];
|
||||||
char skin[MAX_QPATH];
|
|
||||||
char headModel[MAX_QPATH];
|
char headModel[MAX_QPATH];
|
||||||
char oldname[MAX_STRING_CHARS];
|
char oldname[MAX_STRING_CHARS];
|
||||||
gclient_t *client;
|
gclient_t *client;
|
||||||
|
@ -954,11 +957,11 @@ void ClientUserinfoChanged( int clientNum ) {
|
||||||
|
|
||||||
if (g_gametype.integer == GT_TEAMPLAY) {
|
if (g_gametype.integer == GT_TEAMPLAY) {
|
||||||
if (client->sess.sessionTeam == TEAM_RED) {
|
if (client->sess.sessionTeam == TEAM_RED) {
|
||||||
Com_sprintf (model, sizeof (model) , "%s/%s", g_RQ3_team1model.string, g_RQ3_team1skin.string);
|
Com_sprintf (model, sizeof (model) , "%s", g_RQ3_team1model.string);
|
||||||
Com_sprintf (headModel, sizeof (headModel) , "%s/%s", g_RQ3_team1model.string, g_RQ3_team1skin.string);
|
Com_sprintf (headModel, sizeof (headModel) , "%s", g_RQ3_team1model.string);
|
||||||
} else {
|
} else {
|
||||||
Com_sprintf (model, sizeof (model) , "%s/%s", g_RQ3_team2model.string, g_RQ3_team2skin.string);
|
Com_sprintf (model, sizeof (model) , "%s", g_RQ3_team2model.string);
|
||||||
Com_sprintf (headModel, sizeof (headModel) , "%s/%s", g_RQ3_team2model.string, g_RQ3_team2skin.string);
|
Com_sprintf (headModel, sizeof (headModel) , "%s", g_RQ3_team2model.string);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// NiceAss: temporary hack to prevent non-grunt models:
|
// NiceAss: temporary hack to prevent non-grunt models:
|
||||||
|
@ -971,7 +974,9 @@ void ClientUserinfoChanged( int clientNum ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makro - adding abbey
|
// Makro - adding abbey
|
||||||
if ( Q_stricmpn(model2, "grunt", sizeof(model2)) && Q_stricmpn(model2, "abbey", sizeof(model2))) {
|
// if ( Q_stricmpn(model2, "grunt", sizeof(model2)) && Q_stricmpn(model2, "abbey", sizeof(model2))) {
|
||||||
|
// JBravo: Validating the model
|
||||||
|
if (!RQ3_Validatemodel(model2)) {
|
||||||
trap_SendServerCommand( ent-g_entities, va("print \"Illegal player model (%s). Forcing change on server.\n\"", model2));
|
trap_SendServerCommand( ent-g_entities, va("print \"Illegal player model (%s). Forcing change on server.\n\"", model2));
|
||||||
Q_strncpyz(model, "grunt/resdog", sizeof("grunt/resdog"));
|
Q_strncpyz(model, "grunt/resdog", sizeof("grunt/resdog"));
|
||||||
Q_strncpyz(headModel, "grunt/resdog", sizeof("grunt/resdog"));
|
Q_strncpyz(headModel, "grunt/resdog", sizeof("grunt/resdog"));
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.70 2002/04/23 00:21:44 jbravo
|
||||||
|
// Cleanups of the new model code. Removed the spectator bar for zcam modes.
|
||||||
|
//
|
||||||
// Revision 1.69 2002/04/22 16:43:34 blaze
|
// Revision 1.69 2002/04/22 16:43:34 blaze
|
||||||
// Hey look, breakables explode now! :)
|
// Hey look, breakables explode now! :)
|
||||||
//
|
//
|
||||||
|
@ -1110,10 +1113,8 @@ extern vmCvar_t g_RQ3_limchasecam; // JBravo: 0 = no chasecam limit, 1 = limite
|
||||||
extern vmCvar_t g_RQ3_sniperup; // JBravo: 0 = snipers begin with pistol, 1 = begin with sniper
|
extern vmCvar_t g_RQ3_sniperup; // JBravo: 0 = snipers begin with pistol, 1 = begin with sniper
|
||||||
extern vmCvar_t g_RQ3_team1name; // JBravo: cvar for the name of team 1
|
extern vmCvar_t g_RQ3_team1name; // JBravo: cvar for the name of team 1
|
||||||
extern vmCvar_t g_RQ3_team2name; // JBravo: cvar for the name of team 2
|
extern vmCvar_t g_RQ3_team2name; // JBravo: cvar for the name of team 2
|
||||||
extern vmCvar_t g_RQ3_team1model; // JBravo: team 1 model
|
extern vmCvar_t g_RQ3_team1model; // JBravo: team 1 model and skin
|
||||||
extern vmCvar_t g_RQ3_team2model; // JBravo: team 2 model
|
extern vmCvar_t g_RQ3_team2model; // JBravo: team 2 model and skin
|
||||||
extern vmCvar_t g_RQ3_team1skin; // JBravo: team 1 skin
|
|
||||||
extern vmCvar_t g_RQ3_team2skin; // JBravo: team 2 skin
|
|
||||||
extern vmCvar_t g_RQ3_lca; // JBravo: cvar to signal cgame that LCA is in progress
|
extern vmCvar_t g_RQ3_lca; // JBravo: cvar to signal cgame that LCA is in progress
|
||||||
extern vmCvar_t g_RQ3_teamCount1; // JBravo: cvar for the UI join menus
|
extern vmCvar_t g_RQ3_teamCount1; // JBravo: cvar for the UI join menus
|
||||||
extern vmCvar_t g_RQ3_teamCount2; // JBravo: cvar for the UI join menus
|
extern vmCvar_t g_RQ3_teamCount2; // JBravo: cvar for the UI join menus
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.47 2002/04/23 00:21:44 jbravo
|
||||||
|
// Cleanups of the new model code. Removed the spectator bar for zcam modes.
|
||||||
|
//
|
||||||
// Revision 1.46 2002/04/22 02:27:57 jbravo
|
// Revision 1.46 2002/04/22 02:27:57 jbravo
|
||||||
// Dynamic model recognition
|
// Dynamic model recognition
|
||||||
//
|
//
|
||||||
|
@ -202,8 +205,6 @@ vmCvar_t g_RQ3_team1name;
|
||||||
vmCvar_t g_RQ3_team2name;
|
vmCvar_t g_RQ3_team2name;
|
||||||
vmCvar_t g_RQ3_team1model;
|
vmCvar_t g_RQ3_team1model;
|
||||||
vmCvar_t g_RQ3_team2model;
|
vmCvar_t g_RQ3_team2model;
|
||||||
vmCvar_t g_RQ3_team1skin;
|
|
||||||
vmCvar_t g_RQ3_team2skin;
|
|
||||||
vmCvar_t g_RQ3_teamCount1;
|
vmCvar_t g_RQ3_teamCount1;
|
||||||
vmCvar_t g_RQ3_teamCount2;
|
vmCvar_t g_RQ3_teamCount2;
|
||||||
vmCvar_t g_RQ3_numSpectators;
|
vmCvar_t g_RQ3_numSpectators;
|
||||||
|
@ -350,10 +351,8 @@ static cvarTable_t gameCvarTable[] = {
|
||||||
{ &g_RQ3_sniperup, "g_RQ3_sniperup", "0", CVAR_ARCHIVE, 0, qtrue},
|
{ &g_RQ3_sniperup, "g_RQ3_sniperup", "0", CVAR_ARCHIVE, 0, qtrue},
|
||||||
{ &g_RQ3_team1name, "g_RQ3_team1name", "Robbers", CVAR_SYSTEMINFO | CVAR_SERVERINFO , 0, qfalse },
|
{ &g_RQ3_team1name, "g_RQ3_team1name", "Robbers", CVAR_SYSTEMINFO | CVAR_SERVERINFO , 0, qfalse },
|
||||||
{ &g_RQ3_team2name, "g_RQ3_team2name", "Swat", CVAR_SYSTEMINFO | CVAR_SERVERINFO , 0, qfalse },
|
{ &g_RQ3_team2name, "g_RQ3_team2name", "Swat", CVAR_SYSTEMINFO | CVAR_SERVERINFO , 0, qfalse },
|
||||||
{ &g_RQ3_team1model, "g_RQ3_team1model", "grunt", CVAR_SERVERINFO, 0, qfalse },
|
{ &g_RQ3_team1model, "g_RQ3_team1model", "grunt/robber", CVAR_SERVERINFO, 0, qfalse },
|
||||||
{ &g_RQ3_team2model, "g_RQ3_team2model", "grunt", CVAR_SERVERINFO, 0, qfalse },
|
{ &g_RQ3_team2model, "g_RQ3_team2model", "grunt/police", CVAR_SERVERINFO, 0, qfalse },
|
||||||
{ &g_RQ3_team1skin, "g_RQ3_team1skin", "robber", CVAR_SERVERINFO, 0, qfalse },
|
|
||||||
{ &g_RQ3_team2skin, "g_RQ3_team2skin", "police", CVAR_SERVERINFO, 0, qfalse },
|
|
||||||
{ &g_RQ3_teamCount1, "g_RQ3_teamCount1", "0", CVAR_ROM, 0, qfalse },
|
{ &g_RQ3_teamCount1, "g_RQ3_teamCount1", "0", CVAR_ROM, 0, qfalse },
|
||||||
{ &g_RQ3_teamCount2, "g_RQ3_teamCount2", "0", CVAR_ROM, 0, qfalse },
|
{ &g_RQ3_teamCount2, "g_RQ3_teamCount2", "0", CVAR_ROM, 0, qfalse },
|
||||||
{ &g_RQ3_numSpectators, "g_RQ3_numSpectators", "0", CVAR_ROM, 0, qfalse },
|
{ &g_RQ3_numSpectators, "g_RQ3_numSpectators", "0", CVAR_ROM, 0, qfalse },
|
||||||
|
@ -594,13 +593,37 @@ void G_UpdateCvars( void ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
G_InitGame
|
RQ3_Validatemodel
|
||||||
|
Makes sure we have a legit RQ3 model
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
|
|
||||||
legitmodel_t legitmodels[MAXMODELS];
|
legitmodel_t legitmodels[MAXMODELS];
|
||||||
|
|
||||||
|
qboolean RQ3_Validatemodel (char *model) {
|
||||||
|
qboolean valid;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
valid = qfalse;
|
||||||
|
|
||||||
|
for (i=0; i <MAXMODELS; i++) {
|
||||||
|
if (*legitmodels[i].name == 0)
|
||||||
|
break;
|
||||||
|
if (!Q_stricmp (legitmodels[i].name, model)) {
|
||||||
|
valid = qtrue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
G_InitGame
|
||||||
|
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
|
||||||
void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
||||||
int i, j, numdirs, dirlen, len, modelcount;
|
int i, j, numdirs, dirlen, len, modelcount;
|
||||||
char *dirptr, *text_p, *token;
|
char *dirptr, *text_p, *token;
|
||||||
|
@ -745,7 +768,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
||||||
G_InitBots( restart );
|
G_InitBots( restart );
|
||||||
}
|
}
|
||||||
// JBravo: Load legit model names.
|
// JBravo: Load legit model names.
|
||||||
if (g_gametype.integer == GT_TEAMPLAY) {
|
|
||||||
for (i=0; i < MAXMODELS; i++) {
|
for (i=0; i < MAXMODELS; i++) {
|
||||||
memset (&legitmodels[i], 0, sizeof (legitmodels[i]));
|
memset (&legitmodels[i], 0, sizeof (legitmodels[i]));
|
||||||
}
|
}
|
||||||
|
@ -817,7 +839,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
||||||
modelcount++;
|
modelcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
G_RemapTeamShaders();
|
G_RemapTeamShaders();
|
||||||
|
|
||||||
|
@ -2366,6 +2387,7 @@ void RQ3_ReadInitFile() {
|
||||||
fileHandle_t file;
|
fileHandle_t file;
|
||||||
char *buf;
|
char *buf;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = trap_FS_FOpenFile (g_RQ3_IniFile.string, &file, FS_READ);
|
len = trap_FS_FOpenFile (g_RQ3_IniFile.string, &file, FS_READ);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
G_Printf ("Could not open INI file\n");
|
G_Printf ("Could not open INI file\n");
|
||||||
|
@ -2384,23 +2406,15 @@ void RQ3_ReadInitFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RQ3_ParseBuffer (char *buf, int len) {
|
void RQ3_ParseBuffer (char *buf, int len) {
|
||||||
|
|
||||||
char tag[20];
|
char tag[20];
|
||||||
int cur_pos;
|
int cur_pos, tag_type;
|
||||||
int tag_type;
|
|
||||||
|
|
||||||
for (cur_pos = 0; cur_pos < len; cur_pos++) {
|
for (cur_pos = 0; cur_pos < len; cur_pos++) {
|
||||||
|
|
||||||
|
|
||||||
// chop things we dont need
|
// chop things we dont need
|
||||||
if ((*(buf + cur_pos) == ' ') || (*(buf + cur_pos) == '\n') || (*(buf + cur_pos) == '\t') || (*(buf + cur_pos) == '\r'))
|
if ((*(buf + cur_pos) == ' ') || (*(buf + cur_pos) == '\n') || (*(buf + cur_pos) == '\t') || (*(buf + cur_pos) == '\r'))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
if (*(buf + cur_pos) == '<') { // we are in a tag
|
if (*(buf + cur_pos) == '<') { // we are in a tag
|
||||||
cur_pos++;
|
cur_pos++;
|
||||||
|
|
||||||
|
|
||||||
if ((tag_type = RQ3_GetTag (buf, &cur_pos, tag, len)) == INVALID)
|
if ((tag_type = RQ3_GetTag (buf, &cur_pos, tag, len)) == INVALID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2414,19 +2428,15 @@ void RQ3_ParseBuffer ( char *buf, int len ) {
|
||||||
G_Printf ("RQ3 config system: Finished loading the ini File\n");
|
G_Printf ("RQ3 config system: Finished loading the ini File\n");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
// Can't go here
|
// Can't go here
|
||||||
//G_Printf ( "RQ3 config system: Invalid init file\n" );
|
//G_Printf ( "RQ3 config system: Invalid init file\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RQ3_GetTag ( char *buf, int *cur_pos, char *tag, int len){
|
int RQ3_GetTag ( char *buf, int *cur_pos, char *tag, int len){
|
||||||
int counter = 0;
|
int counter = 0, tag_type;
|
||||||
int tag_type;
|
|
||||||
|
|
||||||
|
|
||||||
while ((*(buf + *cur_pos) == ' ') || (*(buf + *cur_pos) == '\t'))
|
while ((*(buf + *cur_pos) == ' ') || (*(buf + *cur_pos) == '\t'))
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
|
|
||||||
while (*(buf + *cur_pos) != '>') {
|
while (*(buf + *cur_pos) != '>') {
|
||||||
tag[counter] = *(buf + *cur_pos);
|
tag[counter] = *(buf + *cur_pos);
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -2447,19 +2457,13 @@ int RQ3_GetTag ( char *buf, int *cur_pos, char *tag, int len){
|
||||||
|
|
||||||
// Parser of a block
|
// Parser of a block
|
||||||
int RQ3_ParseBlock (int tag_type, char *tag, int *cur_pos, char *buf, int len) {
|
int RQ3_ParseBlock (int tag_type, char *tag, int *cur_pos, char *buf, int len) {
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
int map_number = 0;
|
int map_number = 0;
|
||||||
char map_to_go[2];
|
char map_to_go[2], word_buff[50], buff_map[50];
|
||||||
char word_buff[50];
|
char cvar[40], value[80], model[200], *skin;
|
||||||
char buff_map[50];
|
|
||||||
char cvar[40];
|
|
||||||
char value[80];
|
|
||||||
|
|
||||||
G_Printf( "RQ3 config system: Processing block: <%s>\n", tag );
|
G_Printf( "RQ3 config system: Processing block: <%s>\n", tag );
|
||||||
|
|
||||||
if (tag_type == MAIN) {
|
if (tag_type == MAIN) {
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (RQ3_GetCommand (buf, cur_pos, cvar, value, len) == TOKEN_TAG)
|
if (RQ3_GetCommand (buf, cur_pos, cvar, value, len) == TOKEN_TAG)
|
||||||
return RQ3_CheckClosingTag (buf, cur_pos, tag_type, len);
|
return RQ3_CheckClosingTag (buf, cur_pos, tag_type, len);
|
||||||
|
@ -2470,7 +2474,6 @@ int RQ3_ParseBlock ( int tag_type, char *tag, int *cur_pos, char *buf, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (tag_type == TEAM1 || tag_type == TEAM2) {
|
} else if (tag_type == TEAM1 || tag_type == TEAM2) {
|
||||||
|
|
||||||
if (RQ3_GetWord (buf, cur_pos, word_buff, len) != TOKEN_TAG) {
|
if (RQ3_GetWord (buf, cur_pos, word_buff, len) != TOKEN_TAG) {
|
||||||
G_Printf("RQ3 config system: found team name: %s\n", word_buff);
|
G_Printf("RQ3 config system: found team name: %s\n", word_buff);
|
||||||
if (tag_type == TEAM1)
|
if (tag_type == TEAM1)
|
||||||
|
@ -2480,11 +2483,25 @@ int RQ3_ParseBlock ( int tag_type, char *tag, int *cur_pos, char *buf, int len )
|
||||||
} else
|
} else
|
||||||
return RQ3_CheckClosingTag (buf, cur_pos, tag_type, len);
|
return RQ3_CheckClosingTag (buf, cur_pos, tag_type, len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (RQ3_GetWord (buf, cur_pos, word_buff, len) != TOKEN_TAG) {
|
if (RQ3_GetWord (buf, cur_pos, word_buff, len) != TOKEN_TAG) {
|
||||||
G_Printf ("RQ3 config system: found model/skin name: %s\n", word_buff);
|
G_Printf ("RQ3 config system: found model/skin name: %s\n", word_buff);
|
||||||
// do whatever is necessary to put the model/skin on the team
|
Com_sprintf (model, sizeof (model) , "%s", word_buff);
|
||||||
|
skin = Q_strrchr(word_buff, '/');
|
||||||
|
if (skin) {
|
||||||
|
*skin++ = '\0';
|
||||||
|
} else {
|
||||||
|
G_Printf ("RQ3 config system: Found invalid skin\n");
|
||||||
|
return PARSING_ERROR;
|
||||||
|
}
|
||||||
|
if (!RQ3_Validatemodel(word_buff)) {
|
||||||
|
G_Printf ("RQ3 config system: The model is not a valid RQ3 model\n");
|
||||||
|
return PARSING_ERROR;
|
||||||
|
}
|
||||||
|
if (tag_type == TEAM1) {
|
||||||
|
trap_Cvar_Set ("g_RQ3_team1model", model);
|
||||||
|
} else {
|
||||||
|
trap_Cvar_Set ("g_RQ3_team2model", model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RQ3_GetWord (buf, cur_pos, word_buff, len) == TOKEN_TAG)
|
if (RQ3_GetWord (buf, cur_pos, word_buff, len) == TOKEN_TAG)
|
||||||
|
@ -2499,22 +2516,17 @@ int RQ3_ParseBlock ( int tag_type, char *tag, int *cur_pos, char *buf, int len )
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// Find a </rotation> or a <map> entrie
|
// Find a </rotation> or a <map> entrie
|
||||||
if (RQ3_GetCommand (buf, cur_pos, cvar, value, len) == TOKEN_TAG) {
|
if (RQ3_GetCommand (buf, cur_pos, cvar, value, len) == TOKEN_TAG) {
|
||||||
|
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
if ((*(buf + *cur_pos) == '/')) {
|
if ((*(buf + *cur_pos) == '/')) {
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
|
|
||||||
if (RQ3_GetTag (buf, cur_pos, tag, len) == ROTATION) {
|
if (RQ3_GetTag (buf, cur_pos, tag, len) == ROTATION) {
|
||||||
G_Printf ("RQ3 config system: Block <rotation> is finished\n");
|
G_Printf ("RQ3 config system: Block <rotation> is finished\n");
|
||||||
// finished rotation
|
// finished rotation
|
||||||
map_number--;
|
map_number--;
|
||||||
Com_sprintf (buff_map, sizeof(buff_map), "map %s\n", word_buff);
|
Com_sprintf (buff_map, sizeof(buff_map), "map %s\n", word_buff);
|
||||||
|
|
||||||
if (map_number != g_RQ3_NextMapID.integer) {
|
if (map_number != g_RQ3_NextMapID.integer) {
|
||||||
|
|
||||||
g_RQ3_NextMapID.integer++;
|
g_RQ3_NextMapID.integer++;
|
||||||
Com_sprintf (map_to_go, sizeof(map_to_go), "%d", g_RQ3_NextMapID.integer);
|
Com_sprintf (map_to_go, sizeof(map_to_go), "%d", g_RQ3_NextMapID.integer);
|
||||||
|
|
||||||
trap_Cvar_Set ("g_RQ3_NextMapID", map_to_go);
|
trap_Cvar_Set ("g_RQ3_NextMapID", map_to_go);
|
||||||
G_Printf ("RQ3 config system: finished map processing.: %d\n", g_RQ3_NextMapID.integer);
|
G_Printf ("RQ3 config system: finished map processing.: %d\n", g_RQ3_NextMapID.integer);
|
||||||
trap_SendConsoleCommand (EXEC_APPEND, buff_map);
|
trap_SendConsoleCommand (EXEC_APPEND, buff_map);
|
||||||
|
@ -2527,13 +2539,10 @@ int RQ3_ParseBlock ( int tag_type, char *tag, int *cur_pos, char *buf, int len )
|
||||||
trap_SendConsoleCommand (EXEC_APPEND, buff_map);
|
trap_SendConsoleCommand (EXEC_APPEND, buff_map);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
G_Printf ("RQ3 config system: Invalid block closing. Needs </rotation>, found </%s>\n", tag);
|
G_Printf ("RQ3 config system: Invalid block closing. Needs </rotation>, found </%s>\n", tag);
|
||||||
return PARSING_ERROR;
|
return PARSING_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RQ3_GetTag (buf, cur_pos, tag, len) == MAP ) {
|
if (RQ3_GetTag (buf, cur_pos, tag, len) == MAP ) {
|
||||||
|
@ -2544,23 +2553,18 @@ int RQ3_ParseBlock ( int tag_type, char *tag, int *cur_pos, char *buf, int len )
|
||||||
// skipp everything and go to the next map
|
// skipp everything and go to the next map
|
||||||
while (*(buf + *cur_pos) != '<')
|
while (*(buf + *cur_pos) != '<')
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
|
|
||||||
|
|
||||||
if (RQ3_CheckClosingTag (buf, cur_pos, MAP, len) == PARSING_OK) {
|
if (RQ3_CheckClosingTag (buf, cur_pos, MAP, len) == PARSING_OK) {
|
||||||
map_number++;
|
map_number++;
|
||||||
G_Printf ("RQ3 config system: current map count is %d.\n", map_number);
|
G_Printf ("RQ3 config system: current map count is %d.\n", map_number);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return PARSING_ERROR;
|
return PARSING_ERROR;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
if (RQ3_GetWord (buf, cur_pos, word_buff, len) == TOKEN_TAG) {
|
if (RQ3_GetWord (buf, cur_pos, word_buff, len) == TOKEN_TAG) {
|
||||||
if (RQ3_CheckClosingTag (buf, cur_pos, MAP, len) == PARSING_OK) {
|
if (RQ3_CheckClosingTag (buf, cur_pos, MAP, len) == PARSING_OK) {
|
||||||
map_number++;
|
map_number++;
|
||||||
G_Printf ("RQ3 config system: current map number is %d.\n", map_number); // ver esta merda
|
G_Printf ("RQ3 config system: current map number is %d.\n", map_number); // ver esta merda
|
||||||
} else
|
} else
|
||||||
return PARSING_ERROR;
|
return PARSING_ERROR;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// do something with the map name
|
// do something with the map name
|
||||||
G_Printf ("RQ3 config system: map found: %s\n", word_buff);
|
G_Printf ("RQ3 config system: map found: %s\n", word_buff);
|
||||||
|
@ -2569,8 +2573,7 @@ int RQ3_ParseBlock ( int tag_type, char *tag, int *cur_pos, char *buf, int len )
|
||||||
if (RQ3_CheckClosingTag (buf, cur_pos, MAP, len) == PARSING_OK) {
|
if (RQ3_CheckClosingTag (buf, cur_pos, MAP, len) == PARSING_OK) {
|
||||||
map_number++;
|
map_number++;
|
||||||
break;
|
break;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return PARSING_ERROR; // return apropriate error code
|
return PARSING_ERROR; // return apropriate error code
|
||||||
else {
|
else {
|
||||||
// process the cvar here
|
// process the cvar here
|
||||||
|
@ -2585,17 +2588,13 @@ int RQ3_ParseBlock ( int tag_type, char *tag, int *cur_pos, char *buf, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RQ3_GetWord (char *buf, int *cur_pos, char *word, int len) {
|
int RQ3_GetWord (char *buf, int *cur_pos, char *word, int len) {
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
for (;; (*cur_pos)++){
|
|
||||||
|
|
||||||
|
for (;; (*cur_pos)++) {
|
||||||
if (*(buf + *cur_pos) == '"') {
|
if (*(buf + *cur_pos) == '"') {
|
||||||
count = 0;
|
count = 0;
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
|
@ -2627,23 +2626,17 @@ int RQ3_GetWord ( char *buf, int *cur_pos, char *word, int len ){
|
||||||
}
|
}
|
||||||
|
|
||||||
int RQ3_GetCommand (char *buf, int *cur_pos, char *cvar, char *value, int len) {
|
int RQ3_GetCommand (char *buf, int *cur_pos, char *cvar, char *value, int len) {
|
||||||
|
|
||||||
|
|
||||||
enum were_stat { NONE, CVAR, VALUE, DONE };
|
enum were_stat { NONE, CVAR, VALUE, DONE };
|
||||||
|
|
||||||
int state = NONE;
|
int state = NONE;
|
||||||
int count, i;
|
int count;
|
||||||
|
|
||||||
for (;; (*cur_pos)++) {
|
for (;; (*cur_pos)++) {
|
||||||
|
|
||||||
|
|
||||||
if (*(buf + *cur_pos) == '<') // closing block
|
if (*(buf + *cur_pos) == '<') // closing block
|
||||||
return TOKEN_TAG;
|
return TOKEN_TAG;
|
||||||
else if ((*(buf + *cur_pos) == '\r') || (*(buf + *cur_pos) == ' ') || (*(buf + *cur_pos) == '\n') || (*(buf + *cur_pos) == '\t'))
|
else if ((*(buf + *cur_pos) == '\r') || (*(buf + *cur_pos) == ' ') || (*(buf + *cur_pos) == '\n') || (*(buf + *cur_pos) == '\t'))
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
if (state == NONE) {
|
if (state == NONE) {
|
||||||
|
|
||||||
state = CVAR;
|
state = CVAR;
|
||||||
count = 0;
|
count = 0;
|
||||||
while ((*(buf + *cur_pos) != ' ') && (*(buf + *cur_pos) != '\n') && (*(buf + *cur_pos) != '\t') && (*(buf + *cur_pos) != '\r')) {
|
while ((*(buf + *cur_pos) != ' ') && (*(buf + *cur_pos) != '\n') && (*(buf + *cur_pos) != '\t') && (*(buf + *cur_pos) != '\r')) {
|
||||||
|
@ -2652,7 +2645,6 @@ int RQ3_GetCommand ( char *buf, int *cur_pos, char *cvar, char *value, int len )
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
}
|
}
|
||||||
cvar[count] = '\0';
|
cvar[count] = '\0';
|
||||||
|
|
||||||
} else if ((state == CVAR) && (*(buf + *cur_pos) == '"')) {
|
} else if ((state == CVAR) && (*(buf + *cur_pos) == '"')) {
|
||||||
state = VALUE;
|
state = VALUE;
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
|
@ -2688,27 +2680,23 @@ int RQ3_CheckTag ( char *tag ){
|
||||||
for (i = 0; i < NUM_TAGS; i++)
|
for (i = 0; i < NUM_TAGS; i++)
|
||||||
if (Q_stricmp ( known_tags[i], tag) == 0)
|
if (Q_stricmp ( known_tags[i], tag) == 0)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return INVALID;
|
return INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int RQ3_CheckClosingTag (char *buf, int *cur_pos, int tag_type, int len) {
|
int RQ3_CheckClosingTag (char *buf, int *cur_pos, int tag_type, int len) {
|
||||||
|
|
||||||
char tag[20];
|
char tag[20];
|
||||||
|
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
if (*(buf + *cur_pos) == '/') {
|
if (*(buf + *cur_pos) == '/') {
|
||||||
(*cur_pos)++;
|
(*cur_pos)++;
|
||||||
if (RQ3_GetTag (buf, cur_pos, tag, len) == tag_type) {
|
if (RQ3_GetTag (buf, cur_pos, tag, len) == tag_type) {
|
||||||
G_Printf ("RQ3 config system: Block <%s> is finished\n", known_tags[tag_type]);
|
G_Printf ("RQ3 config system: Block <%s> is finished\n", known_tags[tag_type]);
|
||||||
return PARSING_OK;
|
return PARSING_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
G_Printf ("RQ3 config system: Invalid block closing. Needs </%s>, found </%s>\n", known_tags[tag_type], tag);
|
G_Printf ("RQ3 config system: Invalid block closing. Needs </%s>, found </%s>\n", known_tags[tag_type], tag);
|
||||||
return PARSING_ERROR;
|
return PARSING_ERROR;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
G_Printf ("RQ3 config system: Found invalid tag in block <%s>\n", known_tags[tag_type]);
|
G_Printf ("RQ3 config system: Found invalid tag in block <%s>\n", known_tags[tag_type]);
|
||||||
return PARSING_ERROR;
|
return PARSING_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue