From d99727db0d8a1c4cf3e11690e2434f92237ce9f1 Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Sat, 14 Jan 2012 00:18:42 +0000 Subject: [PATCH] More fixes from ioq3 --- reaction/code/game/ai_chat.c | 4 +- reaction/code/game/ai_dmnet.c | 4 +- reaction/code/game/ai_dmq3.c | 28 +++++------ reaction/code/game/ai_main.c | 52 +++++++++++--------- reaction/code/game/ai_team.c | 4 +- reaction/code/game/bg_pmove.c | 4 +- reaction/code/game/g_bot.c | 4 +- reaction/code/game/g_cmds.c | 2 +- reaction/code/game/g_combat.c | 15 +++--- reaction/code/game/g_local.h | 2 + reaction/code/game/g_misc.c | 5 +- reaction/code/game/g_spawn.c | 89 +++++++++++++++++++---------------- reaction/code/game/g_team.c | 8 ++-- reaction/code/game/g_weapon.c | 12 +++-- 14 files changed, 128 insertions(+), 105 deletions(-) diff --git a/reaction/code/game/ai_chat.c b/reaction/code/game/ai_chat.c index cc994ad5..be584222 100644 --- a/reaction/code/game/ai_chat.c +++ b/reaction/code/game/ai_chat.c @@ -1140,9 +1140,9 @@ BotChatTime */ float BotChatTime(bot_state_t * bs) { - int cpm; +// int cpm; - cpm = trap_Characteristic_BInteger(bs->character, CHARACTERISTIC_CHAT_CPM, 1, 4000); +// cpm = trap_Characteristic_BInteger(bs->character, CHARACTERISTIC_CHAT_CPM, 1, 4000); return 2.0; //(float) trap_BotChatLength(bs->cs) * 30 / cpm; } diff --git a/reaction/code/game/ai_dmnet.c b/reaction/code/game/ai_dmnet.c index 645321b8..e02560ef 100644 --- a/reaction/code/game/ai_dmnet.c +++ b/reaction/code/game/ai_dmnet.c @@ -1037,9 +1037,9 @@ int BotGetLongTermGoal(bot_state_t * bs, int tfl, int retreat, bot_goal_t * goal bs->ltgtype = 0; } // - if (bs->camp_range > 0) { + //if (bs->camp_range > 0) { //FIXME: move around a bit - } + //} // trap_BotResetAvoidReach(bs->ms); return qfalse; diff --git a/reaction/code/game/ai_dmq3.c b/reaction/code/game/ai_dmq3.c index 624e362c..5dfefdea 100644 --- a/reaction/code/game/ai_dmq3.c +++ b/reaction/code/game/ai_dmq3.c @@ -685,18 +685,15 @@ BotTeam */ int BotTeam(bot_state_t * bs) { - char info[1024]; - if (bs->client < 0 || bs->client >= MAX_CLIENTS) { - //BotAI_Print(PRT_ERROR, "BotCTFTeam: client out of range\n"); return qfalse; } - trap_GetConfigstring(CS_PLAYERS + bs->client, info, sizeof(info)); - // - if (atoi(Info_ValueForKey(info, "t")) == TEAM_RED) + + if (level.clients[bs->client].sess.sessionTeam == TEAM_RED) { return TEAM_RED; - else if (atoi(Info_ValueForKey(info, "t")) == TEAM_BLUE) + } else if (level.clients[bs->client].sess.sessionTeam == TEAM_BLUE) { return TEAM_BLUE; + } return TEAM_FREE; } @@ -2716,11 +2713,9 @@ int BotSameTeam(bot_state_t * bs, int entnum) int team1, team2; if (bs->client < 0 || bs->client >= MAX_CLIENTS) { - //BotAI_Print(PRT_ERROR, "BotSameTeam: client out of range\n"); return qfalse; } if (entnum < 0 || entnum >= MAX_CLIENTS) { - //BotAI_Print(PRT_ERROR, "BotSameTeam: client out of range\n"); return qfalse; } if (gametype >= GT_TEAM) { @@ -3539,7 +3534,7 @@ void BotCheckAttack(bot_state_t * bs) VectorMA(start, -12, forward, start); BotAI_Trace(&trace, start, mins, maxs, end, bs->entitynum, MASK_SHOT); //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 a teammate is hit if (BotSameTeam(bs, trace.ent)) @@ -4495,7 +4490,8 @@ open, which buttons to activate etc. void BotAIBlocked(bot_state_t * bs, bot_moveresult_t * moveresult, int activate) { int movetype, bspent; - vec3_t hordir, start, end, mins, maxs, sideward, angles, up = { 0, 0, 1 }; + vec3_t hordir, sideward, angles, up = {0, 0, 1}; + //vec3_t start, end, mins, maxs; aas_entityinfo_t entinfo; bot_activategoal_t activategoal; @@ -4556,11 +4552,11 @@ void BotAIBlocked(bot_state_t * bs, bot_moveresult_t * moveresult, int activate) movetype = MOVE_WALK; //if there's an obstacle at the bot's feet and head then //the bot might be able to crouch through - VectorCopy(bs->origin, start); - start[2] += 18; - VectorMA(start, 5, hordir, end); - VectorSet(mins, -16, -16, -24); - VectorSet(maxs, 16, 16, 4); + //VectorCopy(bs->origin, start); + //start[2] += 18; + //VectorMA(start, 5, hordir, end); + //VectorSet(mins, -16, -16, -24); + //VectorSet(maxs, 16, 16, 4); // //bsptrace = AAS_Trace(start, mins, maxs, end, bs->entitynum, MASK_PLAYERSOLID); //if (bsptrace.fraction >= 1) movetype = MOVE_CROUCH; diff --git a/reaction/code/game/ai_main.c b/reaction/code/game/ai_main.c index b38f39f1..f006dec6 100644 --- a/reaction/code/game/ai_main.c +++ b/reaction/code/game/ai_main.c @@ -866,11 +866,10 @@ void BotInputToUserCommand(bot_input_t * bi, usercmd_t * ucmd, int delta_angles[ vec3_t angles, forward, right; short temp; int j; + float f, r, u, m; //clear the whole structure 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 ucmd->serverTime = time; // @@ -935,27 +934,37 @@ void BotInputToUserCommand(bot_input_t * bi, usercmd_t * ucmd, int delta_angles[ //bot input speed is in the range [0, 400] bi->speed = bi->speed * 127 / 400; //set the view independent movement - ucmd->forwardmove = DotProduct(forward, bi->dir) * bi->speed; - ucmd->rightmove = DotProduct(right, bi->dir) * bi->speed; - ucmd->upmove = abs(forward[2]) * bi->dir[2] * bi->speed; - //normal keyboard movement - 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; + f = DotProduct(forward, bi->dir); + r = DotProduct(right, bi->dir); + u = abs(forward[2]) * bi->dir[2]; + m = fabs(f); + + if (fabs(r) > m) { + m = fabs(r); + } + + 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 - if (bi->actionflags & ACTION_JUMP) - ucmd->upmove += 127; + if (bi->actionflags & ACTION_JUMP) ucmd->upmove = 127; //crouch/movedown - 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); + if (bi->actionflags & ACTION_CROUCH) ucmd->upmove = -127; } /* @@ -1664,6 +1673,7 @@ int BotInitLibrary(void) trap_BotLibVarSet("g_gametype", buf); //bot developer mode and log file trap_BotLibVarSet("bot_developer", bot_developer.string); + trap_Cvar_VariableStringBuffer("logfile", buf, sizeof(buf)); trap_BotLibVarSet("log", buf); //no chatting trap_Cvar_VariableStringBuffer("bot_nochat", buf, sizeof(buf)); diff --git a/reaction/code/game/ai_team.c b/reaction/code/game/ai_team.c index c892c0ee..76d33002 100644 --- a/reaction/code/game/ai_team.c +++ b/reaction/code/game/ai_team.c @@ -509,7 +509,7 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t * bs) 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; @@ -554,7 +554,7 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t * bs) { //everyone go for the flag ClientName(teammates[0], name, sizeof(name)); - BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL); + BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); BotSayTeamOrder(bs, teammates[0]); BotSayVoiceTeamOrder(bs, teammates[0], VOICECHAT_GETFLAG); // diff --git a/reaction/code/game/bg_pmove.c b/reaction/code/game/bg_pmove.c index 269bcd1f..a8affeaf 100644 --- a/reaction/code/game/bg_pmove.c +++ b/reaction/code/game/bg_pmove.c @@ -606,7 +606,7 @@ static qboolean PM_CheckWaterJump(void) spot[2] += 16; cont = pm->pointcontents(spot, pm->ps->clientNum); - if (cont) { + if (cont & (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY)) { return qfalse; } // jump out of water @@ -2942,7 +2942,7 @@ void PmoveSingle(pmove_t * pmove) } // 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->ps->eFlags |= EF_FIRING; } else { diff --git a/reaction/code/game/g_bot.c b/reaction/code/game/g_bot.c index 17a75fa6..7901f43e 100644 --- a/reaction/code/game/g_bot.c +++ b/reaction/code/game/g_bot.c @@ -154,7 +154,7 @@ static void G_LoadArenasFromFile(char *filename) } if (len >= MAX_ARENAS_TEXT) { trap_Printf(va - (S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, + (S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_ARENAS_TEXT)); trap_FS_FCloseFile(f); return; @@ -909,7 +909,7 @@ static void G_LoadBotsFromFile(char *filename) } 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)); + (S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_BOTS_TEXT)); trap_FS_FCloseFile(f); return; } diff --git a/reaction/code/game/g_cmds.c b/reaction/code/game/g_cmds.c index a020406c..5ff140ae 100644 --- a/reaction/code/game/g_cmds.c +++ b/reaction/code/game/g_cmds.c @@ -2017,7 +2017,7 @@ Cmd_Where_f */ 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[] = { diff --git a/reaction/code/game/g_combat.c b/reaction/code/game/g_combat.c index c645dfa3..686afb3a 100644 --- a/reaction/code/game/g_combat.c +++ b/reaction/code/game/g_combat.c @@ -554,7 +554,7 @@ LookAtKiller void LookAtKiller(gentity_t * self, gentity_t * inflictor, gentity_t * attacker) { vec3_t dir; - vec3_t angles; +// vec3_t angles; if (attacker && attacker != self) { VectorSubtract(attacker->s.pos.trBase, self->s.pos.trBase, dir); @@ -567,9 +567,9 @@ void LookAtKiller(gentity_t * self, gentity_t * inflictor, gentity_t * attacker) self->client->ps.stats[STAT_DEAD_YAW] = vectoyaw(dir); - angles[YAW] = vectoyaw(dir); - angles[PITCH] = 0; - angles[ROLL] = 0; +// angles[YAW] = vectoyaw(dir); +// angles[PITCH] = 0; +// angles[ROLL] = 0; } /* @@ -1502,7 +1502,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i } } // if client is in a nodrop area, don't drop anything (but return CTF flags!) - contents = trap_PointContents(self->r.currentOrigin, -1); +// contents = trap_PointContents(self->r.currentOrigin, -1); if (!(contents & CONTENTS_NODROP)) { TossClientItems(self); } else { @@ -1606,6 +1606,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i } } // never gib in a nodrop + contents = trap_PointContents(self->r.currentOrigin, -1); if (g_RQ3_gib.integer > 3 && !self->client->gibbed && (self->health <= GIB_HEALTH && !(contents & CONTENTS_NODROP) && g_blood.integer)) { // gib death @@ -1777,7 +1778,7 @@ void G_Damage(gentity_t * targ, gentity_t * inflictor, gentity_t * attacker, gclient_t *client; gentity_t *tent; // int take, save, asave, knockback; - int take, save, knockback; + int take, knockback; int bleeding = 0, instant_dam = 1, height; float z_rel, targ_maxs2, from_top; vec3_t line, new_point; @@ -2039,7 +2040,7 @@ void G_Damage(gentity_t * targ, gentity_t * inflictor, gentity_t * attacker, damage = 1; } take = damage; - save = 0; +// save = 0; // save some from armor // JBravo: armor ? dont think so. diff --git a/reaction/code/game/g_local.h b/reaction/code/game/g_local.h index 2841b7b8..55326bbf 100644 --- a/reaction/code/game/g_local.h +++ b/reaction/code/game/g_local.h @@ -656,6 +656,7 @@ typedef struct { team_t sessionTeam; team_t savedTeam; // JBravo: Used to hold the real team status of a player. int spectatorTime; // for determining next-in-line to play + int spectatorNum; // for determining next-in-line to play spectatorState_t spectatorState; int spectatorClient; // for chasecam and follow mode int wins, losses; // tournament stats @@ -1294,6 +1295,7 @@ void FindIntermissionPoint(void); void SetLeader(int team, int client); void CheckTeamLeader(int team); void G_RunThink(gentity_t * ent); +void AddTournamentQueue(gclient_t *client); void QDECL G_LogPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); void SendScoreboardMessageToAllClients(void); void QDECL G_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); diff --git a/reaction/code/game/g_misc.c b/reaction/code/game/g_misc.c index 398da013..36ebde38 100644 --- a/reaction/code/game/g_misc.c +++ b/reaction/code/game/g_misc.c @@ -615,7 +615,9 @@ TELEPORTERS void TeleportPlayer(gentity_t * player, vec3_t origin, vec3_t angles) { gentity_t *tent; + qboolean noAngles; + noAngles = (angles[0] > 999999.0); // use temp events at source and destination to prevent the effect // from getting dropped by a second player event if (player->client->sess.sessionTeam != TEAM_SPECTATOR) { @@ -631,12 +633,13 @@ void TeleportPlayer(gentity_t * player, vec3_t origin, vec3_t angles) VectorCopy(origin, player->client->ps.origin); player->client->ps.origin[2] += 1; + if (!noAngles) { // spit the player out // AngleVectors( angles, player->client->ps.velocity, NULL, NULL ); // VectorScale( player->client->ps.velocity, 400, player->client->ps.velocity ); player->client->ps.pm_time = 160; // hold time player->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; - + } // toggle the teleport bit so the client knows to not lerp player->client->ps.eFlags ^= EF_TELEPORT_BIT; diff --git a/reaction/code/game/g_spawn.c b/reaction/code/game/g_spawn.c index 1e2e28dd..cf35413b 100644 --- a/reaction/code/game/g_spawn.c +++ b/reaction/code/game/g_spawn.c @@ -216,54 +216,48 @@ qboolean G_SpawnVector(const char *key, const char *defaultString, float *out) typedef enum { F_INT, F_FLOAT, - F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL - F_GSTRING, // string on disk, pointer in memory, TAG_GAME + F_STRING, F_VECTOR, F_ANGLEHACK, - F_ENTITY, // index on disk, pointer in memory - F_ITEM, // index on disk, pointer in memory - F_CLIENT, // index on disk, pointer in memory - F_IGNORE } fieldtype_t; typedef struct { char *name; - int ofs; + size_t ofs; fieldtype_t type; -// int flags; } field_t; field_t fields[] = { - {"classname", FOFS(classname), F_LSTRING}, + {"classname", FOFS(classname), F_STRING}, {"origin", FOFS(s.origin), F_VECTOR}, - {"model", FOFS(model), F_LSTRING}, - {"model2", FOFS(model2), F_LSTRING}, + {"model", FOFS(model), F_STRING}, + {"model2", FOFS(model2), F_STRING}, {"spawnflags", FOFS(spawnflags), F_INT}, {"speed", FOFS(speed), F_FLOAT}, - {"target", FOFS(target), F_LSTRING}, - {"targetname", FOFS(targetname), F_LSTRING}, - {"message", FOFS(message), F_LSTRING}, - {"team", FOFS(team), F_LSTRING}, + {"target", FOFS(target), F_STRING}, + {"targetname", FOFS(targetname), F_STRING}, + {"message", FOFS(message), F_STRING}, + {"team", FOFS(team), F_STRING}, {"wait", FOFS(wait), F_FLOAT}, {"random", FOFS(random), F_FLOAT}, {"count", FOFS(count), F_INT}, {"health", FOFS(health), F_INT}, - {"light", 0, F_IGNORE}, +// {"light", 0, F_IGNORE}, {"dmg", FOFS(damage), F_INT}, {"angles", FOFS(s.angles), F_VECTOR}, //Makro - only used by the sky portal code {"portalspeed", FOFS(movedir), F_VECTOR}, {"angle", FOFS(s.angles), F_ANGLEHACK}, - {"targetShaderName", FOFS(targetShaderName), F_LSTRING}, - {"targetShaderNewName", FOFS(targetShaderNewName), F_LSTRING}, + {"targetShaderName", FOFS(targetShaderName), F_STRING}, + {"targetShaderNewName", FOFS(targetShaderNewName), F_STRING}, {"distance", FOFS(distance), F_FLOAT}, // VALKYRIE: for rotating doors - {"targetinactive", FOFS(targetInactive), F_LSTRING}, // Makro - target to be fired when inactive - {"pathtarget", FOFS(pathtarget), F_LSTRING}, // Makro - for func_trains + {"targetinactive", FOFS(targetInactive), F_STRING}, // Makro - target to be fired when inactive + {"pathtarget", FOFS(pathtarget), F_STRING}, // Makro - for func_trains {"inactive", FOFS(inactive), F_INT}, // Makro - for inactive objects - {"activatename", FOFS(activatename), F_LSTRING}, - {"alias", FOFS(alias), F_LSTRING}, //Makro - entity id strings - {"moveparent", FOFS(moveParent), F_LSTRING}, //Makro - entity id strings - {"attachto", FOFS(moveParent), F_LSTRING}, // + {"activatename", FOFS(activatename), F_STRING}, + {"alias", FOFS(alias), F_STRING}, //Makro - entity id strings + {"moveparent", FOFS(moveParent), F_STRING}, //Makro - entity id strings + {"attachto", FOFS(moveParent), F_STRING}, // {"noreset", FOFS(noreset), F_INT}, //Makro - for entities that shouldn't respawn in TP {NULL} }; @@ -276,10 +270,10 @@ typedef struct { void SP_info_player_start(gentity_t * ent); void SP_info_player_deathmatch(gentity_t * ent); void SP_info_player_intermission(gentity_t * ent); -void SP_info_firstplace(gentity_t * ent); -void SP_info_secondplace(gentity_t * ent); -void SP_info_thirdplace(gentity_t * ent); -void SP_info_podium(gentity_t * ent); +//void SP_info_firstplace(gentity_t * ent); +//void SP_info_secondplace(gentity_t * ent); +//void SP_info_thirdplace(gentity_t * ent); +//void SP_info_podium(gentity_t * ent); void SP_func_plat(gentity_t * ent); void SP_func_static(gentity_t * ent); @@ -305,7 +299,7 @@ void SP_target_delay(gentity_t * ent); void SP_target_speaker(gentity_t * ent); void SP_target_print(gentity_t * ent); void SP_target_laser(gentity_t * self); -void SP_target_character(gentity_t * ent); +//void SP_target_character(gentity_t * ent); void SP_target_score(gentity_t * ent); void SP_target_teleporter(gentity_t * ent); void SP_target_relay(gentity_t * ent); @@ -348,7 +342,7 @@ void SP_func_door_rotating(gentity_t * ent); // VALKYRIE: for rotating doors // JBravo: SP_item_botroam doesnt really exsist. // Makro - still, bots are supposed to use these -void SP_item_botroam(gentity_t * ent); +void SP_item_botroam(gentity_t * ent) {} //Blaze: merged func_explosive into func_breakable @@ -441,12 +435,6 @@ spawn_t spawns[] = { {NULL, 0} }; -// JBravo: Compiler warning shutup -void SP_item_botroam(gentity_t * ent) -{ - return; -} - /* =============== G_CallSpawn @@ -650,7 +638,7 @@ void G_ParseField(const char *key, const char *value, gentity_t * ent) b = (byte *) ent; switch (f->type) { - case F_LSTRING: + case F_STRING: *(char **) (b + f->ofs) = G_NewString(value); break; case F_VECTOR: @@ -671,15 +659,23 @@ void G_ParseField(const char *key, const char *value, gentity_t * ent) ((float *) (b + f->ofs))[1] = v; ((float *) (b + f->ofs))[2] = 0; break; - default: - case F_IGNORE: - break; +// default: +// case F_IGNORE: +// break; } return; } } } +#define ADJUST_AREAPORTAL() \ + if(ent->s.eType == ET_MOVER) \ + { \ + trap_LinkEntity(ent); \ + trap_AdjustAreaPortalState(ent, qtrue); \ + } + + /* =================== G_SpawnGEntityFromSpawnVars @@ -711,6 +707,7 @@ void G_SpawnGEntityFromSpawnVars(void) if (g_gametype.integer == GT_SINGLE_PLAYER) { G_SpawnInt("notsingle", "0", &i); if (i) { + ADJUST_AREAPORTAL(); G_FreeEntity(ent); return; } @@ -718,6 +715,7 @@ void G_SpawnGEntityFromSpawnVars(void) //Makro - check for "notgametype" key if (G_SpawnInt("notgametype", "0", &i)) { if ((i & (1 << g_gametype.integer)) != 0) { + ADJUST_AREAPORTAL(); G_FreeEntity(ent); return; } @@ -725,12 +723,14 @@ void G_SpawnGEntityFromSpawnVars(void) } else if (g_gametype.integer >= GT_TEAM) { G_SpawnInt("notteam", "0", &i); if (i) { + ADJUST_AREAPORTAL(); G_FreeEntity(ent); return; } } else { G_SpawnInt("notfree", "0", &i); if (i) { + ADJUST_AREAPORTAL(); G_FreeEntity(ent); return; } @@ -738,6 +738,7 @@ void G_SpawnGEntityFromSpawnVars(void) G_SpawnInt("notq3a", "0", &i); if (i) { + ADJUST_AREAPORTAL(); G_FreeEntity(ent); return; } @@ -748,6 +749,7 @@ void G_SpawnGEntityFromSpawnVars(void) s = strstr(value, gametypeName); if (!s) { + ADJUST_AREAPORTAL(); G_FreeEntity(ent); return; } @@ -782,7 +784,7 @@ char *G_AddSpawnVarToken(const char *string) l = strlen(string); 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; @@ -943,8 +945,13 @@ void SP_worldspawn(void) g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD; + g_entities[ENTITYNUM_WORLD].r.ownerNum = ENTITYNUM_NONE; g_entities[ENTITYNUM_WORLD].classname = "worldspawn"; + g_entities[ENTITYNUM_NONE].s.number = ENTITYNUM_NONE; + g_entities[ENTITYNUM_NONE].r.ownerNum = ENTITYNUM_NONE; + g_entities[ENTITYNUM_NONE].classname = "nothing"; + // see if we want a warmup time trap_SetConfigstring(CS_WARMUP, ""); if (g_restarted.integer) { diff --git a/reaction/code/game/g_team.c b/reaction/code/game/g_team.c index 68b9b596..c73bc4c4 100644 --- a/reaction/code/game/g_team.c +++ b/reaction/code/game/g_team.c @@ -141,7 +141,7 @@ static __attribute__ ((format (printf, 2, 3))) void QDECL PrintMsg( gentity_t *e char *p; va_start(argptr, fmt); - if (Q_vsnprintf(msg, sizeof(msg), fmt, argptr) > sizeof(msg)) { + if (Q_vsnprintf(msg, sizeof(msg), fmt, argptr) >= sizeof(msg)) { G_Error("PrintMsg overrun"); } va_end(argptr); @@ -782,7 +782,8 @@ int Team_TouchOurFlag(gentity_t * ent, gentity_t * other, int team) player->client->ps.eFlags |= EF_AWARD_ASSIST; 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) { AddScore(player, ent->r.currentOrigin, CTF_FRAG_CARRIER_ASSIST_BONUS); other->client->pers.teamState.assists++; @@ -1000,8 +1001,7 @@ SelectCTFSpawnPoint ============ */ -gentity_t *SelectCTFSpawnPoint(team_t team, int teamstate, vec3_t origin, vec3_t angles) -{ +gentity_t *SelectCTFSpawnPoint (team_t team, int teamstate, vec3_t origin, vec3_t angles) { gentity_t *spot; spot = SelectRandomTeamSpawnPoint(teamstate, team); diff --git a/reaction/code/game/g_weapon.c b/reaction/code/game/g_weapon.c index 1d2fde38..afb86f35 100644 --- a/reaction/code/game/g_weapon.c +++ b/reaction/code/game/g_weapon.c @@ -441,6 +441,10 @@ qboolean CheckGauntletAttack(gentity_t * ent) return qfalse; } + if ( ent->client->noclip ) { + return qfalse; + } + traceEnt = &g_entities[tr.entityNum]; // send blood impact @@ -487,9 +491,9 @@ void SnapVectorTowards(vec3_t v, vec3_t to) for (i = 0; i < 3; i++) { if (to[i] <= v[i]) { - v[i] = (int) v[i]; + v[i] = floor(v[i]); } else { - v[i] = (int) v[i] + 1; + v[i] = ceil(v[i]); } } } @@ -739,7 +743,7 @@ void ShotgunPattern(vec3_t origin, vec3_t origin2, int seed, gentity_t * ent, in float r, u; vec3_t end; vec3_t forward, right, up; - int oldScore; +// int oldScore; qboolean hitClient = qfalse; //Elder: added @@ -754,7 +758,7 @@ void ShotgunPattern(vec3_t origin, vec3_t origin2, int seed, gentity_t * ent, in PerpendicularVector(right, forward); CrossProduct(forward, right, up); - oldScore = ent->client->ps.persistant[PERS_SCORE]; +// oldScore = ent->client->ps.persistant[PERS_SCORE]; //Elder: added if (shotType == WP_M3) {