From 74270f3c49cf2c521150b643fab9081d635b55cb Mon Sep 17 00:00:00 2001 From: IR4T4 Date: Fri, 9 Nov 2012 20:52:52 +0100 Subject: [PATCH] mod: clean up refs #51 --- src/game/g_cmds.c | 86 +---------------- src/game/g_local.h | 6 +- src/game/g_misc.c | 200 +-------------------------------------- src/game/g_teammapdata.c | 3 - 4 files changed, 5 insertions(+), 290 deletions(-) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 11bcc70c9a..b9aa0f7190 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -403,7 +403,6 @@ void Cmd_Give_f(gentity_t *ent) hasAmount = qtrue; } amount = atoi(amt); - //----(SA) end name = ConcatArgs(1); @@ -974,20 +973,7 @@ qboolean SetTeam(gentity_t *ent, char *s, qboolean force, weapon_t w1, weapon_t } } - // DHM - Nerve :: Force players to wait 30 seconds before they can join a new team. - // OSP - changed to 5 seconds - // Gordon: disabling if in dev mode: cuz it sucks - // Gordon: bleh, half of these variables don't mean what they used to, so this doesn't work - /* if ( !g_cheats.integer ) { - if ( team != oldTeam && level.warmupTime == 0 && !client->pers.initialSpawn && ( (level.time - client->pers.connectTime) > 10000 ) && ( (level.time - client->pers.enterTime) < 5000 ) && !force ) { - CP(va("cp \"^3You must wait %i seconds before joining ^3a new team.\n\" 3", (int)(5 - ((level.time - client->pers.enterTime)/1000)))); - return qfalse; - } - }*/ - // dhm - // execute the team change - if (team != TEAM_SPECTATOR) { client->pers.initialSpawn = qfalse; @@ -2539,7 +2525,6 @@ void Cmd_Vote_f(gentity_t *ent) ent->client->pers.propositionClient = -1; ent->client->pers.propositionClient2 = -1; - // dhm // Reset this ent's complainEndTime so they can't send multiple complaints ent->client->pers.complaintEndTime = -1; ent->client->pers.complaintClient = -1; @@ -2598,10 +2583,9 @@ void Cmd_Vote_f(gentity_t *ent) qboolean G_canPickupMelee(gentity_t *ent) { -// JPW NERVE -- no "melee" weapons in net play + // JPW NERVE -- no "melee" weapons in net play return qfalse; } -// jpw /* ================= @@ -3356,60 +3340,6 @@ void Cmd_SetSpawnPoint_f(gentity_t *ent) } } -/* -============ -Cmd_SetSniperSpot_f -============ -*/ -// TODO: remove this -void Cmd_SetSniperSpot_f(gentity_t *clent) -{ - gentity_t *spot; - - vmCvar_t cvar_mapname; - char filename[MAX_QPATH]; - fileHandle_t f; - char buf[1024]; - - if (!g_cheats.integer) - { - return; - } - if (!trap_Cvar_VariableIntegerValue("cl_running")) - { - return; // only allow locally playing client - } - if (clent->s.number != 0) - { - return; // only allow locally playing client - - } - // drop a sniper spot here - spot = G_Spawn(); - spot->classname = "bot_sniper_spot"; - VectorCopy(clent->r.currentOrigin, spot->s.origin); - VectorCopy(clent->client->ps.viewangles, spot->s.angles); - spot->aiTeam = clent->client->sess.sessionTeam; - - // output to text file - trap_Cvar_Register(&cvar_mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM); - - Com_sprintf(filename, sizeof(filename), "maps/%s.botents", cvar_mapname.string); - if (trap_FS_FOpenFile(filename, &f, FS_APPEND) < 0) - { - G_Error("Cmd_SetSniperSpot_f: cannot open %s for writing\n", filename); - } - - Com_sprintf(buf, sizeof(buf), "{\n\"classname\" \"%s\"\n\"origin\" \"%.3f %.3f %.3f\"\n\"angles\" \"%.2f %.2f %.2f\"\n\"aiTeam\" \"%i\"\n}\n\n", spot->classname, spot->s.origin[0], spot->s.origin[1], spot->s.origin[2], spot->s.angles[0], spot->s.angles[1], spot->s.angles[2], spot->aiTeam); - trap_FS_Write(buf, strlen(buf), f); - - trap_FS_FCloseFile(f); - - G_Printf("dropped sniper spot\n"); - - return; -} - void G_PrintAccuracyLog(gentity_t *ent); void Cmd_WeaponStat_f(gentity_t *ent) @@ -3918,7 +3848,6 @@ void ClientCommand(int clientNum) { return; } - // OSP // ignore all other commands when at intermission if (level.intermissiontime) @@ -3961,9 +3890,7 @@ void ClientCommand(int clientNum) } else if (Q_stricmp(cmd, "where") == 0) { - Cmd_Where_f(ent); -// } else if (Q_stricmp (cmd, "startCamera") == 0) { -// Cmd_StartCamera_f( ent ); + Cmd_Where_f(ent);; } else if (Q_stricmp(cmd, "stopCamera") == 0) { @@ -3973,10 +3900,6 @@ void ClientCommand(int clientNum) { Cmd_SetCameraOrigin_f(ent); } - else if (Q_stricmp(cmd, "cameraInterrupt") == 0) // FIXME: remove - { - // Cmd_InterruptCamera_f(ent); - } else if (Q_stricmp(cmd, "setviewpos") == 0) { Cmd_SetViewpos_f(ent); @@ -3985,11 +3908,6 @@ void ClientCommand(int clientNum) { Cmd_SetSpawnPoint_f(ent); } - else if (Q_stricmp(cmd, "setsniperspot") == 0) - { - Cmd_SetSniperSpot_f(ent); - - } else if (G_commandCheck(ent, cmd, qfalse)) { return; diff --git a/src/game/g_local.h b/src/game/g_local.h index db0584336a..942185fc88 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -53,10 +53,8 @@ #define MG42_MULTIPLAYER_HEALTH 350 // How long do bodies last? -// SP : Axis: 20 seconds -// Allies: 30 seconds -// MP : Both 10 seconds -#define BODY_TIME(t) ((g_gametype.integer != GT_SINGLE_PLAYER || g_gametype.integer == GT_COOP) ? 10000 : (t) == TEAM_AXIS ? 20000 : 30000) +// Both teams 10 seconds +#define BODY_TIME(t) 10000 #define MAX_MG42_HEAT 1500.f diff --git a/src/game/g_misc.c b/src/game/g_misc.c index cdeb59222e..59e27dcde3 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -143,7 +143,6 @@ void TeleportPlayer(gentity_t *player, vec3_t origin, vec3_t angles) } } - /*QUAKED misc_teleporter_dest (1 0 0) (-32 -32 -24) (32 32 -16) Point teleporters at these. Now that we don't have teleport destination pads, this is just @@ -153,7 +152,6 @@ void SP_misc_teleporter_dest(gentity_t *ent) { } - /* ================================================================================= @@ -198,7 +196,6 @@ void grabber_think_hit(gentity_t *ent) ent->think = grabber_think_idle; } - /* ============== grabber_die @@ -228,9 +225,6 @@ void grabber_die(gentity_t *ent, gentity_t *inflictor, gentity_t *attacker, int // G_FreeEntity(ent); } - - - /* ============== grabber_attack @@ -350,7 +344,6 @@ void grabber_wake_touch(gentity_t *ent, gentity_t *other, trace_t *trace) grabber_wake(ent); } - /*QUAKED misc_grabber_trap (1 0 0) (-8 -8 -8) (8 8 8) fields: "adist" - radius of 'wakeup' box. player passing closer than distance activates grabber (def: 64) @@ -447,7 +440,6 @@ void SP_misc_grabber_trap(gentity_t *ent) trig->r.svFlags = SVF_NOCLIENT; trig->touch = grabber_wake_touch; trap_LinkEntity(trig); - } void use_spotlight(gentity_t *ent, gentity_t *other, gentity_t *activator) @@ -490,7 +482,6 @@ BACK_AND_FORTH - when end of target spline is hit, reverse direction rather than */ void SP_misc_spotlight(gentity_t *ent) { - ent->s.eType = ET_EF_SPOTLIGHT; ent->think = spotlight_finish_spawning; @@ -509,10 +500,8 @@ void SP_misc_spotlight(gentity_t *ent) { ent->s.density = G_FindConfigstringIndex(ent->target, CS_SPLINES, MAX_SPLINE_CONFIGSTRINGS, qtrue); } - } - //=========================================================== /*QUAKED misc_model (1 0 0) (-16 -16 -16) (16 16 16) @@ -685,8 +674,6 @@ void SP_misc_vis_dummy(gentity_t *ent) } -//----(SA) end - /*QUAKED misc_vis_dummy_multiple (1 .5 0) (-8 -8 -8) (8 8 8) If this entity is "visible" (in player's PVS) then it's target is forced to be active whether it is in the player's PVS or not. This entity itself is never visible or transmitted to clients. @@ -1201,9 +1188,7 @@ void SP_dlight(gentity_t *ent) { trap_LinkEntity(ent); } - } -// done (SA) void flakPuff(vec3_t origin) { @@ -2041,7 +2026,6 @@ void mg42_spawn(gentity_t *ent) VectorCopy(ent->s.angles, gun->s.angles2); - gun->touch = mg42_touch; gun->think = mg42_think; gun->use = mg42_use; @@ -2063,7 +2047,7 @@ void mg42_spawn(gentity_t *ent) // Gordon: storing heat now gun->mg42weapHeat = 0; -// gun->mg42firetime = 0; + // gun->mg42firetime = 0; // Arnout: move track and targetname over to these entities for construction system gun->track = ent->track; @@ -2301,7 +2285,6 @@ spawnitem void misc_spawner_think(gentity_t *ent) { - gitem_t *item; gentity_t *drop = NULL; @@ -2314,7 +2297,6 @@ void misc_spawner_think(gentity_t *ent) G_Printf("-----> WARNING <-------\n"); G_Printf("misc_spawner used at %s failed to drop!\n", vtos(ent->r.currentOrigin)); } - } void misc_spawner_use(gentity_t *ent, gentity_t *other, gentity_t *activator) @@ -2343,7 +2325,6 @@ void SP_misc_spawner(gentity_t *ent) ent->use = misc_spawner_use; trap_LinkEntity(ent); - } //=========================================================================== @@ -2351,182 +2332,6 @@ void SP_misc_spawner(gentity_t *ent) // Mounted Gun, attached to a moving vehicle of some-sort // -/*QUAKED func_mounted_gun (.4 .9 .7) (-16 -16 -24) (16 16 64) -an MG42 to be mounted onto a vehicle. - -Gun must be able to rotate full 360 degrees, with slight pitching. - -Fields: - -*IMPORTANT* color = vector offest of gun mount tag on truck, from truck's origin -*IMPORTANT* delay = offset distance of gunnner mount tag on gun model, from gun's origin -target = targetname of vehicle we are attached to -aiTeam = 0 for Nazi, 1 for Allies, 2 for Monster -harc = visible arc, for initially sighting enemies Default is 220 -radius = visible distance, for sighting enemies Default is 4096 - -varc = vertical fire arc Default is 90 (45 above and below) -health = how much damage can it take default is 50 -accuracy = all guns are 100% accurate an entry of 0.5 would make it 50% -damage = damage caused by each bullet -*/ - -/*void miscGunnerEnemyScan(gentity_t *ent, vec3_t angles) -{ - gentity_t *t; - vec3_t v, tang; - - for (t=g_entities; tinuse) - continue; - if (t->health < 0) - continue; - if (VectorDistanceSquared(ent->r.currentOrigin, t->r.currentOrigin) > SQR(ent->radius)) - continue; - VectorSubtract( t->r.currentOrigin, ent->r.currentOrigin, v ); - vectoangles( v, tang ); - if (!AICast_InFieldOfVision( angles, ent->harc, tang )) - continue; - if (!AICast_VisibleFromPos( ent->r.currentOrigin, ent->s.number, t->r.currentOrigin, t->s.number, qfalse )) - continue; - // found an enemy - ent->enemy = t; - break; - } -}*/ - -/*void miscGunnerThink(gentity_t *ent) -{ - gentity_t *truck, *gun, *enemy; - vec3_t vec, trang, gspot, gang; - vec3_t fwd, r, u; - qboolean fire=qfalse; - float yawspeed, diff; - vec3_t dang; - qboolean clamped = qfalse; - int i; - - // find the entities - gun = &g_entities[ent->mg42BaseEnt]; - truck = &g_entities[gun->mg42BaseEnt]; - - // calculate our position based on that of the truck and gun angles - BG_EvaluateTrajectory( &truck->s.apos, level.time, trang ); - AngleVectors( trang, fwd, r, u ); - BG_EvaluateTrajectory( &truck->s.pos, level.time, gspot ); - VectorMA( gspot, ent->dl_color[0], fwd, gspot ); - VectorMA( gspot, -ent->dl_color[1], r, gspot ); - VectorMA( gspot, ent->dl_color[2], u, gspot ); - G_SetOrigin( ent, gspot ); - G_SetOrigin( gun, gspot ); - - // calculate our facing angles - //VectorAdd( trang, gun->r.currentAngles, gang ); - if (!gun->s.density) - VectorCopy( trang, gang ); - else - BG_EvaluateTrajectory( &gun->s.apos, level.time, gang ); - - // look for an enemy - if (ent->enemy) { - if (ent->enemy->health <= 0) { - ent->enemy = NULL; - } else if (AICast_VisibleFromPos(ent->r.currentOrigin, ent->s.number, ent->enemy->r.currentOrigin, ent->enemy->s.number, qfalse)) { - fire = qtrue; - } - } - - if (!fire) { - miscGunnerEnemyScan(ent, trang); - if (ent->enemy) { - fire = qtrue; - - // if we have just found our first enemy, release us from the "fixed tag" angles - // so we can track them - if (!gun->s.density) { - gun->s.density = 1; - // start facing the same direct, so we don't snap to a different angle immediately - BG_EvaluateTrajectory( &truck->s.apos, level.time, ent->s.angles ); - VectorCopy( gun->s.angles, gun->s.apos.trBase ); - gun->s.apos.trTime = level.time; - gun->s.apos.trDuration = 0; - gun->s.apos.trType = TR_STATIONARY; - VectorClear( gun->s.apos.trDelta ); - } - } - } - - // third, attack that enemy if possible - if (fire) { - - // get the enemy - enemy = ent->enemy; - - // rotate to them - VectorSubtract( enemy->r.currentOrigin, gun->r.currentOrigin, vec ); - vectoangles( vec, gun->TargetAngles ); - VectorCopy (gun->TargetAngles, dang); - for (i=0; i<3; i++) { - dang[i] = AngleNormalize180(dang[i]); - } - - // restrict vertical range - if (dang[0] < 0 && fabs(dang[0]) > (gun->varc/2)) { - clamped = qtrue; - if (dang[0] < 0) - dang[0] = -(gun->varc/2); - else - dang[0] = (gun->varc/2); - } - - // dang is now the ideal angles, restrict movement by speed - yawspeed = 60; - for (i=0; i<3; i++) { - BG_EvaluateTrajectory( &gun->s.apos, level.time, gun->r.currentAngles ); - diff = AngleDifference( dang[i], gun->r.currentAngles[i] ); - if (fabs(diff) > (yawspeed * ((float)FRAMETIME/1000.0))) { - clamped = qtrue; - if (diff > 0) { - dang[i] = AngleMod(gun->r.currentAngles[i] + (yawspeed * ((float)FRAMETIME/1000.0))); - } else { - dang[i] = AngleMod(gun->r.currentAngles[i] - (yawspeed * ((float)FRAMETIME/1000.0))); - } - } - } - - // move to the position over the next frame - VectorSubtract( dang, gun->r.currentAngles, gun->s.apos.trDelta ); - for (i=0; i<3; i++) { - gun->s.apos.trDelta[i] = AngleNormalize180( gun->s.apos.trDelta[i] ); - } - VectorCopy( gun->r.currentAngles, gun->s.apos.trBase ); - VectorScale( gun->s.apos.trDelta, 1000/50, gun->s.apos.trDelta ); - gun->s.apos.trTime = level.time; - gun->s.apos.trType = TR_LINEAR_STOP; - gun->s.apos.trDuration = 50; - - // if we are facing them, fire - if (fabs( AngleNormalize180(gun->r.currentAngles[YAW] - gun->TargetAngles[YAW]) ) < 10) { - AngleVectors (gun->r.currentAngles, forward, right, up); - VectorCopy (gspot, muzzle); - - VectorMA (muzzle, 16, forward, muzzle); - VectorMA (muzzle, 16, up, muzzle); - - // snap to integer coordinates for more efficient network bandwidth usage - SnapVector( muzzle); - - if (gun->damage) - Fire_Lead (gun, gun, MG42_SPREAD/gun->accuracy, gun->damage); - else - Fire_Lead (gun, gun, MG42_SPREAD/gun->accuracy, MG42_DAMAGE_AI); - } - } - - ent->think = miscGunnerThink; - ent->nextthink = level.time + 50; -}*/ - void firetrail_die(gentity_t *ent) { G_FreeEntity(ent); @@ -2544,7 +2349,6 @@ void firetrail_use(gentity_t *ent, gentity_t *other, gentity_t *activator) } trap_LinkEntity(ent); - } /*QUAKED misc_firetrails (.4 .9 .7) (-16 -16 -16) (16 16 16) @@ -2592,14 +2396,12 @@ void misc_firetrails_think(gentity_t *ent) G_SetTargetName(right, ent->targetname); G_ProcessTagConnect(right, qtrue); trap_LinkEntity(right); - } void SP_misc_firetrails(gentity_t *ent) { ent->think = misc_firetrails_think; ent->nextthink = level.time + 100; - } /*QUAKED misc_constructiblemarker (1 0.85 0) ? diff --git a/src/game/g_teammapdata.c b/src/game/g_teammapdata.c index d34fbbad13..9476c978c1 100644 --- a/src/game/g_teammapdata.c +++ b/src/game/g_teammapdata.c @@ -872,14 +872,11 @@ void G_SendSpectatorMapEntityInfo(gentity_t *e) } ax_cnt++; - - } // Allied data init teamList = &mapEntityData[1]; - al_cnt = 0; for (mEnt = teamList->activeMapEntityData.next; mEnt && mEnt != &teamList->activeMapEntityData; mEnt = mEnt->next) {