コード例 #1
0
// scrolls the map one pixel left
bool CMap::scrollLeft(const bool force)
{
    if( !force && findVerticalScrollBlocker((m_scrollx)<<STC) )
        return false;

    const int squareSize = gVideoDriver.getScrollSurface()->w;

	if( m_scrollx > 32 )
	{
		m_scrollx--;
        gVideoDriver.mpVideoEngine->UpdateScrollBufX(m_scrollx, squareSize-1);

		if (m_scrollpix==0)
		{  // need to draw a new stripe
			if(m_mapx>0) m_mapx--;
			if (m_mapxstripepos == 0)
			{
                m_mapxstripepos = (squareSize - 16);
			}
			else
			{
				m_mapxstripepos -= 16;
			}
			drawVstripe(m_mapxstripepos, m_mapx);

			m_scrollpix = 15;
		} else m_scrollpix--;

        refreshVisibleArea();
		return true;
	}
	return false;
}
コード例 #2
0
ファイル: CMap.cpp プロジェクト: Shayster/Commander-Genius
// scrolls the map one pixel left
bool CMap::scrollLeft(const bool force)
{
	if( m_scrollx > 32 )
	{
		m_scrollx--;
		m_scrollx_buf = m_scrollx&511;

		if (m_scrollpix==0)
		{  // need to draw a new stripe
			if(m_mapx>0) m_mapx--;
			if (m_mapxstripepos == 0)
			{
				m_mapxstripepos = (512 - 16);
			}
			else
			{
				m_mapxstripepos -= 16;
			}
			drawVstripe(m_mapxstripepos, m_mapx);

			m_scrollpix = 15;
		} else m_scrollpix--;
	}
	return true;
}
コード例 #3
0
// scrolls the map one pixel right
bool CMap::scrollRight(const bool force)
{
    const int res_width = gVideoDriver.getGameResolution().w;

    if( !force && findVerticalScrollBlocker((m_scrollx+res_width)<<STC) )
		return false;

    const int squareSize = gVideoDriver.getScrollSurface()->w;

    if(m_scrollx < ((m_width-2)<<4) - res_width)
	{
		m_scrollx++;
        gVideoDriver.mpVideoEngine->UpdateScrollBufX(m_scrollx, squareSize-1);

		m_scrollpix++;
        if (m_scrollpix >= 16)
		{  // need to draw a new stripe
            const int totalNumTiles = squareSize/16;
            drawVstripe(m_mapxstripepos, m_mapx + totalNumTiles);
			m_mapx++;
			m_mapxstripepos += 16;
            if (m_mapxstripepos >= squareSize) m_mapxstripepos = 0;
			m_scrollpix = 0;
		}

        refreshVisibleArea();
		return true;
	}
	return false;
}
コード例 #4
0
ファイル: CMap.cpp プロジェクト: Shayster/Commander-Genius
// scrolls the map one pixel right
bool CMap::scrollRight(const bool force)
{
	if(m_scrollx < ((m_width-2)<<4) - g_pVideoDriver->getGameResolution().w)
	{
		m_scrollx++;
		m_scrollx_buf = m_scrollx&511;

		m_scrollpix++;
		if (m_scrollpix>=16)
		{  // need to draw a new stripe
			drawVstripe(m_mapxstripepos, m_mapx + 32);
			m_mapx++;
			m_mapxstripepos += 16;
			if (m_mapxstripepos >= 512) m_mapxstripepos = 0;
			m_scrollpix = 0;
		}
	}
	return true;
}