Tweak Camera

This commit is contained in:
TheBrokenRail 2024-11-22 04:20:22 -05:00
parent 2eb6a1c5be
commit b2c13c8257
7 changed files with 24 additions and 7 deletions

View File

@ -93,6 +93,9 @@
* `Force Touch GUI Button Behavior` To `Force Touch UI Button Behavior` * `Force Touch GUI Button Behavior` To `Force Touch UI Button Behavior`
* `Remove Forced GUI Lag (Can Break Joining Servers)` To `Remove Forced UI Lag (Can Break Joining Servers)` * `Remove Forced GUI Lag (Can Break Joining Servers)` To `Remove Forced UI Lag (Can Break Joining Servers)`
* `Hide Block Outline When GUI Is Hidden` To `Hide Block Outline When UI Is Hidden` * `Hide Block Outline When GUI Is Hidden` To `Hide Block Outline When UI Is Hidden`
* `Fix Camera Functionality` To `Add Camera Functionality`
* `Fix Camera Rendering` To `Enable Camera Rendering`
* `Fix Camera Legs` To `Render Camera Legs`
* Add Milk Buckets * Add Milk Buckets
* Included In The `Add Buckets` Feature Flag * Included In The `Add Buckets` Feature Flag
* Removed `Property Scale Animated Textures` Feature Flag * Removed `Property Scale Animated Textures` Feature Flag

View File

@ -33,7 +33,7 @@ static void setup_environment(const options_t &options) {
// Setup MCPI_HOME // Setup MCPI_HOME
setup_home(); setup_home();
// Create If Needed // Create If Needed
const std::string minecraft_folder = std::string(getenv(_MCPI_HOME_ENV)) + get_home_subdirectory_for_game_data(); const std::string minecraft_folder = home_get();
ensure_directory(minecraft_folder.c_str()); ensure_directory(minecraft_folder.c_str());
} }

View File

@ -50,8 +50,8 @@ CATEGORY Rendering
TRUE Multidraw Rendering TRUE Multidraw Rendering
TRUE Increase Render Chunk Size TRUE Increase Render Chunk Size
CATEGORY Camera CATEGORY Camera
TRUE Fix Camera Rendering TRUE Enable Camera Rendering
TRUE Fix Camera Legs TRUE Render Camera Legs
CATEGORY Block Outline CATEGORY Block Outline
TRUE Show Block Outlines TRUE Show Block Outlines
TRUE Replace Block Highlight With Outline TRUE Replace Block Highlight With Outline
@ -141,5 +141,5 @@ CATEGORY Miscellaneous
TRUE Fullscreen Support TRUE Fullscreen Support
TRUE Always Save Chest Tile Entities TRUE Always Save Chest Tile Entities
TRUE Screenshot Support TRUE Screenshot Support
TRUE Fix Camera Functionality TRUE Add Camera Functionality
TRUE Update Default Options TRUE Update Default Options

View File

@ -33,6 +33,7 @@ void media_SDL_WM_SetCaption(const char *title, __attribute__((unused)) const ch
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
// Extra Settings // Extra Settings
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE); glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
glfwWindowHint(GLFW_ALPHA_BITS, 0);
// Create Window // Create Window
glfw_window = create_glfw_window(title, DEFAULT_WIDTH, DEFAULT_HEIGHT); glfw_window = create_glfw_window(title, DEFAULT_WIDTH, DEFAULT_HEIGHT);

View File

@ -14,6 +14,7 @@ void media_begin_offscreen_render(const int width, const int height) {
glfwWindowHint(GLFW_ALPHA_BITS, 8); glfwWindowHint(GLFW_ALPHA_BITS, 8);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
glfwWindowHint(GLFW_ALPHA_BITS, 8);
// Open Window // Open Window
offscreen_window = glfwCreateWindow(width, height, "Offscreen Rendering", nullptr, nullptr); offscreen_window = glfwCreateWindow(width, height, "Offscreen Rendering", nullptr, nullptr);
if (!offscreen_window) { if (!offscreen_window) {

View File

@ -1,6 +1,9 @@
#include <libreborn/patch.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
#include <mods/screenshot/screenshot.h> #include <mods/screenshot/screenshot.h>
#include <mods/init/init.h> #include <mods/init/init.h>
@ -20,6 +23,7 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp
renderer->constructor(); renderer->constructor();
dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer); dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer);
// Return
return dispatcher; return dispatcher;
} }
@ -49,19 +53,19 @@ static void TripodCameraRenderer_render_TileRenderer_tesselateCrossTexture_injec
// Init // Init
void init_camera() { void init_camera() {
// Implement AppPlatform_linux::saveScreenshot So Cameras Work // Implement AppPlatform_linux::saveScreenshot So Cameras Work
if (feature_has("Fix Camera Functionality", server_disabled)) { if (feature_has("Add Camera Functionality", server_disabled)) {
overwrite_calls(AppPlatform_saveScreenshot, AppPlatform_saveScreenshot_injection); overwrite_calls(AppPlatform_saveScreenshot, AppPlatform_saveScreenshot_injection);
} }
// Fix Camera Rendering // Fix Camera Rendering
if (feature_has("Fix Camera Rendering", server_disabled)) { if (feature_has("Enable Camera Rendering", server_disabled)) {
// Enable TripodCameraRenderer // Enable TripodCameraRenderer
overwrite_calls(EntityRenderDispatcher_constructor, EntityRenderDispatcher_injection); overwrite_calls(EntityRenderDispatcher_constructor, EntityRenderDispatcher_injection);
// Display Smoke From TripodCamera Higher // Display Smoke From TripodCamera Higher
overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection); overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection);
} }
// Camera Legs // Camera Legs
if (feature_has("Fix Camera Legs", server_disabled)) { if (feature_has("Render Camera Legs", server_disabled)) {
overwrite_call((void *) 0x659dc, (void *) TripodCameraRenderer_render_EntityRenderer_bindTexture_injection); overwrite_call((void *) 0x659dc, (void *) TripodCameraRenderer_render_EntityRenderer_bindTexture_injection);
overwrite_call((void *) 0x65a08, (void *) TripodCameraRenderer_render_TileRenderer_tesselateCrossTexture_injection); overwrite_call((void *) 0x65a08, (void *) TripodCameraRenderer_render_TileRenderer_tesselateCrossTexture_injection);
} }

View File

@ -106,6 +106,13 @@ static void ArmorScreen_renderPlayer_glRotatef_injection(float angle, float x, f
media_glRotatef(angle, x, y, z); media_glRotatef(angle, x, y, z);
} }
// Fix Camera
static void TripodCameraRenderer_render_Tesselator_draw_injection(Tesselator *self) {
media_glDisable(GL_LIGHTING);
self->draw();
media_glEnable(GL_LIGHTING);
}
// Init // Init
void _init_lighting() { void _init_lighting() {
overwrite_calls(LevelRenderer_renderEntities, LevelRenderer_renderEntities_injection); overwrite_calls(LevelRenderer_renderEntities, LevelRenderer_renderEntities_injection);
@ -124,4 +131,5 @@ void _init_lighting() {
overwrite_calls(MobRenderer_renderNameTag, MobRenderer_renderNameTag_injection); overwrite_calls(MobRenderer_renderNameTag, MobRenderer_renderNameTag_injection);
overwrite_calls(ArmorScreen_renderPlayer, ArmorScreen_renderPlayer_injection); overwrite_calls(ArmorScreen_renderPlayer, ArmorScreen_renderPlayer_injection);
overwrite_call((void *) 0x29d88, (void *) ArmorScreen_renderPlayer_glRotatef_injection); overwrite_call((void *) 0x29d88, (void *) ArmorScreen_renderPlayer_glRotatef_injection);
overwrite_call((void *) 0x65a10, (void *) TripodCameraRenderer_render_Tesselator_draw_injection);
} }