OpenXcom Forum

OpenXcom => Suggestions => Topic started by: Varana on August 03, 2021, 06:48:32 pm

Title: Mod request: TFTD minimap colors (solved)
Post by: Varana on August 03, 2021, 06:48:32 pm
There is a simple problem but I do not find the .rul where to change it.  :'(

In minimap I want to change to other colors, so I could see enemies (grey dots) better and have the colors more intuitive. I would like to have the dot in ...

o blue: my soldiers
o green: allies
o yellow: civilians
o orange or red: enemies

Could someone who knows the solution please post the code.rul or a mini mod?
Title: Re: Mod request: TFTD minimap colors
Post by: Solarius Scorch on August 17, 2021, 01:44:35 pm
It's not exactly on topic, but... who are "allies"? How do they differ from "civilians"?
Title: Re: Mod request: TFTD minimap colors
Post by: Bonakva on August 17, 2021, 04:24:28 pm
I assume that the soldiers/army/police who protect civilians are meant. They can be found in global mods.
But probably in terms of the mechanics of the game difference between a soldier and a civilian is not
Title: Re: Mod request: TFTD minimap colors
Post by: Meridian on August 20, 2021, 09:43:16 pm
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.DAT

The following indices are used:
Code: [Select]
/**
 * 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.

Code: [Select]
// 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);
}
}
Title: Re: Mod request: TFTD minimap colors
Post by: Varana on August 22, 2021, 06:25:16 am
Ok, so allies are just neutral civilians with weapons in their hand. Thanks for the answers.

Now how should I edit SCANG.DAT ? I tried paint, paint.net, evilpixie and a HEXviewer but they all did not seem to be the right tool. And MCDedit seems to use SCANG.DAT, but can not edit that file as far as I tried.
Do I have to use https://www.ufopaedia.org/index.php/SCANG.DAT and HEXeditor or is there a better way?
Title: Re: Mod request: TFTD minimap colors
Post by: kevL on August 22, 2021, 10:50:20 am
Now how should I edit SCANG.DAT ?

PckView should be able to handle it ... it's included with Mapview2

backup yer ScanG.dat first, it's not well tested ...
Title: Re: Mod request: TFTD minimap colors
Post by: Varana on August 22, 2021, 12:47:14 pm
 8) Thanks, that works fine.  :)
Title: Re: Mod request: TFTD minimap colors
Post by: kevL on August 22, 2021, 12:49:28 pm
8) Thanks, that works fine.  :)

good t' hear :^)
Title: Re: Mod request: TFTD minimap colors
Post by: Bonakva on August 22, 2021, 01:51:51 pm
good t' hear :^)
Waited for it)
Now share the mod))
Title: Re: Mod request: TFTD minimap colors
Post by: kevL on August 22, 2021, 02:28:27 pm
not my mod ;^p

but am going to change those colors in my scanG like Varana did ...
Title: Mod: TFTD minimap colors
Post by: Varana on August 22, 2021, 08:15:39 pm
The mod for TFTD and EU. In EU only switching colors from faction to faction.