aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Options.h
blob: 8be61ac6ebaa5a48120a0a3ac4dc4a96d60ae875 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#pragma once
using namespace std;
class Minecraft;
class KeyMapping;
#include "..\Minecraft.World\File.h"

class Options
{
public:
	static const int AO_OFF = 0;
	static const int AO_MIN = 1;
	static const int AO_MAX = 2;

	// 4J - this used to be an enum
    class Option
	{
	public:
		static const Option options[17];
		static const Option *MUSIC;
		static const Option *SOUND;
		static const Option *INVERT_MOUSE;
		static const Option *SENSITIVITY;
		static const Option *RENDER_DISTANCE;
		static const Option *VIEW_BOBBING;
		static const Option *ANAGLYPH;
		static const Option *ADVANCED_OPENGL;
		static const Option *FRAMERATE_LIMIT;
		static const Option *DIFFICULTY;
		static const Option *GRAPHICS;
		static const Option *AMBIENT_OCCLUSION;
		static const Option *GUI_SCALE;
		static const Option *FOV;
		static const Option *GAMMA;
		static const Option *RENDER_CLOUDS;
		static const Option *PARTICLES;

	private:
		const bool _isProgress;
        const bool _isBoolean;
        const wstring captionId;

	public:
		static const Option *getItem(int id);

        Option(const wstring& captionId, bool hasProgress, bool isBoolean);
        bool	isProgress() const;
		bool	isBoolean() const;
		int		getId() const;
		wstring getCaptionId() const;
    };

private:
	static const wstring RENDER_DISTANCE_NAMES[];
    static const wstring DIFFICULTY_NAMES[];
    static const wstring GUI_SCALE[];
    static const wstring FRAMERATE_LIMITS[];
	static const wstring PARTICLES[];

public:
	float music;
    float sound;
    float sensitivity;
    bool invertYMouse;
    int viewDistance;
    bool bobView;
    bool anaglyph3d;
    bool advancedOpengl;
    int framerateLimit;
    bool fancyGraphics;
    bool ambientOcclusion;
	bool renderClouds;
    wstring skin;

    KeyMapping *keyUp;
    KeyMapping *keyLeft;
    KeyMapping *keyDown;
    KeyMapping *keyRight;
    KeyMapping *keyJump;
    KeyMapping *keyBuild;
    KeyMapping *keyDrop;
    KeyMapping *keyChat;
    KeyMapping *keySneak;
	KeyMapping *keyAttack;
    KeyMapping *keyUse;
    KeyMapping *keyPlayerList;
    KeyMapping *keyPickItem;
    KeyMapping *keyToggleFog;

	static const int keyMappings_length = 14;
    KeyMapping *keyMappings[keyMappings_length];

protected:
	Minecraft *minecraft;
private:
	File optionsFile;

public:
	int difficulty;
    bool hideGui;
    bool thirdPersonView;
    bool renderDebug;
    wstring lastMpIp;

    bool isFlying;
    bool smoothCamera;
    bool fixedCamera;
    float flySpeed;
    float cameraSpeed;
    int guiScale;
	int particles; // 0 is all, 1 is decreased and 2 is minimal
	float fov;
	float gamma;

	void init();	// 4J added
    Options(Minecraft *minecraft, File workingDirectory);
    Options();
    wstring getKeyDescription(int i);
    wstring getKeyMessage(int i);
    void setKey(int i, int key);
    void set(const Options::Option *item, float value);
    void toggle(const Options::Option *option, int dir);
    float getProgressValue(const Options::Option *item);
    bool getBooleanValue(const Options::Option *item);
    wstring getMessage(const Options::Option *item);
    void load();
private:
	float readFloat(wstring string);
public:
	void save();

	bool isCloudsOn();
};