2021-01-27 21:26:19 +00:00
|
|
|
#include <libreborn/libreborn.h>
|
2021-09-12 03:18:12 +00:00
|
|
|
#include <symbols/minecraft.h>
|
2020-12-02 23:18:49 +00:00
|
|
|
|
2022-06-25 21:30:08 +00:00
|
|
|
#include <mods/feature/feature.h>
|
2022-07-13 20:46:33 +00:00
|
|
|
#include <mods/screenshot/screenshot.h>
|
2022-06-25 21:30:08 +00:00
|
|
|
#include <mods/home/home.h>
|
|
|
|
#include <mods/init/init.h>
|
2021-07-04 23:02:45 +00:00
|
|
|
|
2020-12-02 23:18:49 +00:00
|
|
|
// Take Screenshot Using TripodCamera
|
2024-04-03 07:19:12 +00:00
|
|
|
static void AppPlatform_saveScreenshot_injection(__attribute__((unused)) AppPlatform_saveScreenshot_t original, __attribute__((unused)) AppPlatform *app_platform, __attribute__((unused)) std::string *path, __attribute__((unused)) int32_t width, __attribute__((unused)) int32_t height) {
|
2022-07-13 20:46:33 +00:00
|
|
|
#ifndef MCPI_HEADLESS_MODE
|
|
|
|
screenshot_take(home_get());
|
|
|
|
#endif
|
2020-12-02 23:18:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Enable TripodCameraRenderer
|
2024-04-03 07:19:12 +00:00
|
|
|
static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDispatcher_constructor_t original, EntityRenderDispatcher *dispatcher) {
|
2020-12-02 23:18:49 +00:00
|
|
|
// Call Original Method
|
2024-04-03 07:19:12 +00:00
|
|
|
original(dispatcher);
|
2020-12-02 23:18:49 +00:00
|
|
|
|
|
|
|
// Register TripodCameraRenderer
|
2024-05-17 04:36:28 +00:00
|
|
|
TripodCameraRenderer *renderer = new TripodCameraRenderer;
|
2021-02-16 17:26:40 +00:00
|
|
|
ALLOC_CHECK(renderer);
|
2024-05-15 09:02:19 +00:00
|
|
|
renderer->constructor();
|
|
|
|
dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer);
|
2020-12-02 23:18:49 +00:00
|
|
|
|
|
|
|
return dispatcher;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display Smoke From TripodCamera Higher
|
2024-01-06 11:30:23 +00:00
|
|
|
static void TripodCamera_tick_Level_addParticle_call_injection(Level *level, std::string *particle, float x, float y, float z, float deltaX, float deltaY, float deltaZ, int count) {
|
2020-12-02 23:18:49 +00:00
|
|
|
// Call Original Method
|
2024-05-15 09:02:19 +00:00
|
|
|
level->addParticle(particle, x, y + 0.5, z, deltaX, deltaY, deltaZ, count);
|
2020-12-02 23:18:49 +00:00
|
|
|
}
|
|
|
|
|
2021-07-04 23:02:45 +00:00
|
|
|
// Init
|
2020-12-02 23:18:49 +00:00
|
|
|
void init_camera() {
|
|
|
|
// Implement AppPlatform_linux::saveScreenshot So Cameras Work
|
2024-04-03 07:19:12 +00:00
|
|
|
overwrite_virtual_calls(AppPlatform_saveScreenshot, AppPlatform_saveScreenshot_injection);
|
2020-12-02 23:18:49 +00:00
|
|
|
|
2021-07-04 23:02:45 +00:00
|
|
|
// Fix Camera Rendering
|
2022-04-10 00:01:16 +00:00
|
|
|
if (feature_has("Fix Camera Rendering", server_disabled)) {
|
2021-07-04 23:02:45 +00:00
|
|
|
// Enable TripodCameraRenderer
|
2024-04-03 07:19:12 +00:00
|
|
|
overwrite_calls(EntityRenderDispatcher_constructor, EntityRenderDispatcher_injection);
|
2021-07-04 23:02:45 +00:00
|
|
|
// Display Smoke From TripodCamera Higher
|
|
|
|
overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection);
|
|
|
|
}
|
2021-06-17 21:32:24 +00:00
|
|
|
}
|