F10: dropdown popup stays on screen (D568); Crosshair color is Original/Custom with 0-255 sliders, PD style (D569)

This commit is contained in:
James Dansereau committed 2026-10-06 21:20:22 -04:00
1 parent 1d15e5695a
commit fadc0d6d33
4 files changed
+67 -21

No files matched your search

+16 -10
View File
@@ -413,9 +413,9 @@ static struct Row rows[] = {
SEP(G2),
{ .key="Video.CrosshairHide", .label="Show crosshair", .kind=ROW_TOGGLE, .step=1, .names=kOnOffRev },
{ .key="Video.CrosshairColor", .label="Crosshair color", .kind=ROW_ENUM, .step=1, .names=kCrosshairColor },
{ .key="Video.CrosshairRed", .label="Red", .kind=ROW_SLIDER, .step=1, .shownWhen="Video.CrosshairColor", .shownValue=8 },
{ .key="Video.CrosshairGreen", .label="Green", .kind=ROW_SLIDER, .step=1, .shownWhen="Video.CrosshairColor", .shownValue=8 },
{ .key="Video.CrosshairBlue", .label="Blue", .kind=ROW_SLIDER, .step=1, .shownWhen="Video.CrosshairColor", .shownValue=8 },
{ .key="Video.CrosshairRed", .label="Red", .kind=ROW_SLIDER, .step=5, .shownWhen="Video.CrosshairColor", .shownValue=8 },
{ .key="Video.CrosshairGreen", .label="Green", .kind=ROW_SLIDER, .step=5, .shownWhen="Video.CrosshairColor", .shownValue=8 },
{ .key="Video.CrosshairBlue", .label="Blue", .kind=ROW_SLIDER, .step=5, .shownWhen="Video.CrosshairColor", .shownValue=8 },
{ .key="Video.CrosshairSize", .label="Crosshair size", .kind=ROW_SLIDER, .step=5, .unit="%" },
{ .key="Video.CrosshairStyle", .label="Crosshair style", .kind=ROW_ENUM, .step=1, .names=kCrosshairStyle },
{ .key="Video.CrosshairAlpha", .label="Crosshair opacity", .kind=ROW_SLIDER, .step=5, .unit="%" }, /* D511 */
@@ -1630,6 +1630,12 @@ static void rowAdjust(struct Row *r, int dir)
rowSetStepWatch(r, (double)inputPadPresetStep((int)lround(v), dir));
break;
}
if (!strcmp(r->key, "Video.CrosshairColor")) {
/* D569 (PD model): Original sprite or a Custom RGB colour; the old
* named presets (1..7) are migrated to Custom at startup (video.c). */
rowSetStepWatch(r, (int)lround(v) == 8 ? 0.0 : 8.0);
break;
}
if (!strcmp(r->key, "Video.TextureFilter")) {
/* D499: menu order Nearest, Bilinear, Trilinear, 3-Point (stored
* 0, 1, 3, 2: 2 stays 3-Point for existing inis and the Original
@@ -1763,6 +1769,7 @@ static char s_ddLab[DD_MAX][40];
static int rowIsDropdown(const struct Row *r)
{
if (!r->found) return 0;
if (r->kind == ROW_ENUM && !strcmp(r->key, "Video.CrosshairColor")) return 0; /* D569: Original/Custom stepper (PD) */
if (r->kind == ROW_ENUM || r->kind == ROW_MSAA || r->kind == ROW_FPSCAP) return 1;
if (r->kind == ROW_RES) return !videoIsFullscreen() && s_resFitN > 0;
if (r->kind == ROW_AUDIODEV) return 1;
@@ -1906,6 +1913,11 @@ static int ddGeom(s32 *x0, s32 *y0, s32 *x1, s32 *y1, int *vis)
s32 H = ovH();
*y0 = rowY + OV_LINE;
if (*y0 + h > H - 4) *y0 = rowY - h; /* no room below: open upward */
/* D568: no room above either (a long list on a mid-page row): keep the whole
* popup on screen, flush with the bottom margin. A negative top used to
* draw the labels above the screen while the fill wrapped down past the
* bottom edge (an empty, misplaced box). */
if (*y0 < 4) *y0 = (H - 4 - h > 4) ? H - 4 - h : 4;
*y1 = *y0 + h;
*vis = v;
return 1;
@@ -2947,13 +2959,6 @@ static void valueText(int i, char *out, int n)
snprintf(out, n, "%sx", t);
return;
}
/* D506: crosshair RGB channels as a percent of full intensity. */
if (strcmp(r->key, "Video.CrosshairRed") == 0 ||
strcmp(r->key, "Video.CrosshairGreen") == 0 ||
strcmp(r->key, "Video.CrosshairBlue") == 0) {
snprintf(out, n, "%d%%", (int)lround(v * 100.0 / 255.0));
return;
}
/* D346: integer sliders -- optional raw->display divide + unit suffix. */
if (r->dispDiv > 0) {
v = (double)(int)lround(v / (double)r->dispDiv);
@@ -3748,6 +3753,7 @@ static const struct { const char *key, *help; } kRowHelp[] = {
{ "__DisplayMode", "Modern, original or custom graphics presets." },
{ "Video.AspectMode", "Fill window fits the picture to the whole window." }, /* D560: shown only while Fill window is selected (optionsRowHelp) */
{ "Video.CrosshairHide", "When off, the crosshair stays hidden, even with Sight on screen." },
{ "Video.CrosshairColor", "Original keeps the game's red sight. Custom: set Red, Green and Blue (0-255)." },
{ "Video.CrosshairHealthColor", "The crosshair shifts from green to red as your health drops." },
{ "Video.WidescreenAuto", "This only applies when Native widescreen is off." },
{ "Game.ScreenShakeIntensity", "Sets how strongly explosions shake the screen." },
+21 -11
View File
@@ -114,8 +114,19 @@ s32 portNoHitFlash = 0;
* (gunfire.c gunDrawSight, #ifdef PORT). Default keeps the original
* authored red sprite; hide is opt-in. */
s32 portCrosshairHide = 0;
static int cfgCrosshairColor = 0; /* 0 = authored sprite; 1..7 = presets; 8 = custom RGB */
static int cfgCrosshairColor = 0; /* 0 = authored sprite; 8 = custom RGB (D569: old presets 1..7 migrate to 8 at startup) */
static int cfgCrosshairRed = 255, cfgCrosshairGreen = 255, cfgCrosshairBlue = 255;
/* Former named presets (D373/D381), kept for the D569 ini migration. */
static const unsigned char kTints[8][3] = {
{ 0xFF, 0xFF, 0xFF }, /* Original red sprite (identity multiplier) */
{ 0x40, 0xFF, 0x40 }, /* Green */
{ 0xFF, 0x40, 0x40 }, /* Red */
{ 0x40, 0x40, 0xFF }, /* Blue */
{ 0xFF, 0xFF, 0x40 }, /* Yellow */
{ 0x40, 0xFF, 0xFF }, /* Cyan */
{ 0xFF, 0x40, 0xFF }, /* Magenta */
{ 0xFF, 0xFF, 0xFF }, /* Actual white, through alpha silhouette */
};
static int cfgCrosshairSize = 100; /* 100% retains the original 32x32 drawing */
static int cfgCrosshairStyle = 0; /* 0 = original; 1 = unused beta asset */
static int cfgCrosshairAlpha = 100; /* D511: % of the original sprite alpha (0x6E); 100 = untouched */
@@ -175,16 +186,6 @@ void portCrosshairTint(s32 *r, s32 *g, s32 *b)
crosshairHealthTint(portCrosshairHealthRatio(), r, g, b);
return;
}
static const unsigned char kTints[8][3] = {
{ 0xFF, 0xFF, 0xFF }, /* Original red sprite (identity multiplier) */
{ 0x40, 0xFF, 0x40 }, /* Green */
{ 0xFF, 0x40, 0x40 }, /* Red */
{ 0x40, 0x40, 0xFF }, /* Blue */
{ 0xFF, 0xFF, 0x40 }, /* Yellow */
{ 0x40, 0xFF, 0xFF }, /* Cyan */
{ 0xFF, 0x40, 0xFF }, /* Magenta */
{ 0xFF, 0xFF, 0xFF }, /* Actual white, through alpha silhouette */
};
if (cfgCrosshairColor == 8) {
*r = cfgCrosshairRed;
*g = cfgCrosshairGreen;
@@ -1005,6 +1006,15 @@ static float vidAvgFPS = 0.f;
int videoInit(void)
{
/* D569: Crosshair color is Original (0) or Custom RGB (8), as in the PD
* port. Inis from v0.5.0 builds before this may hold a named preset 1..7:
* carry its colour into the Custom channels once, so nothing changes. */
if (cfgCrosshairColor >= 1 && cfgCrosshairColor <= 7) {
cfgCrosshairRed = kTints[cfgCrosshairColor][0];
cfgCrosshairGreen = kTints[cfgCrosshairColor][1];
cfgCrosshairBlue = kTints[cfgCrosshairColor][2];
cfgCrosshairColor = 8;
}
/* D440 CLI route: -n64preset / -portpreset apply the preset
* once at startup (after configLoad, before any value reaches fast3d) and
* persist like an F10 press (the atexit configSave). */