Fix Particles In Front-Facing View
This commit is contained in:
parent
16ce586e9c
commit
02c73176a5
@ -32,7 +32,7 @@ TRUE Disable V-Sync
|
|||||||
TRUE Fix Options Screen
|
TRUE Fix Options Screen
|
||||||
TRUE Force Touch GUI Inventory
|
TRUE Force Touch GUI Inventory
|
||||||
TRUE Fix Pause Menu
|
TRUE Fix Pause Menu
|
||||||
TRUE Improved Title Screen Background
|
TRUE Add Title Screen Background
|
||||||
TRUE Force Touch GUI Button Behavior
|
TRUE Force Touch GUI Button Behavior
|
||||||
TRUE Improved Button Hover Behavior
|
TRUE Improved Button Hover Behavior
|
||||||
TRUE Implement Create World Dialog
|
TRUE Implement Create World Dialog
|
||||||
|
@ -42,32 +42,58 @@ static void _handle_toggle_options(unsigned char *minecraft) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Font-Facing View
|
// Font-Facing View
|
||||||
|
static void invert_rotation(unsigned char *entity) {
|
||||||
|
if (entity != NULL) {
|
||||||
|
*(float *) (entity + Entity_yaw_property_offset) = 180.f + (*(float *) (entity + Entity_yaw_property_offset));
|
||||||
|
*(float *) (entity + Entity_old_yaw_property_offset) = 180.f + (*(float *) (entity + Entity_old_yaw_property_offset));
|
||||||
|
*(float *) (entity + Entity_pitch_property_offset) = -(*(float *) (entity + Entity_pitch_property_offset));
|
||||||
|
*(float *) (entity + Entity_old_pitch_property_offset) = -(*(float *) (entity + Entity_old_pitch_property_offset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void revert_rotation(unsigned char *entity) {
|
||||||
|
if (entity != NULL) {
|
||||||
|
*(float *) (entity + Entity_yaw_property_offset) = -180.f + (*(float *) (entity + Entity_yaw_property_offset));
|
||||||
|
*(float *) (entity + Entity_old_yaw_property_offset) = -180.f + (*(float *) (entity + Entity_old_yaw_property_offset));
|
||||||
|
*(float *) (entity + Entity_pitch_property_offset) = -(*(float *) (entity + Entity_pitch_property_offset));
|
||||||
|
*(float *) (entity + Entity_old_pitch_property_offset) = -(*(float *) (entity + Entity_old_pitch_property_offset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static int is_front_facing = 0;
|
||||||
|
static unsigned char *stored_player = NULL;
|
||||||
static void GameRenderer_setupCamera_injection(unsigned char *game_renderer, float param_1, int param_2) {
|
static void GameRenderer_setupCamera_injection(unsigned char *game_renderer, float param_1, int param_2) {
|
||||||
// Get Objects
|
// Get Objects
|
||||||
unsigned char *minecraft = *(unsigned char **) (game_renderer + GameRenderer_minecraft_property_offset);
|
unsigned char *minecraft = *(unsigned char **) (game_renderer + GameRenderer_minecraft_property_offset);
|
||||||
unsigned char *player = *(unsigned char **) (minecraft + Minecraft_player_property_offset);
|
stored_player = *(unsigned char **) (minecraft + Minecraft_player_property_offset);
|
||||||
|
|
||||||
// Check If In Third-Person
|
// Check If In Third-Person
|
||||||
unsigned char *options = minecraft + Minecraft_options_property_offset;
|
unsigned char *options = minecraft + Minecraft_options_property_offset;
|
||||||
int is_font_facing = (*(options + Options_third_person_property_offset) == 2);
|
is_front_facing = (*(options + Options_third_person_property_offset) == 2);
|
||||||
|
|
||||||
// Invert Rotation
|
// Invert Rotation
|
||||||
if (is_font_facing && player != NULL) {
|
if (is_front_facing) {
|
||||||
*(float *) (player + Entity_yaw_property_offset) = 180.f + (*(float *) (player + Entity_yaw_property_offset));
|
invert_rotation(stored_player);
|
||||||
*(float *) (player + Entity_old_yaw_property_offset) = 180.f + (*(float *) (player + Entity_old_yaw_property_offset));
|
|
||||||
*(float *) (player + Entity_pitch_property_offset) = -(*(float *) (player + Entity_pitch_property_offset));
|
|
||||||
*(float *) (player + Entity_old_pitch_property_offset) = -(*(float *) (player + Entity_old_pitch_property_offset));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
(*GameRenderer_setupCamera)(game_renderer, param_1, param_2);
|
(*GameRenderer_setupCamera)(game_renderer, param_1, param_2);
|
||||||
|
|
||||||
// Revert
|
// Revert
|
||||||
if (is_font_facing && player != NULL) {
|
if (is_front_facing) {
|
||||||
*(float *) (player + Entity_yaw_property_offset) = -180.f + (*(float *) (player + Entity_yaw_property_offset));
|
revert_rotation(stored_player);
|
||||||
*(float *) (player + Entity_old_yaw_property_offset) = -180.f + (*(float *) (player + Entity_old_yaw_property_offset));
|
}
|
||||||
*(float *) (player + Entity_pitch_property_offset) = -(*(float *) (player + Entity_pitch_property_offset));
|
}
|
||||||
*(float *) (player + Entity_old_pitch_property_offset) = -(*(float *) (player + Entity_old_pitch_property_offset));
|
static void ParticleEngine_render_injection(unsigned char *particle_engine, unsigned char *entity, float param_2) {
|
||||||
|
// Invert Rotation
|
||||||
|
if (is_front_facing && stored_player == entity) {
|
||||||
|
invert_rotation(stored_player);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call Original Method
|
||||||
|
(*ParticleEngine_render)(particle_engine, entity, param_2);
|
||||||
|
|
||||||
|
// Revert
|
||||||
|
if (is_front_facing && stored_player == entity) {
|
||||||
|
revert_rotation(stored_player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,5 +105,6 @@ void _init_toggle() {
|
|||||||
// Font-Facing View
|
// Font-Facing View
|
||||||
if (enable_toggles) {
|
if (enable_toggles) {
|
||||||
overwrite_calls((void *) GameRenderer_setupCamera, (void *) GameRenderer_setupCamera_injection);
|
overwrite_calls((void *) GameRenderer_setupCamera, (void *) GameRenderer_setupCamera_injection);
|
||||||
|
overwrite_calls((void *) ParticleEngine_render, (void *) ParticleEngine_render_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ static void StartMenuScreen_buttonClicked_injection(unsigned char *screen, unsig
|
|||||||
// Init
|
// Init
|
||||||
void init_title_screen() {
|
void init_title_screen() {
|
||||||
// Improved Title Screen Background
|
// Improved Title Screen Background
|
||||||
if (feature_has("Improved Title Screen Background", server_disabled)) {
|
if (feature_has("Add Title Screen Background", server_disabled)) {
|
||||||
// Switch Background
|
// Switch Background
|
||||||
overwrite_call((void *) 0x39528, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
overwrite_call((void *) 0x39528, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
||||||
overwrite_call((void *) 0x3dee0, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
overwrite_call((void *) 0x3dee0, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
||||||
|
@ -226,6 +226,11 @@ static GameRenderer_setupCamera_t GameRenderer_setupCamera = (GameRenderer_setup
|
|||||||
|
|
||||||
static uint32_t GameRenderer_minecraft_property_offset = 0x4; // Minecraft *
|
static uint32_t GameRenderer_minecraft_property_offset = 0x4; // Minecraft *
|
||||||
|
|
||||||
|
// ParticleEngine
|
||||||
|
|
||||||
|
typedef void (*ParticleEngine_render_t)(unsigned char *particle_engine, unsigned char *entity, float param_2);
|
||||||
|
static ParticleEngine_render_t ParticleEngine_render = (ParticleEngine_render_t) 0x43060;
|
||||||
|
|
||||||
// Mouse
|
// Mouse
|
||||||
|
|
||||||
typedef int (*Mouse_get_t)();
|
typedef int (*Mouse_get_t)();
|
||||||
|
Loading…
Reference in New Issue
Block a user