KA Team Colour Translations
From KoraxWiki
Overview
Colour Translation is a method to apply corresponding team colours to game objectives or decorations. This is done by changing pixels of blue color hue to target colour hue.
At this point colour translation is required only for CTF and Football game modes, and will not work for others.
Method
Due to some reasons (which are too boring to explain here) the only real way to apply colour translation to game objectives and team decor in this version of Korax Arena is to use ACS (map script). That means that you will have to manually add specific code to your map script.
Basically, when game recognises that some object needs a team colour translation applied, it tries to call a map script which should do the actual translation. To make game know exactly which script number to call in this situation, map script must "register" that script number first. This is done using specific KA script function AGame_SetACSNotifier. This function should bind script number with team colour translation event, which is represented by agame_event_colourtranslation constant. If this is done, every time some thing on map needs team colour translation the registered script will be called.
That script must take 2 arguments of integer type to work properly: 1st argument is the team index from teams table (TEAMINFO lump), 2nd argument is the thing tag (TID). Script should apply a translation to thing(s) with the tag specified according to specified team index.
Script example
Following is, perhaps, a simpliest possible sample of team colour translation script.
#include "vcommon.acs"
#include "karena.acs"
int game;
script 1 OPEN
{
game = GetCvar("deathmatch");
if (game == gametype_ctf || game == gametype_football)
{
// Register notifier script
AGame_SetACSNotifier(agame_event_colourtranslation, 200);
}
}
script 200 (int team, int tid)
{
//
// Notice that Blue team does not need translation,
// because translated sprites ought to be blue-coloured
// by default.
//
switch (team)
{
case 1:
// Red team
CreateTranslation(1, 146:159=176:185);
Thing_SetTranslation(tid, 1);
break;
case 2:
// Gold team
CreateTranslation(2, 146:159=128:143);
Thing_SetTranslation(tid, 2);
break;
case 3:
// Lime team
CreateTranslation(3, 146:159=211:216);
Thing_SetTranslation(tid, 3);
break;
case 4:
// Green team
CreateTranslation(4, 146:159=192:202);
Thing_SetTranslation(tid, 4);
break;
case 5:
// Gray team
CreateTranslation(5, 146:159=16:31);
Thing_SetTranslation(tid, 5);
break;
case 6:
// Brown team
CreateTranslation(6, 146:159=97:111);
Thing_SetTranslation(tid, 6);
break;
case 7:
// Magenta team
CreateTranslation(7, 146:159=231:239);
Thing_SetTranslation(tid, 7);
break;
}
}