Batch of bug fixes for gamecode. Patch compiled and log message written by Tobias Kuehnhammer (#5144)

################################################################################
This Patch fixes:
################################################################################

- The "fraglimit warning" was not played at all, if on the blue team.
- The "where" console command was broken.
- Obelisk explosion wasn't drawn if no Rocketlauncher was loaded.
- Impact marks sometimes didn't draw at all.
- IMPORTANT BUGFIX: No killing for cheaters with Lightning gun and Gauntlet.
- If two doors are close to each other a spectator couldn't fly through them.
- More robust, efficient and logical respawning routine.
  NOTE: The game.qvm will get notable smaller and will use LESS MEMORY!
- Drowning sounds are fixed. Now they are played as intended. (as the id
comment
  in the source code shows).
- Some AI bugs (OVERFLOW!) in the bot movement code.
- Several "Team Arena" Overload and Harvester bugs.
- Stops bots from attacking a team mate (player) who only changed teams.
- Some voice chats and CTF commands fixed.
- "Team_ReturnFlag" was called twice, which did wired things sometimes. 
  NOTE: (G_RunItem checks CONTENTS_NODROP already!)
- A bugfix for Gauntlet animation.
- Incorrect CTF scoring.
- A bunch of corrected comments and print lines ("\n").
- Some regularity of expression and some small trivial bugs.

################################################################################
Details:
################################################################################

********************************************************************************
BUG: in gamemode GT_TEAM the fraglimit warning will not be played if joining
the
     blue team!
--------------------------------------------------------------------------------
Solution: In "CG_CheckLocalSounds": if cgs.scores2 > highScore, highScore
should
          be cgs.scores2.
********************************************************************************
BUG: the "where" console command doesn't work as expected (it's always 0 0 0) 
     but not in id Quake 3 Arena. It seems that now Ioquake3 is affected!
--------------------------------------------------------------------------------
Solution: In Function "Cmd_Where_f" ent->s.origin should be 
          ent->r.currentOrigin.
********************************************************************************
BUG: in gamemode GT_OBELISK obelisk explosion won't be drawn if there is no 
     Rocketlauncher loaded. (The "maps without Rocketlauncher" bug)
--------------------------------------------------------------------------------
Solution: in "cg_main.c": cgs.media.rocketExplosionShader should be registered 
          if gamemode is GT_OBELISK.
********************************************************************************
BUG: Impact marks sometimes doesn't draw at all. Not easy to reproduce if you 
     don't play (io)Quake3 every day and know the places where it happens! ;) 
     But anyway...
     Test: start q3dm12 go to "Long Jump Canyon" (where the small platform 
     teleporter for the BFG is) place yourself at the point where the railgun 
     spawns, look in the direction where the red suspended armor is. Now shoot
     at the sloped wall on the out/leftside of the door you see. (the sloped 
     wall should be nearly in the center of your screen now). If you choose the 
     correct brush face and shoot up and down at this brush face, the impact 
     marks sometimes aren't visible.

     There are hundreds of custom maps where this can happen!
--------------------------------------------------------------------------------
Solution: I replaced the function "SnapVectorTowards" with the one from 
         "Wolfenstein - Enemy Territory (GPL Source Code)"
********************************************************************************
BUG: Normally "NOCLIP" cheaters are logically not allowed to fire a gun.
     Unfortunatly the Gauntlet (and Lightning gun) was forgotten and not 
     restricted to that. All weapons except those two were handled correct. 
--------------------------------------------------------------------------------
Solution: Make Gauntlet and Lightning gun not firing for someone who cheats 
          with "NOCLIP" (like all other weapons).
********************************************************************************
NOTE: A few bugfixes are not mine and are reported here: 
      http://www.quake3world.com/forum/viewtopic.php?f=16&t=9179.

      Thanks to Quake3world, for all those years and the good guys there!
********************************************************************************
BUG: During making a mod I found a very strange bug, which mainly occurs if
     someone tries to implement a lot of singleplayer monsters which should
walk
     slowly (like the "Crash" bot). So if someone wants to make slow down bots
     or monsters when they are walking towards a goal and alter the function
     "BotMoveInGoalArea" then the bots/monsters do stupid things. Otherwise and
     this is the default (also buggy) behavior they start running although they
     shouldn't (as seen with the "Crash" bot and will not be fixed here).
--------------------------------------------------------------------------------
Solution: Fix overflow in bot user command. BUGFIX from "Hunt" mod by J. 
          Hoffman.
********************************************************************************
BUG: in function "BotMoveToGoal" the special elevator case doesn't make sense.
--------------------------------------------------------------------------------
Solution: in "be_ai_move.c": ((result->flags & MOVERESULT_ONTOPOF_FUNCBOB) ||
                              (result->flags & MOVERESULT_ONTOPOF_FUNCBOB)) 
                   should be ((result->flags & MOVERESULT_ONTOPOF_ELEVATOR) ||
                              (result->flags & MOVERESULT_ONTOPOF_FUNCBOB)).
********************************************************************************
BUG: in function "BotWantsToRetreat" and "BotWantsToChase" this is wrong:
     "(bs->enemy != redobelisk.entitynum || bs->enemy !=
blueobelisk.entitynum)"
--------------------------------------------------------------------------------
Solution: "... redobelisk.entitynum) && (bs->enemy != blueobelisk.." is
correct.
********************************************************************************
BUG: in gamemode GT_OBELISK there are too many node switches for bots 
     (test: mpq3tourney6 with many bots). If that happens, game becomes 
     unplayable. I don't know if this is the best solution but here it is:
--------------------------------------------------------------------------------
Solution: In function "AINode_Battle_Fight" right after:
if (!BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy))
{
   I added this: 
#ifdef MISSIONPACK
    if (bs->enemy == redobelisk.entitynum || bs->enemy == 
                                                        blueobelisk.entitynum)
{
    AIEnter_Battle_Chase(bs, "battle fight: obelisk out of sight");
    return qfalse;
    }
#endif
********************************************************************************
BUG: in gamemode >= GT_TEAM, after team change, bots will (sometimes) not stop
     shooting at you, although you are on their team now. It seems that the 
     configstrings are f***** up or not reliable in this case!
--------------------------------------------------------------------------------
Solution: In function "BotTeam" and "BotSameTeam" get the real team values.
********************************************************************************
BUG: Some of the bots voice commands are wrong. They are commanded to attack
the
     enemy base but they say "Okay, I will defend!"
--------------------------------------------------------------------------------
Solution: Corrected some voice commands in "BotCTFOrders_FlagNotAtBase" and
         "Bot1FCTFOrders_EnemyDroppedFlag"
********************************************************************************
BUG: Spectators couldn't fly through doors if they are very close to each
other.
     You can test it with some regular id maps (q3dm14, q3dm12) but there are
     also many custom maps where this can happen! This is annoying because in 
     the worst case you can't move at all and are caught inside a door.
--------------------------------------------------------------------------------
Solution: There is a solution in a mod called "Hunt" by J. Hoffman. 
          Bugfix is included in this patch!
********************************************************************************
BUG: During making a mod I found it very hard to implement some of my ideas
     (something like "Limbo" or "Meeting") because of the way the player spawn
     effect, intermission and spawning on victory pads is handled. I reworked
it
     a bit and simplified it so that the effect is handled when a client      
     respawns
     (as the name says) and not when a client begins. I think this will help 
     more
     mod makers everytime they want to make changes to spawning of players,
bots
     on victory pads or monsters... and want to avoid spectators with 
     Machineguns
     which can kill and score... :()

     NOTE: I also renamed the poorly named function "respawn" 
           to "ClientRespawn". If someone searches the code base for "respawn" 
           it was really hard to find the correct place for what was 
           meant. "respawn" is used so often, that you really get headache ... 
           now with "ClientRespawn" it's easier!

     IMPORTANT: The whole respawning, moving to intermission point and 
                everything related to that is now done in a more reliable way 
                without changing the default behavior. (How critical the whole 
                spwaning mess was did you see by yourself (ioquake3 rev. 2076). 
                With this patch it's safer. 
                Trust me, I spent hours of fixing silly problems...
-------------------------------------------------------------------------------- 
Solution: Simplified "ClientBegin" and moved the teleport event  
          to "ClientSpawn".
********************************************************************************
BUG: If a player is dying or hurted under water the hurt/dying sounds AND the
     drowning sounds are played together. This is silly. Moreover it's no good
     idea to let the server play client sounds! There was a solution in a mod 
     called "Q3A++" by Dan 'Neurobasher' Gomes which fixes the problem.
--------------------------------------------------------------------------------
Solution: Created a "CG_WaterLevel" function to play the appropriate sounds.
********************************************************************************

################################################################################
This commit is contained in:
Thilo Schulz 2011-08-01 11:39:33 +00:00
parent 8ab91bde8e
commit eb9fe030c4
34 changed files with 286 additions and 226 deletions

View file

@ -3187,7 +3187,7 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in
else if ((reach.traveltype & TRAVELTYPE_MASK) == TRAVEL_ELEVATOR || else if ((reach.traveltype & TRAVELTYPE_MASK) == TRAVEL_ELEVATOR ||
(reach.traveltype & TRAVELTYPE_MASK) == TRAVEL_FUNCBOB) (reach.traveltype & TRAVELTYPE_MASK) == TRAVEL_FUNCBOB)
{ {
if ((result->flags & MOVERESULT_ONTOPOF_FUNCBOB) || if ((result->flags & MOVERESULT_ONTOPOF_ELEVATOR) ||
(result->flags & MOVERESULT_ONTOPOF_FUNCBOB)) (result->flags & MOVERESULT_ONTOPOF_FUNCBOB))
{ {
ms->reachability_time = AAS_Time() + 5; ms->reachability_time = AAS_Time() + 5;

View file

@ -2123,9 +2123,9 @@ static void CG_DrawTeamVote(void) {
char *s; char *s;
int sec, cs_offset; int sec, cs_offset;
if ( cgs.clientinfo->team == TEAM_RED ) if ( cgs.clientinfo[cg.clientNum].team == TEAM_RED )
cs_offset = 0; cs_offset = 0;
else if ( cgs.clientinfo->team == TEAM_BLUE ) else if ( cgs.clientinfo[cg.clientNum].team == TEAM_BLUE )
cs_offset = 1; cs_offset = 1;
else else
return; return;

View file

@ -418,6 +418,51 @@ static void CG_ItemPickup( int itemNum ) {
} }
/*
================
CG_WaterLevel
Returns waterlevel for entity origin
================
*/
int CG_WaterLevel(centity_t *cent) {
vec3_t point;
int contents, sample1, sample2, anim, waterlevel;
// get waterlevel, accounting for ducking
waterlevel = 0;
VectorCopy(cent->lerpOrigin, point);
point[2] += MINS_Z + 1;
anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
if (anim == LEGS_WALKCR || anim == LEGS_IDLECR) {
point[2] += CROUCH_VIEWHEIGHT;
} else {
point[2] += DEFAULT_VIEWHEIGHT;
}
contents = CG_PointContents(point, -1);
if (contents & MASK_WATER) {
sample2 = point[2] - MINS_Z;
sample1 = sample2 / 2;
waterlevel = 1;
point[2] = cent->lerpOrigin[2] + MINS_Z + sample1;
contents = CG_PointContents(point, -1);
if (contents & MASK_WATER) {
waterlevel = 2;
point[2] = cent->lerpOrigin[2] + MINS_Z + sample2;
contents = CG_PointContents(point, -1);
if (contents & MASK_WATER) {
waterlevel = 3;
}
}
}
return waterlevel;
}
/* /*
================ ================
@ -443,9 +488,16 @@ void CG_PainEvent( centity_t *cent, int health ) {
} else { } else {
snd = "*pain100_1.wav"; snd = "*pain100_1.wav";
} }
trap_S_StartSound( NULL, cent->currentState.number, CHAN_VOICE, // play a gurp sound instead of a normal pain sound
CG_CustomSound( cent->currentState.number, snd ) ); if (CG_WaterLevel(cent) >= 1) {
if (rand()&1) {
trap_S_StartSound(NULL, cent->currentState.number, CHAN_VOICE, CG_CustomSound(cent->currentState.number, "sound/player/gurp1.wav"));
} else {
trap_S_StartSound(NULL, cent->currentState.number, CHAN_VOICE, CG_CustomSound(cent->currentState.number, "sound/player/gurp2.wav"));
}
} else {
trap_S_StartSound(NULL, cent->currentState.number, CHAN_VOICE, CG_CustomSound(cent->currentState.number, snd));
}
// save pain time for programitic twitch animation // save pain time for programitic twitch animation
cent->pe.painTime = cg.time; cent->pe.painTime = cg.time;
cent->pe.painDirection ^= 1; cent->pe.painDirection ^= 1;
@ -1105,8 +1157,13 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
case EV_DEATH2: case EV_DEATH2:
case EV_DEATH3: case EV_DEATH3:
DEBUGNAME("EV_DEATHx"); DEBUGNAME("EV_DEATHx");
trap_S_StartSound( NULL, es->number, CHAN_VOICE,
CG_CustomSound( es->number, va("*death%i.wav", event - EV_DEATH1 + 1) ) ); if (CG_WaterLevel(cent) >= 1) {
trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, "*drown.wav"));
} else {
trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, va("*death%i.wav", event - EV_DEATH1 + 1)));
}
break; break;

View file

@ -920,6 +920,7 @@ static void CG_RegisterGraphics( void ) {
} }
if ( cgs.gametype == GT_OBELISK || cg_buildScript.integer ) { if ( cgs.gametype == GT_OBELISK || cg_buildScript.integer ) {
cgs.media.rocketExplosionShader = trap_R_RegisterShader("rocketExplosion");
cgs.media.overloadBaseModel = trap_R_RegisterModel( "models/powerups/overload_base.md3" ); cgs.media.overloadBaseModel = trap_R_RegisterModel( "models/powerups/overload_base.md3" );
cgs.media.overloadTargetModel = trap_R_RegisterModel( "models/powerups/overload_target.md3" ); cgs.media.overloadTargetModel = trap_R_RegisterModel( "models/powerups/overload_target.md3" );
cgs.media.overloadLightsModel = trap_R_RegisterModel( "models/powerups/overload_lights.md3" ); cgs.media.overloadLightsModel = trap_R_RegisterModel( "models/powerups/overload_lights.md3" );
@ -1189,7 +1190,7 @@ char *CG_GetMenuBuffer(const char *filename) {
return NULL; return NULL;
} }
if ( len >= MAX_MENUFILE ) { if ( len >= MAX_MENUFILE ) {
trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", filename, len, MAX_MENUFILE ) ); trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i\n", filename, len, MAX_MENUFILE ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return NULL; return NULL;
} }
@ -1446,7 +1447,7 @@ void CG_LoadMenus(const char *menuFile) {
} }
if ( len >= MAX_MENUDEFFILE ) { if ( len >= MAX_MENUDEFFILE ) {
trap_Error( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", menuFile, len, MAX_MENUDEFFILE ) ); trap_Error( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i\n", menuFile, len, MAX_MENUDEFFILE ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return; return;
} }

View file

@ -247,7 +247,7 @@ static qboolean CG_ParseAnimationFile( const char *filename, clientInfo_t *ci )
} }
if ( i != MAX_ANIMATIONS ) { if ( i != MAX_ANIMATIONS ) {
CG_Printf( "Error parsing animation file: %s", filename ); CG_Printf( "Error parsing animation file: %s\n", filename );
return qfalse; return qfalse;
} }
@ -1399,7 +1399,8 @@ static void CG_PlayerAngles( centity_t *cent, vec3_t legs[3], vec3_t torso[3], v
// allow yaw to drift a bit // allow yaw to drift a bit
if ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE if ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE
|| ( cent->currentState.torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND ) { || ((cent->currentState.torsoAnim & ~ANIM_TOGGLEBIT) != TORSO_STAND
&& (cent->currentState.torsoAnim & ~ANIM_TOGGLEBIT) != TORSO_STAND2)) {
// if not standing still, always point all in the same direction // if not standing still, always point all in the same direction
cent->pe.torso.yawing = qtrue; // always center cent->pe.torso.yawing = qtrue; // always center
cent->pe.torso.pitching = qtrue; // always center cent->pe.torso.pitching = qtrue; // always center

View file

@ -415,7 +415,7 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) {
} }
// check for flag pickup // check for flag pickup
if ( cgs.gametype >= GT_TEAM ) { if ( cgs.gametype > GT_TEAM ) {
if ((ps->powerups[PW_REDFLAG] != ops->powerups[PW_REDFLAG] && ps->powerups[PW_REDFLAG]) || if ((ps->powerups[PW_REDFLAG] != ops->powerups[PW_REDFLAG] && ps->powerups[PW_REDFLAG]) ||
(ps->powerups[PW_BLUEFLAG] != ops->powerups[PW_BLUEFLAG] && ps->powerups[PW_BLUEFLAG]) || (ps->powerups[PW_BLUEFLAG] != ops->powerups[PW_BLUEFLAG] && ps->powerups[PW_BLUEFLAG]) ||
(ps->powerups[PW_NEUTRALFLAG] != ops->powerups[PW_NEUTRALFLAG] && ps->powerups[PW_NEUTRALFLAG]) ) (ps->powerups[PW_NEUTRALFLAG] != ops->powerups[PW_NEUTRALFLAG] && ps->powerups[PW_NEUTRALFLAG]) )
@ -465,6 +465,11 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) {
// fraglimit warnings // fraglimit warnings
if ( cgs.fraglimit > 0 && cgs.gametype < GT_CTF) { if ( cgs.fraglimit > 0 && cgs.gametype < GT_CTF) {
highScore = cgs.scores1; highScore = cgs.scores1;
if (cgs.gametype == GT_TEAM && cgs.scores2 > highScore) {
highScore = cgs.scores2;
}
if ( !( cg.fraglimitWarnings & 4 ) && highScore == (cgs.fraglimit - 1) ) { if ( !( cg.fraglimitWarnings & 4 ) && highScore == (cgs.fraglimit - 1) ) {
cg.fraglimitWarnings |= 1 | 2 | 4; cg.fraglimitWarnings |= 1 | 2 | 4;
CG_AddBufferedSound(cgs.media.oneFragSound); CG_AddBufferedSound(cgs.media.oneFragSound);

View file

@ -287,10 +287,8 @@ static void CG_TouchItem( centity_t *cent ) {
return; return;
} }
} }
if( cgs.gametype == GT_CTF || cgs.gametype == GT_HARVESTER ) {
#else
if( cgs.gametype == GT_CTF ) {
#endif #endif
if( cgs.gametype == GT_CTF ) {
if (cg.predictedPlayerState.persistant[PERS_TEAM] == TEAM_RED && if (cg.predictedPlayerState.persistant[PERS_TEAM] == TEAM_RED &&
item->giTag == PW_REDFLAG) item->giTag == PW_REDFLAG)
return; return;

View file

@ -545,7 +545,7 @@ int CG_ParseVoiceChats( const char *filename, voiceChatList_t *voiceChatList, in
return qfalse; return qfalse;
} }
if ( len >= MAX_VOICEFILESIZE ) { if ( len >= MAX_VOICEFILESIZE ) {
trap_Print( va( S_COLOR_RED "voice chat file too large: %s is %i, max allowed is %i", filename, len, MAX_VOICEFILESIZE ) ); trap_Print( va( S_COLOR_RED "voice chat file too large: %s is %i, max allowed is %i\n", filename, len, MAX_VOICEFILESIZE ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return qfalse; return qfalse;
} }
@ -658,7 +658,7 @@ int CG_HeadModelVoiceChats( char *filename ) {
return -1; return -1;
} }
if ( len >= MAX_VOICEFILESIZE ) { if ( len >= MAX_VOICEFILESIZE ) {
trap_Print( va( S_COLOR_RED "voice chat file too large: %s is %i, max allowed is %i", filename, len, MAX_VOICEFILESIZE ) ); trap_Print( va( S_COLOR_RED "voice chat file too large: %s is %i, max allowed is %i\n", filename, len, MAX_VOICEFILESIZE ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return -1; return -1;
} }

View file

@ -381,6 +381,7 @@ int BotValidChatPosition(bot_state_t *bs) {
if (BotIsDead(bs)) return qtrue; if (BotIsDead(bs)) return qtrue;
//never start chatting with a powerup //never start chatting with a powerup
if (bs->inventory[INVENTORY_QUAD] || if (bs->inventory[INVENTORY_QUAD] ||
bs->inventory[INVENTORY_ENVIRONMENTSUIT] ||
bs->inventory[INVENTORY_HASTE] || bs->inventory[INVENTORY_HASTE] ||
bs->inventory[INVENTORY_INVISIBILITY] || bs->inventory[INVENTORY_INVISIBILITY] ||
bs->inventory[INVENTORY_REGEN] || bs->inventory[INVENTORY_REGEN] ||

View file

@ -193,8 +193,12 @@ int BotNearbyGoal(bot_state_t *bs, int tfl, bot_goal_t *ltg, float range) {
//check if the bot should go for air //check if the bot should go for air
if (BotGoForAir(bs, tfl, ltg, range)) return qtrue; if (BotGoForAir(bs, tfl, ltg, range)) return qtrue;
//if the bot is carrying the enemy flag // if the bot is carrying a flag or cubes
if (BotCTFCarryingFlag(bs)) { if (BotCTFCarryingFlag(bs)
#ifdef MISSIONPACK
|| Bot1FCTFCarryingFlag(bs) || BotHarvesterCarryingCubes(bs)
#endif
) {
//if the bot is just a few secs away from the base //if the bot is just a few secs away from the base
if (trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, if (trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin,
bs->teamgoal.areanum, TFL_DEFAULT) < 300) { bs->teamgoal.areanum, TFL_DEFAULT) < 300) {
@ -1303,7 +1307,11 @@ int BotSelectActivateWeapon(bot_state_t *bs) {
return WEAPONINDEX_CHAINGUN; return WEAPONINDEX_CHAINGUN;
else if (bs->inventory[INVENTORY_NAILGUN] > 0 && bs->inventory[INVENTORY_NAILS] > 0) else if (bs->inventory[INVENTORY_NAILGUN] > 0 && bs->inventory[INVENTORY_NAILS] > 0)
return WEAPONINDEX_NAILGUN; return WEAPONINDEX_NAILGUN;
else if (bs->inventory[INVENTORY_PROXLAUNCHER] > 0 && bs->inventory[INVENTORY_MINES] > 0)
return WEAPONINDEX_PROXLAUNCHER;
#endif #endif
else if (bs->inventory[INVENTORY_GRENADELAUNCHER] > 0 && bs->inventory[INVENTORY_GRENADES] > 0)
return WEAPONINDEX_GRENADE_LAUNCHER;
else if (bs->inventory[INVENTORY_RAILGUN] > 0 && bs->inventory[INVENTORY_SLUGS] > 0) else if (bs->inventory[INVENTORY_RAILGUN] > 0 && bs->inventory[INVENTORY_SLUGS] > 0)
return WEAPONINDEX_RAILGUN; return WEAPONINDEX_RAILGUN;
else if (bs->inventory[INVENTORY_ROCKETLAUNCHER] > 0 && bs->inventory[INVENTORY_ROCKETS] > 0) else if (bs->inventory[INVENTORY_ROCKETLAUNCHER] > 0 && bs->inventory[INVENTORY_ROCKETS] > 0)
@ -1962,11 +1970,12 @@ void AIEnter_Battle_Fight(bot_state_t *bs, char *s) {
BotRecordNodeSwitch(bs, "battle fight", "", s); BotRecordNodeSwitch(bs, "battle fight", "", s);
trap_BotResetLastAvoidReach(bs->ms); trap_BotResetLastAvoidReach(bs->ms);
bs->ainode = AINode_Battle_Fight; bs->ainode = AINode_Battle_Fight;
bs->flags &= ~BFL_FIGHTSUICIDAL;
} }
/* /*
================== ==================
AIEnter_Battle_Fight AIEnter_Battle_SuicidalFight
================== ==================
*/ */
void AIEnter_Battle_SuicidalFight(bot_state_t *bs, char *s) { void AIEnter_Battle_SuicidalFight(bot_state_t *bs, char *s) {
@ -2083,6 +2092,12 @@ int AINode_Battle_Fight(bot_state_t *bs) {
} }
//if the enemy is not visible //if the enemy is not visible
if (!BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy)) { if (!BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy)) {
#ifdef MISSIONPACK
if (bs->enemy == redobelisk.entitynum || bs->enemy == blueobelisk.entitynum) {
AIEnter_Battle_Chase(bs, "battle fight: obelisk out of sight");
return qfalse;
}
#endif
if (BotWantsToChase(bs)) { if (BotWantsToChase(bs)) {
AIEnter_Battle_Chase(bs, "battle fight: enemy out of sight"); AIEnter_Battle_Chase(bs, "battle fight: enemy out of sight");
return qfalse; return qfalse;

View file

@ -141,16 +141,17 @@ BotTeam
================== ==================
*/ */
int BotTeam(bot_state_t *bs) { int BotTeam(bot_state_t *bs) {
char info[1024];
if (bs->client < 0 || bs->client >= MAX_CLIENTS) { if (bs->client < 0 || bs->client >= MAX_CLIENTS) {
//BotAI_Print(PRT_ERROR, "BotCTFTeam: client out of range\n");
return qfalse; return qfalse;
} }
trap_GetConfigstring(CS_PLAYERS+bs->client, info, sizeof(info));
// if (level.clients[bs->client].sess.sessionTeam == TEAM_RED) {
if (atoi(Info_ValueForKey(info, "t")) == TEAM_RED) return TEAM_RED; return TEAM_RED;
else if (atoi(Info_ValueForKey(info, "t")) == TEAM_BLUE) return TEAM_BLUE; } else if (level.clients[bs->client].sess.sessionTeam == TEAM_BLUE) {
return TEAM_BLUE;
}
return TEAM_FREE; return TEAM_FREE;
} }
@ -1677,8 +1678,8 @@ void BotCheckItemPickup(bot_state_t *bs, int *oldinventory) {
//trap_BotEnterChat(bs->cs, leader, CHAT_TELL); //trap_BotEnterChat(bs->cs, leader, CHAT_TELL);
} }
} }
bs->teamtaskpreference |= TEAMTP_ATTACKER;
} }
bs->teamtaskpreference |= TEAMTP_ATTACKER;
} }
bs->teamtaskpreference &= ~TEAMTP_DEFENDER; bs->teamtaskpreference &= ~TEAMTP_DEFENDER;
} }
@ -2283,7 +2284,7 @@ int BotWantsToRetreat(bot_state_t *bs) {
else if (gametype == GT_OBELISK) { else if (gametype == GT_OBELISK) {
//the bots should be dedicated to attacking the enemy obelisk //the bots should be dedicated to attacking the enemy obelisk
if (bs->ltgtype == LTG_ATTACKENEMYBASE) { if (bs->ltgtype == LTG_ATTACKENEMYBASE) {
if (bs->enemy != redobelisk.entitynum || if (bs->enemy != redobelisk.entitynum &&
bs->enemy != blueobelisk.entitynum) { bs->enemy != blueobelisk.entitynum) {
return qtrue; return qtrue;
} }
@ -2302,8 +2303,12 @@ int BotWantsToRetreat(bot_state_t *bs) {
if (bs->enemy >= 0) { if (bs->enemy >= 0) {
//if the enemy is carrying a flag //if the enemy is carrying a flag
BotEntityInfo(bs->enemy, &entinfo); BotEntityInfo(bs->enemy, &entinfo);
if (EntityCarriesFlag(&entinfo)) // if the enemy is carrying a flag
return qfalse; if (EntityCarriesFlag(&entinfo)) return qfalse;
#ifdef MISSIONPACK
// if the enemy is carrying cubes
if (EntityCarriesCubes(&entinfo)) return qfalse;
#endif
} }
//if the bot is getting the flag //if the bot is getting the flag
if (bs->ltgtype == LTG_GETFLAG) if (bs->ltgtype == LTG_GETFLAG)
@ -2344,7 +2349,7 @@ int BotWantsToChase(bot_state_t *bs) {
else if (gametype == GT_OBELISK) { else if (gametype == GT_OBELISK) {
//the bots should be dedicated to attacking the enemy obelisk //the bots should be dedicated to attacking the enemy obelisk
if (bs->ltgtype == LTG_ATTACKENEMYBASE) { if (bs->ltgtype == LTG_ATTACKENEMYBASE) {
if (bs->enemy != redobelisk.entitynum || if (bs->enemy != redobelisk.entitynum &&
bs->enemy != blueobelisk.entitynum) { bs->enemy != blueobelisk.entitynum) {
return qfalse; return qfalse;
} }
@ -2352,8 +2357,11 @@ int BotWantsToChase(bot_state_t *bs) {
} }
else if (gametype == GT_HARVESTER) { else if (gametype == GT_HARVESTER) {
//never chase if carrying cubes //never chase if carrying cubes
if (BotHarvesterCarryingCubes(bs)) if (BotHarvesterCarryingCubes(bs)) return qfalse;
return qfalse;
BotEntityInfo(bs->enemy, &entinfo);
// always chase if the enemy is carrying cubes
if (EntityCarriesCubes(&entinfo)) return qtrue;
} }
#endif #endif
//if the bot is getting the flag //if the bot is getting the flag
@ -2767,22 +2775,19 @@ BotSameTeam
================== ==================
*/ */
int BotSameTeam(bot_state_t *bs, int entnum) { int BotSameTeam(bot_state_t *bs, int entnum) {
char info1[1024], info2[1024];
if (bs->client < 0 || bs->client >= MAX_CLIENTS) { if (bs->client < 0 || bs->client >= MAX_CLIENTS) {
//BotAI_Print(PRT_ERROR, "BotSameTeam: client out of range\n");
return qfalse; return qfalse;
} }
if (entnum < 0 || entnum >= MAX_CLIENTS) { if (entnum < 0 || entnum >= MAX_CLIENTS) {
//BotAI_Print(PRT_ERROR, "BotSameTeam: client out of range\n");
return qfalse; return qfalse;
} }
if ( gametype >= GT_TEAM ) {
trap_GetConfigstring(CS_PLAYERS+bs->client, info1, sizeof(info1)); if (gametype >= GT_TEAM) {
trap_GetConfigstring(CS_PLAYERS+entnum, info2, sizeof(info2)); if (level.clients[bs->client].sess.sessionTeam == level.clients[entnum].sess.sessionTeam) return qtrue;
//
if (atoi(Info_ValueForKey(info1, "t")) == atoi(Info_ValueForKey(info2, "t"))) return qtrue;
} }
return qfalse; return qfalse;
} }
@ -3636,7 +3641,7 @@ void BotCheckAttack(bot_state_t *bs) {
VectorMA(start, -12, forward, start); VectorMA(start, -12, forward, start);
BotAI_Trace(&trace, start, mins, maxs, end, bs->entitynum, MASK_SHOT); BotAI_Trace(&trace, start, mins, maxs, end, bs->entitynum, MASK_SHOT);
//if the entity is a client //if the entity is a client
if (trace.ent > 0 && trace.ent <= MAX_CLIENTS) { if (trace.ent >= 0 && trace.ent < MAX_CLIENTS) {
if (trace.ent != attackentity) { if (trace.ent != attackentity) {
//if a teammate is hit //if a teammate is hit
if (BotSameTeam(bs, trace.ent)) if (BotSameTeam(bs, trace.ent))
@ -5133,7 +5138,7 @@ void BotSetupAlternativeRouteGoals(void) {
#ifdef MISSIONPACK #ifdef MISSIONPACK
if (gametype == GT_CTF) { if (gametype == GT_CTF) {
if (trap_BotGetLevelItemGoal(-1, "Neutral Flag", &ctf_neutralflag) < 0) if (trap_BotGetLevelItemGoal(-1, "Neutral Flag", &ctf_neutralflag) < 0)
BotAI_Print(PRT_WARNING, "no alt routes without Neutral Flag\n"); BotAI_Print(PRT_WARNING, "No alt routes without Neutral Flag\n");
if (ctf_neutralflag.areanum) { if (ctf_neutralflag.areanum) {
// //
red_numaltroutegoals = trap_AAS_AlternativeRouteGoals( red_numaltroutegoals = trap_AAS_AlternativeRouteGoals(
@ -5151,7 +5156,8 @@ void BotSetupAlternativeRouteGoals(void) {
} }
} }
else if (gametype == GT_1FCTF) { else if (gametype == GT_1FCTF) {
// if (trap_BotGetLevelItemGoal(-1, "Neutral Obelisk", &neutralobelisk) < 0)
BotAI_Print(PRT_WARNING, "One Flag CTF without Neutral Obelisk\n");
red_numaltroutegoals = trap_AAS_AlternativeRouteGoals( red_numaltroutegoals = trap_AAS_AlternativeRouteGoals(
ctf_neutralflag.origin, ctf_neutralflag.areanum, ctf_neutralflag.origin, ctf_neutralflag.areanum,
ctf_redflag.origin, ctf_redflag.areanum, TFL_DEFAULT, ctf_redflag.origin, ctf_redflag.areanum, TFL_DEFAULT,
@ -5167,7 +5173,7 @@ void BotSetupAlternativeRouteGoals(void) {
} }
else if (gametype == GT_OBELISK) { else if (gametype == GT_OBELISK) {
if (trap_BotGetLevelItemGoal(-1, "Neutral Obelisk", &neutralobelisk) < 0) if (trap_BotGetLevelItemGoal(-1, "Neutral Obelisk", &neutralobelisk) < 0)
BotAI_Print(PRT_WARNING, "Harvester without neutral obelisk\n"); BotAI_Print(PRT_WARNING, "No alt routes without Neutral Obelisk\n");
// //
red_numaltroutegoals = trap_AAS_AlternativeRouteGoals( red_numaltroutegoals = trap_AAS_AlternativeRouteGoals(
neutralobelisk.origin, neutralobelisk.areanum, neutralobelisk.origin, neutralobelisk.areanum,
@ -5183,7 +5189,8 @@ void BotSetupAlternativeRouteGoals(void) {
ALTROUTEGOAL_VIEWPORTALS); ALTROUTEGOAL_VIEWPORTALS);
} }
else if (gametype == GT_HARVESTER) { else if (gametype == GT_HARVESTER) {
// if (trap_BotGetLevelItemGoal(-1, "Neutral Obelisk", &neutralobelisk) < 0)
BotAI_Print(PRT_WARNING, "Harvester without Neutral Obelisk\n");
red_numaltroutegoals = trap_AAS_AlternativeRouteGoals( red_numaltroutegoals = trap_AAS_AlternativeRouteGoals(
neutralobelisk.origin, neutralobelisk.areanum, neutralobelisk.origin, neutralobelisk.areanum,
redobelisk.origin, redobelisk.areanum, TFL_DEFAULT, redobelisk.origin, redobelisk.areanum, TFL_DEFAULT,
@ -5414,27 +5421,27 @@ void BotSetupDeathmatchAI(void) {
if (trap_BotGetLevelItemGoal(-1, "Neutral Flag", &ctf_neutralflag) < 0) if (trap_BotGetLevelItemGoal(-1, "Neutral Flag", &ctf_neutralflag) < 0)
BotAI_Print(PRT_WARNING, "One Flag CTF without Neutral Flag\n"); BotAI_Print(PRT_WARNING, "One Flag CTF without Neutral Flag\n");
if (trap_BotGetLevelItemGoal(-1, "Red Flag", &ctf_redflag) < 0) if (trap_BotGetLevelItemGoal(-1, "Red Flag", &ctf_redflag) < 0)
BotAI_Print(PRT_WARNING, "CTF without Red Flag\n"); BotAI_Print(PRT_WARNING, "One Flag CTF without Red Flag\n");
if (trap_BotGetLevelItemGoal(-1, "Blue Flag", &ctf_blueflag) < 0) if (trap_BotGetLevelItemGoal(-1, "Blue Flag", &ctf_blueflag) < 0)
BotAI_Print(PRT_WARNING, "CTF without Blue Flag\n"); BotAI_Print(PRT_WARNING, "One Flag CTF without Blue Flag\n");
} }
else if (gametype == GT_OBELISK) { else if (gametype == GT_OBELISK) {
if (trap_BotGetLevelItemGoal(-1, "Red Obelisk", &redobelisk) < 0) if (trap_BotGetLevelItemGoal(-1, "Red Obelisk", &redobelisk) < 0)
BotAI_Print(PRT_WARNING, "Obelisk without red obelisk\n"); BotAI_Print(PRT_WARNING, "Overload without Red Obelisk\n");
BotSetEntityNumForGoal(&redobelisk, "team_redobelisk"); BotSetEntityNumForGoal(&redobelisk, "team_redobelisk");
if (trap_BotGetLevelItemGoal(-1, "Blue Obelisk", &blueobelisk) < 0) if (trap_BotGetLevelItemGoal(-1, "Blue Obelisk", &blueobelisk) < 0)
BotAI_Print(PRT_WARNING, "Obelisk without blue obelisk\n"); BotAI_Print(PRT_WARNING, "Overload without Blue Obelisk\n");
BotSetEntityNumForGoal(&blueobelisk, "team_blueobelisk"); BotSetEntityNumForGoal(&blueobelisk, "team_blueobelisk");
} }
else if (gametype == GT_HARVESTER) { else if (gametype == GT_HARVESTER) {
if (trap_BotGetLevelItemGoal(-1, "Red Obelisk", &redobelisk) < 0) if (trap_BotGetLevelItemGoal(-1, "Red Obelisk", &redobelisk) < 0)
BotAI_Print(PRT_WARNING, "Harvester without red obelisk\n"); BotAI_Print(PRT_WARNING, "Harvester without Red Obelisk\n");
BotSetEntityNumForGoal(&redobelisk, "team_redobelisk"); BotSetEntityNumForGoal(&redobelisk, "team_redobelisk");
if (trap_BotGetLevelItemGoal(-1, "Blue Obelisk", &blueobelisk) < 0) if (trap_BotGetLevelItemGoal(-1, "Blue Obelisk", &blueobelisk) < 0)
BotAI_Print(PRT_WARNING, "Harvester without blue obelisk\n"); BotAI_Print(PRT_WARNING, "Harvester without Blue Obelisk\n");
BotSetEntityNumForGoal(&blueobelisk, "team_blueobelisk"); BotSetEntityNumForGoal(&blueobelisk, "team_blueobelisk");
if (trap_BotGetLevelItemGoal(-1, "Neutral Obelisk", &neutralobelisk) < 0) if (trap_BotGetLevelItemGoal(-1, "Neutral Obelisk", &neutralobelisk) < 0)
BotAI_Print(PRT_WARNING, "Harvester without neutral obelisk\n"); BotAI_Print(PRT_WARNING, "Harvester without Neutral Obelisk\n");
BotSetEntityNumForGoal(&neutralobelisk, "team_neutralobelisk"); BotSetEntityNumForGoal(&neutralobelisk, "team_neutralobelisk");
} }
#endif #endif

View file

@ -821,11 +821,10 @@ void BotInputToUserCommand(bot_input_t *bi, usercmd_t *ucmd, int delta_angles[3]
vec3_t angles, forward, right; vec3_t angles, forward, right;
short temp; short temp;
int j; int j;
float f, r, u, m;
//clear the whole structure //clear the whole structure
memset(ucmd, 0, sizeof(usercmd_t)); memset(ucmd, 0, sizeof(usercmd_t));
//
//Com_Printf("dir = %f %f %f speed = %f\n", bi->dir[0], bi->dir[1], bi->dir[2], bi->speed);
//the duration for the user command in milli seconds //the duration for the user command in milli seconds
ucmd->serverTime = time; ucmd->serverTime = time;
// //
@ -876,21 +875,37 @@ void BotInputToUserCommand(bot_input_t *bi, usercmd_t *ucmd, int delta_angles[3]
//bot input speed is in the range [0, 400] //bot input speed is in the range [0, 400]
bi->speed = bi->speed * 127 / 400; bi->speed = bi->speed * 127 / 400;
//set the view independent movement //set the view independent movement
ucmd->forwardmove = DotProduct(forward, bi->dir) * bi->speed; f = DotProduct(forward, bi->dir);
ucmd->rightmove = DotProduct(right, bi->dir) * bi->speed; r = DotProduct(right, bi->dir);
ucmd->upmove = abs(forward[2]) * bi->dir[2] * bi->speed; u = abs(forward[2]) * bi->dir[2];
//normal keyboard movement m = fabs(f);
if (bi->actionflags & ACTION_MOVEFORWARD) ucmd->forwardmove += 127;
if (bi->actionflags & ACTION_MOVEBACK) ucmd->forwardmove -= 127; if (fabs(r) > m) {
if (bi->actionflags & ACTION_MOVELEFT) ucmd->rightmove -= 127; m = fabs(r);
if (bi->actionflags & ACTION_MOVERIGHT) ucmd->rightmove += 127; }
if (fabs(u) > m) {
m = fabs(u);
}
if (m > 0) {
f *= bi->speed / m;
r *= bi->speed / m;
u *= bi->speed / m;
}
ucmd->forwardmove = f;
ucmd->rightmove = r;
ucmd->upmove = u;
if (bi->actionflags & ACTION_MOVEFORWARD) ucmd->forwardmove = 127;
if (bi->actionflags & ACTION_MOVEBACK) ucmd->forwardmove = -127;
if (bi->actionflags & ACTION_MOVELEFT) ucmd->rightmove = -127;
if (bi->actionflags & ACTION_MOVERIGHT) ucmd->rightmove = 127;
//jump/moveup //jump/moveup
if (bi->actionflags & ACTION_JUMP) ucmd->upmove += 127; if (bi->actionflags & ACTION_JUMP) ucmd->upmove = 127;
//crouch/movedown //crouch/movedown
if (bi->actionflags & ACTION_CROUCH) ucmd->upmove -= 127; if (bi->actionflags & ACTION_CROUCH) ucmd->upmove = -127;
//
//Com_Printf("forward = %d right = %d up = %d\n", ucmd.forwardmove, ucmd.rightmove, ucmd.upmove);
//Com_Printf("ucmd->serverTime = %d\n", ucmd->serverTime);
} }
/* /*

View file

@ -458,11 +458,11 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t *bs) {
case 1: break; case 1: break;
case 2: case 2:
{ {
//both will go for the enemy flag // keep one near the base for when the flag is returned
ClientName(teammates[0], name, sizeof(name)); ClientName(teammates[0], name, sizeof(name));
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL); BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
BotSayTeamOrder(bs, teammates[0]); BotSayTeamOrder(bs, teammates[0]);
BotSayVoiceTeamOrder(bs, teammates[0], VOICECHAT_GETFLAG); BotSayVoiceTeamOrder(bs, teammates[0], VOICECHAT_DEFEND);
// //
ClientName(teammates[1], name, sizeof(name)); ClientName(teammates[1], name, sizeof(name));
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
@ -494,7 +494,7 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t *bs) {
//keep some people near the base for when the flag is returned //keep some people near the base for when the flag is returned
defenders = (int) (float) numteammates * 0.3 + 0.5; defenders = (int) (float) numteammates * 0.3 + 0.5;
if (defenders > 3) defenders = 3; if (defenders > 3) defenders = 3;
attackers = (int) (float) numteammates * 0.7 + 0.5; attackers = (int) (float) numteammates * 0.6 + 0.5;
if (attackers > 6) attackers = 6; if (attackers > 6) attackers = 6;
for (i = 0; i < defenders; i++) { for (i = 0; i < defenders; i++) {
// //
@ -537,7 +537,7 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t *bs) {
{ {
//everyone go for the flag //everyone go for the flag
ClientName(teammates[0], name, sizeof(name)); ClientName(teammates[0], name, sizeof(name));
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL); BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
BotSayTeamOrder(bs, teammates[0]); BotSayTeamOrder(bs, teammates[0]);
BotSayVoiceTeamOrder(bs, teammates[0], VOICECHAT_GETFLAG); BotSayVoiceTeamOrder(bs, teammates[0], VOICECHAT_GETFLAG);
// //
@ -1349,7 +1349,7 @@ void Bot1FCTFOrders_EnemyHasFlag(bot_state_t *bs) {
if (defenders > 8) defenders = 8; if (defenders > 8) defenders = 8;
//10% will try to return the flag //10% will try to return the flag
attackers = (int) (float) numteammates * 0.1 + 0.5; attackers = (int) (float) numteammates * 0.1 + 0.5;
if (attackers > 2) attackers = 2; if (attackers > 1) attackers = 1;
for (i = 0; i < defenders; i++) { for (i = 0; i < defenders; i++) {
// //
ClientName(teammates[i], name, sizeof(name)); ClientName(teammates[i], name, sizeof(name));
@ -1410,7 +1410,7 @@ void Bot1FCTFOrders_EnemyHasFlag(bot_state_t *bs) {
{ {
//70% defend the base //70% defend the base
defenders = (int) (float) numteammates * 0.7 + 0.5; defenders = (int) (float) numteammates * 0.7 + 0.5;
if (defenders > 8) defenders = 8; if (defenders > 7) defenders = 7;
//20% try to return the flag //20% try to return the flag
attackers = (int) (float) numteammates * 0.2 + 0.5; attackers = (int) (float) numteammates * 0.2 + 0.5;
if (attackers > 2) attackers = 2; if (attackers > 2) attackers = 2;
@ -1573,7 +1573,7 @@ void Bot1FCTFOrders_EnemyDroppedFlag(bot_state_t *bs) {
ClientName(teammates[numteammates - i - 1], name, sizeof(name)); ClientName(teammates[numteammates - i - 1], name, sizeof(name));
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
BotSayTeamOrder(bs, teammates[numteammates - i - 1]); BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
BotSayVoiceTeamOrder(bs, teammates[numteammates - i - 1], VOICECHAT_DEFEND); BotSayVoiceTeamOrder(bs, teammates[numteammates - i - 1], VOICECHAT_GETFLAG);
} }
// //
break; break;

View file

@ -424,7 +424,7 @@ static qboolean PM_CheckWaterJump( void ) {
spot[2] += 16; spot[2] += 16;
cont = pm->pointcontents (spot, pm->ps->clientNum ); cont = pm->pointcontents (spot, pm->ps->clientNum );
if ( cont ) { if ( cont & (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY) ) {
return qfalse; return qfalse;
} }
@ -1862,7 +1862,7 @@ void PmoveSingle (pmove_t *pmove) {
} }
// set the firing flag for continuous beam weapons // set the firing flag for continuous beam weapons
if ( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION if ( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION && (!pm->ps->pm_type == PM_NOCLIP)
&& ( pm->cmd.buttons & BUTTON_ATTACK ) && pm->ps->ammo[ pm->ps->weapon ] ) { && ( pm->cmd.buttons & BUTTON_ATTACK ) && pm->ps->ammo[ pm->ps->weapon ] ) {
pm->ps->eFlags |= EF_FIRING; pm->ps->eFlags |= EF_FIRING;
} else { } else {

View file

@ -128,15 +128,6 @@ void P_WorldEffects( gentity_t *ent ) {
if (ent->damage > 15) if (ent->damage > 15)
ent->damage = 15; ent->damage = 15;
// play a gurp sound instead of a normal pain sound
if (ent->health <= ent->damage) {
G_Sound(ent, CHAN_VOICE, G_SoundIndex("*drown.wav"));
} else if (rand()&1) {
G_Sound(ent, CHAN_VOICE, G_SoundIndex("sound/player/gurp1.wav"));
} else {
G_Sound(ent, CHAN_VOICE, G_SoundIndex("sound/player/gurp2.wav"));
}
// don't play a normal pain sound // don't play a normal pain sound
ent->pain_debounce_time = level.time + 200; ent->pain_debounce_time = level.time + 200;
@ -999,13 +990,13 @@ void ClientThink_real( gentity_t *ent ) {
// forcerespawn is to prevent users from waiting out powerups // forcerespawn is to prevent users from waiting out powerups
if ( g_forcerespawn.integer > 0 && if ( g_forcerespawn.integer > 0 &&
( level.time - client->respawnTime ) > g_forcerespawn.integer * 1000 ) { ( level.time - client->respawnTime ) > g_forcerespawn.integer * 1000 ) {
respawn( ent ); ClientRespawn( ent );
return; return;
} }
// pressing attack or use is the normal respawn method // pressing attack or use is the normal respawn method
if ( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) { if ( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) {
respawn( ent ); ClientRespawn( ent );
} }
} }
return; return;

View file

@ -132,7 +132,7 @@ static void G_LoadArenasFromFile( char *filename ) {
return; return;
} }
if ( len >= MAX_ARENAS_TEXT ) { if ( len >= MAX_ARENAS_TEXT ) {
trap_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) ); trap_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_ARENAS_TEXT ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return; return;
} }
@ -863,7 +863,7 @@ static void G_LoadBotsFromFile( char *filename ) {
return; return;
} }
if ( len >= MAX_BOTS_TEXT ) { if ( len >= MAX_BOTS_TEXT ) {
trap_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT ) ); trap_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_BOTS_TEXT ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return; return;
} }

View file

@ -419,8 +419,6 @@ void CopyToBodyQue( gentity_t *ent ) {
body = level.bodyQue[ level.bodyQueIndex ]; body = level.bodyQue[ level.bodyQueIndex ];
level.bodyQueIndex = (level.bodyQueIndex + 1) % BODY_QUEUE_SIZE; level.bodyQueIndex = (level.bodyQueIndex + 1) % BODY_QUEUE_SIZE;
trap_UnlinkEntity (body);
body->s = ent->s; body->s = ent->s;
body->s.eFlags = EF_DEAD; // clear EF_TALK, etc body->s.eFlags = EF_DEAD; // clear EF_TALK, etc
#ifdef MISSIONPACK #ifdef MISSIONPACK
@ -526,18 +524,13 @@ void SetClientViewAngle( gentity_t *ent, vec3_t angle ) {
/* /*
================ ================
respawn ClientRespawn
================ ================
*/ */
void respawn( gentity_t *ent ) { void ClientRespawn( gentity_t *ent ) {
gentity_t *tent;
CopyToBodyQue (ent); CopyToBodyQue (ent);
ClientSpawn(ent); ClientSpawn(ent);
// add a teleportation effect
tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN );
tent->s.clientNum = ent->s.clientNum;
} }
/* /*
@ -1007,7 +1000,6 @@ and on transition between teams, but doesn't happen on respawns
void ClientBegin( int clientNum ) { void ClientBegin( int clientNum ) {
gentity_t *ent; gentity_t *ent;
gclient_t *client; gclient_t *client;
gentity_t *tent;
int flags; int flags;
ent = g_entities + clientNum; ent = g_entities + clientNum;
@ -1039,10 +1031,6 @@ void ClientBegin( int clientNum ) {
ClientSpawn( ent ); ClientSpawn( ent );
if ( client->sess.sessionTeam != TEAM_SPECTATOR ) { if ( client->sess.sessionTeam != TEAM_SPECTATOR ) {
// send event
tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN );
tent->s.clientNum = ent->s.clientNum;
if ( g_gametype.integer != GT_TOURNAMENT ) { if ( g_gametype.integer != GT_TOURNAMENT ) {
trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname) ); trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname) );
} }
@ -1071,6 +1059,7 @@ void ClientSpawn(gentity_t *ent) {
clientSession_t savedSess; clientSession_t savedSess;
int persistant[MAX_PERSISTANT]; int persistant[MAX_PERSISTANT];
gentity_t *spawnPoint; gentity_t *spawnPoint;
gentity_t *tent;
int flags; int flags;
int savedPing; int savedPing;
// char *savedAreaBits; // char *savedAreaBits;
@ -1206,19 +1195,6 @@ void ClientSpawn(gentity_t *ent) {
trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd ); trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );
SetClientViewAngle( ent, spawn_angles ); SetClientViewAngle( ent, spawn_angles );
if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
} else {
G_KillBox( ent );
trap_LinkEntity (ent);
// force the base weapon up
client->ps.weapon = WP_MACHINEGUN;
client->ps.weaponstate = WEAPON_READY;
}
// don't allow full run speed for a bit // don't allow full run speed for a bit
client->ps.pm_flags |= PMF_TIME_KNOCKBACK; client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
client->ps.pm_time = 100; client->ps.pm_time = 100;
@ -1231,36 +1207,40 @@ void ClientSpawn(gentity_t *ent) {
client->ps.torsoAnim = TORSO_STAND; client->ps.torsoAnim = TORSO_STAND;
client->ps.legsAnim = LEGS_IDLE; client->ps.legsAnim = LEGS_IDLE;
if ( level.intermissiontime ) { if (!level.intermissiontime) {
MoveClientToIntermission( ent ); if (ent->client->sess.sessionTeam != TEAM_SPECTATOR) {
} else { G_KillBox(ent);
// force the base weapon up
client->ps.weapon = WP_MACHINEGUN;
client->ps.weaponstate = WEAPON_READY;
// fire the targets of the spawn point // fire the targets of the spawn point
G_UseTargets( spawnPoint, ent ); G_UseTargets(spawnPoint, ent);
// select the highest weapon number available, after any spawn given items have fired
// select the highest weapon number available, after any
// spawn given items have fired
client->ps.weapon = 1; client->ps.weapon = 1;
for ( i = WP_NUM_WEAPONS - 1 ; i > 0 ; i-- ) {
if ( client->ps.stats[STAT_WEAPONS] & ( 1 << i ) ) { for (i = WP_NUM_WEAPONS - 1 ; i > 0 ; i--) {
if (client->ps.stats[STAT_WEAPONS] & (1 << i)) {
client->ps.weapon = i; client->ps.weapon = i;
break; break;
} }
} }
} // positively link the client, even if the command times are weird
VectorCopy(ent->client->ps.origin, ent->r.currentOrigin);
tent = G_TempEntity(ent->client->ps.origin, EV_PLAYER_TELEPORT_IN);
tent->s.clientNum = ent->s.clientNum;
trap_LinkEntity (ent);
}
} else {
// move players to intermission
MoveClientToIntermission(ent);
}
// run a client frame to drop exactly to the floor, // run a client frame to drop exactly to the floor,
// initialize animations and other things // initialize animations and other things
client->ps.commandTime = level.time - 100; client->ps.commandTime = level.time - 100;
ent->client->pers.cmd.serverTime = level.time; ent->client->pers.cmd.serverTime = level.time;
ClientThink( ent-g_entities ); ClientThink( ent-g_entities );
// positively link the client, even if the command times are weird
if ( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {
BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );
VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );
trap_LinkEntity( ent );
}
// run the presend to set anything else // run the presend to set anything else
ClientEndFrame( ent ); ClientEndFrame( ent );

View file

@ -1171,7 +1171,7 @@ Cmd_Where_f
================== ==================
*/ */
void Cmd_Where_f( gentity_t *ent ) { void Cmd_Where_f( gentity_t *ent ) {
trap_SendServerCommand( ent-g_entities, va("print \"%s\n\"", vtos( ent->s.origin ) ) ); trap_SendServerCommand( ent-g_entities, va("print \"%s\n\"", vtos(ent->r.currentOrigin) ) );
} }
static const char *gameNames[] = { static const char *gameNames[] = {

View file

@ -561,22 +561,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
} }
} }
// if client is in a nodrop area, don't drop anything (but return CTF flags!)
contents = trap_PointContents( self->r.currentOrigin, -1 );
if ( !( contents & CONTENTS_NODROP )) {
TossClientItems( self ); TossClientItems( self );
}
else {
if ( self->client->ps.powerups[PW_NEUTRALFLAG] ) { // only happens in One Flag CTF
Team_ReturnFlag( TEAM_FREE );
}
else if ( self->client->ps.powerups[PW_REDFLAG] ) { // only happens in standard CTF
Team_ReturnFlag( TEAM_RED );
}
else if ( self->client->ps.powerups[PW_BLUEFLAG] ) { // only happens in standard CTF
Team_ReturnFlag( TEAM_BLUE );
}
}
#ifdef MISSIONPACK #ifdef MISSIONPACK
TossClientPersistantPowerups( self ); TossClientPersistantPowerups( self );
if( g_gametype.integer == GT_HARVESTER ) { if( g_gametype.integer == GT_HARVESTER ) {
@ -626,6 +611,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
memset( self->client->ps.powerups, 0, sizeof(self->client->ps.powerups) ); memset( self->client->ps.powerups, 0, sizeof(self->client->ps.powerups) );
// never gib in a nodrop // never gib in a nodrop
contents = trap_PointContents( self->r.currentOrigin, -1 );
if ( (self->health <= GIB_HEALTH && !(contents & CONTENTS_NODROP) && g_blood.integer) || meansOfDeath == MOD_SUICIDE) { if ( (self->health <= GIB_HEALTH && !(contents & CONTENTS_NODROP) && g_blood.integer) || meansOfDeath == MOD_SUICIDE) {
// gib death // gib death
GibEntity( self, killer ); GibEntity( self, killer );

View file

@ -724,11 +724,11 @@ void G_CheckTeamItems( void ) {
// check for the two flags // check for the two flags
item = BG_FindItem( "Red Flag" ); item = BG_FindItem( "Red Flag" );
if ( !item || !itemRegistered[ item - bg_itemlist ] ) { if ( !item || !itemRegistered[ item - bg_itemlist ] ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map\n" );
} }
item = BG_FindItem( "Blue Flag" ); item = BG_FindItem( "Blue Flag" );
if ( !item || !itemRegistered[ item - bg_itemlist ] ) { if ( !item || !itemRegistered[ item - bg_itemlist ] ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map\n" );
} }
} }
#ifdef MISSIONPACK #ifdef MISSIONPACK
@ -738,15 +738,15 @@ void G_CheckTeamItems( void ) {
// check for all three flags // check for all three flags
item = BG_FindItem( "Red Flag" ); item = BG_FindItem( "Red Flag" );
if ( !item || !itemRegistered[ item - bg_itemlist ] ) { if ( !item || !itemRegistered[ item - bg_itemlist ] ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map\n" );
} }
item = BG_FindItem( "Blue Flag" ); item = BG_FindItem( "Blue Flag" );
if ( !item || !itemRegistered[ item - bg_itemlist ] ) { if ( !item || !itemRegistered[ item - bg_itemlist ] ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map\n" );
} }
item = BG_FindItem( "Neutral Flag" ); item = BG_FindItem( "Neutral Flag" );
if ( !item || !itemRegistered[ item - bg_itemlist ] ) { if ( !item || !itemRegistered[ item - bg_itemlist ] ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_neutralflag in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_neutralflag in map\n" );
} }
} }
@ -757,13 +757,13 @@ void G_CheckTeamItems( void ) {
ent = NULL; ent = NULL;
ent = G_Find( ent, FOFS(classname), "team_redobelisk" ); ent = G_Find( ent, FOFS(classname), "team_redobelisk" );
if( !ent ) { if( !ent ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_redobelisk in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_redobelisk in map\n" );
} }
ent = NULL; ent = NULL;
ent = G_Find( ent, FOFS(classname), "team_blueobelisk" ); ent = G_Find( ent, FOFS(classname), "team_blueobelisk" );
if( !ent ) { if( !ent ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_blueobelisk in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_blueobelisk in map\n" );
} }
} }
@ -774,19 +774,19 @@ void G_CheckTeamItems( void ) {
ent = NULL; ent = NULL;
ent = G_Find( ent, FOFS(classname), "team_redobelisk" ); ent = G_Find( ent, FOFS(classname), "team_redobelisk" );
if( !ent ) { if( !ent ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_redobelisk in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_redobelisk in map\n" );
} }
ent = NULL; ent = NULL;
ent = G_Find( ent, FOFS(classname), "team_blueobelisk" ); ent = G_Find( ent, FOFS(classname), "team_blueobelisk" );
if( !ent ) { if( !ent ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_blueobelisk in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_blueobelisk in map\n" );
} }
ent = NULL; ent = NULL;
ent = G_Find( ent, FOFS(classname), "team_neutralobelisk" ); ent = G_Find( ent, FOFS(classname), "team_neutralobelisk" );
if( !ent ) { if( !ent ) {
G_Printf( S_COLOR_YELLOW "WARNING: No team_neutralobelisk in map" ); G_Printf( S_COLOR_YELLOW "WARNING: No team_neutralobelisk in map\n" );
} }
} }
#endif #endif

View file

@ -573,7 +573,7 @@ team_t PickTeam( int ignoreClientNum );
void SetClientViewAngle( gentity_t *ent, vec3_t angle ); void SetClientViewAngle( gentity_t *ent, vec3_t angle );
gentity_t *SelectSpawnPoint (vec3_t avoidPoint, vec3_t origin, vec3_t angles, qboolean isbot); gentity_t *SelectSpawnPoint (vec3_t avoidPoint, vec3_t origin, vec3_t angles, qboolean isbot);
void CopyToBodyQue( gentity_t *ent ); void CopyToBodyQue( gentity_t *ent );
void respawn (gentity_t *ent); void ClientRespawn(gentity_t *ent);
void BeginIntermission (void); void BeginIntermission (void);
void InitClientPersistant (gclient_t *client); void InitClientPersistant (gclient_t *client);
void InitClientResp (gclient_t *client); void InitClientResp (gclient_t *client);

View file

@ -496,8 +496,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
if( g_gametype.integer == GT_SINGLE_PLAYER || trap_Cvar_VariableIntegerValue( "com_buildScript" ) ) { if( g_gametype.integer == GT_SINGLE_PLAYER || trap_Cvar_VariableIntegerValue( "com_buildScript" ) ) {
G_ModelIndex( SP_PODIUM_MODEL ); G_ModelIndex( SP_PODIUM_MODEL );
G_SoundIndex( "sound/player/gurp1.wav" );
G_SoundIndex( "sound/player/gurp2.wav" );
} }
if ( trap_Cvar_VariableIntegerValue( "bot_enable" ) ) { if ( trap_Cvar_VariableIntegerValue( "bot_enable" ) ) {
@ -933,7 +931,7 @@ void MoveClientToIntermission( gentity_t *ent ) {
StopFollowing( ent ); StopFollowing( ent );
} }
FindIntermissionPoint();
// move to the spot // move to the spot
VectorCopy( level.intermission_origin, ent->s.origin ); VectorCopy( level.intermission_origin, ent->s.origin );
VectorCopy( level.intermission_origin, ent->client->ps.origin ); VectorCopy( level.intermission_origin, ent->client->ps.origin );
@ -1001,8 +999,17 @@ void BeginIntermission( void ) {
} }
level.intermissiontime = level.time; level.intermissiontime = level.time;
FindIntermissionPoint(); // move all clients to the intermission point
for (i=0 ; i< level.maxclients ; i++) {
client = g_entities + i;
if (!client->inuse)
continue;
// respawn if dead
if (client->health <= 0) {
ClientRespawn(client);
}
MoveClientToIntermission( client );
}
#ifdef MISSIONPACK #ifdef MISSIONPACK
if (g_singlePlayer.integer) { if (g_singlePlayer.integer) {
trap_Cvar_Set("ui_singlePlayerActive", "0"); trap_Cvar_Set("ui_singlePlayerActive", "0");
@ -1015,19 +1022,6 @@ void BeginIntermission( void ) {
SpawnModelsOnVictoryPads(); SpawnModelsOnVictoryPads();
} }
#endif #endif
// move all clients to the intermission point
for (i=0 ; i< level.maxclients ; i++) {
client = g_entities + i;
if (!client->inuse)
continue;
// respawn if dead
if (client->health <= 0) {
respawn(client);
}
MoveClientToIntermission( client );
}
// send the current scoring to all clients // send the current scoring to all clients
SendScoreboardMessageToAllClients(); SendScoreboardMessageToAllClients();

View file

@ -78,7 +78,9 @@ TELEPORTERS
void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles ) { void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles ) {
gentity_t *tent; gentity_t *tent;
qboolean noAngles;
noAngles = (angles[0] > 999999.0);
// use temp events at source and destination to prevent the effect // use temp events at source and destination to prevent the effect
// from getting dropped by a second player event // from getting dropped by a second player event
if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) { if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {
@ -94,19 +96,17 @@ void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles ) {
VectorCopy ( origin, player->client->ps.origin ); VectorCopy ( origin, player->client->ps.origin );
player->client->ps.origin[2] += 1; player->client->ps.origin[2] += 1;
if (!noAngles) {
// spit the player out // spit the player out
AngleVectors( angles, player->client->ps.velocity, NULL, NULL ); AngleVectors( angles, player->client->ps.velocity, NULL, NULL );
VectorScale( player->client->ps.velocity, 400, player->client->ps.velocity ); VectorScale( player->client->ps.velocity, 400, player->client->ps.velocity );
player->client->ps.pm_time = 160; // hold time player->client->ps.pm_time = 160; // hold time
player->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; player->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
// set angles
SetClientViewAngle(player, angles);
}
// toggle the teleport bit so the client knows to not lerp // toggle the teleport bit so the client knows to not lerp
player->client->ps.eFlags ^= EF_TELEPORT_BIT; player->client->ps.eFlags ^= EF_TELEPORT_BIT;
// set angles
SetClientViewAngle( player, angles );
// kill anything at the destination // kill anything at the destination
if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) { if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {
G_KillBox (player); G_KillBox (player);

View file

@ -829,26 +829,26 @@ Touch_DoorTriggerSpectator
================ ================
*/ */
static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_t *trace ) { static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_t *trace ) {
int i, axis; int axis;
vec3_t origin, dir, angles; float doorMin, doorMax;
vec3_t origin;
axis = ent->count; axis = ent->count;
VectorClear(dir); // the constants below relate to constants in Think_SpawnNewDoorTrigger()
if (fabs(other->s.origin[axis] - ent->r.absmax[axis]) < doorMin = ent->r.absmin[axis] + 100;
fabs(other->s.origin[axis] - ent->r.absmin[axis])) { doorMax = ent->r.absmax[axis] - 100;
origin[axis] = ent->r.absmin[axis] - 10;
dir[axis] = -1; VectorCopy(other->client->ps.origin, origin);
if (origin[axis] < doorMin || origin[axis] > doorMax) return;
if (fabs(origin[axis] - doorMax) < fabs(origin[axis] - doorMin)) {
origin[axis] = doorMin - 10;
} else {
origin[axis] = doorMax + 10;
} }
else {
origin[axis] = ent->r.absmax[axis] + 10; TeleportPlayer(other, origin, tv(10000000.0, 0, 0));
dir[axis] = 1;
}
for (i = 0; i < 3; i++) {
if (i == axis) continue;
origin[i] = (ent->r.absmin[i] + ent->r.absmax[i]) * 0.5;
}
vectoangles(dir, angles);
TeleportPlayer(other, origin, angles );
} }
/* /*

View file

@ -485,7 +485,7 @@ char *G_AddSpawnVarToken( const char *string ) {
l = strlen( string ); l = strlen( string );
if ( level.numSpawnVarChars + l + 1 > MAX_SPAWN_VARS_CHARS ) { if ( level.numSpawnVarChars + l + 1 > MAX_SPAWN_VARS_CHARS ) {
G_Error( "G_AddSpawnVarToken: MAX_SPAWN_CHARS" ); G_Error( "G_AddSpawnVarToken: MAX_SPAWN_VARS" );
} }
dest = level.spawnVarChars + level.numSpawnVarChars; dest = level.spawnVarChars + level.numSpawnVarChars;

View file

@ -782,7 +782,8 @@ int Team_TouchOurFlag( gentity_t *ent, gentity_t *other, int team ) {
player->client->ps.eFlags |= EF_AWARD_ASSIST; player->client->ps.eFlags |= EF_AWARD_ASSIST;
player->client->rewardTime = level.time + REWARD_SPRITE_TIME; player->client->rewardTime = level.time + REWARD_SPRITE_TIME;
} else if (player->client->pers.teamState.lastfraggedcarrier + }
if (player->client->pers.teamState.lastfraggedcarrier +
CTF_FRAG_CARRIER_ASSIST_TIMEOUT > level.time) { CTF_FRAG_CARRIER_ASSIST_TIMEOUT > level.time) {
AddScore(player, ent->r.currentOrigin, CTF_FRAG_CARRIER_ASSIST_BONUS); AddScore(player, ent->r.currentOrigin, CTF_FRAG_CARRIER_ASSIST_BONUS);
other->client->pers.teamState.assists++; other->client->pers.teamState.assists++;

View file

@ -85,8 +85,15 @@ qboolean CheckGauntletAttack( gentity_t *ent ) {
return qfalse; return qfalse;
} }
if ( ent->client->noclip ) {
return qfalse;
}
traceEnt = &g_entities[ tr.entityNum ]; traceEnt = &g_entities[ tr.entityNum ];
if ( traceEnt->client->noclip ) {
return qfalse;
}
// send blood impact // send blood impact
if ( traceEnt->takedamage && traceEnt->client ) { if ( traceEnt->takedamage && traceEnt->client ) {
tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
@ -142,9 +149,9 @@ void SnapVectorTowards( vec3_t v, vec3_t to ) {
for ( i = 0 ; i < 3 ; i++ ) { for ( i = 0 ; i < 3 ; i++ ) {
if ( to[i] <= v[i] ) { if ( to[i] <= v[i] ) {
v[i] = (int)v[i]; v[i] = floor(v[i]);
} else { } else {
v[i] = (int)v[i] + 1; v[i] = ceil(v[i]);
} }
} }
} }

View file

@ -148,7 +148,7 @@ static void UI_LoadArenasFromFile( char *filename ) {
return; return;
} }
if ( len >= MAX_ARENAS_TEXT ) { if ( len >= MAX_ARENAS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) ); trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_ARENAS_TEXT ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return; return;
} }
@ -337,7 +337,7 @@ static void UI_LoadBotsFromFile( char *filename ) {
return; return;
} }
if ( len >= MAX_BOTS_TEXT ) { if ( len >= MAX_BOTS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT ) ); trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_BOTS_TEXT ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return; return;
} }

View file

@ -1045,7 +1045,7 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
} }
if ( i != MAX_ANIMATIONS ) { if ( i != MAX_ANIMATIONS ) {
Com_Printf( "Error parsing animation file: %s", filename ); Com_Printf( "Error parsing animation file: %s\n", filename );
return qfalse; return qfalse;
} }

View file

@ -1355,7 +1355,7 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) {
y = 80; y = 80;
s_serveroptions.botSkill.generic.type = MTYPE_SPINCONTROL; s_serveroptions.botSkill.generic.type = MTYPE_SPINCONTROL;
s_serveroptions.botSkill.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.botSkill.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_serveroptions.botSkill.generic.name = "Bot Skill: "; s_serveroptions.botSkill.generic.name = "Bot Skill:";
s_serveroptions.botSkill.generic.x = 32 + (strlen(s_serveroptions.botSkill.generic.name) + 2 ) * SMALLCHAR_WIDTH; s_serveroptions.botSkill.generic.x = 32 + (strlen(s_serveroptions.botSkill.generic.name) + 2 ) * SMALLCHAR_WIDTH;
s_serveroptions.botSkill.generic.y = y; s_serveroptions.botSkill.generic.y = y;
s_serveroptions.botSkill.itemnames = botSkill_list; s_serveroptions.botSkill.itemnames = botSkill_list;

View file

@ -115,7 +115,7 @@ static void UI_LoadArenasFromFile( char *filename ) {
return; return;
} }
if ( len >= MAX_ARENAS_TEXT ) { if ( len >= MAX_ARENAS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) ); trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_ARENAS_TEXT ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return; return;
} }
@ -226,7 +226,7 @@ static void UI_LoadBotsFromFile( char *filename ) {
return; return;
} }
if ( len >= MAX_BOTS_TEXT ) { if ( len >= MAX_BOTS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT ) ); trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_BOTS_TEXT ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return; return;
} }

View file

@ -655,7 +655,7 @@ char *GetMenuBuffer(const char *filename) {
return defaultMenu; return defaultMenu;
} }
if ( len >= MAX_MENUFILE ) { if ( len >= MAX_MENUFILE ) {
trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", filename, len, MAX_MENUFILE ) ); trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i\n", filename, len, MAX_MENUFILE ) );
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
return defaultMenu; return defaultMenu;
} }

View file

@ -1132,7 +1132,7 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
} }
if ( i != MAX_ANIMATIONS ) { if ( i != MAX_ANIMATIONS ) {
Com_Printf( "Error parsing animation file: %s", filename ); Com_Printf( "Error parsing animation file: %s\n", filename );
return qfalse; return qfalse;
} }