Hide crosshair in third person
This commit is contained in:
parent
d69aeed538
commit
a15447b232
|
@ -47,7 +47,8 @@ static void revert_rotation(Entity *entity) {
|
||||||
entity->old_pitch = -entity->old_pitch;
|
entity->old_pitch = -entity->old_pitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static int is_front_facing = 0;
|
static bool is_front_facing = false;
|
||||||
|
static bool is_third_person = false;
|
||||||
static LocalPlayer *stored_player = nullptr;
|
static LocalPlayer *stored_player = nullptr;
|
||||||
static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t original, GameRenderer *game_renderer, float param_1, int param_2) {
|
static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t original, GameRenderer *game_renderer, float param_1, int param_2) {
|
||||||
// Get Objects
|
// Get Objects
|
||||||
|
@ -57,6 +58,7 @@ static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t origin
|
||||||
// Check If In Third-Person
|
// Check If In Third-Person
|
||||||
Options *options = &minecraft->options;
|
Options *options = &minecraft->options;
|
||||||
is_front_facing = (options->third_person == 2);
|
is_front_facing = (options->third_person == 2);
|
||||||
|
is_third_person = options->third_person != 0;
|
||||||
|
|
||||||
// Invert Rotation
|
// Invert Rotation
|
||||||
if (is_front_facing) {
|
if (is_front_facing) {
|
||||||
|
@ -86,6 +88,13 @@ static void ParticleEngine_render_injection(ParticleEngine_render_t original, Pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide crosshairs in 3rd person mode
|
||||||
|
static void Gui_renderProgressIndicator_GuiComponent_blit_injection(GuiComponent *self, int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2) {
|
||||||
|
if (!is_third_person) {
|
||||||
|
GuiComponent_blit(self, x1, y1, x2, y2, w1, h1, w2, h2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
void _init_toggle() {
|
void _init_toggle() {
|
||||||
if (feature_has("Bind Common Toggleable Options To Function Keys", server_disabled)) {
|
if (feature_has("Bind Common Toggleable Options To Function Keys", server_disabled)) {
|
||||||
|
@ -96,4 +105,7 @@ void _init_toggle() {
|
||||||
overwrite_calls(GameRenderer_setupCamera, GameRenderer_setupCamera_injection);
|
overwrite_calls(GameRenderer_setupCamera, GameRenderer_setupCamera_injection);
|
||||||
overwrite_calls(ParticleEngine_render, ParticleEngine_render_injection);
|
overwrite_calls(ParticleEngine_render, ParticleEngine_render_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide crosshair in 3rd person
|
||||||
|
overwrite_call((void *) 0x261b8, (void *) Gui_renderProgressIndicator_GuiComponent_blit_injection);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user