mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-23 12:32:09 +00:00
eb9fe030c4
################################################################################ 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. ******************************************************************************** ################################################################################
482 lines
13 KiB
C
482 lines
13 KiB
C
/*
|
|
===========================================================================
|
|
Copyright (C) 1999-2005 Id Software, Inc.
|
|
|
|
This file is part of Quake III Arena source code.
|
|
|
|
Quake III Arena source code is free software; you can redistribute it
|
|
and/or modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2 of the License,
|
|
or (at your option) any later version.
|
|
|
|
Quake III Arena source code is distributed in the hope that it will be
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Quake III Arena source code; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
===========================================================================
|
|
*/
|
|
//
|
|
// g_misc.c
|
|
|
|
#include "g_local.h"
|
|
|
|
|
|
/*QUAKED func_group (0 0 0) ?
|
|
Used to group brushes together just for editor convenience. They are turned into normal brushes by the utilities.
|
|
*/
|
|
|
|
|
|
/*QUAKED info_camp (0 0.5 0) (-4 -4 -4) (4 4 4)
|
|
Used as a positional target for calculations in the utilities (spotlights, etc), but removed during gameplay.
|
|
*/
|
|
void SP_info_camp( gentity_t *self ) {
|
|
G_SetOrigin( self, self->s.origin );
|
|
}
|
|
|
|
|
|
/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
|
|
Used as a positional target for calculations in the utilities (spotlights, etc), but removed during gameplay.
|
|
*/
|
|
void SP_info_null( gentity_t *self ) {
|
|
G_FreeEntity( self );
|
|
}
|
|
|
|
|
|
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
|
|
Used as a positional target for in-game calculation, like jumppad targets.
|
|
target_position does the same thing
|
|
*/
|
|
void SP_info_notnull( gentity_t *self ){
|
|
G_SetOrigin( self, self->s.origin );
|
|
}
|
|
|
|
|
|
/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) linear
|
|
Non-displayed light.
|
|
"light" overrides the default 300 intensity.
|
|
Linear checbox gives linear falloff instead of inverse square
|
|
Lights pointed at a target will be spotlights.
|
|
"radius" overrides the default 64 unit radius of a spotlight at the target point.
|
|
*/
|
|
void SP_light( gentity_t *self ) {
|
|
G_FreeEntity( self );
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
=================================================================================
|
|
|
|
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 ) {
|
|
tent = G_TempEntity( player->client->ps.origin, EV_PLAYER_TELEPORT_OUT );
|
|
tent->s.clientNum = player->s.clientNum;
|
|
|
|
tent = G_TempEntity( origin, EV_PLAYER_TELEPORT_IN );
|
|
tent->s.clientNum = player->s.clientNum;
|
|
}
|
|
|
|
// unlink to make sure it can't possibly interfere with G_KillBox
|
|
trap_UnlinkEntity (player);
|
|
|
|
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;
|
|
// set angles
|
|
SetClientViewAngle(player, angles);
|
|
}
|
|
// toggle the teleport bit so the client knows to not lerp
|
|
player->client->ps.eFlags ^= EF_TELEPORT_BIT;
|
|
// kill anything at the destination
|
|
if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {
|
|
G_KillBox (player);
|
|
}
|
|
|
|
// save results of pmove
|
|
BG_PlayerStateToEntityState( &player->client->ps, &player->s, qtrue );
|
|
|
|
// use the precise origin for linking
|
|
VectorCopy( player->client->ps.origin, player->r.currentOrigin );
|
|
|
|
if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {
|
|
trap_LinkEntity (player);
|
|
}
|
|
}
|
|
|
|
|
|
/*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
|
|
an info_notnull
|
|
*/
|
|
void SP_misc_teleporter_dest( gentity_t *ent ) {
|
|
}
|
|
|
|
|
|
//===========================================================
|
|
|
|
/*QUAKED misc_model (1 0 0) (-16 -16 -16) (16 16 16)
|
|
"model" arbitrary .md3 file to display
|
|
*/
|
|
void SP_misc_model( gentity_t *ent ) {
|
|
|
|
#if 0
|
|
ent->s.modelindex = G_ModelIndex( ent->model );
|
|
VectorSet (ent->mins, -16, -16, -16);
|
|
VectorSet (ent->maxs, 16, 16, 16);
|
|
trap_LinkEntity (ent);
|
|
|
|
G_SetOrigin( ent, ent->s.origin );
|
|
VectorCopy( ent->s.angles, ent->s.apos.trBase );
|
|
#else
|
|
G_FreeEntity( ent );
|
|
#endif
|
|
}
|
|
|
|
//===========================================================
|
|
|
|
void locateCamera( gentity_t *ent ) {
|
|
vec3_t dir;
|
|
gentity_t *target;
|
|
gentity_t *owner;
|
|
|
|
owner = G_PickTarget( ent->target );
|
|
if ( !owner ) {
|
|
G_Printf( "Couldn't find target for misc_partal_surface\n" );
|
|
G_FreeEntity( ent );
|
|
return;
|
|
}
|
|
ent->r.ownerNum = owner->s.number;
|
|
|
|
// frame holds the rotate speed
|
|
if ( owner->spawnflags & 1 ) {
|
|
ent->s.frame = 25;
|
|
} else if ( owner->spawnflags & 2 ) {
|
|
ent->s.frame = 75;
|
|
}
|
|
|
|
// swing camera ?
|
|
if ( owner->spawnflags & 4 ) {
|
|
// set to 0 for no rotation at all
|
|
ent->s.powerups = 0;
|
|
}
|
|
else {
|
|
ent->s.powerups = 1;
|
|
}
|
|
|
|
// clientNum holds the rotate offset
|
|
ent->s.clientNum = owner->s.clientNum;
|
|
|
|
VectorCopy( owner->s.origin, ent->s.origin2 );
|
|
|
|
// see if the portal_camera has a target
|
|
target = G_PickTarget( owner->target );
|
|
if ( target ) {
|
|
VectorSubtract( target->s.origin, owner->s.origin, dir );
|
|
VectorNormalize( dir );
|
|
} else {
|
|
G_SetMovedir( owner->s.angles, dir );
|
|
}
|
|
|
|
ent->s.eventParm = DirToByte( dir );
|
|
}
|
|
|
|
/*QUAKED misc_portal_surface (0 0 1) (-8 -8 -8) (8 8 8)
|
|
The portal surface nearest this entity will show a view from the targeted misc_portal_camera, or a mirror view if untargeted.
|
|
This must be within 64 world units of the surface!
|
|
*/
|
|
void SP_misc_portal_surface(gentity_t *ent) {
|
|
VectorClear( ent->r.mins );
|
|
VectorClear( ent->r.maxs );
|
|
trap_LinkEntity (ent);
|
|
|
|
ent->r.svFlags = SVF_PORTAL;
|
|
ent->s.eType = ET_PORTAL;
|
|
|
|
if ( !ent->target ) {
|
|
VectorCopy( ent->s.origin, ent->s.origin2 );
|
|
} else {
|
|
ent->think = locateCamera;
|
|
ent->nextthink = level.time + 100;
|
|
}
|
|
}
|
|
|
|
/*QUAKED misc_portal_camera (0 0 1) (-8 -8 -8) (8 8 8) slowrotate fastrotate noswing
|
|
The target for a misc_portal_director. You can set either angles or target another entity to determine the direction of view.
|
|
"roll" an angle modifier to orient the camera around the target vector;
|
|
*/
|
|
void SP_misc_portal_camera(gentity_t *ent) {
|
|
float roll;
|
|
|
|
VectorClear( ent->r.mins );
|
|
VectorClear( ent->r.maxs );
|
|
trap_LinkEntity (ent);
|
|
|
|
G_SpawnFloat( "roll", "0", &roll );
|
|
|
|
ent->s.clientNum = roll/360.0 * 256;
|
|
}
|
|
|
|
/*
|
|
======================================================================
|
|
|
|
SHOOTERS
|
|
|
|
======================================================================
|
|
*/
|
|
|
|
void Use_Shooter( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
|
|
vec3_t dir;
|
|
float deg;
|
|
vec3_t up, right;
|
|
|
|
// see if we have a target
|
|
if ( ent->enemy ) {
|
|
VectorSubtract( ent->enemy->r.currentOrigin, ent->s.origin, dir );
|
|
VectorNormalize( dir );
|
|
} else {
|
|
VectorCopy( ent->movedir, dir );
|
|
}
|
|
|
|
// randomize a bit
|
|
PerpendicularVector( up, dir );
|
|
CrossProduct( up, dir, right );
|
|
|
|
deg = crandom() * ent->random;
|
|
VectorMA( dir, deg, up, dir );
|
|
|
|
deg = crandom() * ent->random;
|
|
VectorMA( dir, deg, right, dir );
|
|
|
|
VectorNormalize( dir );
|
|
|
|
switch ( ent->s.weapon ) {
|
|
case WP_GRENADE_LAUNCHER:
|
|
fire_grenade( ent, ent->s.origin, dir );
|
|
break;
|
|
case WP_ROCKET_LAUNCHER:
|
|
fire_rocket( ent, ent->s.origin, dir );
|
|
break;
|
|
case WP_PLASMAGUN:
|
|
fire_plasma( ent, ent->s.origin, dir );
|
|
break;
|
|
}
|
|
|
|
G_AddEvent( ent, EV_FIRE_WEAPON, 0 );
|
|
}
|
|
|
|
|
|
static void InitShooter_Finish( gentity_t *ent ) {
|
|
ent->enemy = G_PickTarget( ent->target );
|
|
ent->think = 0;
|
|
ent->nextthink = 0;
|
|
}
|
|
|
|
void InitShooter( gentity_t *ent, int weapon ) {
|
|
ent->use = Use_Shooter;
|
|
ent->s.weapon = weapon;
|
|
|
|
RegisterItem( BG_FindItemForWeapon( weapon ) );
|
|
|
|
G_SetMovedir( ent->s.angles, ent->movedir );
|
|
|
|
if ( !ent->random ) {
|
|
ent->random = 1.0;
|
|
}
|
|
ent->random = sin( M_PI * ent->random / 180 );
|
|
// target might be a moving object, so we can't set movedir for it
|
|
if ( ent->target ) {
|
|
ent->think = InitShooter_Finish;
|
|
ent->nextthink = level.time + 500;
|
|
}
|
|
trap_LinkEntity( ent );
|
|
}
|
|
|
|
/*QUAKED shooter_rocket (1 0 0) (-16 -16 -16) (16 16 16)
|
|
Fires at either the target or the current direction.
|
|
"random" the number of degrees of deviance from the taget. (1.0 default)
|
|
*/
|
|
void SP_shooter_rocket( gentity_t *ent ) {
|
|
InitShooter( ent, WP_ROCKET_LAUNCHER );
|
|
}
|
|
|
|
/*QUAKED shooter_plasma (1 0 0) (-16 -16 -16) (16 16 16)
|
|
Fires at either the target or the current direction.
|
|
"random" is the number of degrees of deviance from the taget. (1.0 default)
|
|
*/
|
|
void SP_shooter_plasma( gentity_t *ent ) {
|
|
InitShooter( ent, WP_PLASMAGUN);
|
|
}
|
|
|
|
/*QUAKED shooter_grenade (1 0 0) (-16 -16 -16) (16 16 16)
|
|
Fires at either the target or the current direction.
|
|
"random" is the number of degrees of deviance from the taget. (1.0 default)
|
|
*/
|
|
void SP_shooter_grenade( gentity_t *ent ) {
|
|
InitShooter( ent, WP_GRENADE_LAUNCHER);
|
|
}
|
|
|
|
|
|
#ifdef MISSIONPACK
|
|
static void PortalDie (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod) {
|
|
G_FreeEntity( self );
|
|
//FIXME do something more interesting
|
|
}
|
|
|
|
|
|
void DropPortalDestination( gentity_t *player ) {
|
|
gentity_t *ent;
|
|
vec3_t snapped;
|
|
|
|
// create the portal destination
|
|
ent = G_Spawn();
|
|
ent->s.modelindex = G_ModelIndex( "models/powerups/teleporter/tele_exit.md3" );
|
|
|
|
VectorCopy( player->s.pos.trBase, snapped );
|
|
SnapVector( snapped );
|
|
G_SetOrigin( ent, snapped );
|
|
VectorCopy( player->r.mins, ent->r.mins );
|
|
VectorCopy( player->r.maxs, ent->r.maxs );
|
|
|
|
ent->classname = "hi_portal destination";
|
|
ent->s.pos.trType = TR_STATIONARY;
|
|
|
|
ent->r.contents = CONTENTS_CORPSE;
|
|
ent->takedamage = qtrue;
|
|
ent->health = 200;
|
|
ent->die = PortalDie;
|
|
|
|
VectorCopy( player->s.apos.trBase, ent->s.angles );
|
|
|
|
ent->think = G_FreeEntity;
|
|
ent->nextthink = level.time + 2 * 60 * 1000;
|
|
|
|
trap_LinkEntity( ent );
|
|
|
|
player->client->portalID = ++level.portalSequence;
|
|
ent->count = player->client->portalID;
|
|
|
|
// give the item back so they can drop the source now
|
|
player->client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItem( "Portal" ) - bg_itemlist;
|
|
}
|
|
|
|
|
|
static void PortalTouch( gentity_t *self, gentity_t *other, trace_t *trace) {
|
|
gentity_t *destination;
|
|
|
|
// see if we will even let other try to use it
|
|
if( other->health <= 0 ) {
|
|
return;
|
|
}
|
|
if( !other->client ) {
|
|
return;
|
|
}
|
|
// if( other->client->ps.persistant[PERS_TEAM] != self->spawnflags ) {
|
|
// return;
|
|
// }
|
|
|
|
if ( other->client->ps.powerups[PW_NEUTRALFLAG] ) { // only happens in One Flag CTF
|
|
Drop_Item( other, BG_FindItemForPowerup( PW_NEUTRALFLAG ), 0 );
|
|
other->client->ps.powerups[PW_NEUTRALFLAG] = 0;
|
|
}
|
|
else if ( other->client->ps.powerups[PW_REDFLAG] ) { // only happens in standard CTF
|
|
Drop_Item( other, BG_FindItemForPowerup( PW_REDFLAG ), 0 );
|
|
other->client->ps.powerups[PW_REDFLAG] = 0;
|
|
}
|
|
else if ( other->client->ps.powerups[PW_BLUEFLAG] ) { // only happens in standard CTF
|
|
Drop_Item( other, BG_FindItemForPowerup( PW_BLUEFLAG ), 0 );
|
|
other->client->ps.powerups[PW_BLUEFLAG] = 0;
|
|
}
|
|
|
|
// find the destination
|
|
destination = NULL;
|
|
while( (destination = G_Find(destination, FOFS(classname), "hi_portal destination")) != NULL ) {
|
|
if( destination->count == self->count ) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
// if there is not one, die!
|
|
if( !destination ) {
|
|
if( self->pos1[0] || self->pos1[1] || self->pos1[2] ) {
|
|
TeleportPlayer( other, self->pos1, self->s.angles );
|
|
}
|
|
G_Damage( other, other, other, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG );
|
|
return;
|
|
}
|
|
|
|
TeleportPlayer( other, destination->s.pos.trBase, destination->s.angles );
|
|
}
|
|
|
|
|
|
static void PortalEnable( gentity_t *self ) {
|
|
self->touch = PortalTouch;
|
|
self->think = G_FreeEntity;
|
|
self->nextthink = level.time + 2 * 60 * 1000;
|
|
}
|
|
|
|
|
|
void DropPortalSource( gentity_t *player ) {
|
|
gentity_t *ent;
|
|
gentity_t *destination;
|
|
vec3_t snapped;
|
|
|
|
// create the portal source
|
|
ent = G_Spawn();
|
|
ent->s.modelindex = G_ModelIndex( "models/powerups/teleporter/tele_enter.md3" );
|
|
|
|
VectorCopy( player->s.pos.trBase, snapped );
|
|
SnapVector( snapped );
|
|
G_SetOrigin( ent, snapped );
|
|
VectorCopy( player->r.mins, ent->r.mins );
|
|
VectorCopy( player->r.maxs, ent->r.maxs );
|
|
|
|
ent->classname = "hi_portal source";
|
|
ent->s.pos.trType = TR_STATIONARY;
|
|
|
|
ent->r.contents = CONTENTS_CORPSE | CONTENTS_TRIGGER;
|
|
ent->takedamage = qtrue;
|
|
ent->health = 200;
|
|
ent->die = PortalDie;
|
|
|
|
trap_LinkEntity( ent );
|
|
|
|
ent->count = player->client->portalID;
|
|
player->client->portalID = 0;
|
|
|
|
// ent->spawnflags = player->client->ps.persistant[PERS_TEAM];
|
|
|
|
ent->nextthink = level.time + 1000;
|
|
ent->think = PortalEnable;
|
|
|
|
// find the destination
|
|
destination = NULL;
|
|
while( (destination = G_Find(destination, FOFS(classname), "hi_portal destination")) != NULL ) {
|
|
if( destination->count == ent->count ) {
|
|
VectorCopy( destination->s.pos.trBase, ent->pos1 );
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
#endif
|