mirror of
https://github.com/id-Software/quake2-rerelease-dll.git
synced 2025-03-14 12:20:45 +00:00
Added gender stuff
This commit is contained in:
parent
3c524e4c36
commit
cbf9ebbba3
2 changed files with 53 additions and 0 deletions
|
@ -1944,6 +1944,15 @@ constexpr item_id_t weap_ids[] = {
|
|||
IT_WEAPON_SNIPER
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
GENDER_MALE,
|
||||
GENDER_FEMALE,
|
||||
GENDER_NEUTRAL
|
||||
} gender_t;
|
||||
|
||||
#define GENDER_STR( ent, he, she, it ) (((ent)->client->pers.gender == GENDER_MALE) ? he : (((ent)->client->pers.gender == GENDER_FEMALE) ? she : it))
|
||||
|
||||
|
||||
//======================================================================
|
||||
// Action Add End
|
||||
//======================================================================
|
||||
|
@ -2595,6 +2604,7 @@ void RemoveAttackingPainDaemons(edict_t *self);
|
|||
bool G_ShouldPlayersCollide(bool weaponry);
|
||||
bool P_UseCoopInstancedItems();
|
||||
// ACTION
|
||||
void CL_FixUpGender(edict_t *ent, const char *userinfo);
|
||||
void ClientFixLegs(edict_t *ent);
|
||||
// ACTION
|
||||
|
||||
|
@ -2808,6 +2818,7 @@ struct client_respawn_t
|
|||
|
||||
// Action Add
|
||||
// Number of team kills this game
|
||||
gender_t gender;
|
||||
int32_t team_kills;
|
||||
int32_t team_wounds;
|
||||
|
||||
|
|
|
@ -427,6 +427,44 @@ bool P_UseCoopInstancedItems()
|
|||
return g_coop_instanced_items->integer || g_coop_squad_respawn->integer;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Action Add
|
||||
//=======================================================================
|
||||
// Gender-based messaging in a genderless world
|
||||
// Credit to skuller for the `CL_FixUpGender` function
|
||||
//=======================================================================
|
||||
|
||||
// This only applies to Action skins, all others become neutral
|
||||
void CL_FixUpGender(edict_t *ent, const char *userinfo)
|
||||
{
|
||||
char *p;
|
||||
char sk[MAX_QPATH];
|
||||
char val[MAX_INFO_VALUE] = { 0 };
|
||||
|
||||
if (!ent->client)
|
||||
return false;
|
||||
|
||||
Q_strlcpy(sk, info_skin->string, sizeof(sk));
|
||||
if ((p = strchr(sk, '/')) != NULL)
|
||||
*p = 0;
|
||||
if (Q_stricmp(sk, "male") == 0 ||
|
||||
Q_stricmp(sk, "actionmale") == 0 ||
|
||||
Q_stricmp(sk, "aqmarine") == 0 ||
|
||||
Q_stricmp(sk, "messiah") == 0 ||
|
||||
Q_stricmp(sk, "sas") == 0 ||
|
||||
Q_stricmp(sk, "terror") == 0
|
||||
)
|
||||
Q_strlcpy(val, "male", sizeof(val));
|
||||
else if (Q_stricmp(sk, "female") == 0 ||
|
||||
Q_stricmp(sk, "crackhor") == 0 ||
|
||||
Q_stricmp(sk, "actionrally") == 0 ||
|
||||
Q_stricmp(sk, "sydney") == 0
|
||||
)
|
||||
Q_strlcpy(val, "female", sizeof(val));
|
||||
else
|
||||
Q_strlcpy(val, "none", sizeof(val));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
void ClientObituary(edict_t *self, edict_t *inflictor, edict_t *attacker, mod_t mod)
|
||||
|
@ -3432,6 +3470,10 @@ void ClientUserinfoChanged(edict_t *ent, const char *userinfo)
|
|||
if (!gi.Info_ValueForKey(userinfo, "skin", val, sizeof(val)))
|
||||
Q_strlcpy(val, "male/grunt", sizeof(val));
|
||||
|
||||
// set gender based on skin (Action add)
|
||||
//if (!gi.Info_ValueForKey(userinfo, "gender", val, sizeof(val)))
|
||||
CL_FixUpGender(ent, userinfo);
|
||||
|
||||
int playernum = ent - g_edicts - 1;
|
||||
|
||||
// combine name and skin into a configstring
|
||||
|
|
Loading…
Reference in a new issue