From 0dcbd899813cc800468108bc8128c08d0a202c1e Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Wed, 13 Nov 2002 00:50:38 +0000 Subject: [PATCH] Fixed item dropping, specmode selection on death and helmet probs. --- reaction/ChangeLog | Bin 23118 -> 23578 bytes reaction/game/g_active.c | 14 ++++++- reaction/game/g_client.c | 14 +++++-- reaction/game/g_cmds.c | 15 +++++++- reaction/game/g_teamplay.c | 75 +++++++++++++++++++++++++++++++------ 5 files changed, 100 insertions(+), 18 deletions(-) diff --git a/reaction/ChangeLog b/reaction/ChangeLog index 1be936d5af2e24387a55ca8f2d4f8c4700dd3546..6d99ee89bee3863a4be8548cb33a2098d7205bc1 100644 GIT binary patch delta 304 zcmXAj!A`Bck72Sm--3jLPvNup z2J)@VpLAz-W;^q9h`zp~&sXc;H>|q6xJp&<66IPe(^4PcsY-3w&TR4!TmP}$S)diD z8LnDifdan5uA8xq;`7rvEO47~x4&uSx!hCYcg0gmZDC913|B%{#hijtJf0uGuBEVr zx;o+AvU}!c{ok#`nP{vh4VZI!?<^X{_Scount = -1; client->ps.stats[STAT_HOLDABLE_ITEM] &= ~(1 << client->teamplayItem); client->uniqueItems--; + return; } } if (client->ps.stats[STAT_HOLDABLE_ITEM] & (1 << HI_BANDOLIER)) { @@ -982,18 +986,21 @@ void ThrowItem(gentity_t * ent) xr_drop->count = -1; client->ps.stats[STAT_HOLDABLE_ITEM] &= ~(1 << HI_BANDOLIER); client->uniqueItems--; + return; } else if (client->ps.stats[STAT_HOLDABLE_ITEM] & (1 << HI_SLIPPERS)) { xr_item = BG_FindItemForHoldable(HI_SLIPPERS); xr_drop = dropWeapon(ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM); xr_drop->count = -1; client->ps.stats[STAT_HOLDABLE_ITEM] &= ~(1 << HI_SLIPPERS); client->uniqueItems--; + return; } else if (client->ps.stats[STAT_HOLDABLE_ITEM] & (1 << HI_SILENCER)) { xr_item = BG_FindItemForHoldable(HI_SILENCER); xr_drop = dropWeapon(ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM); xr_drop->count = -1; client->ps.stats[STAT_HOLDABLE_ITEM] &= ~(1 << HI_SILENCER); client->uniqueItems--; + return; // JBravo: adding the helmet :) } else if (client->ps.stats[STAT_HOLDABLE_ITEM] & (1 << HI_HELMET)) { xr_item = BG_FindItemForHoldable(HI_HELMET); @@ -1001,18 +1008,21 @@ void ThrowItem(gentity_t * ent) xr_drop->count = -1; client->ps.stats[STAT_HOLDABLE_ITEM] &= ~(1 << HI_HELMET); client->uniqueItems--; + return; } else if (client->ps.stats[STAT_HOLDABLE_ITEM] & (1 << HI_LASER)) { xr_item = BG_FindItemForHoldable(HI_LASER); xr_drop = dropWeapon(ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM); xr_drop->count = -1; client->ps.stats[STAT_HOLDABLE_ITEM] &= ~(1 << HI_LASER); client->uniqueItems--; + return; } else if (client->ps.stats[STAT_HOLDABLE_ITEM] & (1 << HI_KEVLAR)) { xr_item = BG_FindItemForHoldable(HI_KEVLAR); xr_drop = dropWeapon(ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM); xr_drop->count = -1; client->ps.stats[STAT_HOLDABLE_ITEM] &= ~(1 << HI_KEVLAR); client->uniqueItems--; + return; } } } @@ -1172,11 +1182,11 @@ void ClientThink_real(gentity_t * ent) } // JBravo: fixing telefragging and shit during spawnig. (Thanks NiceAss! :) - if (g_gametype.integer == GT_TEAMPLAY && + if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_TEAM) && ((ent->client->ps.stats[STAT_RQ3] & RQ3_PLAYERSOLID) != RQ3_PLAYERSOLID) && !level.lights_camera_action) { UnstickPlayer(ent); } - if (g_gametype.integer == GT_TEAMPLAY && + if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_TEAM) && ((ent->client->ps.stats[STAT_RQ3] & RQ3_PLAYERSOLID) != RQ3_PLAYERSOLID)) { pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; } diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index 286b24a3..4807a33d 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.122 2002/11/13 00:50:38 jbravo +// Fixed item dropping, specmode selection on death and helmet probs. +// // Revision 1.121 2002/10/29 01:34:52 jbravo // Added g_RQ3_tdmMode (0 = TP style, 1 = DM style) including UI support. // @@ -1536,6 +1539,7 @@ void ClientSpawn(gentity_t * ent) // find a spawn point // do it before setting health back up, so farthest // ranging doesn't count this client + if (client->sess.sessionTeam == TEAM_SPECTATOR) { if (g_gametype.integer == GT_CTF && (client->sess.savedTeam == TEAM_RED || client->sess.savedTeam == TEAM_BLUE)) { @@ -1567,8 +1571,7 @@ void ClientSpawn(gentity_t * ent) spawnPoint = SelectCTFSpawnPoint(client->sess.sessionTeam, client->pers.teamState.state, spawn_origin, spawn_angles); // JBravo: If we are in Teamplay mode, use the teamspawnpoints. - } else if (g_gametype.integer == GT_TEAMPLAY) { - + } else if (g_gametype.integer == GT_TEAMPLAY || (g_gametype.integer == GT_TEAM && client->sess.teamSpawn)) { // Freud: Assign the spawns from the spawning system (g_teamplay.c) level.team1spawnpoint = level.teamplay_spawns[0]; level.team2spawnpoint = level.teamplay_spawns[1]; @@ -1865,7 +1868,12 @@ void ClientSpawn(gentity_t * ent) ent->client->ps.stats[STAT_HOLDABLE_ITEM] |= (1 << HI_SILENCER); ent->client->ps.stats[STAT_HOLDABLE_ITEM] |= (1 << HI_BANDOLIER); ent->client->ps.stats[STAT_HOLDABLE_ITEM] |= (1 << HI_SLIPPERS); - ent->client->uniqueItems = 5; + if (g_RQ3_haveHelmet.integer) { + ent->client->ps.stats[STAT_HOLDABLE_ITEM] |= (1 << HI_HELMET); + ent->client->uniqueItems = 6; + } else { + ent->client->uniqueItems = 5; + } } // JBravo: lock the player down diff --git a/reaction/game/g_cmds.c b/reaction/game/g_cmds.c index 6c199939..c61de0c5 100644 --- a/reaction/game/g_cmds.c +++ b/reaction/game/g_cmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.176 2002/11/13 00:50:38 jbravo +// Fixed item dropping, specmode selection on death and helmet probs. +// // Revision 1.175 2002/10/30 20:04:34 jbravo // Adding helmet // @@ -1085,7 +1088,7 @@ void SetTeam(gentity_t * ent, char *s) // execute the team change // //sLiCeR: Matchmode referee hear all protection - if(g_gametype.integer == GT_TEAMPLAY && (oldTeam == TEAM_FREE || oldTeam == TEAM_SPECTATOR) && (team == TEAM_RED || team == TEAM_BLUE)) + if(g_gametype.integer >= GT_TEAM && (oldTeam == TEAM_FREE || oldTeam == TEAM_SPECTATOR) && (team == TEAM_RED || team == TEAM_BLUE)) ent->client->sess.refHear = qfalse; // if the player was dead leave the body @@ -1167,8 +1170,16 @@ void SetTeam(gentity_t * ent, char *s) ClientUserinfoChanged(clientNum); ClientBegin(clientNum); } - if (g_gametype.integer == GT_CTF) + if (g_gametype.integer == GT_CTF || (g_gametype.integer == GT_TEAM && client->sess.savedTeam == TEAM_SPECTATOR)) MakeSpectator (ent); +// JBravo: If the game is in progress, lets spawn players joining. + if (g_gametype.integer == GT_TEAM && level.team_round_going && + (client->sess.savedTeam == TEAM_RED || client->sess.savedTeam == TEAM_BLUE)) { + client->ps.persistant[PERS_SAVEDTEAM] = client->sess.savedTeam; + client->ps.persistant[PERS_TEAM] = client->sess.savedTeam; + client->sess.sessionTeam = client->sess.savedTeam; + respawn (ent); + } } /* diff --git a/reaction/game/g_teamplay.c b/reaction/game/g_teamplay.c index 4ce75caa..06724ead 100644 --- a/reaction/game/g_teamplay.c +++ b/reaction/game/g_teamplay.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.145 2002/11/13 00:50:38 jbravo +// Fixed item dropping, specmode selection on death and helmet probs. +// // Revision 1.144 2002/10/30 20:04:34 jbravo // Adding helmet // @@ -637,15 +640,27 @@ void CheckTeamRules() void StartLCA() { + int i; + gentity_t *player; + CleanLevel(); trap_Cvar_Set("g_RQ3_lca", "1"); level.lights_camera_action = (41 * level.fps) / 10; G_LogPrintf("LIGHTS...\n"); - if (g_gametype.integer == GT_TEAMPLAY) { + if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_TEAM) { SpawnPlayers(); - } else { + } else if (g_gametype.integer == GT_CTF) { RQ3_Respawn_CTB_players(TEAM_RED); RQ3_Respawn_CTB_players(TEAM_BLUE); + if (g_RQ3_limchasecam.integer != 0 && g_RQ3_matchmode.integer ) { + for (i = 0; i < level.maxclients; i++) { + player = &g_entities[i]; + if (!player->inuse || !player->client) + continue; + if (player->client->sess.sub != TEAM_FREE) + Cmd_FollowCycle_f(player, 1); + } + } } level.lights_delay = 4; } @@ -1345,6 +1360,10 @@ void RQ3_Respawn_CTB_players(int team) ent = &g_entities[i]; if (!ent->inuse || !ent->client) continue; + if (g_RQ3_matchmode.integer && ent->client->sess.sub != TEAM_FREE) + continue; + if (ent->client->sess.savedTeam == TEAM_SPECTATOR && ent->client->specMode == SPECTATOR_FREE) + continue; if (ent->client->sess.savedTeam == team && (ent->client->sess.spectatorState == SPECTATOR_FREE || level.lights_camera_action)) { ent->client->weaponCount[ent->client->ps.weapon] = ent->client->savedPSweapon; @@ -1353,6 +1372,9 @@ void RQ3_Respawn_CTB_players(int team) ent->client->ps.persistant[PERS_TEAM] = team; ent->client->sess.spectatorState = SPECTATOR_NOT; ent->client->specMode = SPECTATOR_NOT; + ent->client->idletime = 0; + ResetKills(ent); + ent->client->last_damaged_players[0] = '\0'; ClientSpawn(ent); } } @@ -1365,12 +1387,13 @@ void MakeSpectator(gentity_t * ent) int i; client = ent->client; + if (g_gametype.integer == GT_TEAMPLAY && client->sess.sessionTeam == TEAM_SPECTATOR) return; if (!client->gibbed || ent->s.eType != ET_INVISIBLE) CopyToBodyQue(ent); - if (g_gametype.integer == GT_TEAMPLAY) { + if (g_gametype.integer >= GT_TEAM) { for (i = 0; i < level.maxclients; i++) { follower = &g_entities[i]; if (!follower->inuse || !follower->client) @@ -1384,6 +1407,7 @@ void MakeSpectator(gentity_t * ent) Cmd_FollowCycle_f(follower, 1); } } + if (g_gametype.integer == GT_CTF) { client->savedPSweapon = client->weaponCount[ent->client->ps.weapon]; client->savedSTAT = client->ps.stats[STAT_WEAPONS]; @@ -1445,13 +1469,46 @@ void MakeSpectator(gentity_t * ent) client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM; } } else { - if (OKtoFollow(ent - g_entities)) { - client->sess.spectatorState = client->specMode; - } else { + if (client->specMode == SPECTATOR_NOT) { client->ps.pm_flags &= ~PMF_FOLLOW; client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM; client->sess.spectatorState = SPECTATOR_FREE; - StopFollowing(ent); + client->specMode = SPECTATOR_FREE; + } + if (client->specMode == SPECTATOR_FOLLOW) { + if (OKtoFollow(ent - g_entities)) { + client->sess.spectatorState = SPECTATOR_FOLLOW; + client->ps.pm_flags |= PMF_FOLLOW; + client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM; + ClientSpawn(ent); + Cmd_FollowCycle_f(ent, 1); + return; + } else { + client->sess.spectatorState = SPECTATOR_FREE; + client->ps.pm_flags &= ~PMF_FOLLOW; + client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM; + } + } + if (client->specMode == SPECTATOR_ZCAM) { + if (OKtoFollow(ent - g_entities)) { + client->sess.spectatorState = SPECTATOR_ZCAM; + client->ps.pm_flags &= ~PMF_FOLLOW; + client->ps.stats[STAT_RQ3] |= RQ3_ZCAM; + ClientSpawn(ent); + if (client->camera->mode == CAMERA_MODE_SWING) { + CameraSwingCycle (ent, 1); + } else if (client->camera->mode == CAMERA_MODE_FLIC) { + CameraFlicBegin (ent); + } else { + client->camera->mode = CAMERA_MODE_SWING; + CameraSwingCycle (ent, 1); + } + return; + } else { + client->sess.spectatorState = SPECTATOR_FREE; + client->ps.pm_flags &= ~PMF_FOLLOW; + client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM; + } } } ClientSpawn(ent); @@ -1481,10 +1538,6 @@ qboolean OKtoFollow(int clientnum) continue; } - x++; - }; - - if (x > 0) { return qtrue; } return qfalse;