Exemple #1
0
void EffectActor::EndTurnProcess(void)
{
	

	
	while(GetActionQueueNumItems() > 0) 
	{
		GetNextAction(k_doInvisible);
		MapPoint  end;
		m_curAction->GetEndMapPoint(end);
		if (end.x != 0 || end.y != 0) 
		{
			m_pos = end;
		}
	}

	

	if (m_curAction != NULL) 
	{
		sint32 x, y;

		maputils_MapXY2PixelXY(m_pos.x, m_pos.y, &x, &y);

		m_shX = m_x = x;
		m_shY = m_y = y;

		
		m_frame = m_curAction->GetSpriteFrame();

		
		m_transparency = m_curAction->GetTransparency();

		POINT curPt;

		
		if (m_curAction->GetPath() != NULL) {
			
			curPt = m_curAction->GetPosition();

			m_shX = m_x = curPt.x;
			m_shY = m_y = curPt.y;
		}

		
		m_facing = m_curAction->GetFacing();

		
		
		
		if(GetNeedsToDie())
		{
			SetDieAtTick(0);  
			SetKillNow();
		}
	}
}
Exemple #2
0
void WorkerActor::Process(void)
{
	

	if (m_curAction) {
		m_curAction->Process();

		
		if (m_curAction->Finished()) {
			MapPoint  end;
			m_curAction->GetEndMapPoint(end);
			if (end.x != 0 || end.y != 0) {
				m_pos = end;
			}

			GetNextAction();
		}
	}

	if (m_curAction != NULL) {







		
		m_frame = m_curAction->GetSpriteFrame();

		
		m_transparency = m_curAction->GetTransparency();


		
		if (m_curAction->GetPath()) 
        {
		    (void) m_curAction->GetPosition();
		}

		m_facing = m_curAction->GetFacing();
	}
}
Exemple #3
0
void EffectActor::Process(void)
{
	

	
	
	
	
	if(!m_curAction)
		GetNextAction();
			
	if (m_curAction) {

		if(GetActionQueueNumItems() > 0)
			m_curAction->Process(LookAtNextAction());
		else
			m_curAction->Process();

			
		
		
		
		if (m_curAction->Finished()) 
		{
			MapPoint  end;
			m_curAction->GetEndMapPoint(end);
			if (end.x != 0 || end.y != 0) {
				m_pos = end;
			}

			GetNextAction();
		}
	}
	
	
	if (m_curAction != NULL) {
		sint32 x, y;

		maputils_MapXY2PixelXY(m_pos.x, m_pos.y, &x, &y);

		
		
		m_shX = m_x = x;
		m_shY = m_y = y;


		POINT curPt;

		
		if (m_curAction->GetPath() != NULL) {
			
			curPt = m_curAction->GetPosition();

			m_shX = m_x = curPt.x;
			m_shY = m_y = curPt.y;
		}

		if(m_curAction->GetActionType() == EFFECTACTION_PLAY)
		{
			m_lastMoveFacing = m_curAction->GetFacing();
		}

		if(m_curAction->SpecialDelayProcess())
		{
			m_facing = m_lastMoveFacing;
		}
		else
		{
			
			m_facing = m_curAction->GetFacing();
		}
		
		m_frame = m_curAction->GetSpriteFrame();
		
		m_transparency = m_curAction->GetTransparency();
		
		
		
		
		if(GetNeedsToDie() && m_curAction->GetCurrentEndCondition() == ACTIONEND_INTERRUPT)
		{
			SetKillNow();
		}

	}
}
Exemple #4
0
void TradeActor::Process(void)
{
	

 	if (m_curAction) 
	{
		m_curAction->Process();

		
		if (m_curAction->Finished()) 
		{
			MapPoint  end;
			m_curAction->GetEndMapPoint(end);
			if (end.x != 0 || end.y != 0) 
			{
				m_currentPos = end;
			}

			GetNextAction();
		}
	}

	if (m_curAction != NULL) {
		sint32 x, y;

		
		
		
	
		if(m_curAction->GetCurrentEndCondition() == ACTIONEND_INTERRUPT && 	m_curAction->LoopAnimHasCycled())
		{
			m_curAction->ResetAnimLoop();
			m_curAction->SetCurActionCounter(0);
			m_currentPos = GetNextPos();

			
			
			
			
			
			MapPoint tempDestPos = LookAtNextPos();
			MapPoint tempCurPos = m_currentPos;

			
			m_curAction->CreatePath(m_currentPos.x, m_currentPos.y, tempDestPos.x, tempDestPos.y);

		}
		
		maputils_MapXY2PixelXY(m_currentPos.x, m_currentPos.y, &x, &y);
		
		m_x = x;
		m_y = y;

		
		m_frame = m_curAction->GetSpriteFrame();

		
		m_transparency = m_curAction->GetTransparency();

		POINT curPt;

		
		if (m_curAction->GetPath() != NULL) {

			
			curPt = m_curAction->GetPosition();

			



			m_x = curPt.x;
			m_y = curPt.y;
		}
		
		m_facing = m_curAction->GetFacing();
	}
}
Exemple #5
0
bool test6::Parse(xxxx& scanner)
{
	static short gotoCount[] = {
			2, 1, 0, 0, 0};
	static short gotoStart[] = {
			0, 2, 3, 3, 3};
	static dGotoEntry gotoTable[] = {
			dGotoEntry (257, 2), dGotoEntry (258, 1), dGotoEntry (259, 3)};

	dList<dStackPair> stack;
	const int lastToken = 257;
	
	stack.Append ();
	m_grammarError = false;
	dToken token = dToken (scanner.NextToken());
	for (bool terminate = false; !terminate;) {

		const dActionEntry* const action = GetNextAction (stack, token, scanner);
		if (!action) {
			terminate = true;
			fprintf (stderr, "unrecoverable parser error\n");
			DTRACE (("unrecoverable parser error\n"));
		} else {
			switch (action->m_stateType) 
			{
				case dSHIFT: 
				{
					dStackPair& entry = stack.Append()->GetInfo();
					entry.m_state = action->m_nextState;
					entry.m_scannerLine = scanner.GetLineNumber();
					entry.m_scannerIndex = scanner.GetIndex();
					entry.m_value = dUserVariable (token, scanner.GetTokenString(), entry.m_scannerLine, entry.m_scannerIndex);
					token = dToken (scanner.NextToken());
					entry.m_token = token;
					if (token == -1) {
						token = ACCEPTING_TOKEN;
					}

					break;
				}

				case dREDUCE: 
				{
					dStackPair parameter[MAX_USER_PARAM];

					int reduceCount = action->m_ruleSymbols;
					_ASSERTE (reduceCount < sizeof (parameter) / sizeof (parameter[0]));

					for (int i = 0; i < reduceCount; i ++) {
						parameter[reduceCount - i - 1] = stack.GetLast()->GetInfo();
						stack.Remove (stack.GetLast());
					}

					const dStackPair& stackTop = stack.GetLast()->GetInfo();
					int start = gotoStart[stackTop.m_state];
					int count = gotoCount[stackTop.m_state];
					const dGotoEntry* const table = &gotoTable[start];
					const dGotoEntry* const gotoEntry = FindGoto (table, count, dToken (action->m_nextState + lastToken));

					dStackPair& entry = stack.Append()->GetInfo();
					entry.m_state = gotoEntry->m_nextState;
					entry.m_scannerLine = scanner.GetLineNumber();
					entry.m_scannerIndex = scanner.GetIndex();
					entry.m_token = dToken (gotoEntry->m_token);
					
					switch (action->m_ruleIndex) 
					{
						//do user semantic Actions
						case 3:// rule0 : 
							{/*xxx1*/}
							break;
						case 1:// NewtonHeader : 
							{/*xxx0*/}
							break;
						case 4:// rule1 : 
							{/*xxx2*/}
							break;

						default:;
					}

					break;

				}
		
				case dACCEPT: // 2 = accept
				{
					// program parsed successfully, exit with successful code
					terminate = true;
					break;
				}
				
				default:  
				{
					_ASSERTE (0);
					// syntax error parsing program
					//if (!ErrorHandler ("error")) {
					//}
					terminate = true;
					m_grammarError = true;
					break;
				}
			}
		}
	}
	return !m_grammarError;
}