aliens

Author Topic: Mod request: TFTD minimap colors (solved)  (Read 1420 times)

Offline Varana

  • Sergeant
  • **
  • Posts: 49
    • View Profile
    • Email
Mod request: TFTD minimap colors (solved)
« 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?
« Last Edit: August 22, 2021, 09:24:28 pm by Varana »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 10466
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
    • Email
Re: Mod request: TFTD minimap colors
« Reply #1 on: August 17, 2021, 01:44:35 pm »
It's not exactly on topic, but... who are "allies"? How do they differ from "civilians"?

Offline Bonakva

  • Colonel
  • ****
  • Posts: 179
    • View Profile
Re: Mod request: TFTD minimap colors
« Reply #2 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

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7363
    • View Profile
Re: Mod request: TFTD minimap colors
« Reply #3 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);
}
}
« Last Edit: August 20, 2021, 09:45:01 pm by Meridian »

Offline Varana

  • Sergeant
  • **
  • Posts: 49
    • View Profile
    • Email
Re: Mod request: TFTD minimap colors
« Reply #4 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?
« Last Edit: August 22, 2021, 06:29:54 am by Varana »

Offline kevL

  • Colonel
  • ****
  • Posts: 408
  • pitchforks and torches
    • View Profile
Re: Mod request: TFTD minimap colors
« Reply #5 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 ...
« Last Edit: August 22, 2021, 10:58:00 am by kevL »

Offline Varana

  • Sergeant
  • **
  • Posts: 49
    • View Profile
    • Email
Re: Mod request: TFTD minimap colors
« Reply #6 on: August 22, 2021, 12:47:14 pm »
 8) Thanks, that works fine.  :)

Offline kevL

  • Colonel
  • ****
  • Posts: 408
  • pitchforks and torches
    • View Profile
Re: Mod request: TFTD minimap colors
« Reply #7 on: August 22, 2021, 12:49:28 pm »
8) Thanks, that works fine.  :)

good t' hear :^)

Offline Bonakva

  • Colonel
  • ****
  • Posts: 179
    • View Profile
Re: Mod request: TFTD minimap colors
« Reply #8 on: August 22, 2021, 01:51:51 pm »
good t' hear :^)
Waited for it)
Now share the mod))

Offline kevL

  • Colonel
  • ****
  • Posts: 408
  • pitchforks and torches
    • View Profile
Re: Mod request: TFTD minimap colors
« Reply #9 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 ...

Offline Varana

  • Sergeant
  • **
  • Posts: 49
    • View Profile
    • Email
Mod: TFTD minimap colors
« Reply #10 on: August 22, 2021, 08:15:39 pm »
The mod for TFTD and EU. In EU only switching colors from faction to faction.
« Last Edit: August 22, 2021, 09:02:02 pm by Varana »