Fix last commit

This commit is contained in:
UnknownShadow200 2024-04-25 16:54:29 +10:00
parent ca195d161f
commit 6465c91b95
2 changed files with 33 additions and 15 deletions

View File

@ -786,15 +786,21 @@ void LocalPlayer_ResetJumpVelocity(struct LocalPlayer* p) {
p->Physics.ServerJumpVel = p->Physics.JumpVel;
}
static void LocalPlayer_Reset(void) {
struct LocalPlayer* p = &LocalPlayer_Instances[0];
static void LocalPlayer_Reset(struct LocalPlayer* p) {
p->ReachDistance = 5.0f;
Vec3_Set(p->Base.Velocity, 0,0,0);
LocalPlayer_ResetJumpVelocity(p);
}
static void LocalPlayer_OnNewMap(void) {
struct LocalPlayer* p = &LocalPlayer_Instances[0];
static void LocalPlayers_Reset(void) {
int i;
for (i = 0; i < MAX_LOCAL_PLAYERS; i++)
{
LocalPlayer_Reset(&LocalPlayer_Instances[i]);
}
}
static void LocalPlayer_OnNewMap(struct LocalPlayer* p) {
Vec3_Set(p->Base.Velocity, 0,0,0);
Vec3_Set(p->OldVelocity, 0,0,0);
@ -804,6 +810,14 @@ static void LocalPlayer_OnNewMap(void) {
p->_warnedZoom = false;
}
static void LocalPlayers_OnNewMap(void) {
int i;
for (i = 0; i < MAX_LOCAL_PLAYERS; i++)
{
LocalPlayer_OnNewMap(&LocalPlayer_Instances[i]);
}
}
static cc_bool LocalPlayer_IsSolidCollide(BlockID b) { return Blocks.Collide[b] == COLLIDE_SOLID; }
static void LocalPlayer_DoRespawn(struct LocalPlayer* p) {
struct LocationUpdate update;
@ -1008,6 +1022,7 @@ void NetPlayer_Init(struct NetPlayer* p) {
*---------------------------------------------------Entities component----------------------------------------------------*
*#########################################################################################################################*/
static void Entities_Init(void) {
int i;
Event_Register_(&GfxEvents.ContextLost, NULL, Entities_ContextLost);
Event_Register_(&InputEvents.Down, NULL, LocalPlayer_InputDown);
Event_Register_(&InputEvents.Up, NULL, LocalPlayer_InputUp);
@ -1020,9 +1035,12 @@ static void Entities_Init(void) {
ShadowMode_Names, Array_Elems(ShadowMode_Names));
if (Game_ClassicMode) Entities.ShadowsMode = SHADOW_MODE_NONE;
Entities.List[ENTITIES_SELF_ID] = &LocalPlayer_Instances[0].Base;
for (i = 0; i < MAX_LOCAL_PLAYERS; i++)
{
LocalPlayer_Init(&LocalPlayer_Instances[i]);
Entities.List[ENTITIES_SELF_ID] = &LocalPlayer_Instances[i].Base;
}
Entities.CurPlayer = &LocalPlayer_Instances[0];
LocalPlayer_Init(&LocalPlayer_Instances[0]);
}
static void Entities_Free(void) {
@ -1036,6 +1054,6 @@ static void Entities_Free(void) {
struct IGameComponent Entities_Component = {
Entities_Init, /* Init */
Entities_Free, /* Free */
LocalPlayer_Reset, /* Reset */
LocalPlayer_OnNewMap, /* OnNewMap */
LocalPlayers_Reset, /* Reset */
LocalPlayers_OnNewMap, /* OnNewMap */
};

View File

@ -2272,13 +2272,13 @@ static void TouchScreen_BindClick(void* screen, void* widget) {
static const struct TouchButtonDesc onscreenDescs[ONSCREEN_MAX_BTNS] = {
{ "Chat", 0,0,0, TouchScreen_ChatClick },
{ "Tablist", 0,0,0, TouchScreen_TabClick },
{ "Respawn", 0,0,0, TouchScreen_RespawnClick, &Entities.CurPlayer->Hacks.CanRespawn },
{ "Set spawn", 0,0,0, TouchScreen_SetSpawnClick, &Entities.CurPlayer->Hacks.CanRespawn },
{ "Fly", 0,0,0, TouchScreen_FlyClick, &Entities.CurPlayer->Hacks.CanFly },
{ "Noclip", 0,0,0, TouchScreen_NoclipClick, &Entities.CurPlayer->Hacks.CanNoclip },
{ "Speed", 0,0,0, TouchScreen_SpeedClick, &Entities.CurPlayer->Hacks.CanSpeed },
{ "\xabSpeed", 0,0,0, TouchScreen_HalfClick, &Entities.CurPlayer->Hacks.CanSpeed },
{ "Camera", 0,0,0, TouchScreen_CameraClick, &Entities.CurPlayer->Hacks.CanUseThirdPerson },
{ "Respawn", 0,0,0, TouchScreen_RespawnClick, &LocalPlayer_Instances[0].Hacks.CanRespawn },
{ "Set spawn", 0,0,0, TouchScreen_SetSpawnClick, &LocalPlayer_Instances[0].Hacks.CanRespawn },
{ "Fly", 0,0,0, TouchScreen_FlyClick, &LocalPlayer_Instances[0].Hacks.CanFly },
{ "Noclip", 0,0,0, TouchScreen_NoclipClick, &LocalPlayer_Instances[0].Hacks.CanNoclip },
{ "Speed", 0,0,0, TouchScreen_SpeedClick, &LocalPlayer_Instances[0].Hacks.CanSpeed },
{ "\xabSpeed", 0,0,0, TouchScreen_HalfClick, &LocalPlayer_Instances[0].Hacks.CanSpeed },
{ "Camera", 0,0,0, TouchScreen_CameraClick, &LocalPlayer_Instances[0].Hacks.CanUseThirdPerson },
{ "Delete", 0,0,0, TouchScreen_DeleteClick },
{ "Pick", 0,0,0, TouchScreen_PickClick },
{ "Place", 0,0,0, TouchScreen_PlaceClick },