void NSInputActionComponent::Remove(std::string p_sAction)
{
	m_listQueuedActions->remove(p_sAction);
	if (!m_listQueuedActions->empty())
	{
		SetCurrentAction(m_listQueuedActions->back());
	}
	else 
	{
		SetCurrentAction("");
	}
}	
Example #2
0
void GameEntity::BeginMoveNextTile(eDirection direction)
{
    assert(direction < NUM_DIRECTIONS);

    if (!mEntityClass->IsCreature())
    {
        assert(!"GameEntity::BeginMoveNextTile creature entity is expected");
    }

    const Direction2D moveDirection = GetDirectionVector(direction);

    // destination tile
    const MapLocation destination = mLocationOnMap + moveDirection;
    if (!GameMap::Instance().IsWithin(destination))
    {
        assert(!"GameEntity::BeginMoveNextTile destination tile is not within map bounds");
    }
    mPrevLocationOnMap = mLocationOnMap;

    MapRectangle rcOccupation;
    GetOccupationRect(rcOccupation);

    GameMap::Instance().RemoveOccupant(this, rcOccupation);
    mLocationOnMap = destination;

    GetOccupationRect(rcOccupation);
    GameMap::Instance().AssignOccupant(this, rcOccupation);
    SelectEntityAnimation(eEntityAction::aMoveNextTile, direction);
    SetCurrentAction(eEntityAction::aMoveNextTile);
}
Example #3
0
ACTIONRESULT DETOUR_CGameSprite::DETOUR_ExecuteAction() {
	if (0) IECString("DETOUR_CGameSprite::DETOUR_ExecuteAction");

	m_bExecutingAction = TRUE;
	ACTIONRESULT ar = ACTIONRESULT_ERROR;

	if (m_aCurrent.m_wOpcode == ACTION_BREAK_INSTANTS) SetCurrentAction(GetTopAction(g_pActionTemp));

	switch (m_aCurrent.m_wOpcode) {
	case ACTION_BREAK_INSTANTS:
		ar = ACTIONRESULT_DONE; //re-implement here to prevent weird behaviour for double BreakInstants()
		break;
	case ACTION_LOSE_GAME:
		g_pChitin->GetInfGame().SetLoseCutscene();
		ar = ACTIONRESULT_DONE;
		break;
	case ACTION_DIALOG_SET_GLOBAL:
		m_aCurrent.m_wOpcode = ACTION_SET_GLOBAL;
		return (this->*Tramp_CGameSprite_ExecuteAction)();
		break;
	case ACTION_DIALOG_INCREMENT_GLOBAL:
		m_aCurrent.m_wOpcode = ACTION_INCREMENT_GLOBAL;
		return (this->*Tramp_CGameSprite_ExecuteAction)();
		break;
	case ACTION_DIALOG_SG:
		m_aCurrent.m_wOpcode = ACTION_SG;
		return (this->*Tramp_CGameSprite_ExecuteAction)();
		break;
	case ACTION_ASSIGN:
		ar = ActionAssign(m_aCurrent);
		break;
	case ACTION_EVAL:
		ar = ActionEval(m_aCurrent);
		break;
	case ACTION_CLEAR_BLOCK_VARIABLES:
		ar = ActionClearBlockVars();
		break;
	default:
		return (this->*Tramp_CGameSprite_ExecuteAction)();
		break;
	}

	arCurrent = ar;
	m_bExecutingAction = FALSE;

	return ar;

	return (this->*Tramp_CGameSprite_ExecuteAction)();
}
void NSInputActionComponent::Push(std::string p_sAction)
{
	m_listQueuedActions->push_back(p_sAction);
	SetCurrentAction(p_sAction);
}