Skip to content

Commit 147fc38

Browse files
committed
Fix railgun / crosshair colors
Add a consistent color band to pakQ3VR, which supersedes both pak8a and pak3a, and keeps bands consistent across baseq3/missionpack without changes to either of the other pk3 files. Demo video: https://youtube.com/shorts/N9rZJ-VkIu8
1 parent 66b0f61 commit 147fc38

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed
12 KB
Binary file not shown.

code/q3_ui/ui_playersettings.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ typedef struct {
7373

7474
static playersettings_t s_playersettings;
7575

76-
static int gamecodetoui[] = {4,2,3,0,5,1,6};
77-
static int uitogamecode[] = {4,6,2,3,1,5,7};
76+
static int gamecodetoui[] = {0,2,1,4,5,3,6};
77+
static int uitogamecode[] = {1,3,2,6,4,5,7};
7878

7979
static const char *handicap_items[] = {
8080
"None",
@@ -236,8 +236,10 @@ static void PlayerSettings_DrawEffects( void *self ) {
236236

237237
UI_DrawProportionalString( item->generic.x, item->generic.y, "Effects", style, color );
238238

239+
int markerX = item->generic.x + 64 + (item->curvalue * 112 / 6);
240+
239241
UI_DrawHandlePic( item->generic.x + 64, item->generic.y + PROP_HEIGHT + 8, 128, 8, s_playersettings.fxBasePic );
240-
UI_DrawHandlePic( item->generic.x + 64 + item->curvalue * 16 + 8, item->generic.y + PROP_HEIGHT + 6, 16, 12, s_playersettings.fxPic[item->curvalue] );
242+
UI_DrawHandlePic( markerX, item->generic.y + PROP_HEIGHT + 6, 16, 12, s_playersettings.fxPic[item->curvalue] );
241243
}
242244

243245

code/q3_ui/ui_preferences.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,10 @@ static void CrosshairColor_Draw( void *self ) {
406406
UI_DrawString( x - SMALLCHAR_WIDTH, y, s->generic.name, style|UI_RIGHT, color );
407407

408408
// Draw color picker
409+
int markerX = x + SMALLCHAR_WIDTH + (s->curvalue * 112 / 6);
410+
409411
UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y + 4, 128, 8, s_preferences.fxBasePic );
410-
UI_DrawHandlePic( x + SMALLCHAR_WIDTH + s->curvalue * 16 + 8, y + 2, 16, 12, s_preferences.fxPic[s->curvalue] );
412+
UI_DrawHandlePic( markerX, y + 2, 16, 12, s_preferences.fxPic[s->curvalue] );
411413
}
412414

413415

code/ui/ui_main.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ static char* netnames[] = {
115115
static char quake3worldMessage[] = "Visit www.quake3world.com - News, Community, Events, Files";
116116
#endif
117117

118-
static int gamecodetoui[] = {0,1,2,3,4,5,6};
119-
static int uitogamecode[] = {1,2,3,4,5,6,7};
118+
static int gamecodetoui[] = {0,2,1,4,5,3,6};
119+
static int uitogamecode[] = {1,3,2,6,4,5,7};
120120

121121

122122
static void UI_StartServerRefresh(qboolean full, qboolean force);
@@ -1296,9 +1296,10 @@ static void UI_DrawEffects(rectDef_t *rect, float scale, vec4_t color) {
12961296
static int gamecodetofxpic[] = {0,2,1,4,5,3,6};
12971297
int gameColorCode = uitogamecode[uiInfo.effectsColor];
12981298
int fxPicIndex = gamecodetofxpic[gameColorCode - 1];
1299+
int markerX = rect->x + (uiInfo.effectsColor * 112 / 6);
12991300

13001301
UI_DrawHandlePic( rect->x, rect->y - 14, 128, 8, uiInfo.uiDC.Assets.fxBasePic );
1301-
UI_DrawHandlePic( rect->x + uiInfo.effectsColor * 16 + 8, rect->y - 16, 16, 12, uiInfo.uiDC.Assets.fxPic[fxPicIndex] );
1302+
UI_DrawHandlePic( markerX, rect->y - 16, 16, 12, uiInfo.uiDC.Assets.fxPic[fxPicIndex] );
13021303
}
13031304

13041305
static void UI_DrawMapPreview(rectDef_t *rect, float scale, vec4_t color, qboolean net) {
@@ -1911,9 +1912,10 @@ static void UI_DrawCrosshairColor(rectDef_t *rect, float scale, vec4_t color) {
19111912
}
19121913
int uiColorIndex = gamecodetoui[gameColorCode - 1];
19131914
int fxPicIndex = gamecodetofxpic[gameColorCode - 1];
1915+
int markerX = rect->x + (uiColorIndex * 112 / 6);
19141916

19151917
UI_DrawHandlePic( rect->x, rect->y - 10, 128, 8, uiInfo.uiDC.Assets.fxBasePic );
1916-
UI_DrawHandlePic( rect->x + uiColorIndex * 16 + 8, rect->y - 12, 16, 12, uiInfo.uiDC.Assets.fxPic[fxPicIndex] );
1918+
UI_DrawHandlePic( markerX, rect->y - 12, 16, 12, uiInfo.uiDC.Assets.fxPic[fxPicIndex] );
19171919
}
19181920

19191921
/*
@@ -2744,13 +2746,15 @@ static qboolean UI_CrosshairColor_HandleKey(int flags, float *special, int key)
27442746
int select = UI_SelectForKey(key);
27452747
if (select != 0) {
27462748
int currentColor = (int)trap_Cvar_VariableValue("cg_crosshairColor");
2747-
currentColor += select;
2749+
int uiIndex = gamecodetoui[currentColor - 1];
2750+
uiIndex += select;
27482751

2749-
if (currentColor > 7) {
2750-
currentColor = 1;
2751-
} else if (currentColor < 1) {
2752-
currentColor = 7;
2752+
if (uiIndex > 6) {
2753+
uiIndex = 0;
2754+
} else if (uiIndex < 0) {
2755+
uiIndex = 6;
27532756
}
2757+
currentColor = uitogamecode[uiIndex];
27542758
trap_Cvar_SetValue("cg_crosshairColor", currentColor);
27552759
// Enable health-based coloring for white, disable for custom colors
27562760
if (currentColor == 7) {

0 commit comments

Comments
 (0)