mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Fix 'speed on' not reappearing when speeding, going into zone that disables hax, then exiting zone which re-enables hax
This commit is contained in:
parent
cec101ba5c
commit
e01bdcc60c
@ -30,11 +30,11 @@ namespace ClassicalSharp.Gui.Screens {
|
|||||||
public override void Render(double delta) {
|
public override void Render(double delta) {
|
||||||
UpdateStatus(delta);
|
UpdateStatus(delta);
|
||||||
if (game.HideGui || !game.ShowFPS) return;
|
if (game.HideGui || !game.ShowFPS) return;
|
||||||
|
|
||||||
game.Graphics.Texturing = true;
|
game.Graphics.Texturing = true;
|
||||||
status.Render(delta);
|
status.Render(delta);
|
||||||
|
|
||||||
if (!game.ClassicMode && game.Gui.activeScreen == null) {
|
if (!game.ClassicMode && game.Gui.activeScreen == null) {
|
||||||
UpdateHackState(false);
|
if (HacksChanged()) { UpdateHackState(); }
|
||||||
DrawPosition();
|
DrawPosition();
|
||||||
hackStates.Render(delta);
|
hackStates.Render(delta);
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ namespace ClassicalSharp.Gui.Screens {
|
|||||||
.SetLocation(Anchor.LeftOrTop, Anchor.LeftOrTop, 2, yOffset);
|
.SetLocation(Anchor.LeftOrTop, Anchor.LeftOrTop, 2, yOffset);
|
||||||
hackStates.ReducePadding = true;
|
hackStates.ReducePadding = true;
|
||||||
hackStates.Init();
|
hackStates.Init();
|
||||||
UpdateHackState(true);
|
UpdateHackState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
@ -144,24 +144,27 @@ namespace ClassicalSharp.Gui.Screens {
|
|||||||
game.Graphics.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index);
|
game.Graphics.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool speeding, halfSpeeding, noclip, fly;
|
bool speed, halfSpeed, noclip, fly, canSpeed;
|
||||||
int lastFov;
|
int lastFov;
|
||||||
void UpdateHackState(bool force) {
|
bool HacksChanged() {
|
||||||
HacksComponent hacks = game.LocalPlayer.Hacks;
|
HacksComponent hacks = game.LocalPlayer.Hacks;
|
||||||
if (force || hacks.Speeding != speeding || hacks.HalfSpeeding != halfSpeeding || hacks.Noclip != noclip ||
|
return hacks.Speeding != speed || hacks.HalfSpeeding != halfSpeed || hacks.Flying != fly
|
||||||
hacks.Flying != fly || game.Fov != lastFov) {
|
|| hacks.Noclip != noclip || game.Fov != lastFov || hacks.CanSpeed != canSpeed;
|
||||||
speeding = hacks.Speeding; halfSpeeding = hacks.HalfSpeeding; noclip = hacks.Noclip; fly = hacks.Flying;
|
}
|
||||||
lastFov = game.Fov;
|
|
||||||
statusBuffer.Clear();
|
|
||||||
|
|
||||||
|
void UpdateHackState() {
|
||||||
|
HacksComponent hacks = game.LocalPlayer.Hacks;
|
||||||
|
speed = hacks.Speeding; halfSpeed = hacks.HalfSpeeding; fly = hacks.Flying;
|
||||||
|
noclip = hacks.Noclip; lastFov = game.Fov; canSpeed = hacks.CanSpeed;
|
||||||
|
|
||||||
|
statusBuffer.Clear();
|
||||||
if (game.Fov != game.DefaultFov) statusBuffer.Append("Zoom fov ").AppendNum(lastFov).Append(" ");
|
if (game.Fov != game.DefaultFov) statusBuffer.Append("Zoom fov ").AppendNum(lastFov).Append(" ");
|
||||||
if (fly) statusBuffer.Append("Fly ON ");
|
if (fly) statusBuffer.Append("Fly ON ");
|
||||||
|
|
||||||
bool speed = (speeding || halfSpeeding) && (hacks.CanSpeed || hacks.BaseHorSpeed > 1);
|
bool speeding = (speed || halfSpeed) && (hacks.CanSpeed || hacks.BaseHorSpeed > 1);
|
||||||
if (speed) statusBuffer.Append("Speed ON ");
|
if (speeding) statusBuffer.Append("Speed ON ");
|
||||||
if (noclip) statusBuffer.Append("Noclip ON ");
|
if (noclip) statusBuffer.Append("Noclip ON ");
|
||||||
hackStates.SetText(statusBuffer.ToString());
|
hackStates.SetText(statusBuffer.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -95,7 +95,9 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
|
|
||||||
float lastFogEnd = -1, lastFogDensity = -1;
|
float lastFogEnd = -1, lastFogDensity = -1;
|
||||||
public override void SetFogDensity(float value) {
|
public override void SetFogDensity(float value) {
|
||||||
FogParam(FogParameter.FogDensity, value, ref lastFogDensity);
|
if (value == lastFogDensity) return;
|
||||||
|
GL.Fogf(FogParameter.FogDensity, value);
|
||||||
|
lastFogDensity = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetFogStart(float value) {
|
public override void SetFogStart(float value) {
|
||||||
@ -103,13 +105,9 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void SetFogEnd(float value) {
|
public override void SetFogEnd(float value) {
|
||||||
FogParam(FogParameter.FogEnd, value, ref lastFogEnd);
|
if (value == lastFogEnd) return;
|
||||||
}
|
GL.Fogf(FogParameter.FogEnd, value);
|
||||||
|
lastFogEnd = value;
|
||||||
static void FogParam(FogParameter param, float value, ref float last) {
|
|
||||||
if (value == last) return;
|
|
||||||
GL.Fogf(param, value);
|
|
||||||
last = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Fog lastFogMode = (Fog)999;
|
Fog lastFogMode = (Fog)999;
|
||||||
|
@ -300,7 +300,7 @@ typedef struct StatusScreen_ {
|
|||||||
TextAtlas PosAtlas;
|
TextAtlas PosAtlas;
|
||||||
Real64 Accumulator;
|
Real64 Accumulator;
|
||||||
Int32 Frames, FPS;
|
Int32 Frames, FPS;
|
||||||
bool Speeding, HalfSpeeding, Noclip, Fly;
|
bool Speed, HalfSpeed, Noclip, Fly, CanSpeed;
|
||||||
Int32 LastFov;
|
Int32 LastFov;
|
||||||
} StatusScreen;
|
} StatusScreen;
|
||||||
StatusScreen StatusScreen_Instance;
|
StatusScreen StatusScreen_Instance;
|
||||||
@ -358,13 +358,16 @@ void StatusScreen_DrawPosition(StatusScreen* screen) {
|
|||||||
GfxCommon_UpdateDynamicVb_IndexedTris(ModelCache_Vb, vertices, index);
|
GfxCommon_UpdateDynamicVb_IndexedTris(ModelCache_Vb, vertices, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusScreen_UpdateHackState(StatusScreen* screen, bool force) {
|
bool StatusScreen_HacksChanged(StatusScreen* screen) {
|
||||||
HacksComp* hacks = &LocalPlayer_Instance.Hacks;
|
HacksComp* hacks = &LocalPlayer_Instance.Hacks;
|
||||||
if (force || hacks->Speeding != screen->Speeding || hacks->HalfSpeeding != screen->HalfSpeeding
|
return hacks->Speeding != screen->Speed || hacks->HalfSpeeding != screen->HalfSpeed || hacks->Flying != screen->Fly
|
||||||
|| hacks->Noclip != screen->Noclip || hacks->Flying != screen->Fly || Game_Fov != screen->LastFov) {
|
|| hacks->Noclip != screen->Noclip || Game_Fov != screen->LastFov || hacks->CanSpeed != screen->CanSpeed;
|
||||||
screen->Speeding = hacks->Speeding; screen->Noclip = hacks->Noclip;
|
}
|
||||||
screen->HalfSpeeding = hacks->HalfSpeeding; screen->Fly = hacks->Flying;
|
|
||||||
screen->LastFov = Game_Fov;
|
void StatusScreen_UpdateHackState(StatusScreen* screen) {
|
||||||
|
HacksComp* hacks = &LocalPlayer_Instance.Hacks;
|
||||||
|
screen->Speed = hacks->Speeding; screen->HalfSpeed = hacks->HalfSpeeding; screen->Fly = hacks->Flying;
|
||||||
|
screen->Noclip = hacks->Noclip; screen->LastFov = Game_Fov; screen->CanSpeed = hacks->CanSpeed;
|
||||||
|
|
||||||
UInt8 statusBuffer[String_BufferSize(STRING_SIZE * 2)];
|
UInt8 statusBuffer[String_BufferSize(STRING_SIZE * 2)];
|
||||||
String status = String_InitAndClearArray(statusBuffer);
|
String status = String_InitAndClearArray(statusBuffer);
|
||||||
@ -376,13 +379,12 @@ void StatusScreen_UpdateHackState(StatusScreen* screen, bool force) {
|
|||||||
}
|
}
|
||||||
if (hacks->Flying) String_AppendConst(&status, "Fly ON ");
|
if (hacks->Flying) String_AppendConst(&status, "Fly ON ");
|
||||||
|
|
||||||
bool speed = (hacks->Speeding || hacks->HalfSpeeding) && (hacks->CanSpeed || hacks->BaseHorSpeed > 1);
|
bool speeding = (hacks->Speeding || hacks->HalfSpeeding) && (hacks->CanSpeed || hacks->BaseHorSpeed > 1);
|
||||||
if (speed) String_AppendConst(&status, "Speed ON ");
|
if (speeding) String_AppendConst(&status, "Speed ON ");
|
||||||
if (hacks->Noclip) String_AppendConst(&status, "Noclip ON ");
|
if (hacks->Noclip) String_AppendConst(&status, "Noclip ON ");
|
||||||
|
|
||||||
TextWidget_SetText(&screen->HackStates, &status);
|
TextWidget_SetText(&screen->HackStates, &status);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void StatusScreen_Update(StatusScreen* screen, Real64 delta) {
|
void StatusScreen_Update(StatusScreen* screen, Real64 delta) {
|
||||||
screen->Frames++;
|
screen->Frames++;
|
||||||
@ -432,7 +434,7 @@ void StatusScreen_ContextRecreated(void* obj) {
|
|||||||
Widget_SetLocation(&hacks->Base, ANCHOR_LEFT_OR_TOP, ANCHOR_LEFT_OR_TOP, 2, yOffset);
|
Widget_SetLocation(&hacks->Base, ANCHOR_LEFT_OR_TOP, ANCHOR_LEFT_OR_TOP, 2, yOffset);
|
||||||
hacks->ReducePadding = true;
|
hacks->ReducePadding = true;
|
||||||
Widget_Init(hacks);
|
Widget_Init(hacks);
|
||||||
StatusScreen_UpdateHackState(screen, true);
|
StatusScreen_UpdateHackState(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusScreen_Init(GuiElement* elem) {
|
void StatusScreen_Init(GuiElement* elem) {
|
||||||
@ -454,7 +456,7 @@ void StatusScreen_Render(GuiElement* elem, Real64 delta) {
|
|||||||
Widget_Render(&screen->Status, delta);
|
Widget_Render(&screen->Status, delta);
|
||||||
|
|
||||||
if (!Game_ClassicMode && Gui_Active == NULL) {
|
if (!Game_ClassicMode && Gui_Active == NULL) {
|
||||||
StatusScreen_UpdateHackState(screen, false);
|
if (StatusScreen_HacksChanged(screen)) { StatusScreen_UpdateHackState(screen, false); }
|
||||||
StatusScreen_DrawPosition(screen);
|
StatusScreen_DrawPosition(screen);
|
||||||
Widget_Render(&screen->HackStates, delta);
|
Widget_Render(&screen->HackStates, delta);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user