Split Up Animated Textures Into Three Flags
This commit is contained in:
parent
781377005e
commit
ecbcfb2922
@ -6,7 +6,8 @@
|
||||
* Add Peaceful Mode To Options Screen
|
||||
* Proper Create New World 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 `Send Full Level When Hosting Game` Feature Flag (Enabled By Default)
|
||||
* Add `Food Overlay` Feature Flag (Disabled By Default)
|
||||
|
@ -8,7 +8,9 @@ TRUE Fix Sign Placement
|
||||
TRUE Show Block Outlines
|
||||
FALSE Expand Creative Mode Inventory
|
||||
FALSE Remove Creative Mode Restrictions
|
||||
TRUE Animated Water & Lava
|
||||
TRUE Animated Water
|
||||
TRUE Animated Lava
|
||||
TRUE Animated Fire
|
||||
TRUE Remove Invalid Item Background
|
||||
TRUE Disable "gui_blocks" Atlas
|
||||
TRUE Fix Camera Rendering
|
||||
|
@ -1,3 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <symbols/minecraft.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern bool buckets_enabled;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <mods/feature/feature.h>
|
||||
#include <mods/init/init.h>
|
||||
#include <mods/misc/misc.h>
|
||||
#include <mods/bucket/bucket.h>
|
||||
|
||||
// Items
|
||||
static FoodItem *bucket = NULL;
|
||||
|
@ -223,23 +223,39 @@ static DynamicTexture *create_fire_texture(int a2) {
|
||||
texture->m_random.param_1 = 0x271;
|
||||
texture->m_random.param_2 = false;
|
||||
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 (DynamicTexture *) texture;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// Call Original Method
|
||||
Textures_addDynamicTexture(textures, dynamic_texture);
|
||||
if (animated_water) {
|
||||
Textures_addDynamicTexture(textures, dynamic_texture);
|
||||
}
|
||||
|
||||
// Add Lava
|
||||
Textures_addDynamicTexture(textures, create_lava_texture());
|
||||
Textures_addDynamicTexture(textures, create_lava_side_texture());
|
||||
Textures_addDynamicTexture(textures, create_fire_texture(0));
|
||||
Textures_addDynamicTexture(textures, create_fire_texture(1));
|
||||
if (animated_lava) {
|
||||
Textures_addDynamicTexture(textures, create_lava_texture());
|
||||
Textures_addDynamicTexture(textures, create_lava_side_texture());
|
||||
}
|
||||
if (animated_fire) {
|
||||
Textures_addDynamicTexture(textures, create_fire_texture(0));
|
||||
Textures_addDynamicTexture(textures, create_fire_texture(1));
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
#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);
|
||||
|
@ -214,10 +214,20 @@ static Texture AppPlatform_linux_loadTexture_injection(__attribute__((unused)) A
|
||||
// Init
|
||||
void init_textures() {
|
||||
// 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);
|
||||
// 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
|
||||
_init_textures_lava();
|
||||
_init_textures_lava(animated_water, animated_lava, animated_fire);
|
||||
}
|
||||
|
||||
// Scale Animated Textures
|
||||
|
Loading…
Reference in New Issue
Block a user