Skip to content

Commit

Permalink
Implement MAX value overflow blinking styles #51
Browse files Browse the repository at this point in the history
  • Loading branch information
JNechaevsky authored Aug 21, 2023
2 parents 2ba6ebb + 828bc0a commit 703661f
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 37 deletions.
2 changes: 2 additions & 0 deletions src/crlvars.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ int crl_freeze = 0;
int crl_widget_coords = 0;
int crl_widget_playstate = 2;
int crl_widget_render = 1;
int crl_widget_maxvp = 0;
int crl_widget_kis = 0;
int crl_widget_time = 0;
int crl_widget_powerups = 0;
Expand Down Expand Up @@ -112,6 +113,7 @@ void CRL_BindVariables (void)
M_BindIntVariable("crl_widget_coords", &crl_widget_coords);
M_BindIntVariable("crl_widget_playstate", &crl_widget_playstate);
M_BindIntVariable("crl_widget_render", &crl_widget_render);
M_BindIntVariable("crl_widget_maxvp", &crl_widget_maxvp);
M_BindIntVariable("crl_widget_kis", &crl_widget_kis);
M_BindIntVariable("crl_widget_time", &crl_widget_time);
M_BindIntVariable("crl_widget_powerups", &crl_widget_powerups);
Expand Down
1 change: 1 addition & 0 deletions src/crlvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern int crl_freeze;
extern int crl_widget_coords;
extern int crl_widget_playstate;
extern int crl_widget_render;
extern int crl_widget_maxvp;
extern int crl_widget_kis;
extern int crl_widget_time;
extern int crl_widget_powerups;
Expand Down
20 changes: 19 additions & 1 deletion src/doom/crlfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,24 @@ void CRL_MoveTo_MAX (void)
P_SetThingPosition(player->mo);
}

static byte *CRL_Colorize_MAX (int style)
{
switch (style)
{
case 1: // Slow blinking
return gametic & 8 ? cr[CR_YELLOW] : cr[CR_GREEN];
break;

case 2: // Fast blinking
return gametic & 16 ? cr[CR_YELLOW] : cr[CR_GREEN];
break;

default:
return cr[CR_YELLOW];
break;
}
}

// -----------------------------------------------------------------------------
// Draws CRL stats.
// [JN] Draw all the widgets and counters.
Expand Down Expand Up @@ -395,7 +413,7 @@ void CRL_StatDrawer (void)
// x
M_WriteText(32 + M_StringWidth(vis), 133+yy, max, TotalVisPlanes >= CRL_MaxVisPlanes ?
(gametic & 8 ? cr[CR_RED] : cr[CR_YELLOW]) :
CRL_MAX_count >= CRL_MaxVisPlanes ? cr[CR_YELLOW] : cr[CR_GREEN]);
CRL_MAX_count >= CRL_MaxVisPlanes ? CRL_Colorize_MAX(crl_widget_maxvp) : cr[CR_GREEN]);

// )
M_WriteText(32 + M_StringWidth(vis) + M_StringWidth(max), 133+yy, ")", TotalVisPlanes >= CRL_MaxVisPlanes ?
Expand Down
96 changes: 60 additions & 36 deletions src/doom/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ static void M_ChooseCRL_Widgets (int choice);
static void M_DrawCRL_Widgets (void);

static void M_CRL_Widget_Render (int choice);
static void M_CRL_Widget_MAX (int choice);
static void M_CRL_Widget_Playstate (int choice);
static void M_CRL_Widget_KIS (int choice);
static void M_CRL_Widget_Coords (int choice);
Expand Down Expand Up @@ -799,6 +800,7 @@ static byte *M_Line_Glow (const int tics)
#define GLOW_DARKRED 2
#define GLOW_GREEN 3
#define GLOW_DARKGREEN 4
#define GLOW_YELLOW 5

#define ITEMONTICS currentMenu->menuitems[itemOn].tics
#define ITEMSETONTICS currentMenu->menuitems[itemSetOn].tics
Expand All @@ -808,9 +810,10 @@ static byte *M_Item_Glow (const int itemSetOn, const int color)
if (itemOn == itemSetOn)
{
return
color == GLOW_RED || color == GLOW_DARKRED ? cr[CR_RED_BRIGHT5] :
color == GLOW_GREEN || color == GLOW_DARKGREEN ? cr[CR_GREEN_BRIGHT5] :
cr[CR_MENU_BRIGHT5] ; // GLOW_UNCOLORED
color == GLOW_RED || color == GLOW_DARKRED ? cr[CR_RED_BRIGHT5] :
color == GLOW_GREEN || color == GLOW_DARKGREEN ? cr[CR_GREEN_BRIGHT5] :
color == GLOW_YELLOW ? cr[CR_YELLOW_BRIGHT5] :
cr[CR_MENU_BRIGHT5] ; // GLOW_UNCOLORED
}
else
{
Expand Down Expand Up @@ -859,6 +862,15 @@ static byte *M_Item_Glow (const int itemSetOn, const int color)
ITEMSETONTICS == 2 ? cr[CR_GREEN_BRIGHT2] :
ITEMSETONTICS == 1 ? cr[CR_GREEN_BRIGHT1] : cr[CR_DARKGREEN];
}
if (color == GLOW_YELLOW)
{
return
ITEMSETONTICS == 5 ? cr[CR_YELLOW_BRIGHT5] :
ITEMSETONTICS == 4 ? cr[CR_YELLOW_BRIGHT4] :
ITEMSETONTICS == 3 ? cr[CR_YELLOW_BRIGHT3] :
ITEMSETONTICS == 2 ? cr[CR_YELLOW_BRIGHT2] :
ITEMSETONTICS == 1 ? cr[CR_YELLOW_BRIGHT1] : cr[CR_YELLOW];
}
}
return NULL;
}
Expand Down Expand Up @@ -2575,20 +2587,20 @@ static void M_Bind_M_Reset (int choice)

static menuitem_t CRLMenu_Widgets[]=
{
{ 2, "RENDER COUNTERS", M_CRL_Widget_Render, 'r'},
{ 2, "PLAYSTATE COUNTERS", M_CRL_Widget_Playstate, 'r'},
{ 2, "KIS STATS/FRAGS", M_CRL_Widget_KIS, 'k'},
{ 2, "LEVEL/DM TIMER", M_CRL_Widget_Time, 'l'},
{ 2, "PLAYER COORDS", M_CRL_Widget_Coords, 'p'},
{ 2, "POWERUP TIMERS", M_CRL_Widget_Powerups, 'p'},
{ 2, "TARGET'S HEALTH", M_CRL_Widget_Health, 't'},
{-1, "", 0, '\0'},
{ 2, "RENDER COUNTERS", M_CRL_Widget_Render, 'r'},
{ 2, "MAX OVERFLOW STYLE", M_CRL_Widget_MAX, 'r'},
{ 2, "PLAYSTATE COUNTERS", M_CRL_Widget_Playstate, 'r'},
{ 2, "KIS STATS/FRAGS", M_CRL_Widget_KIS, 'k'},
{ 2, "LEVEL/DM TIMER", M_CRL_Widget_Time, 'l'},
{ 2, "PLAYER COORDS", M_CRL_Widget_Coords, 'p'},
{ 2, "POWERUP TIMERS", M_CRL_Widget_Powerups, 'p'},
{ 2, "TARGET'S HEALTH", M_CRL_Widget_Health, 't'},
{-1, "", 0, '\0'},
{ 2, "ROTATE MODE", M_CRL_Automap_Rotate, 'r'},
{ 2, "OVERLAY MODE", M_CRL_Automap_Overlay, 'o'},
{ 2, "DRAWING MODE", M_CRL_Automap_Drawing, 'd'},
{ 2, "MARK SECRET SECTORS", M_CRL_Automap_Secrets, 'm'},
{-1, "", 0, '\0'},
{ 2, "ROTATE MODE", M_CRL_Automap_Rotate, 'r'},
{ 2, "OVERLAY MODE", M_CRL_Automap_Overlay, 'o'},
{ 2, "DRAWING MODE", M_CRL_Automap_Drawing, 'd'},
{ 2, "MARK SECRET SECTORS", M_CRL_Automap_Secrets, 'm'},
{-1, "", 0, '\0'}
};

Expand Down Expand Up @@ -2622,73 +2634,85 @@ static void M_DrawCRL_Widgets (void)
M_Item_Glow(0, crl_widget_render == 1 ? GLOW_GREEN :
crl_widget_render == 2 ? GLOW_DARKGREEN : GLOW_DARKRED));

// MAX overflow style
sprintf(str, crl_widget_maxvp == 1 ? "BLINKING 1" :
crl_widget_maxvp == 2 ? "BLINKING 2" : "STATIC");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 45, str,
M_Item_Glow(1, crl_widget_maxvp == 1 ? (gametic & 8 ? GLOW_YELLOW : GLOW_GREEN) :
crl_widget_maxvp == 2 ? (gametic & 16 ? GLOW_YELLOW : GLOW_GREEN) : GLOW_YELLOW));

// Playstate counters
sprintf(str, crl_widget_playstate == 1 ? "ON" :
crl_widget_playstate == 2 ? "OVERFLOWS" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 45, str,
M_Item_Glow(1, crl_widget_playstate == 1 ? GLOW_GREEN :
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 54, str,
M_Item_Glow(2, crl_widget_playstate == 1 ? GLOW_GREEN :
crl_widget_playstate == 2 ? GLOW_DARKGREEN : GLOW_DARKRED));

// K/I/S stats
sprintf(str, crl_widget_kis == 1 ? "ON" :
crl_widget_kis == 2 ? "AUTOMAP" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 54, str,
M_Item_Glow(2, crl_widget_kis ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 63, str,
M_Item_Glow(3, crl_widget_kis ? GLOW_GREEN : GLOW_DARKRED));

// Level time
sprintf(str, crl_widget_time == 1 ? "ON" :
crl_widget_time == 2 ? "AUTOMAP" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 63, str,
M_Item_Glow(3, crl_widget_time ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 72, str,
M_Item_Glow(4, crl_widget_time ? GLOW_GREEN : GLOW_DARKRED));

// Player coords
sprintf(str, crl_widget_coords == 1 ? "ON" :
crl_widget_coords == 2 ? "AUTOMAP" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 72, str,
M_Item_Glow(4, crl_widget_coords ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 81, str,
M_Item_Glow(5, crl_widget_coords ? GLOW_GREEN : GLOW_DARKRED));

// Powerup timers
sprintf(str, crl_widget_powerups ? "ON" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 81, str,
M_Item_Glow(5, crl_widget_powerups ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 90, str,
M_Item_Glow(6, crl_widget_powerups ? GLOW_GREEN : GLOW_DARKRED));

// Target's health
sprintf(str, crl_widget_health == 1 ? "TOP" :
crl_widget_health == 2 ? "TOP+NAME" :
crl_widget_health == 3 ? "BOTTOM" :
crl_widget_health == 4 ? "BOTTOM+NAME" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 90, str,
M_Item_Glow(6, crl_widget_health ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 99, str,
M_Item_Glow(7, crl_widget_health ? GLOW_GREEN : GLOW_DARKRED));

M_WriteTextCentered(108, "AUTOMAP", cr[CR_YELLOW]);
M_WriteTextCentered(117, "AUTOMAP", cr[CR_YELLOW]);

// Rotate mode
sprintf(str, crl_automap_rotate ? "ON" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 117, str,
M_Item_Glow(9, crl_automap_rotate ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 126, str,
M_Item_Glow(10, crl_automap_rotate ? GLOW_GREEN : GLOW_DARKRED));

// Overlay mode
sprintf(str, crl_automap_overlay ? "ON" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 126, str,
M_Item_Glow(10, crl_automap_overlay ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 135, str,
M_Item_Glow(11, crl_automap_overlay ? GLOW_GREEN : GLOW_DARKRED));

// Drawing mode
sprintf(str, crl_automap_mode == 1 ? "FLOOR VISPLANES" :
crl_automap_mode == 2 ? "CEILING VISPLANES" : "NORMAL");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 135, str,
M_Item_Glow(11, crl_automap_mode ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 144, str,
M_Item_Glow(12, crl_automap_mode ? GLOW_GREEN : GLOW_DARKRED));

// Mark secret sectors
sprintf(str, crl_automap_secrets ? "ON" : "OFF");
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 144, str,
M_Item_Glow(12, crl_automap_secrets ? GLOW_GREEN : GLOW_DARKRED));
M_WriteText (CRL_MENU_RIGHTOFFSET - M_StringWidth(str), 153, str,
M_Item_Glow(13, crl_automap_secrets ? GLOW_GREEN : GLOW_DARKRED));
}

static void M_CRL_Widget_Render (int choice)
{
crl_widget_render = M_INT_Slider(crl_widget_render, 0, 2, choice);
}

static void M_CRL_Widget_MAX (int choice)
{
crl_widget_maxvp = M_INT_Slider(crl_widget_maxvp, 0, 2, choice);
}

static void M_CRL_Widget_Playstate (int choice)
{
crl_widget_playstate = M_INT_Slider(crl_widget_playstate, 0, 2, choice);
Expand Down
1 change: 1 addition & 0 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ static default_t doom_defaults_list[] =
CONFIG_VARIABLE_INT(crl_widget_coords),
CONFIG_VARIABLE_INT(crl_widget_playstate),
CONFIG_VARIABLE_INT(crl_widget_render),
CONFIG_VARIABLE_INT(crl_widget_maxvp),
CONFIG_VARIABLE_INT(crl_widget_kis),
CONFIG_VARIABLE_INT(crl_widget_time),
CONFIG_VARIABLE_INT(crl_widget_powerups),
Expand Down
44 changes: 44 additions & 0 deletions src/v_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ static byte cr_darkgreen[256];
static byte cr_brightgreen[256];
static byte cr_olive[256];
static byte cr_blue2[256];

static byte cr_yellow[256];
static byte cr_yellow_bright5[256];
static byte cr_yellow_bright4[256];
static byte cr_yellow_bright3[256];
static byte cr_yellow_bright2[256];
static byte cr_yellow_bright1[256];

static byte cr_orange[256];
static byte cr_white[256];
static byte cr_gray[256];
Expand Down Expand Up @@ -110,7 +117,14 @@ byte *cr[] =
(byte *) &cr_brightgreen,
(byte *) &cr_olive,
(byte *) &cr_blue2,

(byte *) &cr_yellow,
(byte *) &cr_yellow_bright5,
(byte *) &cr_yellow_bright4,
(byte *) &cr_yellow_bright3,
(byte *) &cr_yellow_bright2,
(byte *) &cr_yellow_bright1,

(byte *) &cr_orange,
(byte *) &cr_white,
(byte *) &cr_gray,
Expand Down Expand Up @@ -492,6 +506,36 @@ byte V_Colorize (byte *playpal, int cr, byte source, boolean keepgray109)
hsv.y = 1.0 - 0.4 * hsv.z;
hsv.z = 0.2 + 0.8 * hsv.z;
}
else if (cr == CR_YELLOW_BRIGHT5)
{
hsv.x = (7.0 + 53. * hsv.z)/360.;
hsv.y = 1.0 - 0.4 * hsv.z;
hsv.z = 0.2 + 0.8 * hsv.z * 1.5;
}
else if (cr == CR_YELLOW_BRIGHT4)
{
hsv.x = (7.0 + 53. * hsv.z)/360.;
hsv.y = 1.0 - 0.4 * hsv.z;
hsv.z = 0.2 + 0.8 * hsv.z * 1.4;
}
else if (cr == CR_YELLOW_BRIGHT3)
{
hsv.x = (7.0 + 53. * hsv.z)/360.;
hsv.y = 1.0 - 0.4 * hsv.z;
hsv.z = 0.2 + 0.8 * hsv.z * 1.3;
}
else if (cr == CR_YELLOW_BRIGHT2)
{
hsv.x = (7.0 + 53. * hsv.z)/360.;
hsv.y = 1.0 - 0.4 * hsv.z;
hsv.z = 0.2 + 0.8 * hsv.z * 1.2;
}
else if (cr == CR_YELLOW_BRIGHT1)
{
hsv.x = (7.0 + 53. * hsv.z)/360.;
hsv.y = 1.0 - 0.4 * hsv.z;
hsv.z = 0.2 + 0.8 * hsv.z * 1.1;
}
else if (cr == CR_ORANGE)
{
hsv.x = 0.0666;
Expand Down
7 changes: 7 additions & 0 deletions src/v_trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ enum
CR_BRIGHTGREEN,
CR_OLIVE,
CR_BLUE2,

CR_YELLOW,
CR_YELLOW_BRIGHT5,
CR_YELLOW_BRIGHT4,
CR_YELLOW_BRIGHT3,
CR_YELLOW_BRIGHT2,
CR_YELLOW_BRIGHT1,

CR_ORANGE,
CR_WHITE,
CR_GRAY,
Expand Down

0 comments on commit 703661f

Please sign in to comment.