From f54d209bc8cb6c4ae8735090b2eb6f15af35ed36 Mon Sep 17 00:00:00 2001
From: grorp <grorp@posteo.de>
Date: Tue, 31 Dec 2024 19:28:57 +0100
Subject: [PATCH] Remove normal map leftovers (#15609)

leftovers from #10487 / ed22260822086f84016aa8384c3174bfc6d1739d
---
 doc/lua_api.md               |  1 -
 src/client/imagesource.cpp   |  7 -------
 src/client/texturesource.cpp | 22 ----------------------
 src/client/texturesource.h   |  2 --
 4 files changed, 32 deletions(-)

diff --git a/doc/lua_api.md b/doc/lua_api.md
index f46c9eb28..af57c5442 100644
--- a/doc/lua_api.md
+++ b/doc/lua_api.md
@@ -188,7 +188,6 @@ Mod directory structure
     │   ├── models
     │   ├── textures
     │   │   ├── modname_stuff.png
-    │   │   ├── modname_stuff_normal.png
     │   │   ├── modname_something_else.png
     │   │   ├── subfolder_foo
     │   │   │   ├── modname_more_stuff.png
diff --git a/src/client/imagesource.cpp b/src/client/imagesource.cpp
index bd612eb2a..e2538c372 100644
--- a/src/client/imagesource.cpp
+++ b/src/client/imagesource.cpp
@@ -980,13 +980,6 @@ bool ImageSource::generateImagePart(std::string_view part_of_name,
 			if (part_of_name.empty())
 				return true;
 
-			// Do not create normalmap dummies
-			if (str_ends_with(part_of_name, "_normal.png")) {
-				warningstream << "generateImagePart(): Could not load normal map \""
-					<< part_of_name << "\"" << std::endl;
-				return true;
-			}
-
 			errorstream << "generateImagePart(): Could not load image \""
 				<< part_of_name << "\" while building texture; "
 				"Creating a dummy image" << std::endl;
diff --git a/src/client/texturesource.cpp b/src/client/texturesource.cpp
index 01d2b8a9d..fd06fcc91 100644
--- a/src/client/texturesource.cpp
+++ b/src/client/texturesource.cpp
@@ -121,7 +121,6 @@ public:
 	// Shall be called from the main thread.
 	void rebuildImagesAndTextures();
 
-	video::ITexture* getNormalTexture(const std::string &name);
 	video::SColor getTextureAverageColor(const std::string &name);
 
 private:
@@ -488,27 +487,6 @@ void TextureSource::rebuildTexture(video::IVideoDriver *driver, TextureInfo &ti)
 		m_texture_trash.push_back(t_old);
 }
 
-video::ITexture* TextureSource::getNormalTexture(const std::string &name)
-{
-	if (isKnownSourceImage("override_normal.png"))
-		return getTexture("override_normal.png");
-	std::string fname_base = name;
-	static const char *normal_ext = "_normal.png";
-	static const u32 normal_ext_size = strlen(normal_ext);
-	size_t pos = fname_base.find('.');
-	std::string fname_normal = fname_base.substr(0, pos) + normal_ext;
-	if (isKnownSourceImage(fname_normal)) {
-		// look for image extension and replace it
-		size_t i = 0;
-		while ((i = fname_base.find('.', i)) != std::string::npos) {
-			fname_base.replace(i, 4, normal_ext);
-			i += normal_ext_size;
-		}
-		return getTexture(fname_base);
-	}
-	return nullptr;
-}
-
 video::SColor TextureSource::getTextureAverageColor(const std::string &name)
 {
 	video::IVideoDriver *driver = RenderingEngine::get_video_driver();
diff --git a/src/client/texturesource.h b/src/client/texturesource.h
index 46cf50c45..1297329dd 100644
--- a/src/client/texturesource.h
+++ b/src/client/texturesource.h
@@ -54,7 +54,6 @@ public:
 	 */
 	virtual Palette* getPalette(const std::string &name) = 0;
 	virtual bool isKnownSourceImage(const std::string &name)=0;
-	virtual video::ITexture* getNormalTexture(const std::string &name)=0;
 	virtual video::SColor getTextureAverageColor(const std::string &name)=0;
 };
 
@@ -75,7 +74,6 @@ public:
 	virtual void processQueue()=0;
 	virtual void insertSourceImage(const std::string &name, video::IImage *img)=0;
 	virtual void rebuildImagesAndTextures()=0;
-	virtual video::ITexture* getNormalTexture(const std::string &name)=0;
 	virtual video::SColor getTextureAverageColor(const std::string &name)=0;
 };