Beispiel #1
0
void MemeSingleGameType::OnBoxDestroy(uint32 x, uint32 y, bool by_bomb)
{
    BillboardDisplayListRecord* templ = BillboardDisplayListRecord::Create(31, 0, 0, 0, 0.8f, 0.8f, true, true);
    sParticleEmitterMgr->AddEmitter(templ, x-0.5f, 0.0f, y-0.5f, 0.6f, 0.6f, 90.0f, 0.0f, 0, 0, 150, 30, 5.0f, 0.1f, 10, 5, 0, 0, 0, 1500);

    if (by_bomb)
    {
        // vytvorit bonus na dynamic mape
        Map* pMap = (Map*)sMapManager->GetMap();
        if (!pMap)
            return;

        // sance 1:1, pozdeji asi doladit
        if (rand()%2 > 0)
        {
            uint32 which = rand()%3;
            pMap->AddDynamicCell(x,y,DYNAMIC_TYPE_BONUS,0,which);
            sMapManager->FillDynamicRecords();
        }
    }

    sGameplayMgr->localPlayerStats.MemeSingleStats.boxesDestroyed += 1;
}
Beispiel #2
0
void MemeSingleGameType::OnGameInit(ModelDisplayListRecord* pPlayerRec)
{
    Map* pMap = (Map*)sMapManager->GetMap();
    if (!pMap)
        return;

    m_enemies.clear();

    pMap->DestroyAllDynamicRecords();

    uint32 startlocpos = 0; // vzdy je jedna vyhrazena pro hrace + se inkrementuje s poctem nepratel

    for (uint32 i = 0; i < pMap->field.size(); i++)
    {
        for (uint32 j = 0; j < pMap->field[0].size(); j++)
        {
            // Muzeme dat bednu jen na misto kde nebude stat hrac, ani pevny objekt mapy
            if (pMap->field[i][j].type == TYPE_GROUND && !pMap->NearStartPos(i,j))
            {
                // pri 10ti se deli dvema, pri 1 se deli 11ti, asi nejjednodussi
                if ((rand()%(12-sGameplayMgr->GetSetting(SETTING_BOX_DENSITY))) == 0)
                {
                    pMap->AddDynamicCell(i,j,DYNAMIC_TYPE_BOX);
                }
            }
        }
    }

    sMapManager->FillDynamicRecords();

    // Pole vsech moznych modelu nepratel
    uint32 EnemyModelMap[] = {11};
    uint32 count = sizeof(EnemyModelMap)/sizeof(uint32);

    uint32 enemycount = 0;

    for (uint32 i = 0; i < pMap->field.size(); i++)
    {
        for (uint32 j = 0; j < pMap->field[0].size(); j++)
        {
            if (pMap->field[i][j].type == TYPE_STARTLOC)
            {
                // Pokud je vetsi nez 0, muzeme tam dat nepritele, jinak se jedna o hracovu pozici
                if (startlocpos > 0 && startlocpos <= sGameplayMgr->GetSetting(SETTING_ENEMY_COUNT))
                {
                    // TODO: lepsi vyber modelu a tak.. asi to bude lepsi presunout do funkce
                    // TODO2: vyber AI urovne podle zvolene v nastaveni.. asi derivovat podtridu, ale je to fuk, de to zapodminkovat
                    EnemyTemplate* pEnemy = new EnemyTemplate;
                    pEnemy->Init(EnemyModelMap[(rand()%count)], i, j, ++enemycount);
                    pEnemy->m_movement->SetSpeedMod(1.0f - (float(sGameplayMgr->GetSetting(SETTING_ENEMY_SPEED)) / 10.0f));
                    pEnemy->m_movement->Mutate(MOVEMENT_TARGETTED);
                    m_enemies.push_back(pEnemy);
                    startlocpos++;
                }
                else
                {
                    pPlayerRec->x = i-0.5f;
                    pPlayerRec->z = j-0.5f;
                    startlocpos++;
                }
            }
        }
    }
}