[server] Implement/match CPlayer::ToggleCheckpoint(...)

This commit is contained in:
RD42 2024-09-16 23:44:09 +08:00
parent 54eeb4abfa
commit 3fc732d05c
2 changed files with 41 additions and 3 deletions

View File

@ -1,6 +1,8 @@
#include "main.h" #include "main.h"
extern CNetGame *pNetGame;
//---------------------------------------------------- //----------------------------------------------------
void CPlayer::Say(unsigned char * szText, BYTE byteTextLen) void CPlayer::Say(unsigned char * szText, BYTE byteTextLen)
@ -17,3 +19,33 @@ void CPlayer::SetSpawnInfo(PLAYER_SPAWN_INFO *pSpawn)
} }
//---------------------------------------------------- //----------------------------------------------------
//----------------------------------------------------
void CPlayer::ToggleCheckpoint(BOOL bEnabled)
{
m_bCheckpointEnabled = bEnabled;
m_bInCheckpoint = FALSE;
RakNet::BitStream bsParams;
if (bEnabled)
{
bsParams.Write(m_vecCheckpoint.X);
bsParams.Write(m_vecCheckpoint.Y);
bsParams.Write(m_vecCheckpoint.Z);
bsParams.Write(m_fCheckpointSize);
pNetGame->SendToPlayer(RPC_SetCheckpoint, &bsParams, m_PlayerID, 2);
} else {
pNetGame->SendToPlayer(RPC_DisableCheckpoint, &bsParams, m_PlayerID, 2);
}
}
//----------------------------------------------------

View File

@ -138,7 +138,7 @@ public:
short field_295D; short field_295D;
int field_295F; int field_295F;
int field_2963; int field_2963;
short field_2967; PLAYERID m_PlayerID;
int field_2969; int field_2969;
struc_92 field_296D[10]; struc_92 field_296D[10];
BOOL field_2B75[10]; BOOL field_2B75[10];
@ -149,7 +149,11 @@ public:
char field_2BA9; char field_2BA9;
char _pad2BAA[53]; VECTOR m_vecCheckpoint;
float m_fCheckpointSize;
BOOL m_bInCheckpoint;
char _pad2BBE[33];
int field_2BDF; int field_2BDF;
short field_2BE3[11]; short field_2BE3[11];
@ -161,7 +165,7 @@ public:
char field_2C31; char field_2C31;
short field_2C32; short field_2C32;
int field_2C34; int field_2C34;
int field_2C38; BOOL m_bCheckpointEnabled;
int field_2C3C; int field_2C3C;
int field_2C40; int field_2C40;
@ -194,6 +198,8 @@ public:
void Say(unsigned char * szText, BYTE byteTextLength); void Say(unsigned char * szText, BYTE byteTextLength);
void SetSpawnInfo(PLAYER_SPAWN_INFO *pSpawn); void SetSpawnInfo(PLAYER_SPAWN_INFO *pSpawn);
void ToggleCheckpoint(BOOL bEnabled);
}; };
//---------------------------------------------------- //----------------------------------------------------