This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).
リビジョン | b68d78dbbc820309e5a507baa197a79710b1612c (tree) |
---|---|
日時 | 2021-07-23 08:54:24 |
作者 | Adam Kaminski <kaminskiadam9@gmai...> |
コミッター | Adam Kaminski |
Changed some rules on how players are respawned if sv_samespotspawn is enabled. Particularly, players won't spawn where they died if it's in a damaging sector or crusher, or if there's not enough room to respawn in the first place.
@@ -804,6 +804,7 @@ | ||
804 | 804 | bool PLAYER_NameMatchesServer( const FString &Name ); |
805 | 805 | bool PLAYER_NameUsed( const FString &Name, const ULONG ulIgnorePlayer = MAXPLAYERS ); |
806 | 806 | FString PLAYER_GenerateUniqueName( void ); |
807 | +bool PLAYER_CanRespawnWhereDied( player_t *pPlayer ); | |
807 | 808 | |
808 | 809 | void P_CheckPlayerSprite(AActor *mo, int &spritenum, fixed_t &scalex, fixed_t &scaley); |
809 | 810 |
@@ -81,6 +81,7 @@ | ||
81 | 81 | #include "r_data/colormaps.h" |
82 | 82 | #include "v_video.h" |
83 | 83 | #include "st_hud.h" |
84 | +#include "p_terrain.h" | |
84 | 85 | |
85 | 86 | // [BC] Ugh. |
86 | 87 | void SERVERCONSOLE_UpdatePlayerInfo( LONG lPlayer, ULONG ulUpdateFlags ); |
@@ -3325,6 +3326,67 @@ | ||
3325 | 3326 | return name; |
3326 | 3327 | } |
3327 | 3328 | |
3329 | +//***************************************************************************** | |
3330 | +// | |
3331 | +bool PLAYER_CanRespawnWhereDied( player_t *pPlayer ) | |
3332 | +{ | |
3333 | + // [AK] The player shouldn't respawn in any sectors that have damaging floors. | |
3334 | + if (( pPlayer->mo->Sector->damage > 0 ) || ( Terrains[P_GetThingFloorType( pPlayer->mo )].DamageAmount > 0 )) | |
3335 | + return false; | |
3336 | + | |
3337 | + switch ( pPlayer->mo->Sector->special ) | |
3338 | + { | |
3339 | + case dLight_Strobe_Hurt: | |
3340 | + case dDamage_Hellslime: | |
3341 | + case dDamage_Nukage: | |
3342 | + case dDamage_End: | |
3343 | + case dDamage_SuperHellslime: | |
3344 | + case dDamage_LavaWimpy: | |
3345 | + case dDamage_LavaHefty: | |
3346 | + case dScroll_EastLavaDamage: | |
3347 | + case hDamage_Sludge: | |
3348 | + case sLight_Strobe_Hurt: | |
3349 | + case sDamage_Hellslime: | |
3350 | + case sDamage_SuperHellslime: | |
3351 | + return false; | |
3352 | + } | |
3353 | + | |
3354 | + // [AK] Don't respawn the player in an instant death sector. Taken directly from P_PlayerSpawn. | |
3355 | + if (( pPlayer->mo->Sector->Flags & SECF_NORESPAWN ) || (( pPlayer->mo->Sector->special & 255 ) == Damage_InstantDeath )) | |
3356 | + return false; | |
3357 | + | |
3358 | + // [AK] Make sure they're not going to be blocked by anything upon respawning where they died. | |
3359 | + AActor *temp = Spawn( pPlayer->cls->TypeName.GetChars( ), pPlayer->mo->x, pPlayer->mo->y, pPlayer->mo->z, NO_REPLACE ); | |
3360 | + bool bCanSpawn = P_TestMobjLocation( temp ); | |
3361 | + | |
3362 | + temp->Destroy( ); | |
3363 | + if ( bCanSpawn == false ) | |
3364 | + return false; | |
3365 | + | |
3366 | + DCeiling *pCeiling; | |
3367 | + TThinkerIterator<DCeiling> CeilingIterator; | |
3368 | + | |
3369 | + // [AK] The player shouldn't respawn in a sector that has any active crushers. We'll first iterate | |
3370 | + // through all ceilings crushers and see if one is connected to the sector the player's body is in. | |
3371 | + while (( pCeiling = CeilingIterator.Next( )) != NULL ) | |
3372 | + { | |
3373 | + if (( pCeiling->GetSector( ) == pPlayer->mo->Sector ) && ( pCeiling->GetCrush( ) > -1 )) | |
3374 | + return false; | |
3375 | + } | |
3376 | + | |
3377 | + DFloor *pFloor; | |
3378 | + TThinkerIterator<DFloor> FloorIterator; | |
3379 | + | |
3380 | + // [AK] Next, check all the floor crushers. | |
3381 | + while (( pFloor = FloorIterator.Next( )) != NULL ) | |
3382 | + { | |
3383 | + if (( pFloor->GetSector( ) == pPlayer->mo->Sector ) && ( pFloor->GetCrush( ) > -1 )) | |
3384 | + return false; | |
3385 | + } | |
3386 | + | |
3387 | + return true; | |
3388 | +} | |
3389 | + | |
3328 | 3390 | CCMD (kill) |
3329 | 3391 | { |
3330 | 3392 | // Only allow it in a level. |
@@ -5424,10 +5424,9 @@ | ||
5424 | 5424 | ( deathmatch == false ) && |
5425 | 5425 | ( teamgame == false ) && |
5426 | 5426 | ( gameaction != ga_worlddone ) && |
5427 | - ( p->bSpawnOkay ) && | |
5428 | 5427 | ( p->mo != NULL ) && |
5429 | - ( !(p->mo->Sector->Flags & SECF_NORESPAWN) ) && | |
5430 | - ( (p->mo->Sector->special & 255) != Damage_InstantDeath )) | |
5428 | + // [AK] Moved the SECF_NORESPAWN and Damage_InstantDeath checks into PLAYER_CanRespawnWhereDied. | |
5429 | + ( PLAYER_CanRespawnWhereDied( p ))) | |
5431 | 5430 | { |
5432 | 5431 | spawn_x = p->mo->x; |
5433 | 5432 | spawn_y = p->mo->y; |