void CellClass::GetColourComponents(int *arg0, int *Intensity, signed int *Ambient, int *arg3, int *arg4, int *tintR, int *tintG, int *tintB) {

  *Ambient = Scenario->Ambient / 200.0;
  *tintR = Scenario->Tint.R / 200.0;
  *tintG = Scenario->Tint.G / 200.0;
  *tintB = Scenario->Tint.B / 200.0;

  for(int idxLS = 0; idxLS < vec_LightSources.Length; ++idxLS) {
    LightSourceClass *thisLS = vec_LightSources[idxLS];
    if ( thisLS->IsActive ) {
      // gDetailLevel is a global setting "Detail Level",
      // in ctor, light sources' DetailLevel is set to 2 
      if ( gDetailLevel >= thisLS->DetailLevel ) {
        int sqX = (this->pos.X - thisLS->pos.X) * (this->pos.X - thisLS->pos.X);
        int sqY = (this->pos.Y - thisLS->pos.Y) * (this->pos.Y - thisLS->pos.Y);

        if ( sqY + sqX <= thisLS->Visibility * thisLS->Visibility ) {
          int distance = FloatToInt(float_sqrt(sqY + sqX));
          if ( distance <= thisLS->Visibility ) {
            int lsEffect = (1000 * thisLS->Visibility - 1000 * distance) / thisLS->Visibility;
            *Intensity += lsEffect * thisLS->Intensity / 1000.0;
            *tintR += lsEffect * thisLS->Tint.R / 1000.0;
            *tintG += lsEffect * thisLS->Tint.G / 1000.0;
            *tintB += lsEffect * thisLS->Tint.B / 1000.0;
          }
        }
      }
    }
  }

  int delta_level_ground, _ground, _level_composite;

  *Ambient += this->Level * Scenario->Level - Scenario->Ground;
  _ground = Scenario->Ground;
  _level_composite = Scenario->Level * (this->Level + 4);
  delta_level_ground = _level_composite - _ground + *arg4;

  if( *Ambient > 2000 ) {
    *Ambient = 2000;
  }

  // this basically makes sure those values don't reach huge amounts
  ApplyLimits(arg0, arg3, tintR, tintG, tintB, delta_level_ground, _level_composite);
}