aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/AbstractTexturePack.h
blob: 6386ecf1e4340a94011c30856eea23ae652ed8e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once
using namespace std;

#include "TexturePack.h"

class BufferedImage;

class AbstractTexturePack : public TexturePack
{
private:
	const DWORD id;
	const wstring name;

protected:
	File *file;
	wstring texname;
	wstring m_wsWorldName;

	wstring desc1;
	wstring desc2;

	PBYTE m_iconData;
	DWORD m_iconSize;

	PBYTE m_comparisonData;
	DWORD m_comparisonSize;

	TexturePack *fallback;

	ColourTable *m_colourTable;

protected:
	BufferedImage *iconImage;

private:
	int textureId;

protected:
	AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback);

private:
	static wstring trim(wstring line);
	
protected:
	virtual void loadIcon();
	virtual void loadComparison();
	virtual void loadDescription();
	virtual void loadName();

public:
	virtual InputStream *getResource(const wstring &name, bool allowFallback); //throws IOException
	// 4J Removed do to current override in TexturePack class
	//virtual InputStream *getResource(const wstring &name); //throws IOException
	virtual DLCPack * getDLCPack() =0;


protected:
	virtual InputStream *getResourceImplementation(const wstring &name) = 0; // throws IOException;
public:
	virtual void unload(Textures *textures);
	virtual void load(Textures *textures);
	virtual bool hasFile(const wstring &name, bool allowFallback);
	virtual bool hasFile(const wstring &name) = 0;
	virtual DWORD getId();
	virtual wstring getName();
	virtual wstring getDesc1();
	virtual wstring getDesc2();
	virtual wstring getWorldName();
	
	virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback);

protected:
	virtual wstring getAnimationString(const wstring &textureName, const wstring &path);
	void loadDefaultUI();
	void loadDefaultColourTable();
	void loadDefaultHTMLColourTable();
#ifdef _XBOX
	void loadHTMLColourTableFromXuiScene(HXUIOBJ hObj);
#endif

public:
	virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"");
	virtual void loadColourTable();
	virtual void loadUI();
	virtual void unloadUI();
	virtual wstring getXuiRootPath();
	virtual PBYTE getPackIcon(DWORD &dwImageBytes);
	virtual PBYTE getPackComparison(DWORD &dwImageBytes);
	virtual unsigned int getDLCParentPackId();
	virtual unsigned char getDLCSubPackId();
	virtual ColourTable *getColourTable() { return m_colourTable; }
	virtual ArchiveFile *getArchiveFile() { return nullptr; }
};