aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/Tutorial/AreaHint.cpp
blob: 8b711c8807e79ed9626b8ded3c8158edae18c044 (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
#include "stdafx.h"

#include "..\..\Minecraft.h"
#include "..\..\MultiplayerLocalPlayer.h"
#include "AreaHint.h"
#include "..\..\..\Minecraft.World\AABB.h"
#include "Tutorial.h"

AreaHint::AreaHint(eTutorial_Hint id, Tutorial *tutorial, eTutorial_State displayState, eTutorial_State completeState,
	int descriptionId, double x0, double y0, double z0, double x1, double y1, double z1, bool allowFade /*= false*/, bool contains /*= true*/ )
	: TutorialHint( id, tutorial, descriptionId, e_Hint_Area, allowFade )
{
	area = AABB::newPermanent(x0, y0, z0, x1, y1, z1);

	this->contains = contains;

	m_displayState = displayState;
	m_completeState = completeState;
}

AreaHint::~AreaHint()
{
	delete area;
}

int AreaHint::tick()
{	
	Minecraft *minecraft = Minecraft::GetInstance();
	if( (m_displayState == e_Tutorial_State_Any || m_tutorial->getCurrentState() == m_displayState) &&
		m_hintNeeded &&
		area->contains( minecraft->player->getPos(1) ) == contains )
	{
		if( m_completeState == e_Tutorial_State_None ) 
		{
			m_hintNeeded = false;
		}
		else if ( m_tutorial->isStateCompleted( m_completeState ) )
		{
			m_hintNeeded = false;
			return -1;
		}

		return m_descriptionId;
	}
	else
	{
		return -1;
	}
}