Ejemplo n.º 1
0
static bool GetQuantityMenuInfo_Execute(COMMAND_ARGS, UInt32 which)
{
	QuantityMenu* menu = (QuantityMenu*)GetMenuByType(kMenuType_Quantity);
	if (menu) {
		switch (which) {
			case kQuantityMenu_Max:
				*result = menu->maxQuantity;
				DEBUG_PRINT("GetQMMaximum >> %d", menu->maxQuantity);
				return true;
			case kQuantityMenu_Cur:
				{
					if (menu->quantity_scroll) {
						Tile::Value* val = menu->quantity_scroll->GetValueByType(kTileValue_user7);
						if (val) {
							*result = val->num;
							DEBUG_PRINT("GetQMCurrent >> %.0f", val->num);
						}
					}
				}
				return true;
			case kQuantityMenu_Item:
				{
					TESForm* item = NULL;
					UInt32* refResult = (UInt32*)result;
					*refResult = 0;

					if (menu->itemTile) {
						Tile::Value* val = menu->itemTile->GetValueByType(kTileValue_user11);
						if (val) {
							UInt32 idx = val->num;
							// are we bartering? and what container is open?
							bool bMerchant = false;
							TESObjectREFR* container = *g_thePlayer;
							if (menu->unk44 == 0x33) {
								ContainerMenu* contMenu = (ContainerMenu*)GetMenuByType(kMenuType_Container);
								container = contMenu->isContainerContents ? contMenu->refr : container;
								bMerchant = contMenu && contMenu->isContainerContents && contMenu->isBarter;
							}

							item = container->GetInventoryItem(idx, bMerchant);
							*refResult = item ? item->refID : 0;
							DEBUG_PRINT("GetQMItem >> %s", GetFullName(item));
						}
					}
				}
				return true;
		}
	}
	return true;
}
Ejemplo n.º 2
0
void TextInputMessageBox::Update()
{
	std::string text = m_promptText + m_inputText;

	MessageMenu* msgBox = (MessageMenu*)GetMenuByType(kMenuType_Message);
	if (!msgBox)	//original msgBox was closed/overwritten
	{
		Init();														//so re-display it
		msgBox = (MessageMenu*)GetMenuByType(kMenuType_Message);
	}
	else if (*ShowMessageBox_pScriptRefID != m_scriptRefID || !msgBox->IsScriptMessageBox())
		return;	// someone else is displaying a messagebox, let's not interfere

	msgBox->messageText->SetStringValue(kTileValue_string, text.c_str());
	msgBox->messageText->UpdateField(kTileValue_string, 0.0, text.c_str());
}
Ejemplo n.º 3
0
static bool Cmd_GetMapMarkers_Execute(COMMAND_ARGS)
{
	UInt32 inclHidden = 1;
	UInt32 markerType = 0;

	ArrayID arr = g_ArrayMap.Create(kDataType_Numeric, true, scriptObj->GetModIndex());
	*result = arr;

	if(ExtractArgs(PASS_EXTRACT_ARGS, &inclHidden, &markerType))
	{
		std::vector<TESObjectREFR*> vec;
		MapMenu* mapMenu = (MapMenu*)GetMenuByType(kMenuType_Map);
		for (MapMenu::MapMarkerEntry* cur = mapMenu->mapMarkers; cur && cur->mapMarker; cur = cur->next){
			ExtraMapMarker* markerExtra = (ExtraMapMarker*)cur->mapMarker->baseExtraList.GetByType(kExtraData_MapMarker);
			UInt32 isVisible = markerExtra->IsVisible();
			UInt32 canTravel = markerExtra->CanTravelTo();
			if(!markerType || markerType == markerExtra->data->type){
				if ((inclHidden == 0 && isVisible && canTravel) || (inclHidden == 1 && isVisible) || inclHidden == 2){
					//It seems that disabled mapmarkers are considered visible so an extra check is needed
					if(!cur->mapMarker->IsDisabled() || inclHidden == 2){
						vec.push_back(cur->mapMarker);	
					}
				}
			}
		}
		//We wanna reverse the array to make it easier to combine with the GetMenuChildXXXValue functions
		std::reverse(vec.begin(), vec.end());
		for (UInt32 i = 0; i < vec.size(); i++) {
			g_ArrayMap.SetElementFormID(arr, (double)i, vec[i]->refID);
		}
	} 

	return true;
}
Ejemplo n.º 4
0
bool TextInputJournal::IsOpen() const
{
	BookMenu* bookMenu = (BookMenu*)GetMenuByType(kMenuType_Book);
	if (bookMenu && bookMenu->book == m_dummyBook)
		return true;
	else
		return false;
}
Ejemplo n.º 5
0
static bool Cmd_IsGameMessageBox_Execute(COMMAND_ARGS)
{
	*result = 0;
	MessageMenu* menu = (MessageMenu*)GetMenuByType(kMenuType_Message);
	if (menu)	// if not game generated, expression is true
		*result = (menu->buttonCallback == ShowMessageBox_Callback) ? 0 : 1;

	return true;
}
Ejemplo n.º 6
0
TextInputMessageBox::~TextInputMessageBox()
{
	ToggleMenuShortcutKeys(true);

	MessageMenu* menu = (MessageMenu*)GetMenuByType(kMenuType_Message);
	if (menu)
		menu->HandleClick(menu->kButtonID_Close, 0);		//closes the menu

	delete[] m_fmtString;
}
Ejemplo n.º 7
0
TextInputJournal::~TextInputJournal()
{
	ToggleMenuShortcutKeys(true);

	BookMenu* menu = (BookMenu*)GetMenuByType(kMenuType_Book);
	if (menu)
		menu->HandleClick(menu->kButtonID_Exit, 0);		//closes the menu

	m_dummyBook->Destroy(false);
}
Ejemplo n.º 8
0
void TextInputJournal::Init()
{
	//TODO: Turn creation of menus into a template function?

	InterfaceManager* intfc = InterfaceManager::GetSingleton();

	// Is BookMenu already open?
	BookMenu* bookMenu = (BookMenu*)GetMenuByType(kMenuType_Book);
	if (bookMenu)	// open, so get rid of it first
		bookMenu->Destructor(1);

	// create new book menu
	Tile* tile = intfc->menuRoot->ReadXML("data\\menus\\book_menu.xml");
	if (tile)
	{
		Tile* bookRoot = tile->GetRoot();
		if (bookRoot)
		{
			TileMenu* bookMenuTile = tile_cast <TileMenu>(bookRoot);
			if (bookMenuTile)
			{
				BookMenu* bookMenu = (BookMenu*)(bookMenuTile->menu);
				if (bookMenu)
				{
					bookMenu->book = m_dummyBook;
					bookMenu->bookRef = NULL;

					ToggleMenuShortcutKeys(false, bookMenu);

					bookMenu->RegisterTile(bookMenuTile);
					
					// update depth
					Tile* backgroundTile = NULL;
					if (m_dummyBook->IsScroll())
						backgroundTile = bookMenu->tile->GetChildByName("book_background_scroll");
					else
						backgroundTile = bookMenu->tile->GetChildByName("book_background");

					Tile::Value* depthVal = backgroundTile->GetValueByType(kTileValue_depth);
					if (depthVal)
					{
						backgroundTile->UpdateFloat(kTileValue_depth, depthVal->num + intfc->GetDepth());
						depthVal->num += intfc->GetDepth();
					}

					if (!m_dummyBook->IsScroll())
						bookMenu->tile->UpdateFloat(BookMenu::kBookValue_IsBook, 2.0);	
					
					bookMenu->EnableMenu(false);
					bookMenu->UpdateText(m_inputText.c_str());
				}
			}
		}
	}
}
Ejemplo n.º 9
0
static bool Cmd_GetMapMenuMarkerName_Execute(COMMAND_ARGS)
{
	const char* name = "";

	MapMenu* mapMenu = (MapMenu*)GetMenuByType(kMenuType_Map);
	if (mapMenu)
		name = mapMenu->GetSelectedMarkerName();

	AssignToStringVar(PASS_COMMAND_ARGS, name);
	return true;
}
Ejemplo n.º 10
0
static bool Cmd_SetButtonPressed_Execute(COMMAND_ARGS)
{
	UInt32 button = 0;
	if (ExtractArgs(PASS_EXTRACT_ARGS, &button))
	{
		MessageMenu* menu = (MessageMenu*)GetMenuByType(kMenuType_Message);
		if (menu)
			menu->HandleClick(menu->kButtonID_Button1 + button, 0);
	}

	return true;
}
Ejemplo n.º 11
0
static Tile* ExtractMenuComponent(COMMAND_ARGS, const char* componentNameBuffer)
{
	UInt32 menuType = 0;
	Tile* tile = NULL;

	if (ExtractArgs(PASS_EXTRACT_ARGS, componentNameBuffer, &menuType))
	{
		Menu* menu = GetMenuByType(menuType);
		if (menu)
			tile = menu->GetComponentByName(componentNameBuffer);
	}

	return tile;
}
Ejemplo n.º 12
0
static bool Cmd_GetBarterItem_Execute(COMMAND_ARGS)
{
	UInt32* refResult = (UInt32*)result;
	*refResult = 0;

	ContainerMenu* contMenu = (ContainerMenu*)GetMenuByType(kMenuType_Container);
	if (contMenu) {
		TESForm* item = contMenu->GetItem();
		if (item) {
			*refResult = item->refID;
		}
	}

	return true;
}
Ejemplo n.º 13
0
static bool Cmd_GetEnchMenuBaseItem_Execute(COMMAND_ARGS)
{
	UInt32* refResult = (UInt32*)result;
	*refResult = 0;

	EnchantmentMenu* theMenu = (EnchantmentMenu*)GetMenuByType(kMenuType_Enchantment);
	if (theMenu && theMenu->enchantableInfo){
		TESForm* item = theMenu->enchantableInfo->form;
		if(item){
			*refResult = item->refID;
		}
	}

	if(IsConsoleMode())
		Console_Print("GetEnchMenuBaseItem >> (%08x)", *refResult);

	return true;
}
Ejemplo n.º 14
0
static bool Cmd_GetClassMenuSelectedClass_Execute(COMMAND_ARGS)
{
	UInt32* refResult = (UInt32*)result;
	*refResult = 0;

	ClassMenu* theMenu = (ClassMenu*)GetMenuByType(kMenuType_Class);
	if (theMenu){
		TESClass* theClass = theMenu->selectedClass;
		if (theClass) {
			*refResult = theClass->refID;
		}
	}

	if(IsConsoleMode())
		Console_Print("GetSelectedClass >> (%08X)", *refResult);

	return true;
}
Ejemplo n.º 15
0
static bool Cmd_GetMapMenuMarkerRef_Execute(COMMAND_ARGS)
{
	UInt32* refResult = (UInt32*)result;
	*refResult = 0;

	MapMenu* mapMenu = (MapMenu*)GetMenuByType(kMenuType_Map);
	if (mapMenu)
	{
		TESObjectREFR* markerRef = mapMenu->GetSelectedMarker();
		if (markerRef)
		{
			*refResult = markerRef->refID;
			if (IsConsoleMode())
				Console_Print("GetMapMenuMarkerRef >> %s (%08X)", GetFullName(markerRef), markerRef->refID);
		}
	}

	return true;
}
Ejemplo n.º 16
0
static bool Cmd_ClickMenuButton_Execute(COMMAND_ARGS)
{
	UInt32 menuType;
	char name[kMaxMessageLength] = { 0 };

	if (ExtractFormatStringArgs(0, name, paramInfo, arg1, opcodeOffsetPtr, scriptObj, eventList, kCommandInfo_GetMenuFloatValue.numParams, &menuType))
	{
		Menu* menu = GetMenuByType(menuType);
		if (menu && name)
		{
			UInt32 buttonID = 0;
			Tile* parentTile = NULL;

			if (name[0] == '#')		// component specified by ID rather than name
			{
				buttonID = atoi(name + 1);
				parentTile = menu->tile->GetChildByIDTrait(buttonID);
			}
			else		// roundabout way of getting a button tile - look up the <id> trait then take the parent tile
			{
				UInt32 nameLen = strlen(name);
				name[nameLen] = '\\';
				name[nameLen+1] = 'i';
				name[nameLen+2] = 'd';
				name[nameLen+3] = '\0';

				Tile::Value* val = menu->tile->GetValueByName(name);
				if (val)
				{
					buttonID = val->num;
					parentTile = val->parentTile;
				}
			}

			//DEBUG_PRINT("Parent Tile: %08x, ID: %d", parentTile, buttonID);
			if (parentTile)
				menu->HandleClick(buttonID, parentTile);
		}
	}

	return true;
}
Ejemplo n.º 17
0
void TextInputMessageBox::Init()
{
	char* buttons[10] = { NULL };
	UInt32 numButtons = 0;
	UInt32 fmtStringLen = strlen(m_fmtString);
	char* fmtString = new char[fmtStringLen + 1];
	strcpy_s(fmtString, fmtStringLen + 1, m_fmtString);

	//separate prompt text and button text
	for (UInt32 strPos = 0; strPos < fmtStringLen && numButtons < 10; strPos++)
	{
		if (fmtString[strPos] == GetSeparatorChar(m_script) && (strPos + 1 < fmtStringLen))
		{
			fmtString[strPos] = '\0';
			buttons[numButtons++] = fmtString + strPos + 1;
		}
	}

	m_promptText = fmtString;
	if (!buttons[0])				//supply default button if none specified
		buttons[0] = "Finished";

	//now display the messagebox
	ShowMessageBox(fmtString, ShowMessageBox_Callback, 0, buttons[0], buttons[1], buttons[2], buttons[3], buttons[4],
		buttons[5], buttons[6], buttons[7], buttons[8], buttons[9], 0);

	//Register it with the game so scripts can pick up button pressed
	*ShowMessageBox_pScriptRefID = m_scriptRefID;
	*ShowMessageBox_button = -1;

	//Disable menu shortcut keys so they don't interfere with typing
	if (!m_bShortcutsDisabled)
	{
		m_bShortcutsDisabled = true;
		ToggleMenuShortcutKeys(false, GetMenuByType(kMenuType_Message));
	}
}
Ejemplo n.º 18
0
void TextInputJournal::Update()
{
	BookMenu* bookMenu = (BookMenu*)GetMenuByType(kMenuType_Book);
	if (bookMenu && bookMenu->book == m_dummyBook)
		bookMenu->UpdateText((m_promptText + m_inputText).c_str());
}
Ejemplo n.º 19
0
static bool Cmd_GetClassMenuHighlightedClass_Execute(COMMAND_ARGS)
{
	UInt32* refResult = (UInt32*)result;
	*refResult = 0;
	
	// make sure the user is actually doing class selection
	ClassMenu* theMenu = (ClassMenu*)GetMenuByType(kMenuType_Class);
	if (!theMenu){
		if(IsConsoleMode())
			Console_Print("GetHighlightedClass >> Class menu not open");
		return true;
	}

	Tile* tile = NULL;
	tile = InterfaceManager::GetSingleton()->activeTile;
	if (!tile){
		if(IsConsoleMode())
			Console_Print("GetHighlightedClass >> Not selecting a class");
		return true;
	}

	if (strcmp(tile->parent->GetQualifiedName().c_str(), "class_background\\class_list_window\\class_list_pane")){
		if(IsConsoleMode())
			Console_Print("GetHighlightedClass >> Not selecting a class");
		return true;
	}

	// get the name of the highlighted class
	const char* className;
	tile->GetStringValue(kTileValue_user1, &className);

	// ClassMenu doesn't have a convenient pointer to the highlighted class?
	// So grab the class info from the menu.
	float specialization;
	theMenu->tile->GetFloatValue(kTileValue_user18, &specialization);

	float attributes[2];
	theMenu->tile->GetFloatValue(kTileValue_user19, &attributes[0]);
	theMenu->tile->GetFloatValue(kTileValue_user20, &attributes[1]);

	float skills[7];
	theMenu->tile->GetFloatValue(kTileValue_user11, &skills[0]);
	theMenu->tile->GetFloatValue(kTileValue_user12, &skills[1]);
	theMenu->tile->GetFloatValue(kTileValue_user13, &skills[2]);
	theMenu->tile->GetFloatValue(kTileValue_user14, &skills[3]);
	theMenu->tile->GetFloatValue(kTileValue_user15, &skills[4]);
	theMenu->tile->GetFloatValue(kTileValue_user16, &skills[5]);
	theMenu->tile->GetFloatValue(kTileValue_user17, &skills[6]);

	// iterate over all classes in the game to find one that matches
	DataHandler::Node<TESClass> *classNode = &(*g_dataHandler)->classes;
	TESClass* theClass = NULL;
	while(classNode && classNode->data){
		theClass = classNode->data;
		if(theClass->IsPlayable()){
			if(!strcmp(theClass->GetFullName()->name.m_data, className)){
				if(theClass->specialization == (UInt32)specialization){
					if(theClass->attributes[0] == (UInt32)attributes[0] && theClass->attributes[1] == (UInt32)attributes[1]){
						bool bAttributesMatch = true;
						for (UInt32 i = 0; i < 7; i++) {
							if (theClass->majorSkills[i] != skills[i]) {
								bAttributesMatch = false;
								break;
							}
						}
						if (bAttributesMatch) {
							*refResult = theClass->refID;
							break;
						}
					}
				}
			}
		}
		classNode = classNode->next;
	}

	if(IsConsoleMode())
		Console_Print("GetHighlightedClass >> (%08X)", *refResult);

	return true;
}
Ejemplo n.º 20
0
static bool GetSetMenuValue_Execute(COMMAND_ARGS, UInt32 mode)
{
	const char* separatorChar = GetSeparatorChars(scriptObj);
	char stringArg[kMaxMessageLength] = { 0 };
	UInt32 menuType = 0;
	float newFloatVal = 0;
	char* newStringVal = NULL;
	
	char* componentPath = stringArg;

	bool bExtracted = false;
	switch (mode)
	{
	case kGetFloat:
	case kGetString:
	case kExists:
		bExtracted = ExtractFormatStringArgs(0, stringArg, paramInfo, arg1, opcodeOffsetPtr, scriptObj, eventList, kCommandInfo_GetMenuFloatValue.numParams, &menuType);
		break;
	case kSetFloat:
		bExtracted = ExtractFormatStringArgs(0, stringArg, paramInfo, arg1, opcodeOffsetPtr, scriptObj, eventList, kCommandInfo_SetMenuFloatValue.numParams, &menuType, &newFloatVal);
		break;
	case kSetString:
		{
			bExtracted = ExtractFormatStringArgs(0, stringArg, paramInfo, arg1, opcodeOffsetPtr, scriptObj, eventList, kCommandInfo_GetMenuFloatValue.numParams, &menuType);
			// extract new value from format string
			char* context = NULL;
			componentPath = strtok_s(stringArg, separatorChar, &context);
			newStringVal = strtok_s(NULL, separatorChar, &context);
			bExtracted = (bExtracted && componentPath && newStringVal);
		}
		break;
	}

	char* strToAssign = "";

	if (bExtracted)
	{
		Menu* menu = GetMenuByType(menuType);
		if (menu && menu->tile)
		{
			Tile::Value* val = menu->tile->GetValueByName(componentPath);
			if (val)
			{
#if _DEBUG && 0
				val->DumpExpressionList();
#endif
				switch (mode)
				{
				case kExists:
					*result = 1;
					break;
				case kGetFloat:
					if (val->IsNum())
						*result = val->num;
					break;
				case kSetFloat:
					val->bIsNum = 1;
					val->parentTile->UpdateFloat(val->id, newFloatVal);
					break;
				case kGetString:
					if (val->IsString())
						strToAssign = val->str.m_data;
					break;
				case kSetString:
					val->bIsNum = 0;
					val->parentTile->UpdateString(val->id, newStringVal);
					val->parentTile->SetStringValue(val->id, newStringVal);
					val->parentTile->UpdateField(val->id, 0, newStringVal);

					break;
				}
			}
		}
	}

	if (mode == kGetString)		// need to assign even if errors occur during arg extraction/value retrieval
		AssignToStringVar(PASS_COMMAND_ARGS, strToAssign);

	return true;
}
Ejemplo n.º 21
0
static bool Cmd_GetMessageBoxType_Execute(COMMAND_ARGS)
{
	*result = kMsgBox_Unknown;

	MessageMenu* menu = (MessageMenu*)GetMenuByType(kMenuType_Message);
	if (!menu || !menu->buttonCallback || !menu->messageText)
		return true;

	const char* msg = NULL;
	if (!menu->messageText->GetStringValue(kTileValue_string, &msg) || !msg)
		return true;

	std::string msgText(msg);
	SettingInfo* setting = NULL;

	if (menu->buttonCallback == NULL)
	{
		if (GetGameSetting("sNoRepairMagic", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_NoRepairMagic;
	}
	else if (menu->buttonCallback == ShowMessageBox_Callback)
	{
		*result = kMsgBox_Script;
	}
	else if (menu->buttonCallback == ContainerMenuCallback)
	{
		if (GetGameSetting("sBuy", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_BuyItem;
		else if (GetGameSetting("sSell", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_SellItem;
		else if (GetGameSetting("sGiveAway", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_GiveItem;
	}
	else if (menu->buttonCallback == SpellPurchaseCallback)
	{
		if (GetGameSetting("sConfirmBuySpell", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_BuySpell;
	}
	else if (menu->buttonCallback == PoisonConfirmCallback)
	{
		if (GetGameSetting("sPoisonConfirmMessage", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_PoisonWeapon;
		else if (GetGameSetting("sPoisonBowConfirmMessage", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_PoisonWeapon;
	}
	else if (menu->buttonCallback == OverwriteSaveGameCallback)
	{
		if (GetGameSetting("sSaveOverSaveGame", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_OverwriteGame;
	}
	else if (menu->buttonCallback == LoadGameCallback)
	{
		if (GetGameSetting("sLoadFromMainMenu", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_LoadGame;
		else if (GetGameSetting("sLoadWhilePlaying", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_LoadGame;
	}
	else if (menu->buttonCallback == MissingContentCallback)
	{
		if (GetGameSetting("sSaveGameContentIsMissing", &setting) && msgText.find(setting->s) == 0)
			*result = kMsgBox_MissingContent;
	}

	if (IsConsoleMode())
		Console_Print("GetMessageBoxType >> %.0f", *result);

	return true;
}
Ejemplo n.º 22
0
static bool GetActiveMenuElement(COMMAND_ARGS, eMenuValue whichValue, MenuInfo* out, UInt32 whichMenu = 0)
{
	InterfaceManager* intfc = InterfaceManager::GetSingleton();
	Menu* activeMenu = intfc->activeMenu;
	Tile* activeTile = intfc->activeTile;
	if (!activeTile) {
		// theoretically this is active tile if user is navigating by keyboard - for this to work user must pass whichMenu arg
		activeTile = intfc->altActiveTile;
	}

	bool gotValue = false;
	UInt32 intArg = -1;

	//Extract arguments
	if (whichValue < kMenu_Ingredient && whichValue >= kMenu_Selection)	//optional int param specifies menu type
	{
		ExtractArgs(EXTRACT_ARGS, &intArg);
		if (intArg != -1)
			activeMenu = GetMenuByType(intArg);
	}
	else if (whichValue >= kMenu_Ingredient)
	{
		ExtractArgs(EXTRACT_ARGS, &intArg);
		if (intArg == -1)
			return false;
	}

	if (whichMenu)	//specific menu, so look it up directly
		activeMenu = GetMenuByType(whichMenu);

	if (!activeMenu)
		return false;

	//get element based on menu type
	switch (activeMenu->id)
	{
	case kMenuType_Message:
		{
			MessageMenu* msgMenu = (MessageMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Object:
				if (ShowMessageBox_pScriptRefID && msgMenu->IsScriptMessageBox())
				{
					out->form = LookupFormByID(*ShowMessageBox_pScriptRefID);
					gotValue = true;
				}
				else
					out->form = 0;
			default:
				break;
			}
		}
		break;
	case kMenuType_Alchemy:
		{
			AlchemyMenu* menu = (AlchemyMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Object:
				out->form = menu->potion;
				gotValue = true;
				break;
			case kMenu_Ingredient:
				out->form = menu->GetIngredientItem(intArg);
				gotValue = true;
				break;
			case kMenu_IngredientCount:
				out->integer = menu->GetIngredientCount(intArg);
				gotValue = true;
				break;
			case kMenu_Apparatus:
				out->form = menu->GetApparatus(intArg);
				gotValue = true;
				break;
			default:
				break;
			}
		}
		break;
	case kMenuType_Container:
		{
			ContainerMenu* menu = (ContainerMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_ContainerView:
				if (menu->isContainerContents)
					out->integer = 0;
				else
					out->integer = 1;
				gotValue = true;
				break;
			case kMenu_Ref:
				{
					out->form = menu->refr;
					gotValue = true;
					break;
				}
			case kMenu_Filter:
				out->integer = menu->filterType;
				gotValue = true;
				break;
			case kMenu_Selection:
				{
					if (activeTile)
					{
						float fIndex;
						if (activeTile->GetFloatValue(kTileValue_user11, &fIndex))
						{
							UInt32 index = fIndex;
							if (menu->isContainerContents)
								out->form = menu->refr->GetInventoryItem(index, menu->isBarter);
							else
								out->form = (*g_thePlayer)->GetInventoryItem(index, 0);
							gotValue = true;
						}
					}
				}
				break;
			case kMenu_Barter:
				out->integer = menu->isBarter;
				gotValue = true;
				break;
			default:
				break;
			}
			break;
		}
	case kMenuType_Magic:
		{
			MagicMenu* menu = (MagicMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Selection:
				{
					if (activeTile && menu->filterType != MagicMenu::kFilter_ActiveEffects)
					{
						float fIndex;
						if (activeTile->GetFloatValue(kTileValue_user13, &fIndex)) {
							DEBUG_PRINT("Index of active magic item: %.0f", fIndex);
							UInt32 index = fIndex;
							float fObjType;
							if (activeTile->GetFloatValue(kTileValue_user7, &fObjType)) {
								if (fObjType == 8)	{	// a scroll
									TESForm* form = menu->GetMagicItemForIndex(index);
									if (form) {
										out->form = form;
										gotValue = true;
									}
								}
								else {	// a spell
									out->form = MenuSpellListVisitor(&menu->spells).GetNthInfo(index-1);
									gotValue = true;
								}
							}
						}
					}
				}
				break;
			case kMenu_Filter:
				out->integer = menu->filterType;
				gotValue = true;
				break;
			default:
				break;
			}
			break;
		}
	case kMenuType_SpellPurchase:
		{
			SpellPurchaseMenu* menu = (SpellPurchaseMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Selection:
				{
					if (activeTile)
					{
						float fIndex;
						//if (activeTile->GetFloatValue(kTileValue_user11, &fIndex))
						if (activeTile->GetFloatValue(kTileValue_user0, &fIndex))
						{
							UInt32 index = fIndex;
							out->form = MenuSpellListVisitor(&menu->spells).GetNthInfo(index);
							gotValue = true;
						}
					}
					break;
				}
			case kMenu_Ref:
				{
					out->form = menu->spellMerchant;
					gotValue = true;
					break;
				}
			default:
				break;
			}
		}
		break;
	case kMenuType_Enchantment:
		{
			EnchantmentMenu* menu = (EnchantmentMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Soulgem:
				if (menu->soulGemInfo)
				{
					out->form = menu->soulGemInfo->form;
					gotValue = true;
				}
				break;
			case kMenu_EnchantItem:
				out->form = menu->enchantItem;
				gotValue = true;
				break;
			default:
				break;
			}
		}
		break;
	case kMenuType_Book:
		{
			BookMenu* menu = (BookMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Ref:
				out->form = menu->bookRef;
				gotValue = true;
				break;
			case kMenu_Object:
				out->form = menu->book;
				gotValue = true;
				break;
			default:
				break;
			}
		}
		break;
	case kMenuType_Inventory:
		{
			InventoryMenu* menu = (InventoryMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Selection:
				{
					if (activeTile)
					{
						float fIndex;
						if (activeTile->GetFloatValue(kTileValue_user11, &fIndex))
						{
							UInt32 index = fIndex;
							out->form = (*g_thePlayer)->GetInventoryItem(index, 0);
							gotValue = true;
						}
					}
				}
				break;
			case kMenu_Filter:
				out->integer = menu->filterType;
				gotValue = true;
				break;
			default:
				break;
			}
		}
		break;
	case kMenuType_Dialog:
		{
			DialogMenu* menu = (DialogMenu*)activeMenu;
			switch (whichValue)
			{
			case kMenu_Ref:
				out->form = menu->speaker;
				gotValue = true;
				break;
			default:
				break;
			}
		}
		break;
	default:
		break;
	}

	return gotValue;
}