mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Speed in top left status should say 'speed: 15x' instead of just 'speed: ON'
This commit is contained in:
parent
85dfa73921
commit
91bcfd2d37
@ -63,7 +63,8 @@ static struct HUDScreen {
|
|||||||
struct TextAtlas posAtlas;
|
struct TextAtlas posAtlas;
|
||||||
double accumulator;
|
double accumulator;
|
||||||
int frames, fps;
|
int frames, fps;
|
||||||
cc_bool speed, halfSpeed, canSpeed, hacksChanged;
|
cc_bool hacksChanged;
|
||||||
|
float lastSpeed;
|
||||||
int lastFov;
|
int lastFov;
|
||||||
struct HotbarWidget hotbar;
|
struct HotbarWidget hotbar;
|
||||||
} HUDScreen_Instance;
|
} HUDScreen_Instance;
|
||||||
@ -121,30 +122,37 @@ static void HUDScreen_DrawPosition(struct HUDScreen* s) {
|
|||||||
Gfx_UpdateDynamicVb_IndexedTris(Models.Vb, vertices, count);
|
Gfx_UpdateDynamicVb_IndexedTris(Models.Vb, vertices, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float HUDScreen_CalcHacksSpeed(void) {
|
||||||
|
struct HacksComp* hacks = &LocalPlayer_Instance.Hacks;
|
||||||
|
float speed = 0;
|
||||||
|
if (!hacks->CanSpeed) return 0;
|
||||||
|
|
||||||
|
if (hacks->HalfSpeeding) speed += hacks->SpeedMultiplier / 2;
|
||||||
|
if (hacks->Speeding) speed += hacks->SpeedMultiplier;
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
|
||||||
static cc_bool HUDScreen_HasHacksChanged(struct HUDScreen* s) {
|
static cc_bool HUDScreen_HasHacksChanged(struct HUDScreen* s) {
|
||||||
struct HacksComp* hacks = &LocalPlayer_Instance.Hacks;
|
struct HacksComp* hacks = &LocalPlayer_Instance.Hacks;
|
||||||
return hacks->Speeding != s->speed || hacks->HalfSpeeding != s->halfSpeed
|
float speed = HUDScreen_CalcHacksSpeed();
|
||||||
|| Game_Fov != s->lastFov || hacks->CanSpeed != s->canSpeed || s->hacksChanged;
|
return speed != s->lastSpeed || Game_Fov != s->lastFov || s->hacksChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HUDScreen_UpdateHackState(struct HUDScreen* s) {
|
static void HUDScreen_UpdateHackState(struct HUDScreen* s) {
|
||||||
cc_string status; char statusBuffer[STRING_SIZE * 2];
|
cc_string status; char statusBuffer[STRING_SIZE * 2];
|
||||||
struct HacksComp* hacks;
|
struct HacksComp* hacks = &LocalPlayer_Instance.Hacks;
|
||||||
cc_bool speeding;
|
float speed = HUDScreen_CalcHacksSpeed();
|
||||||
|
|
||||||
hacks = &LocalPlayer_Instance.Hacks;
|
s->lastSpeed = speed; s->lastFov = Game_Fov;
|
||||||
s->speed = hacks->Speeding; s->halfSpeed = hacks->HalfSpeeding;
|
|
||||||
s->lastFov = Game_Fov; s->canSpeed = hacks->CanSpeed;
|
|
||||||
s->hacksChanged = false;
|
s->hacksChanged = false;
|
||||||
|
|
||||||
String_InitArray(status, statusBuffer);
|
String_InitArray(status, statusBuffer);
|
||||||
if (Game_Fov != Game_DefaultFov) {
|
if (Game_Fov != Game_DefaultFov) {
|
||||||
String_Format1(&status, "Zoom fov %i ", &Game_Fov);
|
String_Format1(&status, "Zoom fov %i ", &Game_Fov);
|
||||||
}
|
}
|
||||||
speeding = (hacks->Speeding || hacks->HalfSpeeding) && hacks->CanSpeed;
|
|
||||||
|
|
||||||
if (hacks->Flying) String_AppendConst(&status, "Fly ON ");
|
if (hacks->Flying) String_AppendConst(&status, "Fly ON ");
|
||||||
if (speeding) String_AppendConst(&status, "Speed ON ");
|
if (speed) String_Format1(&status, "Speed %f1x ", &speed);
|
||||||
if (hacks->Noclip) String_AppendConst(&status, "Noclip ON ");
|
if (hacks->Noclip) String_AppendConst(&status, "Noclip ON ");
|
||||||
|
|
||||||
TextWidget_Set(&s->line2, &status, &s->font);
|
TextWidget_Set(&s->line2, &status, &s->font);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user