mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Fix if motd is changed to -hax +thirdperson, you are still sent back into first person, even though you can still use third person (Thanks cybertoon)
This commit is contained in:
parent
cc5c9f8ed5
commit
8a0c0850ca
@ -228,7 +228,7 @@ static void HandleRawMouseMoved(void* obj, int idx, int deltaX, int deltaY) {
|
|||||||
|
|
||||||
static void Camera_CheckThirdPerson(void* obj) {
|
static void Camera_CheckThirdPerson(void* obj) {
|
||||||
struct HacksComp* h = &LocalPlayer_Instance.Hacks;
|
struct HacksComp* h = &LocalPlayer_Instance.Hacks;
|
||||||
if (!h->CanUseThirdPersonCamera || !h->Enabled) Camera_CycleActive();
|
if (!h->CanUseThirdPerson || !h->Enabled) Camera_CycleActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera_Init(void) {
|
void Camera_Init(void) {
|
||||||
@ -254,7 +254,7 @@ void Camera_CycleActive(void) {
|
|||||||
if (Game_ClassicMode) return;
|
if (Game_ClassicMode) return;
|
||||||
Camera.Active = Camera.Active->next;
|
Camera.Active = Camera.Active->next;
|
||||||
|
|
||||||
if (!p->Hacks.CanUseThirdPersonCamera || !p->Hacks.Enabled) {
|
if (!p->Hacks.CanUseThirdPerson || !p->Hacks.Enabled) {
|
||||||
Camera.Active = &cam_FirstPerson;
|
Camera.Active = &cam_FirstPerson;
|
||||||
}
|
}
|
||||||
cam_isForwardThird = Camera.Active == &cam_ForwardThird;
|
cam_isForwardThird = Camera.Active == &cam_ForwardThird;
|
||||||
|
@ -149,7 +149,7 @@ static void HacksComp_SetAll(struct HacksComp* hacks, cc_bool allowed) {
|
|||||||
hacks->CanAnyHacks = allowed; hacks->CanFly = allowed;
|
hacks->CanAnyHacks = allowed; hacks->CanFly = allowed;
|
||||||
hacks->CanNoclip = allowed; hacks->CanRespawn = allowed;
|
hacks->CanNoclip = allowed; hacks->CanRespawn = allowed;
|
||||||
hacks->CanSpeed = allowed; hacks->CanPushbackBlocks = allowed;
|
hacks->CanSpeed = allowed; hacks->CanPushbackBlocks = allowed;
|
||||||
hacks->CanUseThirdPersonCamera = allowed;
|
hacks->CanUseThirdPerson = allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HacksComp_Init(struct HacksComp* hacks) {
|
void HacksComp_Init(struct HacksComp* hacks) {
|
||||||
@ -249,11 +249,12 @@ void HacksComp_RecheckFlags(struct HacksComp* hacks) {
|
|||||||
HacksComp_SetAll(hacks, hax);
|
HacksComp_SetAll(hacks, hax);
|
||||||
hacks->CanBePushed = true;
|
hacks->CanBePushed = true;
|
||||||
|
|
||||||
HacksComp_ParseFlag(hacks, "+fly", "-fly", &hacks->CanFly);
|
HacksComp_ParseFlag(hacks, "+fly", "-fly", &hacks->CanFly);
|
||||||
HacksComp_ParseFlag(hacks, "+noclip", "-noclip", &hacks->CanNoclip);
|
HacksComp_ParseFlag(hacks, "+noclip", "-noclip", &hacks->CanNoclip);
|
||||||
HacksComp_ParseFlag(hacks, "+speed", "-speed", &hacks->CanSpeed);
|
HacksComp_ParseFlag(hacks, "+speed", "-speed", &hacks->CanSpeed);
|
||||||
HacksComp_ParseFlag(hacks, "+respawn", "-respawn", &hacks->CanRespawn);
|
HacksComp_ParseFlag(hacks, "+respawn", "-respawn", &hacks->CanRespawn);
|
||||||
HacksComp_ParseFlag(hacks, "+push", "-push", &hacks->CanBePushed);
|
HacksComp_ParseFlag(hacks, "+push", "-push", &hacks->CanBePushed);
|
||||||
|
HacksComp_ParseFlag(hacks, "+thirdperson", "-thirdperson", &hacks->CanUseThirdPerson);
|
||||||
|
|
||||||
if (hacks->IsOp) HacksComp_ParseAllFlag(hacks, "+ophax", "-ophax");
|
if (hacks->IsOp) HacksComp_ParseAllFlag(hacks, "+ophax", "-ophax");
|
||||||
hacks->BaseHorSpeed = HacksComp_ParseFlagFloat("horspeed=", hacks);
|
hacks->BaseHorSpeed = HacksComp_ParseFlagFloat("horspeed=", hacks);
|
||||||
|
@ -47,7 +47,7 @@ struct HacksComp {
|
|||||||
/* Whether user has allowed hacks as an option. Note 'can use X' set by the server override this */
|
/* Whether user has allowed hacks as an option. Note 'can use X' set by the server override this */
|
||||||
cc_bool Enabled;
|
cc_bool Enabled;
|
||||||
|
|
||||||
cc_bool CanAnyHacks, CanUseThirdPersonCamera, CanSpeed, CanFly;
|
cc_bool CanAnyHacks, CanUseThirdPerson, CanSpeed, CanFly;
|
||||||
cc_bool CanRespawn, CanNoclip, CanPushbackBlocks,CanSeeAllNames;
|
cc_bool CanRespawn, CanNoclip, CanPushbackBlocks,CanSeeAllNames;
|
||||||
cc_bool CanDoubleJump, CanBePushed;
|
cc_bool CanDoubleJump, CanBePushed;
|
||||||
float BaseHorSpeed;
|
float BaseHorSpeed;
|
||||||
|
@ -806,7 +806,7 @@ static void CycleViewDistanceBackwards(const short* viewDists, int count) {
|
|||||||
|
|
||||||
cc_bool InputHandler_SetFOV(int fov) {
|
cc_bool InputHandler_SetFOV(int fov) {
|
||||||
struct HacksComp* h = &LocalPlayer_Instance.Hacks;
|
struct HacksComp* h = &LocalPlayer_Instance.Hacks;
|
||||||
if (!h->Enabled || !h->CanUseThirdPersonCamera) return false;
|
if (!h->Enabled || !h->CanUseThirdPerson) return false;
|
||||||
|
|
||||||
Game_ZoomFov = fov;
|
Game_ZoomFov = fov;
|
||||||
Game_SetFov(fov);
|
Game_SetFov(fov);
|
||||||
@ -818,7 +818,7 @@ static cc_bool InputHandler_DoFovZoom(float deltaPrecise) {
|
|||||||
if (!KeyBind_IsPressed(KEYBIND_ZOOM_SCROLL)) return false;
|
if (!KeyBind_IsPressed(KEYBIND_ZOOM_SCROLL)) return false;
|
||||||
|
|
||||||
h = &LocalPlayer_Instance.Hacks;
|
h = &LocalPlayer_Instance.Hacks;
|
||||||
if (!h->Enabled || !h->CanUseThirdPersonCamera) return false;
|
if (!h->Enabled || !h->CanUseThirdPerson) return false;
|
||||||
|
|
||||||
if (input_fovIndex == -1.0f) input_fovIndex = (float)Game_ZoomFov;
|
if (input_fovIndex == -1.0f) input_fovIndex = (float)Game_ZoomFov;
|
||||||
input_fovIndex -= deltaPrecise * 5.0f;
|
input_fovIndex -= deltaPrecise * 5.0f;
|
||||||
@ -829,7 +829,7 @@ static cc_bool InputHandler_DoFovZoom(float deltaPrecise) {
|
|||||||
|
|
||||||
static void InputHandler_CheckZoomFov(void* obj) {
|
static void InputHandler_CheckZoomFov(void* obj) {
|
||||||
struct HacksComp* h = &LocalPlayer_Instance.Hacks;
|
struct HacksComp* h = &LocalPlayer_Instance.Hacks;
|
||||||
if (!h->Enabled || !h->CanUseThirdPersonCamera) Game_SetFov(Game_DefaultFov);
|
if (!h->Enabled || !h->CanUseThirdPerson) Game_SetFov(Game_DefaultFov);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cc_bool HandleBlockKey(int key) {
|
static cc_bool HandleBlockKey(int key) {
|
||||||
|
@ -1097,11 +1097,11 @@ static void CPE_HackControl(cc_uint8* data) {
|
|||||||
struct PhysicsComp* physics;
|
struct PhysicsComp* physics;
|
||||||
int jumpHeight;
|
int jumpHeight;
|
||||||
|
|
||||||
p->Hacks.CanFly = data[0] != 0;
|
p->Hacks.CanFly = data[0] != 0;
|
||||||
p->Hacks.CanNoclip = data[1] != 0;
|
p->Hacks.CanNoclip = data[1] != 0;
|
||||||
p->Hacks.CanSpeed = data[2] != 0;
|
p->Hacks.CanSpeed = data[2] != 0;
|
||||||
p->Hacks.CanRespawn = data[3] != 0;
|
p->Hacks.CanRespawn = data[3] != 0;
|
||||||
p->Hacks.CanUseThirdPersonCamera = data[4] != 0;
|
p->Hacks.CanUseThirdPerson = data[4] != 0;
|
||||||
HacksComp_Update(&p->Hacks);
|
HacksComp_Update(&p->Hacks);
|
||||||
|
|
||||||
jumpHeight = Stream_GetU16_BE(data + 5);
|
jumpHeight = Stream_GetU16_BE(data + 5);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user