MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / UpdateSpot

Method UpdateSpot

ogsr_engine/xrGame/map_location.cpp:325–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323xr_vector<u32> map_point_path;
324
325void CMapLocation::UpdateSpot(CUICustomMap* map, CMapSpot* sp)
326{
327 // точка на той же карте где и ГГ
328 if (map->MapName() == LevelName())
329 {
330 CSE_ALifeDynamicObject* obj = NULL;
331
332 if (ai().get_alife() && !IsUserDefined())
333 {
334 obj = ai().alife().objects().object(m_objectID, true);
335 if (!obj)
336 {
337 Msg("- Critical: CMapLocation::UpdateSpot binded to non-existent object id=%d", m_objectID);
338 return;
339 }
340 }
341
342 if (m_flags.test(eHideInOffline) && ai().get_alife() && !IsUserDefined() && !obj->m_bOnline)
343 return;
344
345 if (!IsUserDefined() && ai().get_alife() && FALSE == obj->m_flags.test(CSE_ALifeObject::flVisibleForMap))
346 return;
347
348 // update spot position
349 Fvector2 position = Position();
350
351 auto position_on_map = map->ConvertRealToLocal(position, !map->IsRounded());
352 sp->SetWndPos(position_on_map);
353 Frect wnd_rect = sp->GetWndRect();
354
355 // позиция для отрисовки
356 auto position_on_map_visible = map->ConvertRealToLocal(position, true);
357 sp->SetWndPos(position_on_map_visible);
358
359 if (map->IsRectVisible(wnd_rect))
360 {
361 // update heading if needed
362 if (!IsUserDefined() && sp->Heading())
363 {
364 Fvector2 dir_global = Direction();
365 float h = dir_global.getH();
366 float h_ = map->GetHeading() + h;
367 sp->SetHeading(h_);
368 }
369
370 Frect clip_rect = map->GetClipperRect();
371 sp->SetClipRect(clip_rect);
372 map->AttachChild(sp);
373
374 if (GetSpotPointer(sp))
375 {
376 CMapSpot* s = GetSpotBorder(sp);
377 if (s)
378 {
379 s->SetWndPos(sp->GetWndPos());
380 map->AttachChild(s);
381 }
382 }

Callers

nothing calls this directly

Calls 15

MsgFunction · 0.85
DirectionEnum · 0.85
ActorFunction · 0.85
MapNameMethod · 0.80
get_alifeMethod · 0.80
ConvertRealToLocalMethod · 0.80
IsRoundedMethod · 0.80
GetWndRectMethod · 0.80
SetHeadingMethod · 0.80
GetClipperRectMethod · 0.80
SetClipRectMethod · 0.80
AttachChildMethod · 0.80

Tested by

no test coverage detected