Skip to content

Commit

Permalink
Merge remote-tracking branch 'yquake2/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
0lvin committed Aug 11, 2024
2 parents 1b86a84 + 18f7541 commit c0fe05f
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 110 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ set(Client-Source
${CLIENT_SRC_DIR}/cl_effects.c
${CLIENT_SRC_DIR}/cl_entities.c
${CLIENT_SRC_DIR}/cl_input.c
${CLIENT_SRC_DIR}/cl_image.c
${CLIENT_SRC_DIR}/cl_inventory.c
${CLIENT_SRC_DIR}/cl_keyboard.c
${CLIENT_SRC_DIR}/cl_lights.c
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ GAME_OBJS_ = \
CLIENT_OBJS_ := \
src/backends/generic/misc.o \
src/client/cl_cin.o \
src/client/cl_image.o \
src/client/cl_console.o \
src/client/cl_download.o \
src/client/cl_effects.o \
Expand Down Expand Up @@ -1012,7 +1013,6 @@ CLIENT_OBJS_ := \
src/client/sound/sdl.o \
src/client/sound/sound.o \
src/client/sound/wave.o \
src/client/cl_image.o \
src/client/vid/vid.o \
src/common/argproc.o \
src/common/clientserver.o \
Expand Down
2 changes: 1 addition & 1 deletion src/backends/unix/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void *
Sys_GetGameAPI(void *parms)
{
typedef void *(*fnAPI)(void *);
fnAPI GetGameAPI;
fnAPI GetGameAPI;

char name[MAX_OSPATH];
char *path;
Expand Down
59 changes: 42 additions & 17 deletions src/client/cl_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ DrawAltStringScaled(int x, int y, const char *s, float factor)
void
Key_ClearTyping(void)
{
key_lines[edit_line][1] = 0; /* clear any typing */
key_linepos = 1;
key_lines[edit_line][0] = '\0';
key_linepos = 0;
}

void
Expand Down Expand Up @@ -471,6 +471,10 @@ Con_DrawInput(void)
int i;
float scale;
char *text;
char ch;
int txtlen;
int linepos;
int draw_icon;

if (cls.key_dest == key_menu)
{
Expand All @@ -485,29 +489,50 @@ Con_DrawInput(void)

scale = SCR_GetConsoleScale();
text = key_lines[edit_line];
linepos = key_linepos;

/* add the cursor frame */
text[key_linepos] = 10 + ((int)(cls.realtime >> 8) & 1);

/* fill out remainder with spaces */
for (i = key_linepos + 1; i < con.linewidth; i++)
/* prestep if horizontally scrolling */
if (linepos >= (con.linewidth - 1))
{
text[i] = ' ';
}
int ofs = 1 + linepos - con.linewidth;

/* prestep if horizontally scrolling */
if (key_linepos >= con.linewidth)
text += ofs;
linepos -= ofs;

draw_icon = 0;
}
else
{
text += 1 + key_linepos - con.linewidth;
Draw_CharScaled(8 * scale, con.vislines - 22 * scale, CON_INPUT_INDICATOR, scale);
draw_icon = 1;
}

for (i = 0; i < con.linewidth; i++)
txtlen = strlen(text);

for (i = 0; i < (con.linewidth - draw_icon); i++)
{
Draw_CharScaled(((i + 1) << 3) * scale, con.vislines - 22 * scale, text[i], scale);
}
if (i == linepos)
{
if (cls.realtime & 8)
{
ch = CON_INPUT_CURSOR;
}
else
{
ch = (text[i] == '\0') ? 10 : text[i];
}
}
else if (i >= txtlen)
{
ch = ' ';
}
else
{
ch = text[i];
}

/* remove cursor */
key_lines[edit_line][key_linepos] = 0;
Draw_CharScaled(((i + 1 + draw_icon) << 3) * scale, con.vislines - 22 * scale, ch, scale);
}
}

/*
Expand Down
Loading

0 comments on commit c0fe05f

Please sign in to comment.