Revision | 9f1fb012a62949f21476bd2fd4c7be5f67f0cfd7 (tree) |
---|---|
Time | 2022-02-19 00:11:20 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Added the function CLIENTDEMO_SpawnFreeSpectatorPlayer.
@@ -866,6 +866,25 @@ | ||
866 | 866 | |
867 | 867 | //***************************************************************************** |
868 | 868 | // |
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 | +// | |
869 | 888 | void CLIENTDEMO_ClearFreeSpectatorPlayer( void ) |
870 | 889 | { |
871 | 890 | if ( g_demoCameraPlayer.mo != NULL ) |
@@ -1059,23 +1078,13 @@ | ||
1059 | 1078 | if ( CLIENTDEMO_IsPlaying( ) == false ) |
1060 | 1079 | return; |
1061 | 1080 | |
1062 | - const AActor *pCamera = players[consoleplayer].camera; | |
1063 | - if ( pCamera != g_demoCameraPlayer.mo ) | |
1081 | + if ( players[consoleplayer].camera != g_demoCameraPlayer.mo ) | |
1064 | 1082 | { |
1065 | 1083 | 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 | + | |
1076 | 1086 | players[consoleplayer].camera = g_demoCameraPlayer.mo; |
1077 | - p->camera = p->mo; | |
1078 | 1087 | if ( StatusBar ) |
1079 | - StatusBar->AttachToPlayer ( p ); | |
1088 | + StatusBar->AttachToPlayer ( &g_demoCameraPlayer ); | |
1080 | 1089 | } |
1081 | 1090 | } |
@@ -104,6 +104,7 @@ | ||
104 | 104 | void CLIENTDEMO_FreeSpectatorPlayerThink( bool bTickBody = false ); |
105 | 105 | player_t *CLIENTDEMO_GetFreeSpectatorPlayer( void ); |
106 | 106 | bool CLIENTDEMO_IsFreeSpectatorPlayer( player_t *pPlayer ); |
107 | +void CLIENTDEMO_SpawnFreeSpectatorPlayer( void ); | |
107 | 108 | void CLIENTDEMO_ClearFreeSpectatorPlayer( void ); |
108 | 109 | |
109 | 110 | #endif // __CL_DEMO__ |