there are only 3 types of units:
1. xcom
2. enemies of xcom
3. neutrals (friendly towards xcom, hostile towards enemies of xcom)
The colors are defined in the SCANG.DAT spritesheet:
https://www.ufopaedia.org/index.php/SCANG.DATThe following indices are used:
/**
* Get the unit's minimap sprite index. Used to display the unit on the minimap
* @return the unit minimap index
*/
int BattleUnit::getMiniMapSpriteIndex() const
{
//minimap sprite index:
// * 0-2 : Xcom soldier
// * 3-5 : Alien
// * 6-8 : Civilian
// * 9-11 : Item
// * 12-23 : Xcom HWP
// * 24-35 : Alien big terror unit(cyberdisk, ...)
if (isOut())
{
return 9;
}
switch (getFaction())
{
case FACTION_HOSTILE:
if (_armor->getSize() == 1)
return 3;
else
return 24;
case FACTION_NEUTRAL:
if (_armor->getSize() == 1)
return 6;
else
return 12;
default:
if (_armor->getSize() == 1)
return 0;
else
return 12;
}
}
There are no 2x2 neutrals in vanilla, so there is no corresponding SCANG.DAT sprite either. OpenXcom uses same sprite for them as for 2x2 xcom units. OXCE recolors them to red, hardcoded.
// alive units
if (t->getUnit() && (t->getUnit()->getVisible() || _battleGame->getBughuntMode() || _battleGame->getDebugMode()))
{
int frame = t->getUnit()->getMiniMapSpriteIndex();
int size = t->getUnit()->getArmor()->getSize();
frame += (t->getPosition().y - t->getUnit()->getPosition().y) * size;
frame += t->getPosition().x - t->getUnit()->getPosition().x;
frame += _frame * size * size;
Surface * s = _set->getFrame(frame);
if (size > 1 && t->getUnit()->getFaction() == FACTION_NEUTRAL)
{
s->blitNShade(this, x, y, 0, false, Pathfinding::red);
}
else
{
s->blitNShade(this, x, y, 0);
}
}