12 const int MIN_OFFSET = 3;
13 const int MAX_OFFSET = 80;
19 protected int m_iTargetBaseId = -1;
28 return m_iTargetBaseId;
44 m_TargetBase = targetBase;
46 SetOrigin(m_TargetBase.GetOwner().GetOrigin());
53 void OnMapOpenCallback(MapConfiguration config)
59 void OnMapZoom(
float pixelPerUnit)
68 vector newPos = m_TargetBase.GetOwner().GetOrigin();
69 newPos[0] = newPos[0] + CalculateOffset() / 2.5;
70 newPos[2] = newPos[2] - CalculateOffset() / 5;
76 float CalculateOffset()
78 float pixelPerUnit =
SCR_MapEntity.GetMapInstance().GetCurrentZoom();
79 int max_offset = MAX_OFFSET;
80 int min_offset = MIN_OFFSET;
84 float a = max_offset * min_offset * (max_zoom - min_zoom) / (min_offset - max_offset);
85 float b = min_zoom - a / min_offset;
87 return b + a / pixelPerUnit;
91 string GetBaseNameWithCallsign()
94 return m_TargetBase.GetBaseNameUpperCase();
95 return string.Format(
"%1 (%2)", m_TargetBase.GetBaseNameUpperCase(), m_TargetBase.GetCallsignDisplayNameOnlyUC());
113 override void Deserialize(ScriptBitReader reader)
115 super.Deserialize(reader);
118 reader.ReadInt(baseID);
124 m_iTargetBaseId = baseID;
128 if (base.GetFaction() == GetTargetFaction())
135 override void Serialize(ScriptBitWriter writer)
137 super.Serialize(writer);
142 baseID = base.GetCallsign();
144 writer.WriteInt(baseID);
148 protected override void UpdateMapInfo()