- remove pPlayerPed global var

This commit is contained in:
InspirationByte 2022-01-03 15:25:33 +03:00
parent 9a2b2d27cb
commit b06bb8bad5
5 changed files with 15 additions and 9 deletions

View File

@ -365,6 +365,10 @@ int CameraCollisionCheck(void)
// [D] [T] // [D] [T]
void TurnHead(PLAYER *lp) void TurnHead(PLAYER *lp)
{ {
LPPEDESTRIAN pPlayerPed;
pPlayerPed = lp->pPed;
// [A] handle REDRIVER2 dedicated look back button // [A] handle REDRIVER2 dedicated look back button
if ((paddCamera & CAMERA_PAD_LOOK_BACK) == CAMERA_PAD_LOOK_BACK || (paddCamera & CAMERA_PAD_LOOK_BACK_DED)) if ((paddCamera & CAMERA_PAD_LOOK_BACK) == CAMERA_PAD_LOOK_BACK || (paddCamera & CAMERA_PAD_LOOK_BACK_DED))
{ {

View File

@ -1072,7 +1072,7 @@ void StepSim(void)
} }
// Update players // Update players
for (i = 0; i < 8; i++) for (i = 0; i < MAX_PLAYERS; i++)
{ {
pl = &player[i]; pl = &player[i];

View File

@ -205,7 +205,6 @@ void InitPedestrians(void)
maxSeated = seated_count; maxSeated = seated_count;
numTannerPeds = 0; numTannerPeds = 0;
pinginPedAngle = 0; pinginPedAngle = 0;
pPlayerPed = NULL;
seated_count = 0; seated_count = 0;
ping_in_pedestrians = 1; ping_in_pedestrians = 1;
numCopPeds = 0; numCopPeds = 0;
@ -1213,7 +1212,6 @@ void PedGetInCar(PEDESTRIAN* pPed)
ChangePedPlayerToCar(playerID, carToGetIn); ChangePedPlayerToCar(playerID, carToGetIn);
DestroyPedestrian(pPed); DestroyPedestrian(pPed);
pPlayerPed = NULL;
numTannerPeds--; numTannerPeds--;
} }
} }
@ -2886,8 +2884,6 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC
pedptr->dir.vx = 0; pedptr->dir.vx = 0;
pedptr->dir.vy = dir; pedptr->dir.vy = dir;
pedptr->head_rot = 0; pedptr->head_rot = 0;
pPlayerPed = pedptr;
lp->headTimer = 0; lp->headTimer = 0;
pedptr->pedType = playerType; pedptr->pedType = playerType;
SetupPedestrian(pedptr); SetupPedestrian(pedptr);

View File

@ -14,8 +14,7 @@
#include "felony.h" #include "felony.h"
#include "shadow.h" #include "shadow.h"
PEDESTRIAN *pPlayerPed = NULL; PLAYER player[MAX_PLAYERS];
PLAYER player[8];
// [D] [T] // [D] [T]
void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid) void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid)
@ -62,8 +61,11 @@ void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction
} }
else else
{ {
LPPEDESTRIAN pPlayerPed;
ActivatePlayerPedestrian(NULL, padid, direction, startPos, (PED_MODEL_TYPES)playerType); ActivatePlayerPedestrian(NULL, padid, direction, startPos, (PED_MODEL_TYPES)playerType);
pPlayerPed = locPlayer->pPed;
locPlayer->playerType = 2; locPlayer->playerType = 2;
locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position; locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position;
locPlayer->playerCarId = -1; locPlayer->playerCarId = -1;
@ -113,6 +115,9 @@ void ChangeCarPlayerToPed(int playerID)
if (gInGameCutsceneActive == 0 && gInGameChaseActive == 0) if (gInGameCutsceneActive == 0 && gInGameChaseActive == 0)
{ {
LPPEDESTRIAN pPlayerPed;
pPlayerPed = locPlayer->pPed;
locPlayer->worldCentreCarId = -1; locPlayer->worldCentreCarId = -1;
locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position; locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position;
} }

View File

@ -1,8 +1,9 @@
#ifndef PLAYERS_H #ifndef PLAYERS_H
#define PLAYERS_H #define PLAYERS_H
extern PLAYER player[8]; #define MAX_PLAYERS 8
extern PEDESTRIAN *pPlayerPed;
extern PLAYER player[MAX_PLAYERS];
extern void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid); // 0x000739D8 extern void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid); // 0x000739D8