void BeginIntermission (edict_t *targ) { int i; edict_t *ent, *client; if (level.intermissionframe) return; // already activated // respawn any dead clients for (i=0 ; i<game.maxclients ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; if (client->health <= 0) respawn(client); } tdm_match_status = MM_SCOREBOARD; level.intermissionframe = level.framenum; level.changemap = targ->map; level.exitintermission = 0; // find an intermission spot ent = G_Find (NULL, FOFS(classname), "info_player_intermission"); if (!ent) { // the map creator forgot to put in an intermission point... ent = G_Find (NULL, FOFS(classname), "info_player_start"); if (!ent) ent = G_Find (NULL, FOFS(classname), "info_player_deathmatch"); } else { // chose one of four spots i = genrand_int32() & 3; while (i--) { ent = G_Find (ent, FOFS(classname), "info_player_intermission"); if (!ent) // wrap around the list ent = G_Find (ent, FOFS(classname), "info_player_intermission"); } } VectorCopy (ent->s.origin, level.intermission_origin); VectorCopy (ent->s.angles, level.intermission_angle); // move all clients to the intermission point for (i=0 ; i<game.maxclients ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; MoveClientToIntermission (client); } }
void Monster::reset() { m_currentAnimation = m_down; dt = 0; m_currentTile = m_nextTile = m_startTile; m_path.clear(); if(m_nextTile != NULL) transformSpriteInformation(); beginRespawn(); respawn(); }
/* ============== ClientBeginServerFrame This will be called once for each server frame, before running any other entities in the world. ============== */ void ClientBeginServerFrame (edict_t *ent) { gclient_t *client; int buttonMask; if (level.intermissiontime) return; client = ent->client; if (deathmatch->value && client->pers.spectator != client->resp.spectator && (level.time - client->respawn_time) >= 5) { spectator_respawn(ent); return; } // run weapon animations if it hasn't been done by a ucmd_t if (!client->weapon_thunk && !client->resp.spectator) Think_Weapon (ent); else client->weapon_thunk = false; if (ent->deadflag) { // wait for any button just going down if ( level.time > client->respawn_time) { // in deathmatch, only wait for attack button if (deathmatch->value) buttonMask = BUTTON_ATTACK; else buttonMask = -1; if ( ( client->latched_buttons & buttonMask ) || (deathmatch->value && ((int)dmflags->value & DF_FORCE_RESPAWN) ) ) { respawn(ent); client->latched_buttons = 0; } } return; } // add player trail so monsters can follow if (!deathmatch->value) if (!visible (ent, PlayerTrail_LastSpot() ) ) PlayerTrail_Add (ent->s.old_origin); client->latched_buttons = 0; }
void Character::disconnected() { mConnected = false; // Make the dead characters respawn, even in case of disconnection. if (getAction() == DEAD) respawn(); else GameState::remove(this); signal_disconnected.emit(this); }
void CharacterComponent::disconnected(Entity &entity) { mConnected = false; // Make the dead characters respawn, even in case of disconnection. if (entity.getComponent<BeingComponent>()->getAction() == DEAD) respawn(entity); else GameState::remove(&entity); signal_disconnected.emit(entity); }
/* ================= Cmd_Kill_f ================= */ void Cmd_Kill_f (edict_t *ent) { if((level.time - ent->client->respawn_time) < 5) return; ent->flags &= ~FL_GODMODE; ent->health = 0; meansOfDeath = MOD_SUICIDE; player_die (ent, ent, ent, 100000, vec3_origin); // don't even bother waiting for death frames ent->deadflag = DEAD_DEAD; respawn (ent); }
void boss_tank_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) { //gi.dprintf("boss_tank_die()\n"); respawn(self->activator); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_NO; // we're quite dead, dont call the death function again self->think = BecomeExplosion1; self->nextthink = level.time + FRAMETIME; SpawnRune(self, attacker, false); SpawnRune(self, attacker, false); }
/* ============== ClientBeginServerFrame This will be called once for each server frame, before running any other entities in the world. ============== */ void ClientBeginServerFrame (edict_t *ent) { gclient_t *client; int buttonMask; if (level.intermissiontime) return; client = ent->client; // run weapon animations if it hasn't been done by a ucmd_t if (!client->weapon_thunk) Think_Weapon (ent); else client->weapon_thunk = false; // make sure the fov and weapon models are gone if we're in camera mode if (client->zCameraTrack) { client->ps.fov = 90; client->ps.gunindex = 0; } if (ent->deadflag) { // wait for any button just going down if ( level.time > client->respawn_time) { // in deathmatch, only wait for attack button if (deathmatch->value) buttonMask = BUTTON_ATTACK; else buttonMask = -1; if ( ( client->latched_buttons & buttonMask ) || (deathmatch->value && ((int)dmflags->value & DF_FORCE_RESPAWN) ) ) { respawn(ent); client->latched_buttons = 0; } } return; } // add player trail so monsters can follow if (!deathmatch->value) if (!visible (ent, PlayerTrail_LastSpot() ) ) PlayerTrail_Add (ent->s.old_origin); client->latched_buttons = 0; }
void Spawn::idle(int t) { SpawnedMap::iterator it; for(it = spawnedmap.begin(); it != spawnedmap.end();) { if (it->second->isRemoved == true /*it->second->health <= 0*/) { if(it->first != 0) { spawnmap[it->first].lastspawn = OTSYS_TIME(); } it->second->releaseThing(); //delete it->second; spawnedmap.erase(it++); } else if(!isInSpawnRange(it->second->pos) && it->first != 0) { spawnedmap.insert(spawned_pair(0, it->second)); spawnedmap.erase(it++); } else ++it; } for(SpawnMap::iterator sit = spawnmap.begin(); sit != spawnmap.end(); ++sit) { if(spawnedmap.count(sit->first) == 0) { if((OTSYS_TIME() - sit->second.lastspawn) >= sit->second.spawntime) { SpectatorVec list; SpectatorVec::iterator it; game->getSpectators(Range(sit->second.pos, true), list); bool playerFound = false; for(it = list.begin(); it != list.end(); ++it) { Player *player = dynamic_cast<Player*>(*it); if(player && player->access < g_config.ACCESS_PROTECT) { playerFound = true; break; } } if(playerFound) { sit->second.lastspawn = OTSYS_TIME(); continue; } respawn(sit->first, sit->second.pos, sit->second.name, sit->second.dir); } } } }
/* ============== JoinedTeam ============== A player just joined a team, so do things. */ void JoinedTeam (edict_t *ent, qboolean reconnected, qboolean notify) { PMenu_Close (ent); if (notify) { if (g_gamemode->value != GAMEMODE_1V1) gi.bprintf (PRINT_HIGH, "%s %sjoined team '%s'\n", ent->client->pers.netname, reconnected ? "re" : "", teaminfo[ent->client->pers.team].name); else gi.bprintf (PRINT_HIGH, "%s %sjoined the game.\n", ent->client->pers.netname, reconnected ? "re" : ""); } ent->client->resp.ready = false; //joining a team with no captain by default assigns. //FIXME: should this still assign even if the team has existing players? if (!teaminfo[ent->client->pers.team].captain) TDM_SetCaptain (ent->client->pers.team, ent); //nasty hack for setting team names for 1v1 mode TDM_UpdateTeamNames (); //if we were invited mid-game, reallocate and insert into teamplayers // wision: do not add if a player reconnected and used his joincode // skuller: force add if player was picked/invited to the different team if (tdm_match_status != MM_WARMUP && !reconnected && (!ent->client->resp.teamplayerinfo || ent->client->resp.teamplayerinfo->team != ent->client->pers.team)) TDM_AddPlayerToMatchinfo (ent); //wision: set skin for new player gi.configstring (CS_PLAYERSKINS + (ent - g_edicts) - 1, va("%s\\%s", ent->client->pers.netname, teaminfo[ent->client->pers.team].skin)); //set everyone elses teamskin for this player based on what team he is on TDM_SetAllTeamSkins (ent); //set this players teamskins based on his team TDM_SetTeamSkins (ent, NULL); if (g_gamemode->value != GAMEMODE_1V1) gi.configstring (CS_TDM_SPECTATOR_STRINGS + (ent - g_edicts) - 1, va ("%s (%s)", ent->client->pers.netname, teaminfo[ent->client->pers.team].name)); else gi.configstring (CS_TDM_SPECTATOR_STRINGS + (ent - g_edicts) - 1, ent->client->pers.netname); TDM_TeamsChanged (); respawn (ent); // switch from spec to player statusbar, if weapon hud is enabled, that'll happen in respawn() if (!UF(ent, WEAPON_HUD)) { TDM_UpdateHud(ent, true); } }
void TBI_SpawnPlayers() { int CurrentRedSpawn, CurrentBlueSpawn; int i_maxclients = maxclients->value; edict_t *cl_ent; CurrentRedSpawn = CurrentBlueSpawn = 0; OrganizeTeams(true); // Assign everyone a spawn for (cl_ent = g_edicts + 1; cl_ent != g_edicts + i_maxclients + 1; cl_ent++) { if (cl_ent->client && cl_ent->inuse && !G_IsSpectator(cl_ent)) // we never know { if (cl_ent->teamnum == RED_TEAM) // Red team { if (tbi_game.EntRedSpawns[CurrentRedSpawn] != NULL) // we got a valid spawn point { cl_ent->spawn = tbi_game.EntRedSpawns[CurrentRedSpawn]; CurrentRedSpawn++; if (CurrentRedSpawn == tbi_game.TotalRedSpawns) // we're out of spawns then huh CurrentRedSpawn = 0; } }else // Blue team { if (tbi_game.EntBlueSpawns[CurrentBlueSpawn] != NULL) { cl_ent->spawn = tbi_game.EntBlueSpawns[CurrentBlueSpawn]; CurrentBlueSpawn++; if (CurrentBlueSpawn == tbi_game.TotalBlueSpawns) CurrentBlueSpawn = 0; } } } } for (cl_ent = g_edicts + 1; cl_ent != g_edicts + i_maxclients + 1; cl_ent++) { vec3_t start; // Alrighty, everyone's got spawns. if (cl_ent->client && cl_ent->inuse && !G_IsSpectator(cl_ent)) { respawn(cl_ent); } } G_ResetPlayerState(NULL); }
void Pony::kill() { health = 0; dead = true; Scene* scene = findScene(sceneName); for (Player* player : scene->players) { if (player->pony.netviewId != netviewId) sendNetviewRemove(player, netviewId, NetviewRemoveReasonKill); } respawn(); }
void nibind_svc_run(void) { fd_set readfds; for (;;) { readfds = svc_fdset; switch (select(svc_maxfd+1, &readfds, NULL, NULL, NULL)) { case -1: if (errno != EINTR) { system_log(LOG_ALERT, "unexpected errno: %m, aborting"); } break; case 0: break; default: svc_getreqset(&readfds); break; } if (waitreg == 0) { waitreg = -1; if (debug == 1) { system_log(LOG_DEBUG, "all servers registered"); } else { system_log(LOG_DEBUG, "all servers registered - signalling parent"); killparent(); } } if (restart == 1) { svc_unregister(NIBIND_PROG, NIBIND_VERS); pmap_unset(NIBIND_PROG, NIBIND_VERS); respawn(); } } }
Mouse::Mouse(sf::RenderWindow& window) { //seed the random engine auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count(); randomEngine.seed(seed); //we want randoms from 0 - screen size auto size = window.getSize(); xDistribution = std::uniform_int_distribution<int>(0, size.x); yDistribution = std::uniform_int_distribution<int>(0, size.y); //hackity hack mouseBody.setRadius(10); respawn(); }
/*********************************************************************** * Character * constructor ***********************************************************************/ fired::Character::Character(fired::Camera *_cam, sf::Vector2f _startpos, fired::World *_world, fired::BaseCreature *_base, const char *filename) { world = _world; cam = _cam; base = _base; memcpy(&baseStats, &(base->stats), sizeof(fired::CharacterStats)); inventory = new fired::Inventory(this); helm = NULL; arms = NULL; legs = NULL; body = NULL; shoe = NULL; fist = NULL; weapon = NULL; shotSound = NULL; switch (_base->model->type) { case mtHumanoid: { model = new fired::ModelHumanoid(this, (fired::BaseModelHumanoid*)_base->model, (fired::ModelHumanoidColors*)_base->colors, base->modelScale, world); break; } case mtAnimal: { model = new fired::ModelAnimal(this, (fired::BaseModelAnimal*)_base->model, (fired::ModelAnimalColors*)_base->colors, base->modelScale, world); break; } case mtSpider: { model = new fired::ModelSpider(this, (fired::BaseModelSpider*)_base->model, (fired::ModelSpiderColors*)_base->colors, base->modelScale, world); break; } } level = 1; XP = 0; fraction = _base->fraction; if (filename) loadChar(this, filename); updateStats(); respawn(_startpos); lastXP = levelXP(level - 1); needXP = levelXP(level); }
void Racer::applyForces(float seconds) { hkVector4 aVel, vel = body->getLinearVelocity(); float dot = vel.dot3(vel); aVel = body->getAngularVelocity(); float aDot = aVel.dot3(aVel); // Only want to be automatically braking if the player // isn't trying to move or already moving if (((dot > 0.0f) && (dot < 6.0f) && (aDot != 0.0f)) && (currentAcceleration == 0.0f)) { brake(seconds); } else { applyFriction(seconds); } applyTireRaycast(); applySprings(seconds); applyDrag(seconds); if (laserTime > 0.0f) { laserTime -= seconds; } if (respawnTimer > 0.0f) { respawnTimer -= seconds; SmokeParticle* smoke = new SmokeParticle(); hkVector4 pos = body->getPosition(); smoke->setPosition(&pos); SmokeSystem::system->addSmoke(ROCKET_SMOKE, smoke); smoke = NULL; } else if (!respawned && (respawnTimer <= 0.0f)) { respawnTimer = 0.0f; respawned = true; respawn(); } }
/** \brief Set up application modules. * * Loads configuration file and distributes its options to all application modules. * * \return Enum indicating the setup state. */ uint8_t Initializer::setup() { // Create configuration file object. this->conf = shared_ptr<Config>(new Config(AMBER_OBU_CONF_FILE)); // Load configuration from file. uint8_t status = conf->load(); // One or more errors occurred. // Print them and return setup status indicator. if (status) { vector<string> errors = conf->getErrors(); for (auto err : errors) cerr << err << endl; return INIT_ERR_LOAD; } // Set up io module. status = setUpIO(conf); if (status) return status; // Set up image processing module. status = setUpImgProc(conf); if (status) return status; // Set up event module. status = setUpEvtProc(conf); if (status) return status; // Create Messages for spawning network threads. // These messages are polled from message hub as soon as the main thread of this instance is running. shared_ptr<M2M_Respawn> respawn(new M2M_Respawn); shared_ptr<ValInt> respID(new ValInt); respID->setValue(NW_REALTIME); respawn->setValue(ARG_RESPAWN_CHILD, respID); // Push message to hub. MsgHub::getInstance()->appendMsg(respawn); return status; }
/* ================== BeginIntermission ================== */ void BeginIntermission( void ) { int i; gentity_t *client; if ( level.intermissiontime ) { return; // already active } // if in tournement mode, change the wins / losses if ( g_gametype.integer == GT_TOURNAMENT ) { AdjustTournamentScores(); } level.intermissiontime = level.time; FindIntermissionPoint(); #ifdef MISSIONPACK if (g_singlePlayer.integer) { trap_Cvar_Set("ui_singlePlayerActive", "0"); UpdateTournamentInfo(); } #else // if single player game if ( g_gametype.integer == GT_SINGLE_PLAYER ) { UpdateTournamentInfo(); SpawnModelsOnVictoryPads(); } #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 SendScoreboardMessageToAllClients(); }
/* ============== ToggleChaseCam ============== Player hit Spectator menu option or used chase command. */ void ToggleChaseCam (edict_t *ent) { if (ent->client->pers.team) { TDM_LeftTeam (ent, true); TDM_TeamsChanged (); if (tdm_match_status == MM_TIMEOUT && teaminfo[TEAM_A].players == 0 && teaminfo[TEAM_B].players == 0) TDM_ResumeGame (); respawn (ent); } if (ent->client->chase_target) DisableChaseCam (ent); else GetChaseTarget(ent); PMenu_Close (ent); }
// TODO: make an abstract method which creates an instant of the mouse in the constructor and after that // Constructor playerSnake::playerSnake() { // Load initial images of playerSnake and sets position of head and tail mHead = load_image("../imgs/playersnake/head.bmp"); mBody = load_image("../imgs/playersnake/body.bmp"); mTail = load_image("../imgs/playersnake/tail.bmp"); SDL_Rect first; SDL_Rect second; SDL_Rect third; SDL_Rect fourth; // all sides first.x = 0; first.y = 0; first.h = mHead->h/2; first.w = mHead->w/2; second.x = mHead->h/2; second.y = 0; second.h = mHead->h/2; second.w = mHead->w; third = second; third.x = 0; third.y = mHead->w/2; third.h = mHead->h/2; third.w = mHead->w/2; fourth = second; fourth.x = mHead->h/2; fourth.y = mHead->w/2; fourth.h = mHead->h/2; fourth.w = mHead->w/2; // Set the clips mclip_locations.insert(mclip_locations.begin() , first); mclip_locations.insert(mclip_locations.begin() + 1, second); mclip_locations.insert(mclip_locations.begin() + 2, third); mclip_locations.insert(mclip_locations.begin() + 3, fourth); respawn(); }
void gameLogic() { if (gameState == GAME_LOADING) { systemSound->endLevel(); cout << "loading" << endl; room = Room(); room.setLevel(gameLevel); ruskoBounds->setRoom(&room); collisions = new RuskoCollisions(&room); plights.clear(); setTorchLight(xpos, ypos, zpos, ruskoTorchRadius); gameState = GAME_LSCREEN; } else if (gameState == GAME_RUNNING) { if(dead) { livesLeft--; respawn(); } collisions->checkForCollisions(); renderList.push_back((Renderable *)&room); if (collisions->torchesAllLit) { gameLevel++; gameState = GAME_LOADING; } } else if (gameState == GAME_LSCREEN) { if (firstLoad){ loadscreen->renderWelcomeScreen(); } else if (livesLeft == 0) { loadscreen->renderGameOver(); } else { resetGameVariables(); loadscreen->render(gameLevel, room.getNumTorches()); } } }
void Character::disconnected() { mConnected = false; // Make the dead characters respawn, even in case of disconnection. if (getAction() == DEAD) respawn(); else GameState::remove(this); for (Listeners::iterator i = mListeners.begin(), i_end = mListeners.end(); i != i_end;) { const EventListener &l = **i; ++i; // In case the listener removes itself from the list on the fly. if (l.dispatch->disconnected) l.dispatch->disconnected(&l, this); } }
void INV_SpawnPlayers (void) { edict_t *e, *cl_ent; vec3_t start; trace_t tr; // we shouldn't be here if this isn't invasion mode if (!INVASION_OTHERSPAWNS_REMOVED) return; // if there are no players waiting to be spawned, then we're done if (!(cl_ent = INV_GetSpawnPlayer())) return; for (e=g_edicts ; e < &g_edicts[globals.num_edicts]; e++) { // find an available spawn point if (e && e->inuse && (e->mtype == INVASION_PLAYERSPAWN) && (level.time > e->wait)) { // get player starting position VectorCopy(e->s.origin, start); start[2] = e->absmax[2] + 1 + abs(cl_ent->mins[2]); tr = gi.trace(start, cl_ent->mins, cl_ent->maxs, start, NULL, MASK_SHOT); // don't spawn if another player is standing in the way if ((tr.fraction < 1) && tr.ent && tr.ent->inuse && tr.ent->client) { e->wait = level.time + 1.0; continue; } e->wait = level.time + 2.0; // delay before other players can use this spawn cl_ent->spawn = e; // player may use this spawn respawn(cl_ent); // get another waiting player if (!(cl_ent = INV_GetSpawnPlayer())) return; } } }
void PowerUp::updateSelf( const double & delta ) { mRotationAngle += delta * 100.0f; setRotation( QQuaternion::fromAxisAndAngle( 0,1,0, mRotationAngle ) ); QSharedPointer<Player> player = mLandscape->world()->player(); float dist = ( player->worldPosition() - worldPosition() ).length(); if( mRespawning ) { mRespawnCoolDown -= delta; if( mRespawnCoolDown < 0.0f ) { mRespawnCoolDown = 0.0f; mRespawning = false; } } else { if( dist <= 2.0f ) { switch( mPowerType ) { case HEALTH: player->setLife( qMin( player->life() + 25, 100 ) ); break; case ARMOR: player->setArmor( qMin( player->armor() + 40, 100 ) ); break; case WEAPON_LASER: player->giveWeapon( QSharedPointer<AWeapon>( new Laser( world() ) ) ); break; } respawn(); } } }
void duck::step() { pos[0] += speed; if( pos[0] >= edge || pos[0] <= edge - 14 ) { speed *= -1; flip *= -1; } if( hit ) { if( lied ) { respawnTime -= 1; if( respawnTime <= 0 ) respawn(); } angle -= rate; if( angle <= -90 && !lied ) { angle = -90; rate = 0; respawnTime = 20; lied = true; } if( angle >= 0 ) { angle = 0; rate = 0; hit = false; } } }
/* ============== ClientThink This will be called once for each client frame, which will usually be a couple times for each server frame on fast clients. If "g_synchronousClients 1" is set, this will be called exactly once for each server frame, which makes for smooth demo recording. ============== */ void ClientThink_real( gentity_t *ent ) { gclient_t *client; pmove_t pm; // vec3_t oldOrigin; int oldEventSequence; int msec; usercmd_t *ucmd; int monsterslick = 0; // JPW NERVE int i; vec3_t muzzlebounce; gitem_t *item; gentity_t *ent2; vec3_t velocity, org, offset; vec3_t angles,mins,maxs; int weapon; trace_t tr; // jpw // Rafael wolfkick //int validkick; //static int wolfkicktimer = 0; client = ent->client; // don't think if the client is not yet connected (and thus not yet spawned in) if ( client->pers.connected != CON_CONNECTED ) { return; } if ( client->cameraPortal ) { G_SetOrigin( client->cameraPortal, client->ps.origin ); trap_LinkEntity( client->cameraPortal ); VectorCopy( client->cameraOrigin, client->cameraPortal->s.origin2 ); } // mark the time, so the connection sprite can be removed ucmd = &ent->client->pers.cmd; ent->client->ps.identifyClient = ucmd->identClient; // NERVE - SMF // JPW NERVE -- update counter for capture & hold display if ( g_gametype.integer == GT_WOLF_CPH ) { client->ps.stats[STAT_CAPTUREHOLD_RED] = level.capturetimes[TEAM_RED]; client->ps.stats[STAT_CAPTUREHOLD_BLUE] = level.capturetimes[TEAM_BLUE]; } // jpw // sanity check the command time to prevent speedup cheating if ( ucmd->serverTime > level.time + 200 ) { ucmd->serverTime = level.time + 200; // G_Printf("serverTime <<<<<\n" ); } if ( ucmd->serverTime < level.time - 1000 ) { ucmd->serverTime = level.time - 1000; // G_Printf("serverTime >>>>>\n" ); } msec = ucmd->serverTime - client->ps.commandTime; // following others may result in bad times, but we still want // to check for follow toggles if ( msec < 1 && client->sess.spectatorState != SPECTATOR_FOLLOW ) { return; /* // Ridah, fixes savegame timing issue if (msec < -100) { client->ps.commandTime = ucmd->serverTime - 100; msec = 100; } else { return; } */ // done. } if ( msec > 200 ) { msec = 200; } if ( pmove_msec.integer < 8 ) { trap_Cvar_Set( "pmove_msec", "8" ); } else if ( pmove_msec.integer > 33 ) { trap_Cvar_Set( "pmove_msec", "33" ); } if ( pmove_fixed.integer || client->pers.pmoveFixed ) { ucmd->serverTime = ( ( ucmd->serverTime + pmove_msec.integer - 1 ) / pmove_msec.integer ) * pmove_msec.integer; //if (ucmd->serverTime - client->ps.commandTime <= 0) // return; } // // check for exiting intermission // if ( level.intermissiontime ) { ClientIntermissionThink( client ); return; } // spectators don't do much // DHM - Nerve :: In limbo use SpectatorThink if ( client->sess.sessionTeam == TEAM_SPECTATOR || client->ps.pm_flags & PMF_LIMBO ) { if ( client->sess.spectatorState == SPECTATOR_SCOREBOARD ) { return; } SpectatorThink( ent, ucmd ); return; } // JPW NERVE do some time-based muzzle flip -- this never gets touched in single player (see g_weapon.c) // #define RIFLE_SHAKE_TIME 150 // JPW NERVE this one goes with the commented out old damped "realistic" behavior below #define RIFLE_SHAKE_TIME 300 // per Id request, longer recoil time if ( client->sniperRifleFiredTime ) { if ( level.time - client->sniperRifleFiredTime > RIFLE_SHAKE_TIME ) { client->sniperRifleFiredTime = 0; } else { VectorCopy( client->ps.viewangles,muzzlebounce ); // JPW per Id request, longer recoil time muzzlebounce[PITCH] -= 2 * cos( 2.5 * ( level.time - client->sniperRifleFiredTime ) / RIFLE_SHAKE_TIME ); muzzlebounce[YAW] += 0.5*client->sniperRifleMuzzleYaw*cos( 1.0 - ( level.time - client->sniperRifleFiredTime ) * 3 / RIFLE_SHAKE_TIME ); muzzlebounce[PITCH] -= 0.25 * random() * ( 1.0f - ( level.time - client->sniperRifleFiredTime ) / RIFLE_SHAKE_TIME ); muzzlebounce[YAW] += 0.5 * crandom() * ( 1.0f - ( level.time - client->sniperRifleFiredTime ) / RIFLE_SHAKE_TIME ); SetClientViewAngle( ent,muzzlebounce ); } } if ( client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC ) { if ( level.time > client->ps.powerups[PW_REGEN] + 5000 ) { client->ps.powerups[PW_REGEN] = level.time; } } // also update weapon recharge time // JPW drop button drops secondary weapon so new one can be picked up // TTimo explicit braces to avoid ambiguous 'else' if ( g_gametype.integer != GT_SINGLE_PLAYER ) { if ( ucmd->wbuttons & WBUTTON_DROP ) { if ( !client->dropWeaponTime ) { client->dropWeaponTime = 1; // just latch it for now if ( ( client->ps.stats[STAT_PLAYER_CLASS] == PC_SOLDIER ) || ( client->ps.stats[STAT_PLAYER_CLASS] == PC_LT ) ) { for ( i = 0; i < MAX_WEAPS_IN_BANK_MP; i++ ) { weapon = weapBanksMultiPlayer[3][i]; if ( COM_BitCheck( client->ps.weapons,weapon ) ) { item = BG_FindItemForWeapon( weapon ); VectorCopy( client->ps.viewangles, angles ); // clamp pitch if ( angles[PITCH] < -30 ) { angles[PITCH] = -30; } else if ( angles[PITCH] > 30 ) { angles[PITCH] = 30; } AngleVectors( angles, velocity, NULL, NULL ); VectorScale( velocity, 64, offset ); offset[2] += client->ps.viewheight / 2; VectorScale( velocity, 75, velocity ); velocity[2] += 50 + random() * 35; VectorAdd( client->ps.origin,offset,org ); VectorSet( mins, -ITEM_RADIUS, -ITEM_RADIUS, 0 ); VectorSet( maxs, ITEM_RADIUS, ITEM_RADIUS, 2 * ITEM_RADIUS ); trap_Trace( &tr, client->ps.origin, mins, maxs, org, ent->s.number, MASK_SOLID ); VectorCopy( tr.endpos, org ); ent2 = LaunchItem( item, org, velocity, client->ps.clientNum ); COM_BitClear( client->ps.weapons,weapon ); if ( weapon == WP_MAUSER ) { COM_BitClear( client->ps.weapons,WP_SNIPERRIFLE ); } // Clear out empty weapon, change to next best weapon G_AddEvent( ent, EV_NOAMMO, 0 ); i = MAX_WEAPS_IN_BANK_MP; // show_bug.cgi?id=568 if ( client->ps.weapon == weapon ) { client->ps.weapon = 0; } ent2->count = client->ps.ammoclip[BG_FindClipForWeapon( weapon )]; ent2->item->quantity = client->ps.ammoclip[BG_FindClipForWeapon( weapon )]; client->ps.ammoclip[BG_FindClipForWeapon( weapon )] = 0; } } } } } else { client->dropWeaponTime = 0; } } // jpw // check for inactivity timer, but never drop the local client of a non-dedicated server if ( !ClientInactivityTimer( client ) ) { return; } if ( reloading || client->cameraPortal ) { ucmd->buttons = 0; ucmd->forwardmove = 0; ucmd->rightmove = 0; ucmd->upmove = 0; ucmd->wbuttons = 0; ucmd->wolfkick = 0; if ( client->cameraPortal ) { client->ps.pm_type = PM_FREEZE; } } else if ( client->noclip ) { client->ps.pm_type = PM_NOCLIP; } else if ( client->ps.stats[STAT_HEALTH] <= 0 ) { client->ps.pm_type = PM_DEAD; } else { client->ps.pm_type = PM_NORMAL; } // set parachute anim condition flag BG_UpdateConditionValue( ent->s.number, ANIM_COND_PARACHUTE, ( ent->flags & FL_PARACHUTE ) != 0, qfalse ); // all playing clients are assumed to be in combat mode if ( !client->ps.aiChar ) { client->ps.aiState = AISTATE_COMBAT; } client->ps.gravity = g_gravity.value; // set speed client->ps.speed = g_speed.value; if ( client->ps.powerups[PW_HASTE] ) { client->ps.speed *= 1.3; } // set up for pmove oldEventSequence = client->ps.eventSequence; client->currentAimSpreadScale = (float)client->ps.aimSpreadScale / 255.0; memset( &pm, 0, sizeof( pm ) ); pm.ps = &client->ps; pm.pmext = &client->pmext; pm.cmd = *ucmd; pm.oldcmd = client->pers.oldcmd; if ( pm.ps->pm_type == PM_DEAD ) { pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; // DHM-Nerve added:: EF_DEAD is checked for in Pmove functions, but wasn't being set // until after Pmove pm.ps->eFlags |= EF_DEAD; // dhm-Nerve end } else { pm.tracemask = MASK_PLAYERSOLID; } // MrE: always use capsule for AI and player //pm.trace = trap_TraceCapsule;//trap_Trace; //DHM - Nerve :: We've gone back to using normal bbox traces pm.trace = trap_Trace; pm.pointcontents = trap_PointContents; pm.debugLevel = g_debugMove.integer; pm.noFootsteps = ( g_dmflags.integer & DF_NO_FOOTSTEPS ) > 0; pm.pmove_fixed = pmove_fixed.integer | client->pers.pmoveFixed; pm.pmove_msec = pmove_msec.integer; pm.noWeapClips = ( g_dmflags.integer & DF_NO_WEAPRELOAD ) > 0; if ( ent->aiCharacter && AICast_NoReload( ent->s.number ) ) { pm.noWeapClips = qtrue; // ensure AI characters don't use clips if they're not supposed to. } // Ridah // if (ent->r.svFlags & SVF_NOFOOTSTEPS) // pm.noFootsteps = qtrue; VectorCopy( client->ps.origin, client->oldOrigin ); // NERVE - SMF pm.gametype = g_gametype.integer; pm.ltChargeTime = g_LTChargeTime.integer; pm.soldierChargeTime = g_soldierChargeTime.integer; pm.engineerChargeTime = g_engineerChargeTime.integer; pm.medicChargeTime = g_medicChargeTime.integer; // -NERVE - SMF monsterslick = Pmove( &pm ); if ( monsterslick && !( ent->flags & FL_NO_MONSTERSLICK ) ) { //vec3_t dir; //vec3_t kvel; //vec3_t forward; // TTimo gcc: might be used unitialized in this function float angle = 0.0f; qboolean bogus = qfalse; // NE if ( ( monsterslick & SURF_MONSLICK_N ) && ( monsterslick & SURF_MONSLICK_E ) ) { angle = 45; } // NW else if ( ( monsterslick & SURF_MONSLICK_N ) && ( monsterslick & SURF_MONSLICK_W ) ) { angle = 135; } // N else if ( monsterslick & SURF_MONSLICK_N ) { angle = 90; } // SE else if ( ( monsterslick & SURF_MONSLICK_S ) && ( monsterslick & SURF_MONSLICK_E ) ) { angle = 315; } // SW else if ( ( monsterslick & SURF_MONSLICK_S ) && ( monsterslick & SURF_MONSLICK_W ) ) { angle = 225; } // S else if ( monsterslick & SURF_MONSLICK_S ) { angle = 270; } // E else if ( monsterslick & SURF_MONSLICK_E ) { angle = 0; } // W else if ( monsterslick & SURF_MONSLICK_W ) { angle = 180; } else { bogus = qtrue; } } // server cursor hints if ( ent->lastHintCheckTime < level.time ) { G_CheckForCursorHints( ent ); ent->lastHintCheckTime = level.time + FRAMETIME; } // DHM - Nerve :: Set animMovetype to 1 if ducking if ( ent->client->ps.pm_flags & PMF_DUCKED ) { ent->s.animMovetype = 1; } else { ent->s.animMovetype = 0; } // save results of pmove if ( ent->client->ps.eventSequence != oldEventSequence ) { ent->eventTime = level.time; ent->r.eventTime = level.time; } // Ridah, fixes jittery zombie movement if ( g_smoothClients.integer ) { BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue ); } else { BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue ); } if ( !( ent->client->ps.eFlags & EF_FIRING ) ) { client->fireHeld = qfalse; // for grapple } // // // use the precise origin for linking // VectorCopy( ent->client->ps.origin, ent->r.currentOrigin ); // // // use the snapped origin for linking so it matches client predicted versions VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin ); VectorCopy( pm.mins, ent->r.mins ); VectorCopy( pm.maxs, ent->r.maxs ); ent->waterlevel = pm.waterlevel; ent->watertype = pm.watertype; // execute client events ClientEvents( ent, oldEventSequence ); // link entity now, after any personal teleporters have been used trap_LinkEntity( ent ); if ( !ent->client->noclip ) { G_TouchTriggers( ent ); } // NOTE: now copy the exact origin over otherwise clients can be snapped into solid VectorCopy( ent->client->ps.origin, ent->r.currentOrigin ); // store the client's current position for antilag traces G_StoreClientPosition( ent ); // touch other objects ClientImpacts( ent, &pm ); // save results of triggers and client events if ( ent->client->ps.eventSequence != oldEventSequence ) { ent->eventTime = level.time; } // swap and latch button actions client->oldbuttons = client->buttons; client->buttons = ucmd->buttons; client->latched_buttons = client->buttons & ~client->oldbuttons; // client->latched_buttons |= client->buttons & ~client->oldbuttons; // FIXME:? (SA) MP method (causes problems for us. activate 'sticks') //----(SA) added client->oldwbuttons = client->wbuttons; client->wbuttons = ucmd->wbuttons; client->latched_wbuttons = client->wbuttons & ~client->oldwbuttons; // client->latched_wbuttons |= client->wbuttons & ~client->oldwbuttons; // FIXME:? (SA) MP method // Rafael - Activate // Ridah, made it a latched event (occurs on keydown only) if ( client->latched_buttons & BUTTON_ACTIVATE ) { Cmd_Activate_f( ent ); } if ( ent->flags & FL_NOFATIGUE ) { ent->client->ps.sprintTime = 20000; } // check for respawning if ( client->ps.stats[STAT_HEALTH] <= 0 ) { // DHM - Nerve if ( g_gametype.integer >= GT_WOLF ) { WolfFindMedic( ent ); } // dhm - end // wait for the attack button to be pressed if ( level.time > client->respawnTime ) { // forcerespawn is to prevent users from waiting out powerups if ( ( g_gametype.integer != GT_SINGLE_PLAYER ) && ( g_forcerespawn.integer > 0 ) && ( ( level.time - client->respawnTime ) > g_forcerespawn.integer * 1000 ) && ( !( ent->client->ps.pm_flags & PMF_LIMBO ) ) ) { // JPW NERVE // JPW NERVE if ( g_gametype.integer >= GT_WOLF ) { limbo( ent, qtrue ); } else { respawn( ent ); } // jpw return; } // DHM - Nerve :: Single player game respawns immediately as before, // but in multiplayer, require button press before respawn if ( g_gametype.integer == GT_SINGLE_PLAYER ) { respawn( ent ); } // NERVE - SMF - we want to only respawn on jump button now else if ( ( ucmd->upmove > 0 ) && ( !( ent->client->ps.pm_flags & PMF_LIMBO ) ) ) { // JPW NERVE // JPW NERVE if ( g_gametype.integer >= GT_WOLF ) { limbo( ent, qtrue ); } else { respawn( ent ); } // jpw } // dhm - Nerve :: end // NERVE - SMF - we want to immediately go to limbo mode if gibbed else if ( client->ps.stats[STAT_HEALTH] <= GIB_HEALTH && !( ent->client->ps.pm_flags & PMF_LIMBO ) ) { if ( g_gametype.integer >= GT_WOLF ) { limbo( ent, qfalse ); } else { respawn( ent ); } } // -NERVE - SMF } return; } // perform once-a-second actions ClientTimerActions( ent, msec ); }
void CHL2MPRules::RestartGame() { // bounds check if ( mp_timelimit.GetInt() < 0 ) { mp_timelimit.SetValue( 0 ); } m_flGameStartTime = gpGlobals->curtime; if ( !IsFinite( m_flGameStartTime.Get() ) ) { Warning( "Trying to set a NaN game start time\n" ); m_flGameStartTime.GetForModify() = 0.0f; } CleanUpMap(); // now respawn all players for (int i = 1; i <= gpGlobals->maxClients; i++ ) { CHL2MP_Player *pPlayer = (CHL2MP_Player*) UTIL_PlayerByIndex( i ); if ( !pPlayer ) continue; if ( pPlayer->GetActiveWeapon() ) { pPlayer->GetActiveWeapon()->Holster(); } pPlayer->RemoveAllItems( true ); respawn( pPlayer, false ); pPlayer->Reset(); } // Respawn entities (glass, doors, etc..) CTeam *pRebels = GetGlobalTeam( TEAM_REBELS ); CTeam *pCombine = GetGlobalTeam( TEAM_COMBINE ); if ( pRebels ) { pRebels->SetScore( 0 ); } if ( pCombine ) { pCombine->SetScore( 0 ); } m_flIntermissionEndTime = 0; m_flRestartGameTime = 0.0; m_bCompleteReset = false; IGameEvent * event = gameeventmanager->CreateEvent( "round_start" ); if ( event ) { event->SetInt("fraglimit", 0 ); event->SetInt( "priority", 6 ); // HLTV event priority, not transmitted event->SetString("objective","DEATHMATCH"); gameeventmanager->FireEvent( event ); } }
/* ============== ClientThink This will be called once for each client frame, which will usually be a couple times for each server frame on fast clients. If "g_synchronousClients 1" is set, this will be called exactly once for each server frame, which makes for smooth demo recording. ============== */ void ClientThink_real(gentity_t * ent) { gclient_t *client; pmove_t pm; int oldEventSequence; int msec; usercmd_t *ucmd; int bJumping = 0; client = ent->client; // don't think if the client is not yet connected (and thus not yet spawned in) if (client->pers.connected != CON_CONNECTED) { return; } // mark the time, so the connection sprite can be removed ucmd = &ent->client->pers.cmd; // sanity check the command time to prevent speedup cheating if (ucmd->serverTime > level.time + 200) { ucmd->serverTime = level.time + 200; } if (ucmd->serverTime < level.time - 1000) { ucmd->serverTime = level.time - 1000; } client->lastUpdateFrame = level.framenum; msec = ucmd->serverTime - client->ps.commandTime; // following others may result in bad times, but we still want // to check for follow toggles if (msec < 1 && client->sess.spectatorState != SPECTATOR_FOLLOW) { return; } if (msec > 200) { msec = 200; } if (pmove_msec.integer < 8) { trap_Cvar_Set("pmove_msec", "8"); } else if (pmove_msec.integer > 33) { trap_Cvar_Set("pmove_msec", "33"); } if (pmove_fixed.integer || client->pers.pmoveFixed) { ucmd->serverTime = ((ucmd->serverTime + pmove_msec.integer - 1) / pmove_msec.integer) * pmove_msec.integer; } // // check for exiting intermission // if (level.intermissiontime) { ClientIntermissionThink(client); return; } // spectators don't do much if (client->sess.sessionTeam == TEAM_SPECTATOR) { if (client->sess.spectatorState == SPECTATOR_SCOREBOARD) { return; } SpectatorThink(ent, ucmd); return; } // check for inactivity timer, but never drop the local client of a non-dedicated server if (!ClientInactivityTimer(client)) { return; } // clear the rewards if time if (level.time > client->rewardTime) { client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP); } if (client->noclip) { client->ps.pm_type = PM_NOCLIP; } else if (client->ps.stats[STAT_HEALTH] <= 0) { client->ps.pm_type = PM_DEAD; } else { client->ps.pm_type = PM_NORMAL; } client->ps.gravity = g_gravity.value; // set speed client->ps.speed = g_speed.value; // set up for pmove oldEventSequence = client->ps.eventSequence; memset(&pm, 0, sizeof(pm)); if (ent->flags & FL_FORCE_GESTURE) { ent->flags &= ~FL_FORCE_GESTURE; ent->client->pers.cmd.buttons |= BUTTON_GESTURE; } //Elder: 3rb Code moved to bg_pmove.c (resides in PM_Weapon) pm.ps = &client->ps; pm.cmd = *ucmd; if (pm.ps->pm_type == PM_DEAD) { pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; } else if (ent->r.svFlags & SVF_BOT) { pm.tracemask = MASK_PLAYERSOLID | CONTENTS_BOTCLIP; } else { pm.tracemask = MASK_PLAYERSOLID; } // JBravo: fixing telefragging and shit during spawnig. (Thanks NiceAss! :) if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_TEAM) && ((ent->client->ps.stats[STAT_RQ3] & RQ3_PLAYERSOLID) != RQ3_PLAYERSOLID) && !level.lights_camera_action) { UnstickPlayer(ent); } if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_TEAM) && ((ent->client->ps.stats[STAT_RQ3] & RQ3_PLAYERSOLID) != RQ3_PLAYERSOLID)) { pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; } pm.trace = trap_Trace; pm.pointcontents = trap_PointContents; pm.debugLevel = g_debugMove.integer; pm.noFootsteps = (g_dmflags.integer & DF_NO_FOOTSTEPS) > 0; pm.pmove_fixed = pmove_fixed.integer | client->pers.pmoveFixed; pm.pmove_msec = pmove_msec.integer; VectorCopy(client->ps.origin, client->oldOrigin); // JBravo: setting lca in pm if appropriate if (g_RQ3_lca.integer == 1) pm.lca = qtrue; else pm.lca = qfalse; pm.predict = qtrue; Pmove(&pm); if ((pm.cmd.upmove > 10) && (pm.waterlevel == 0) && ent->s.groundEntityNum != ENTITYNUM_NONE && pm.ps->groundEntityNum == ENTITYNUM_NONE) bJumping = 1; // save results of pmove if (ent->client->ps.eventSequence != oldEventSequence) { ent->eventTime = level.time; } BG_PlayerStateToEntityState(&ent->client->ps, &ent->s, qtrue); SendPendingPredictableEvents(&ent->client->ps); if (!(ent->client->ps.eFlags & EF_FIRING)) { client->fireHeld = qfalse; // for grapple } // use the snapped origin for linking so it matches client predicted versions VectorCopy(ent->s.pos.trBase, ent->r.currentOrigin); VectorCopy(pm.mins, ent->r.mins); VectorCopy(pm.maxs, ent->r.maxs); ent->waterlevel = pm.waterlevel; ent->watertype = pm.watertype; // execute client events ClientEvents(ent, oldEventSequence); // link entity now, after any personal teleporters have been used // JBravo: this call reactivates gibbed players. if (!ent->client->gibbed) trap_LinkEntity(ent); if (!ent->client->noclip) { G_TouchTriggers(ent); } // NOTE: now copy the exact origin over otherwise clients can be snapped into solid VectorCopy(ent->client->ps.origin, ent->r.currentOrigin); //test for solid areas in the AAS file BotTestAAS(ent->r.currentOrigin); // touch other objects ClientImpacts(ent, &pm); //Elder: someone added if (bJumping) JumpKick(ent); // save results of triggers and client events if (ent->client->ps.eventSequence != oldEventSequence) { ent->eventTime = level.time; } // swap and latch button actions client->oldbuttons = client->buttons; client->buttons = ucmd->buttons; client->latched_buttons |= client->buttons & ~client->oldbuttons; // check for respawning // JBravo: Lets make dead players into spectators. if (client->ps.stats[STAT_HEALTH] <= 0) { // wait for the attack button to be pressed if (level.time > client->respawnTime) { // forcerespawn is to prevent users from waiting out powerups if (g_forcerespawn.integer > 0 && (level.time - client->respawnTime) > g_forcerespawn.integer * 1000 && g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) { respawn(ent); return; } if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) && level.time > client->respawnTime) { MakeSpectator(ent); } // pressing attack or use is the normal respawn method // JBravo: make'em spactate if (ucmd->buttons & (BUTTON_ATTACK | BUTTON_USE_HOLDABLE)) { if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { MakeSpectator(ent); } else { respawn(ent); } } } return; } // JBravo: Idle sounds if (g_RQ3_ppl_idletime.integer) { if (ucmd->forwardmove == 0 && ucmd->rightmove == 0) { if (client->idletime) { if (level.time >= client->idletime + (g_RQ3_ppl_idletime.integer * 1000)) { if (g_gametype.integer >= GT_TEAM && g_RQ3_idleaction.integer == 1 && (ent->client->sess.sessionTeam == TEAM_RED || ent->client->sess.sessionTeam == TEAM_BLUE)) { trap_SendServerCommand( -1, va("print \"Removing %s^7 from his team for excessive Idling\n\"", ent->client->pers.netname)); trap_SendServerCommand(ent - g_entities, "stuff team none\n"); } else if (g_gametype.integer >= GT_TEAM && g_RQ3_idleaction.integer == 2 && (ent->client->sess.sessionTeam == TEAM_RED || ent->client->sess.sessionTeam == TEAM_BLUE)) { trap_SendServerCommand( -1, va("print \"Kicking %s^7 for excessive Idling\n\"", ent->client->pers.netname)); trap_DropClient(ent - g_entities, "Dropped due to excessive Idling"); } else G_TempEntity(ent->r.currentOrigin, EV_INSANESOUND); client->idletime = 0; } } else { client->idletime = level.time; } } else { client->idletime = 0; } } // perform once-a-second actions ClientTimerActions(ent, msec); }
void BeginIntermission (edict_t *targ) { int i, n; edict_t *ent, *client; if (level.intermissiontime) return; // already activated //RAV WAVMOD if (wav_mod_ && use_song_file->value) { char *nextwav; char sound[64]; if (nextwav = wav_mod_next_map()) { gi.cvar_set("wav", nextwav); //set up the songtoplay cvar sprintf(sound, "misc/%s.wav", nextwav); gi.cvar_set("song", sound); } } //ZOID if (deathmatch->value && ctf->value) { CTFCalcScores(); } //ZOID game.autosaved = false; // respawn any dead clients for (i=0 ; i<maxclients->value ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; if (client->health <= 0) respawn(client, false); } level.intermissiontime = level.time; level.changemap = targ->map; if (strstr(level.changemap, "*")) { if (coop->value) { for (i=0 ; i<maxclients->value ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; // strip players of all keys between units for (n = 0; n < MAX_ITEMS; n++) { if (itemlist[n].flags & IT_KEY) client->client->pers.inventory[n] = 0; } } } } else { if (!deathmatch->value) { level.exitintermission = 1; // go immediately to the next level return; } } level.exitintermission = 0; // find an intermission spot ent = G_Find (NULL, FOFS(classname), "info_player_intermission"); if (!ent) { // the map creator forgot to put in an intermission point... ent = G_Find (NULL, FOFS(classname), "info_player_start"); if (!ent) ent = G_Find (NULL, FOFS(classname), "info_player_deathmatch"); } else { // chose one of four spots i = rand() & 3; while (i--) { ent = G_Find (ent, FOFS(classname), "info_player_intermission"); if (!ent) // wrap around the list ent = G_Find (ent, FOFS(classname), "info_player_intermission"); } } VectorCopy (ent->s.origin, level.intermission_origin); VectorCopy (ent->s.angles, level.intermission_angle); // move all clients to the intermission point for (i=0 ; i<maxclients->value ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; MoveClientToIntermission (client); } }
void BeginIntermission (edict_t *targ) { int i, n; edict_t *ent, *client; if (level.intermissiontime) return; // already activated game.autosaved = false; // respawn any dead clients for (i=0 ; i<maxclients->value ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; if (client->health <= 0) respawn(client); } level.intermissiontime = level.time; level.changemap = targ->map; if (strstr(level.changemap, "*")) { if (coop->value) { for (i=0 ; i<maxclients->value ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; // strip players of all keys between units for (n = 0; n < MAX_ITEMS; n++) { if (itemlist[n].flags & IT_KEY) client->client->pers.inventory[n] = 0; } } } } else { if (!deathmatch->value) { level.exitintermission = 1; // go immediately to the next level return; } } level.exitintermission = 0; // find an intermission spot ent = G_Find (NULL, FOFS(classname), "info_player_intermission"); if (!ent) { // the map creator forgot to put in an intermission point... ent = G_Find (NULL, FOFS(classname), "info_player_start"); if (!ent) ent = G_Find (NULL, FOFS(classname), "info_player_deathmatch"); } else { // chose one of four spots i = rand() & 3; while (i--) { ent = G_Find (ent, FOFS(classname), "info_player_intermission"); if (!ent) // wrap around the list ent = G_Find (ent, FOFS(classname), "info_player_intermission"); } } VectorCopy (ent->s.origin, level.intermission_origin); VectorCopy (ent->s.angles, level.intermission_angle); // move all clients to the intermission point for (i=0 ; i<maxclients->value ; i++) { client = g_edicts + 1 + i; if (!client->inuse) continue; MoveClientToIntermission (client); } }