• R/O
  • SSH

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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.

変更サマリ

差分

diff -r f79aeef55f65 -r b68d78dbbc82 src/d_player.h
--- a/src/d_player.h Mon Jul 19 21:43:42 2021 -0400
+++ b/src/d_player.h Thu Jul 22 19:54:24 2021 -0400
@@ -804,6 +804,7 @@
804804 bool PLAYER_NameMatchesServer( const FString &Name );
805805 bool PLAYER_NameUsed( const FString &Name, const ULONG ulIgnorePlayer = MAXPLAYERS );
806806 FString PLAYER_GenerateUniqueName( void );
807+bool PLAYER_CanRespawnWhereDied( player_t *pPlayer );
807808
808809 void P_CheckPlayerSprite(AActor *mo, int &spritenum, fixed_t &scalex, fixed_t &scaley);
809810
diff -r f79aeef55f65 -r b68d78dbbc82 src/p_interaction.cpp
--- a/src/p_interaction.cpp Mon Jul 19 21:43:42 2021 -0400
+++ b/src/p_interaction.cpp Thu Jul 22 19:54:24 2021 -0400
@@ -81,6 +81,7 @@
8181 #include "r_data/colormaps.h"
8282 #include "v_video.h"
8383 #include "st_hud.h"
84+#include "p_terrain.h"
8485
8586 // [BC] Ugh.
8687 void SERVERCONSOLE_UpdatePlayerInfo( LONG lPlayer, ULONG ulUpdateFlags );
@@ -3325,6 +3326,67 @@
33253326 return name;
33263327 }
33273328
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+
33283390 CCMD (kill)
33293391 {
33303392 // Only allow it in a level.
diff -r f79aeef55f65 -r b68d78dbbc82 src/p_mobj.cpp
--- a/src/p_mobj.cpp Mon Jul 19 21:43:42 2021 -0400
+++ b/src/p_mobj.cpp Thu Jul 22 19:54:24 2021 -0400
@@ -5424,10 +5424,9 @@
54245424 ( deathmatch == false ) &&
54255425 ( teamgame == false ) &&
54265426 ( gameaction != ga_worlddone ) &&
5427- ( p->bSpawnOkay ) &&
54285427 ( 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 )))
54315430 {
54325431 spawn_x = p->mo->x;
54335432 spawn_y = p->mo->y;