Example #1
0
void cheat_entry::menu_text(astring &description, astring &state, UINT32 &flags)
{
	// description is standard
	description.cpy(m_description);
	state.reset();
	flags = 0;

	// some cheat entries are just text for display
	if (is_text_only())
	{
		if (description)
		{
			description.trimspace();
			if (!description)
				description.cpy(MENU_SEPARATOR_ITEM);
		}
		flags = MENU_FLAG_DISABLE;
	}

	// if we have no parameter and no run or off script, it's a oneshot cheat
	else if (is_oneshot())
		state.cpy("Set");

	// if we have no parameter, it's just on/off
	else if (is_onoff())
	{
		state.cpy((m_state == SCRIPT_STATE_RUN) ? "On" : "Off");
		flags = (m_state != 0) ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW;
	}

	// if we have a value parameter, compute it
	else if (m_parameter != NULL)
	{
		if (m_state == SCRIPT_STATE_OFF)
		{
			state.cpy(is_oneshot_parameter() ? "Set" : "Off");
			flags = MENU_FLAG_RIGHT_ARROW;
		}
		else
		{
			state.cpy(m_parameter->text());
			flags = MENU_FLAG_LEFT_ARROW;
			if (!m_parameter->is_maximum())
				flags |= MENU_FLAG_RIGHT_ARROW;
		}
	}
}