Split Up Animated Textures Into Three Flags

This commit is contained in:
TheBrokenRail 2024-02-07 19:00:55 -05:00
parent 781377005e
commit ecbcfb2922
7 changed files with 51 additions and 11 deletions

View File

@ -6,7 +6,8 @@
* Add Peaceful Mode To Options Screen * Add Peaceful Mode To Options Screen
* Proper Create New World Screen * Proper Create New World Screen
* Proper Chat Screen * Proper Chat Screen
* The `Animated Water` Feature Flag Is Now `Animated Water & Lava` * Add `Animated Lava` Feature Flag (Enabled By Default)
* Add `Animated Fire` Feature Flag (Enabled By Default)
* Add `Use Java Beta 1.3 Light Ramp` Feature Flag (Enabled By Default) * Add `Use Java Beta 1.3 Light Ramp` Feature Flag (Enabled By Default)
* Add `Send Full Level When Hosting Game` Feature Flag (Enabled By Default) * Add `Send Full Level When Hosting Game` Feature Flag (Enabled By Default)
* Add `Food Overlay` Feature Flag (Disabled By Default) * Add `Food Overlay` Feature Flag (Disabled By Default)

View File

@ -8,7 +8,9 @@ TRUE Fix Sign Placement
TRUE Show Block Outlines TRUE Show Block Outlines
FALSE Expand Creative Mode Inventory FALSE Expand Creative Mode Inventory
FALSE Remove Creative Mode Restrictions FALSE Remove Creative Mode Restrictions
TRUE Animated Water & Lava TRUE Animated Water
TRUE Animated Lava
TRUE Animated Fire
TRUE Remove Invalid Item Background TRUE Remove Invalid Item Background
TRUE Disable "gui_blocks" Atlas TRUE Disable "gui_blocks" Atlas
TRUE Fix Camera Rendering TRUE Fix Camera Rendering

View File

@ -1,3 +1,13 @@
#pragma once #pragma once
#include <symbols/minecraft.h>
#ifdef __cplusplus
extern "C" {
#endif
extern bool buckets_enabled; extern bool buckets_enabled;
#ifdef __cplusplus
}
#endif

View File

@ -4,6 +4,7 @@
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
#include <mods/init/init.h> #include <mods/init/init.h>
#include <mods/misc/misc.h> #include <mods/misc/misc.h>
#include <mods/bucket/bucket.h>
// Items // Items
static FoodItem *bucket = NULL; static FoodItem *bucket = NULL;

View File

@ -223,23 +223,39 @@ static DynamicTexture *create_fire_texture(int a2) {
texture->m_random.param_1 = 0x271; texture->m_random.param_1 = 0x271;
texture->m_random.param_2 = false; texture->m_random.param_2 = false;
texture->m_random.param_3 = 0; texture->m_random.param_3 = 0;
for (int i = 0; i < 320; i++) {
texture->m_data1[i] = 0.0f;
texture->m_data2[i] = 0.0f;
}
// Return // Return
return (DynamicTexture *) texture; return (DynamicTexture *) texture;
} }
// Add Textures // Add Textures
static bool animated_water = false;
static bool animated_lava = false;
static bool animated_fire = false;
static void Textures_addDynamicTexture_injection(Textures *textures, DynamicTexture *dynamic_texture) { static void Textures_addDynamicTexture_injection(Textures *textures, DynamicTexture *dynamic_texture) {
// Call Original Method // Call Original Method
Textures_addDynamicTexture(textures, dynamic_texture); if (animated_water) {
Textures_addDynamicTexture(textures, dynamic_texture);
}
// Add Lava // Add Lava
Textures_addDynamicTexture(textures, create_lava_texture()); if (animated_lava) {
Textures_addDynamicTexture(textures, create_lava_side_texture()); Textures_addDynamicTexture(textures, create_lava_texture());
Textures_addDynamicTexture(textures, create_fire_texture(0)); Textures_addDynamicTexture(textures, create_lava_side_texture());
Textures_addDynamicTexture(textures, create_fire_texture(1)); }
if (animated_fire) {
Textures_addDynamicTexture(textures, create_fire_texture(0));
Textures_addDynamicTexture(textures, create_fire_texture(1));
}
} }
// Init // Init
void _init_textures_lava() { void _init_textures_lava(bool animated_water_param, bool animated_lava_param, bool animated_fire_param) {
animated_water = animated_water_param;
animated_lava = animated_lava_param;
animated_fire = animated_fire_param;
overwrite_call((void *) 0x170b4, (void *) Textures_addDynamicTexture_injection); overwrite_call((void *) 0x170b4, (void *) Textures_addDynamicTexture_injection);
} }

View File

@ -1,3 +1,3 @@
#pragma once #pragma once
__attribute__((visibility("internal"))) void _init_textures_lava(); __attribute__((visibility("internal"))) void _init_textures_lava(bool animated_water, bool animated_lava, bool animated_fire);

View File

@ -214,10 +214,20 @@ static Texture AppPlatform_linux_loadTexture_injection(__attribute__((unused)) A
// Init // Init
void init_textures() { void init_textures() {
// Tick Dynamic Textures (Animated Water) // Tick Dynamic Textures (Animated Water)
if (feature_has("Animated Water & Lava", server_disabled)) { bool animated_water = feature_has("Animated Water", server_disabled);
bool animated_lava = feature_has("Animated Lava", server_disabled);
bool animated_fire = feature_has("Animated Fire", server_disabled);
if (animated_water || animated_lava || animated_fire) {
// Tick Dynamic Textures
misc_run_on_tick(Minecraft_tick_injection); misc_run_on_tick(Minecraft_tick_injection);
// Disable Animated Water If Set
if (!animated_water) {
unsigned char disable_water_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x17094, disable_water_patch);
patch((void *) 0x170b4, disable_water_patch);
}
// Animated Lava // Animated Lava
_init_textures_lava(); _init_textures_lava(animated_water, animated_lava, animated_fire);
} }
// Scale Animated Textures // Scale Animated Textures