Setting ( for real ) gender on DM

This commit is contained in:
Daniel Simoes 2002-06-13 20:59:35 +00:00
parent 34c1907fc2
commit 463005e333
2 changed files with 26 additions and 16 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.92 2002/06/13 20:59:35 slicer
// Setting ( for real ) gender on DM
//
// Revision 1.91 2002/06/12 22:32:24 slicer
// Even better way to improve the Cvar Anti-Cheat System
//
@ -231,7 +234,7 @@ breakable_t rq3_breakables[RQ3_MAX_BREAKABLES];
// JBravo: for models
extern legitmodel_t legitmodels[MAXMODELS];
qboolean RQ3_Validatemodel (char *model);
int RQ3_Validatemodel (char *model);
// g_client.c -- client functions that don't happen every frame
@ -968,6 +971,7 @@ void ClientUserinfoChanged( int clientNum ) {
char userinfo[MAX_INFO_STRING];
// NiceAss: Added the following. Needed to prevent all models but "grunt"
char *skin2, model2[MAX_STRING_CHARS];
int gender;
ent = g_entities + clientNum;
client = ent->client;
@ -1049,7 +1053,7 @@ void ClientUserinfoChanged( int clientNum ) {
} else {
skin2 = "chowda";
}
if (RQ3_Validatemodel(model2)) {
if (RQ3_Validatemodel(model2)!= -1) {
Com_sprintf (model, sizeof (model) , "%s/%s", model2, skin2);
Com_sprintf (headModel, sizeof (headModel) , "%s/%s", model2, skin2);
} else {
@ -1085,11 +1089,16 @@ void ClientUserinfoChanged( int clientNum ) {
// Makro - adding abbey
// if ( Q_stricmpn(model2, "grunt", sizeof(model2)) && Q_stricmpn(model2, "abbey", sizeof(model2))) {
// JBravo: Validating the model
if (!RQ3_Validatemodel(model2)) {
gender = RQ3_Validatemodel(model2);
if (gender == -1) {
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(headModel, "grunt/resdog", sizeof("grunt/resdog"));
client->radioGender = 0; // Male
}
else
if(gender != GENDER_NEUTER)
client->radioGender = gender;
// End of temporary hack.
}
// bots set their team a few frames later

View file

@ -5,8 +5,8 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.77 2002/06/13 20:16:16 slicer
// Setting gender on DM also
// Revision 1.78 2002/06/13 20:59:35 slicer
// Setting ( for real ) gender on DM
//
// Revision 1.76 2002/06/13 19:46:18 assimon
// Map defined in cfg is now played with main/team cvar settings
@ -713,21 +713,21 @@ JBravo: Makes sure we have a legit RQ3 model
legitmodel_t legitmodels[MAXMODELS];
qboolean RQ3_Validatemodel (char *model) {
qboolean valid;
int RQ3_Validatemodel (char *model) {
int gender;
int i;
valid = qfalse;
gender = -1;
for (i=0; i <MAXMODELS; i++) {
if (*legitmodels[i].name == 0)
break;
if (!Q_stricmp (legitmodels[i].name, model)) {
valid = qtrue;
gender = legitmodels[i].gender;
break;
}
}
return valid;
return gender;
}
/*
@ -806,7 +806,8 @@ void RQ3_loadmodels (void)
else if (!Q_stricmp(token, "female"))
legitmodels[modelcount].gender = GENDER_FEMALE;
else if (!Q_stricmp(token, "neuter"))
legitmodels[modelcount].gender = GENDER_NEUTER;
//slicer no NEUTER
legitmodels[modelcount].gender = GENDER_MALE;
else
break;
else
@ -945,7 +946,11 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
G_SoundIndex( "sound/player/gurp1.wav" );
G_SoundIndex( "sound/player/gurp2.wav" );
}
//Slicer: Default Radio Gender according to MODEL gender
// JBravo: reset teamplay stuff.
if( g_gametype.integer == GT_TEAMPLAY ) {
//Slicer: Default Radio Gender according to MODEL gender
Q_strncpyz(model, g_RQ3_team1model.string, sizeof(model));
Q_strncpyz(model2, g_RQ3_team2model.string, sizeof(model));
s = Q_strrchr(model, '/');
@ -957,16 +962,12 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
for (i=0; i <MAXMODELS; i++) {
if (!Q_stricmp (legitmodels[i].name,model)) {
if(legitmodels[i].gender != GENDER_NEUTER)
level.team1gender = legitmodels[i].gender;
}
if (!Q_stricmp (legitmodels[i].name,model2)) {
if(legitmodels[i].gender != GENDER_NEUTER)
level.team2gender = legitmodels[i].gender;
}
}
// JBravo: reset teamplay stuff.
if( g_gametype.integer == GT_TEAMPLAY ) {
level.team_round_countdown = 0;
level.rulecheckfrequency = 0;
level.lights_camera_action = 0;