本文整理汇总了C++中Map::GetStaticRecord方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetStaticRecord方法的具体用法?C++ Map::GetStaticRecord怎么用?C++ Map::GetStaticRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::GetStaticRecord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBombBoom
void MemeSingleGameType::OnBombBoom(BombRecord* bomb)
{
if (!bomb)
return;
Map* pMap = (Map*)sMapManager->GetMap();
if (pMap)
{
// Nejdrive znicime bombu na mape
pMap->DestroyDynamicRecords(bomb->x, bomb->y, DYNAMIC_TYPE_BOMB);
// Nyni promenliva hodnota podle bonusu
// Bonus se ale zapocita jen pokud je bomba polozena az po vzeti bonusu, ne na vsechny
// Jednak je to realistictejsi a jednak to usnadni trochu pathfinding pro AI
uint32 bombreach = bomb->reach;
// Projdeme vsechny mozne zaznamy na mape az na maximalni definovany dosah
// pokud tam neco je, zamezime dalsimu prepsani a zapiseme
uint32 reach_x1 = bombreach+1, reach_x2 = bombreach+1, reach_y1 = bombreach+1, reach_y2 = bombreach+1;
// Promenna urcujici, zdali doslo ke kolizi kvuli objektu (true) nebo kvuli dosahu (false)
bool rx1_box = false, rx2_box = false, ry1_box = false, ry2_box = false;
for (uint32 i = 0; i < bombreach; i++)
{
// Pokud jeste nebylo zapsano
if (reach_x1 == bombreach+1)
{
// Overime, zdali na dane pozici neco neprostupneho je
if (pMap->IsDynamicRecordPresent(bomb->x + i + 1, bomb->y, DYNAMIC_TYPE_BOX))
{
// Pokud ano, zamezime zapsanim maximalni pozice dalsimu prepsani
reach_x1 = i+1;
rx1_box = true;
}
else if (pMap->GetStaticRecord(bomb->x + i + 1,bomb->y) == TYPE_SOLID_BOX)
reach_x1 = i+1;
}
if (reach_x2 == bombreach+1)
{
if (pMap->IsDynamicRecordPresent(bomb->x - i - 1, bomb->y, DYNAMIC_TYPE_BOX))
{
reach_x2 = i+1;
rx2_box = true;
}
else if (pMap->GetStaticRecord(bomb->x - i - 1,bomb->y) == TYPE_SOLID_BOX)
reach_x2 = i+1;
}
if (reach_y1 == bombreach+1)
{
if (pMap->IsDynamicRecordPresent(bomb->x, bomb->y + i + 1, DYNAMIC_TYPE_BOX))
{
reach_y1 = i+1;
ry1_box = true;
}
else if (pMap->GetStaticRecord(bomb->x,bomb->y + i + 1) == TYPE_SOLID_BOX)
reach_y1 = i+1;
}
if (reach_y2 == bombreach+1)
{
if (pMap->IsDynamicRecordPresent(bomb->x, bomb->y - i - 1, DYNAMIC_TYPE_BOX))
{
reach_y2 = i+1;
ry2_box = true;
}
else if (pMap->GetStaticRecord(bomb->x,bomb->y - i - 1) == TYPE_SOLID_BOX)
reach_y2 = i+1;
}
}
// Pak vsechno dekrementujeme - zapise se vzdy pozice uz nepristupneho pole
--reach_x1;
--reach_x2;
--reach_y1;
--reach_y2;
// Exploze - particle emittery
BillboardDisplayListRecord* templ = BillboardDisplayListRecord::Create(31, 0, 0, 0, 0.8f, 0.8f, true, true);
sParticleEmitterMgr->AddEmitter(templ, bomb->x-0.5f, 0.1f, bomb->y-0.5f, 0.15f, 0.4f, 0, 0.0f, 0, 0, reach_y1*100 + (ry1_box?100:0), 20, 10.0f, 0.1f, 50, 10, 1, 0, ANIM_FLAG_NOT_REPEAT, 1500);
templ = BillboardDisplayListRecord::Create(31, 0, 0, 0, 0.8f, 0.8f, true, true);
sParticleEmitterMgr->AddEmitter(templ, bomb->x-0.5f, 0.1f, bomb->y-0.5f, 0.15f, 0.4f, 0, 90.0f, 0, 0, reach_x2*100 + (rx2_box?100:0), 20, 10.0f, 0.1f, 50, 10, 1, 0, ANIM_FLAG_NOT_REPEAT, 1500);
templ = BillboardDisplayListRecord::Create(31, 0, 0, 0, 0.8f, 0.8f, true, true);
sParticleEmitterMgr->AddEmitter(templ, bomb->x-0.5f, 0.1f, bomb->y-0.5f, 0.15f, 0.4f, 0, 180.0f, 0, 0, reach_y2*100 + (ry2_box?100:0), 20, 10.0f, 0.1f, 50, 10, 1, 0, ANIM_FLAG_NOT_REPEAT, 1500);
templ = BillboardDisplayListRecord::Create(31, 0, 0, 0, 0.8f, 0.8f, true, true);
sParticleEmitterMgr->AddEmitter(templ, bomb->x-0.5f, 0.1f, bomb->y-0.5f, 0.15f, 0.4f, 0, 270.0f, 0, 0, reach_x1*100 + (rx1_box?100:0), 20, 10.0f, 0.1f, 50, 10, 1, 0, ANIM_FLAG_NOT_REPEAT, 1500);
// Casovani vybuchu je implementovano pri polozeni bomby
}
}