MCPcopy Create free account
hub / github.com/crossuo/crossuo / LoadBlock

Method LoadBlock

src/Managers/MapManager.cpp:467–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467void CMapManager::LoadBlock(CMapBlock *block)
468{
469 CIndexMap *indexMap = GetIndex(GetActualMap(), block->X, block->Y);
470 if (indexMap == nullptr || indexMap->MapAddress == 0)
471 {
472 return;
473 }
474
475 MAP_BLOCK *pmb = (MAP_BLOCK *)indexMap->MapAddress;
476 int bx = block->X * 8;
477 int by = block->Y * 8;
478 for (int x = 0; x < 8; x++)
479 {
480 for (int y = 0; y < 8; y++)
481 {
482 int pos = (int)y * 8 + (int)x;
483 CMapObject *obj = new CLandObject(
484 pos,
485 pmb->Cells[pos].TileID & 0x3FFF,
486 0,
487 bx + (int)x,
488 by + (int)y,
489 pmb->Cells[pos].Z);
490 block->AddObject(obj, (int)x, (int)y);
491 }
492 }
493
494 STATICS_BLOCK *sb = (STATICS_BLOCK *)indexMap->StaticAddress;
495 if (sb != nullptr)
496 {
497 int count = indexMap->StaticCount;
498 for (int c = 0; c < count; c++, sb++)
499 {
500 if ((sb->Color != 0u) && sb->Color != 0xFFFF)
501 {
502 int x = sb->X;
503 int y = sb->Y;
504 int pos = (y * 8) + x;
505 if (pos >= 64)
506 {
507 continue;
508 }
509
510 CRenderStaticObject *obj =
511 new CStaticObject(pos, sb->Color, sb->Hue, bx + x, by + y, sb->Z);
512 block->AddObject(obj, x, y);
513 }
514 }
515 }
516
517 block->CreateLandTextureRect();
518}
519
520int CMapManager::GetActualMap()
521{

Callers 3

CalculateRenderListMethod · 0.80
CreateItemsListMethod · 0.80

Calls 3

GetIndexFunction · 0.85
CreateLandTextureRectMethod · 0.80
AddObjectMethod · 0.45

Tested by

no test coverage detected