• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revision9f1fb012a62949f21476bd2fd4c7be5f67f0cfd7 (tree)
Time2022-02-19 00:11:20
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Added the function CLIENTDEMO_SpawnFreeSpectatorPlayer.

Change Summary

Incremental Difference

diff -r ab089e2fed31 -r 9f1fb012a629 src/cl_demo.cpp
--- a/src/cl_demo.cpp Sun Feb 06 10:58:58 2022 -0500
+++ b/src/cl_demo.cpp Fri Feb 18 10:11:20 2022 -0500
@@ -866,6 +866,25 @@
866866
867867 //*****************************************************************************
868868 //
869+void CLIENTDEMO_SpawnFreeSpectatorPlayer( void )
870+{
871+ const AActor *pCamera = players[consoleplayer].camera;
872+ player_t *p = &g_demoCameraPlayer;
873+
874+ p->bSpectating = true;
875+ p->cls = PlayerClasses[p->CurrentPlayerClass].Type;
876+ p->mo = static_cast<APlayerPawn *> (Spawn (p->cls, pCamera->x, pCamera->y, pCamera->z + pCamera->height, NO_REPLACE));
877+ p->mo->angle = pCamera->angle;
878+ p->mo->flags |= (MF_NOGRAVITY);
879+ p->mo->player = p;
880+ p->DesiredFOV = p->FOV = 90.f;
881+ p->crouchfactor = FRACUNIT;
882+ PLAYER_SetDefaultSpectatorValues( p );
883+ p->camera = p->mo;
884+}
885+
886+//*****************************************************************************
887+//
869888 void CLIENTDEMO_ClearFreeSpectatorPlayer( void )
870889 {
871890 if ( g_demoCameraPlayer.mo != NULL )
@@ -1059,23 +1078,13 @@
10591078 if ( CLIENTDEMO_IsPlaying( ) == false )
10601079 return;
10611080
1062- const AActor *pCamera = players[consoleplayer].camera;
1063- if ( pCamera != g_demoCameraPlayer.mo )
1081+ if ( players[consoleplayer].camera != g_demoCameraPlayer.mo )
10641082 {
10651083 CLIENTDEMO_ClearFreeSpectatorPlayer();
1066- player_t *p = &g_demoCameraPlayer;
1067- p->bSpectating = true;
1068- p->cls = PlayerClasses[p->CurrentPlayerClass].Type;
1069- p->mo = static_cast<APlayerPawn *> (Spawn (p->cls, pCamera->x, pCamera->y, pCamera->z + pCamera->height , NO_REPLACE));
1070- p->mo->angle = pCamera->angle;
1071- p->mo->flags |= (MF_NOGRAVITY);
1072- p->mo->player = p;
1073- p->DesiredFOV = p->FOV = 90.f;
1074- p->crouchfactor = FRACUNIT;
1075- PLAYER_SetDefaultSpectatorValues ( p );
1084+ CLIENTDEMO_SpawnFreeSpectatorPlayer();
1085+
10761086 players[consoleplayer].camera = g_demoCameraPlayer.mo;
1077- p->camera = p->mo;
10781087 if ( StatusBar )
1079- StatusBar->AttachToPlayer ( p );
1088+ StatusBar->AttachToPlayer ( &g_demoCameraPlayer );
10801089 }
10811090 }
diff -r ab089e2fed31 -r 9f1fb012a629 src/cl_demo.h
--- a/src/cl_demo.h Sun Feb 06 10:58:58 2022 -0500
+++ b/src/cl_demo.h Fri Feb 18 10:11:20 2022 -0500
@@ -104,6 +104,7 @@
104104 void CLIENTDEMO_FreeSpectatorPlayerThink( bool bTickBody = false );
105105 player_t *CLIENTDEMO_GetFreeSpectatorPlayer( void );
106106 bool CLIENTDEMO_IsFreeSpectatorPlayer( player_t *pPlayer );
107+void CLIENTDEMO_SpawnFreeSpectatorPlayer( void );
107108 void CLIENTDEMO_ClearFreeSpectatorPlayer( void );
108109
109110 #endif // __CL_DEMO__
Show on old repository browser