mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-04 00:23:22 +08:00
[bot] Implement RequestClass(...)
* Implement `CNetGame::SetMyZAngle(...)`
This commit is contained in:
parent
8b46841b34
commit
cbca7594a1
25
bot/main.h
25
bot/main.h
@ -66,7 +66,30 @@ char* strlwr(char* str);
|
|||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
typedef struct _PLAYER_SPAWN_INFO
|
typedef struct _PLAYER_SPAWN_INFO
|
||||||
{
|
{
|
||||||
char _gap0[46];
|
char _gap0[6];
|
||||||
|
|
||||||
|
VECTOR vecPos;
|
||||||
|
float fRotation;
|
||||||
|
|
||||||
|
char _gap16[24];
|
||||||
|
|
||||||
} PLAYER_SPAWN_INFO;
|
} PLAYER_SPAWN_INFO;
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct _ONFOOT_SYNC_DATA
|
||||||
|
{
|
||||||
|
WORD lrAnalog;
|
||||||
|
WORD udAnalog;
|
||||||
|
WORD wKeys;
|
||||||
|
VECTOR vecPos;
|
||||||
|
QUATERNION quatRotation;
|
||||||
|
BYTE byteHealth;
|
||||||
|
BYTE byteArmour;
|
||||||
|
BYTE byteCurrentWeapon : 6;
|
||||||
|
BYTE byteSpecialKey : 2;
|
||||||
|
BYTE byteSpecialAction;
|
||||||
|
|
||||||
|
char _gap26[30];
|
||||||
|
|
||||||
|
} ONFOOT_SYNC_DATA;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include "../main.h"
|
#include "../main.h"
|
||||||
#include "../../raknet/SocketDataEncryptor.h"
|
#include "../../raknet/SocketDataEncryptor.h"
|
||||||
|
#include "../mathutils.h"
|
||||||
|
|
||||||
#define NETGAME_VERSION 4057
|
#define NETGAME_VERSION 4057
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ char unnamed_2[63];
|
|||||||
PASSENGER_SYNC_DATA unnamed_5[MAX_PLAYERS];
|
PASSENGER_SYNC_DATA unnamed_5[MAX_PLAYERS];
|
||||||
BOOL unnamed_6[MAX_PLAYERS];
|
BOOL unnamed_6[MAX_PLAYERS];
|
||||||
char unnamed_9;
|
char unnamed_9;
|
||||||
char unnamed_1[68];
|
ONFOOT_SYNC_DATA ofSync;
|
||||||
char unnamed_3[1000][68];
|
char unnamed_3[1000][68];
|
||||||
BYTE unnamed_8[MAX_PLAYERS];
|
BYTE unnamed_8[MAX_PLAYERS];
|
||||||
BOOL unnamed_7[MAX_VEHICLES];
|
BOOL unnamed_7[MAX_VEHICLES];
|
||||||
@ -44,6 +45,33 @@ char unnamed_4[1000][63];
|
|||||||
|
|
||||||
bool bSpawned = false;
|
bool bSpawned = false;
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
// MATCH
|
||||||
|
void CNetGame::SetMyZAngle(float fAngle)
|
||||||
|
{
|
||||||
|
//logprintf("CNetGame::SetMyZAngle(%f)", fAngle);
|
||||||
|
|
||||||
|
float fRadians = fAngle * 0.017453292f; // (PI/180.0f)
|
||||||
|
|
||||||
|
MATRIX4X4 mat;
|
||||||
|
memset(&mat,0,sizeof(MATRIX4X4));
|
||||||
|
mat.right.Z = 0.0f;
|
||||||
|
mat.up.Z = 0.0f;
|
||||||
|
mat.at.X = 0.0f;
|
||||||
|
mat.at.Y = 0.0f;
|
||||||
|
mat.at.Z = 1.0f;
|
||||||
|
|
||||||
|
float fCos = cos(fRadians);
|
||||||
|
float fSin = sin(fRadians);
|
||||||
|
|
||||||
|
mat.right.X = fCos;
|
||||||
|
mat.right.Y = fSin;
|
||||||
|
mat.up.X = -fSin;
|
||||||
|
mat.up.Y = fCos;
|
||||||
|
|
||||||
|
MatrixToQuaternion(&mat, &ofSync.quatRotation);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
// TODO: length assert has to be at line 397
|
// TODO: length assert has to be at line 397
|
||||||
@ -103,7 +131,6 @@ void CNetGame::ShutdownForGameModeRestart()
|
|||||||
|
|
||||||
StopRecordingPlayback();
|
StopRecordingPlayback();
|
||||||
|
|
||||||
memset(unnamed_1,0,sizeof(unnamed_1));
|
|
||||||
memset(unnamed_2,0,sizeof(unnamed_2));
|
memset(unnamed_2,0,sizeof(unnamed_2));
|
||||||
memset(unnamed_3,0,sizeof(unnamed_3));
|
memset(unnamed_3,0,sizeof(unnamed_3));
|
||||||
memset(unnamed_4,0,sizeof(unnamed_4));
|
memset(unnamed_4,0,sizeof(unnamed_4));
|
||||||
@ -111,6 +138,7 @@ void CNetGame::ShutdownForGameModeRestart()
|
|||||||
memset(unnamed_6,0,sizeof(unnamed_6));
|
memset(unnamed_6,0,sizeof(unnamed_6));
|
||||||
memset(unnamed_7,0,sizeof(unnamed_7));
|
memset(unnamed_7,0,sizeof(unnamed_7));
|
||||||
memset(unnamed_8,0,sizeof(unnamed_8));
|
memset(unnamed_8,0,sizeof(unnamed_8));
|
||||||
|
memset(&ofSync,0,sizeof(ONFOOT_SYNC_DATA));
|
||||||
|
|
||||||
m_bZoneNames = FALSE;
|
m_bZoneNames = FALSE;
|
||||||
}
|
}
|
||||||
@ -171,8 +199,8 @@ void CNetGame::Init(PCHAR szHostOrIp, int iPort,
|
|||||||
m_bZoneNames = FALSE;
|
m_bZoneNames = FALSE;
|
||||||
m_bInstagib = FALSE;
|
m_bInstagib = FALSE;
|
||||||
|
|
||||||
memset(unnamed_1,0,sizeof(unnamed_1));
|
|
||||||
memset(unnamed_2,0,sizeof(unnamed_2));
|
memset(unnamed_2,0,sizeof(unnamed_2));
|
||||||
|
memset(&ofSync,0,sizeof(ONFOOT_SYNC_DATA));
|
||||||
memset(unnamed_3,0,sizeof(unnamed_3));
|
memset(unnamed_3,0,sizeof(unnamed_3));
|
||||||
memset(unnamed_4,0,sizeof(unnamed_4));
|
memset(unnamed_4,0,sizeof(unnamed_4));
|
||||||
memset(unnamed_5,0,sizeof(unnamed_5));
|
memset(unnamed_5,0,sizeof(unnamed_5));
|
||||||
|
@ -96,6 +96,8 @@ public:
|
|||||||
void ShutdownForGameModeRestart();
|
void ShutdownForGameModeRestart();
|
||||||
|
|
||||||
void sub_415EC0(VEHICLEID VehicleID, BOOL a2);
|
void sub_415EC0(VEHICLEID VehicleID, BOOL a2);
|
||||||
|
void SetMyZAngle(float fAngle);
|
||||||
|
|
||||||
void SetPlayerAdded(PLAYERID playerId, BOOL a2);
|
void SetPlayerAdded(PLAYERID playerId, BOOL a2);
|
||||||
|
|
||||||
void StopRecordingPlayback();
|
void StopRecordingPlayback();
|
||||||
|
@ -7,6 +7,7 @@ extern CNetGame* pNetGame;
|
|||||||
#define REJECT_REASON_BAD_NICKNAME 2
|
#define REJECT_REASON_BAD_NICKNAME 2
|
||||||
#define REJECT_REASON_BAD_MOD 3
|
#define REJECT_REASON_BAD_MOD 3
|
||||||
|
|
||||||
|
extern ONFOOT_SYNC_DATA ofSync;
|
||||||
extern bool bSpawned;
|
extern bool bSpawned;
|
||||||
|
|
||||||
void EnterVehicle(RPCParameters *rpcParams) {}
|
void EnterVehicle(RPCParameters *rpcParams) {}
|
||||||
@ -197,7 +198,32 @@ void Chat(RPCParameters *rpcParams)
|
|||||||
|
|
||||||
void RequestClass(RPCParameters *rpcParams)
|
void RequestClass(RPCParameters *rpcParams)
|
||||||
{
|
{
|
||||||
// TODO: RequestClass
|
PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input);
|
||||||
|
int iBitLength = rpcParams->numberOfBitsOfData;
|
||||||
|
PlayerID sender = rpcParams->sender;
|
||||||
|
|
||||||
|
RakNet::BitStream bsData(Data,(iBitLength/8)+1,false);
|
||||||
|
BYTE byteRequestOutcome=0;
|
||||||
|
PLAYER_SPAWN_INFO SpawnInfo;
|
||||||
|
|
||||||
|
bsData.Read(byteRequestOutcome);
|
||||||
|
bsData.Read((PCHAR)&SpawnInfo,sizeof(PLAYER_SPAWN_INFO));
|
||||||
|
|
||||||
|
ofSync.byteHealth = 100;
|
||||||
|
ofSync.byteArmour = 100;
|
||||||
|
ofSync.byteCurrentWeapon = 0;
|
||||||
|
ofSync.byteSpecialAction = 0;
|
||||||
|
ofSync.vecPos.X = SpawnInfo.vecPos.X;
|
||||||
|
ofSync.vecPos.Y = SpawnInfo.vecPos.Y;
|
||||||
|
ofSync.vecPos.Z = SpawnInfo.vecPos.Z;
|
||||||
|
|
||||||
|
pNetGame->SetMyZAngle(SpawnInfo.fRotation);
|
||||||
|
|
||||||
|
if(byteRequestOutcome) {
|
||||||
|
//logprintf("NPC: RequestClass. Requesting Spawn.");
|
||||||
|
RakNet::BitStream bsSpawnRequest;
|
||||||
|
pNetGame->GetRakClient()->RPC(RPC_RequestSpawn,&bsSpawnRequest,HIGH_PRIORITY,RELIABLE,0,false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestSpawn(RPCParameters *rpcParams)
|
void RequestSpawn(RPCParameters *rpcParams)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user