MCPcopy Create free account
hub / github.com/ddnet/ddnet / CreateMapObject

Function CreateMapObject

src/tools/map_replace_area.cpp:474–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474CMapObject CreateMapObject(const CMapItemGroup *pLayerGroup, const int PosX, const int PosY, const int Width, const int Height)
475{
476 CMapObject Ob;
477
478 Ob.m_aaBaseArea[0][0] = PosX - pLayerGroup->m_OffsetX;
479 Ob.m_aaBaseArea[1][0] = PosY - pLayerGroup->m_OffsetY;
480 Ob.m_aaBaseArea[0][1] = Ob.m_aaBaseArea[0][0] + Width;
481 Ob.m_aaBaseArea[1][1] = Ob.m_aaBaseArea[1][0] + Height;
482 Ob.m_aLayerOffset[0] = pLayerGroup->m_OffsetX;
483 Ob.m_aLayerOffset[1] = pLayerGroup->m_OffsetY;
484 Ob.m_UseClipping = pLayerGroup->m_UseClipping;
485 Ob.m_aaClipArea[0][0] = pLayerGroup->m_ClipX;
486 Ob.m_aaClipArea[1][0] = pLayerGroup->m_ClipY;
487 Ob.m_aaClipArea[0][1] = pLayerGroup->m_ClipX + pLayerGroup->m_ClipW;
488 Ob.m_aaClipArea[1][1] = pLayerGroup->m_ClipY + pLayerGroup->m_ClipH;
489 Ob.m_aSpeed[0] = 1 - (pLayerGroup->m_ParallaxX / 100.0f);
490 Ob.m_aSpeed[1] = 1 - (pLayerGroup->m_ParallaxY / 100.0f);
491
492 for(int i = 0; i < 2; i++)
493 {
494 Ob.m_aaScreenOffset[i][0] = -CMapObject::ms_aStandardScreen[i];
495 Ob.m_aaScreenOffset[i][1] = CMapObject::ms_aStandardScreen[i];
496 if(Ob.m_aSpeed[i] < 0)
497 std::swap(Ob.m_aaScreenOffset[i][0], Ob.m_aaScreenOffset[i][1]);
498 }
499
500 SetExtendedArea(Ob);
501 return Ob;
502}
503
504void SetExtendedArea(CMapObject &Ob)
505{

Callers 3

ReplaceAreaTilesFunction · 0.85
RemoveDestinationQuadsFunction · 0.85
InsertDestinationQuadsFunction · 0.85

Calls 1

SetExtendedAreaFunction · 0.85

Tested by

no test coverage detected