Пример #1
0
void SoundNode::connectDisplay()
{
    if (!AudioEngine::get()) {
        throw Exception(AVG_ERR_UNSUPPORTED, 
                "Sound nodes can only be created if audio is not disabled."); 
    }
    checkReload();
    AreaNode::connectDisplay();
    long long curTime = Player::get()->getFrameTime(); 
    if (m_State != Unloaded) {
        startDecoding();
        m_StartTime = curTime;
        m_PauseTime = 0;
    }
    if (m_State == Paused) {
        m_PauseStartTime = curTime;
    } 
}
Пример #2
0
void ImageNode::setHRef(const UTF8String& href)
{
    m_href = href;
    if (m_pGPUImage->getSource() == GPUImage::SCENE && getState() == Node::NS_CANRENDER)
    {
        m_pGPUImage->getCanvas()->removeDependentCanvas(getCanvas());
    }
    try {
        if (href == "") {
            m_pGPUImage->setEmpty();
        } else {
            checkReload();
        }
    } catch (const Exception&) {
        m_href = "";
        m_pGPUImage->setEmpty();
        throw;
    }
}
int main ()
{
    TowerArray *tArray = initTowerArray();

    /*Tower* initTower(int ttype, int x, int y, int damage, int range, int rtime, int lastShot);*/

    Tower* tower1 = initTower(basicLine,20,30,3,3,3,1); //cant shoot
    Tower* tower2 = initTower(AOE,25,35,4,4,4,4); // can shoot
    Tower* tower3 = initTower(bomb,30,40,5,5,5,2); // can shoot
    Tower* tower4 = initTower(collat,35,45,6,6,6,7); //cant shoot

    tArray->towers[0] = *tower1;
    tArray->towers[1] = *tower2;
    tArray->towers[2] = *tower3;
    tArray->towers[3] = *tower4;
    tArray->size = 4;


    checkReload(tArray);
    updateReload(tArray);

    return 0;
}
/* 
*  Entry point to this module, it checks the towers each gametick to find out 
*  which units will be shooting, and which units they are hitting. 
*/
void checkTowers(TowerArray* allTowers, UnitListHeader* units, Path* path)
{
    TowerArray* towerA;
	int i, j;

	/* Each time that the towerA buffer is updated, check to make sure there is still 
	 * valid towers left in it. */
    updateReload(allTowers);
	towerA = checkReload(allTowers);
    if (towerA == NULL) {
        return;
    }
    towerA = haveUnitsInRange(towerA, units, path);
    if (towerA->size == 0) {
        return;
    }

	/* If we get here, the tower has units to shoot at and is reloaded */
	whichUnitHit (towerA, units, path);
    
    /* Due to an large oversight concering the use of the buffer arrays, 
    *  we need to find the units in the buffer array that are shooting, find 
    *  that tower in the main array passed to us, and change the main array's 
    *  lastShot and isFiring variables, because we destroy the temp array at the 
    *  end of the function. Super hacky solution but it had to be done and it works */ 
    for (i = 0; i < allTowers->size;i++) {
        for (j = 0; j < towerA->size; j++) {
            if (equals(allTowers->towers[i], towerA->towers[j])){
                allTowers->towers[i].lastShot = 0;
                allTowers->towers[i].isFiring = 1;
            }
        }
    }

	/* Free up our temp array */
    destroyTowerArray(towerA);
}
Пример #5
0
void VectorNode::connect(CanvasPtr pCanvas)
{
    Node::connect(pCanvas);
    checkReload();
}
Пример #6
0
void VectorNode::setTexHRef(const UTF8String& href)
{
    m_TexHRef = href;
    checkReload();
    setDrawNeeded();
}
Пример #7
0
void DivNode::setMediaDir(const UTF8String& sMediaDir)
{
//    avgDeprecationWarning("1.7", "DivNode.mediadir", "");
    m_sMediaDir = sMediaDir;
    checkReload();
}
Пример #8
0
void RasterNode::setMaskHRef(const UTF8String& sHref)
{
    m_sMaskHref = sHref;
    checkReload();
}
Пример #9
0
void SoundNode::setHRef(const UTF8String& href)
{
    m_href = href;
    checkReload();
}
Пример #10
0
void SoundNode::connect(CanvasPtr pCanvas)
{
    checkReload();
    AreaNode::connect(pCanvas);
    pCanvas->registerFrameEndListener(this);
}
Пример #11
0
void DivNode::setMediaDir(const UTF8String& sMediaDir)
{
    m_sMediaDir = sMediaDir;
    checkReload();
}
Пример #12
0
void ImageNode::connect(CanvasPtr pCanvas)
{
    RasterNode::connect(pCanvas);
    checkReload();
}