aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIScene_DebugOptions.cpp
blob: c7db8db945005c610b2aea1dbc2b04b14471227f (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
#include "stdafx.h"
#include "UI.h"
#include "UIScene_DebugOptions.h"

LPCWSTR UIScene_DebugOptionsMenu::m_DebugCheckboxTextA[eDebugSetting_Max+1]=
{
	L"Load Saves From Local Folder Mode",
	L"Write Saves To Local Folder Mode",
	L"Freeze Players", //L"Not Used",
	L"Display Safe Area",
	L"Mobs don't attack",
	L"Freeze Time",
	L"Disable Weather",
	L"Craft Anything",
	L"Use DPad for debug",
	L"Mobs don't tick",
	L"Art tools", //L"Instant Mine",
	L"Show UI Console",
	L"Distributable Save",
	L"Debug Leaderboards",
	L"Height-Water Maps",
	L"Superflat Nether",
	//L"Light/Dark background",
	L"More lightning when thundering",
	L"Biome override",
	//L"Go To End",
	L"Go To Overworld",
	L"Unlock All DLC", //L"Toggle Font",
	L"Show Marketing Guide",
};

UIScene_DebugOptionsMenu::UIScene_DebugOptionsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
	// Setup all the Iggy references we need for this scene
	initialiseMovie();

	unsigned int uiDebugBitmask=app.GetGameSettingsDebugMask(iPad);

	IggyValuePath *root = IggyPlayerRootPath ( getMovie() );
	for(m_iTotalCheckboxElements = 0; m_iTotalCheckboxElements < eDebugSetting_Max && m_iTotalCheckboxElements < 21; ++m_iTotalCheckboxElements)
	{
		wstring label(m_DebugCheckboxTextA[m_iTotalCheckboxElements]);
		m_checkboxes[m_iTotalCheckboxElements].init(label,m_iTotalCheckboxElements,(uiDebugBitmask&(1<<m_iTotalCheckboxElements)) ? true : false);
	}
}

wstring UIScene_DebugOptionsMenu::getMoviePath()
{
	return L"DebugOptionsMenu";
}

void UIScene_DebugOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
	//app.DebugPrintf("UIScene_DebugOptionsMenu handling input for pad %d, key %d, repeat- %s, pressed- %s, released- %s\n", iPad, key, repeat?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE");

	switch(key)
	{
	case ACTION_MENU_CANCEL:
		if(pressed)
		{
			int iCurrentBitmaskIndex=0;
			unsigned int uiDebugBitmask=0L;
			for(int i=0;i<m_iTotalCheckboxElements;i++)
			{
				uiDebugBitmask|=m_checkboxes[i].IsChecked()?(1<<iCurrentBitmaskIndex):0;
				iCurrentBitmaskIndex++;
			}

			if(uiDebugBitmask!=app.GetGameSettingsDebugMask(iPad))
			{
				app.SetGameSettingsDebugMask(iPad,uiDebugBitmask);
				if(app.DebugSettingsOn())
				{
					app.ActionDebugMask(iPad);		
				}
				else
				{
					// force debug mask off
					app.ActionDebugMask(iPad,true);
				}

				app.CheckGameSettingsChanged(true,iPad);
			}

			navigateBack();
		}
		break;
	case ACTION_MENU_OK:
	case ACTION_MENU_UP:
	case ACTION_MENU_DOWN:
	case ACTION_MENU_PAGEUP:
	case ACTION_MENU_PAGEDOWN:
			sendInputToMovie(key, repeat, pressed, released);
		break;
	}
}