Skip to content

Autodetect float vs integer _minlight #470

@SirYodaJedi

Description

@SirYodaJedi

Issue

Currently, minlight is hardcoded to be interpreted as a float between 0 and 2 (or higher for BSPX HDR), only if outputting a Q2BSP:

ericw-tools/light/ltface.cc

Lines 624 to 627 in bfea46c

// Q2 uses a 0-1 range for minlight
if (bsp->loadversion->game->id == GAME_QUAKE_II) {
lightsurf.minlight *= 128.f;
}

This is consistent with QRAD3 (Quake 2) and QRAD (HL1).

However, this makes things a bit inconsistent between EWTs output formats, since the other three output formats expect minlight to be formatted as an integer between 0 and 512 (or higher for BSPX HDR). This sort of inconsistency is a bit confusing, since it's not an actual format difference.

Proposal

Ideally, it should detect if it's an integer or decimal, like with _color: if there's a decimal point, multiply by 128, otherwise leave as-is.

Potential caveats

  • This could potentially break something if someone used a decimal point with the 0-512 notation, but that seems unlikely, since the lightmap doesn't have that sort of precision.
  • This would break the ability to just say _minlight 2 for full overbright in Q2 mode, but the mapper could just change the 2 to 2.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions