From d8b7a3585a1be1344d956ada1fcf8a9db441f436 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Tue, 10 Feb 2015 01:50:09 -0800 Subject: [PATCH] clean up names --- arch/sdl/key.c | 2 +- include/console.h | 18 +++--- main/cli.c | 139 +++++++++++++++++++++--------------------- main/cli.h | 28 ++++----- main/console.c | 151 +++++++++++++++++++++++----------------------- main/game.c | 2 +- main/gamecntl.c | 4 +- main/gamerend.c | 2 +- main/inferno.c | 4 +- 9 files changed, 174 insertions(+), 176 deletions(-) diff --git a/arch/sdl/key.c b/arch/sdl/key.c index 76dcb988..32d617dd 100644 --- a/arch/sdl/key.c +++ b/arch/sdl/key.c @@ -475,7 +475,7 @@ void key_handle_binding(int keycode, int state) if (Function_mode != FMODE_GAME) return; - if (CON_isVisible()) + if (con_is_visible()) return; if (!state && key_binding_list[keycode][0] == '+') diff --git a/include/console.h b/include/console.h index 5d37ac15..efaa099c 100644 --- a/include/console.h +++ b/include/console.h @@ -27,23 +27,23 @@ enum { /* Takes keys from the keyboard and inputs them to the console if the console isVisible(). * If the event was not handled (i.e. WM events or unknown ctrl- or alt-sequences) * the function returns the event for further processing. */ -int CON_Events(int event); +int con_key_handler(int key); /* Makes the console visible */ -void CON_Show(void); +void con_show(void); /* Hides the console */ -void CON_Hide(void); +void con_hide(void); /* Returns 1 if the console is visible, 0 else */ -int CON_isVisible(void); +int con_is_visible(void); /* Draws the console to the screen if it isVisible()*/ -void CON_DrawConsole(void); +void con_draw(void); /* Initializes the console */ -void CON_Init(void); +void con_init(void); /* Initializes the graphical console */ -void CON_InitGFX(int w, int h); +void con_init_gfx(int w, int h); /* printf for the console */ -void CON_Out(const char *str, ...); +void con_out(const char *str, ...); /* Changes the size of the console */ -void CON_Resize(int w, int h); +void con_resize(int w, int h); /* Priority levels */ diff --git a/main/cli.c b/main/cli.c index 8189404b..f477ecd5 100644 --- a/main/cli.c +++ b/main/cli.c @@ -26,70 +26,69 @@ #define get_msecs() approx_fsec_to_msec(timer_get_approx_seconds()) -#define CON_NUM_LINES 128 +#define CLI_NUM_LINES 128 // Cut the buffer line if it becomes longer than this -#define CON_CHARS_PER_LINE 128 +#define CLI_CHARS_PER_LINE 128 // Cursor blink frequency in ms -#define CON_BLINK_RATE 500 +#define CLI_BLINK_RATE 500 // Border in pixels from the most left to the first letter -#define CON_CHAR_BORDER 4 +#define CLI_CHAR_BORDER 4 // Default prompt used at the commandline -#define CON_DEFAULT_PROMPT "]" +#define CLI_DEFAULT_PROMPT "]" // Cursor shown if we are in insert mode -#define CON_INS_CURSOR "_" +#define CLI_INS_CURSOR "_" // Cursor shown if we are in overwrite mode -#define CON_OVR_CURSOR "|" +#define CLI_OVR_CURSOR "|" +int CLI_insert_mode; // Insert or Overwrite characters? -/* The console's data */ static char **CommandLines; // List of all the past commands static int TotalCommands; // Number of commands in the Back Commands static int LineBuffer; // The number of visible lines in the console (autocalculated) static char *Prompt; // Prompt displayed in command line -static char Command[CON_CHARS_PER_LINE]; // current command in command line = lcommand + rcommand -static char LCommand[CON_CHARS_PER_LINE]; // right hand side of cursor -static char RCommand[CON_CHARS_PER_LINE]; // left hand side of cursor -static char VCommand[CON_CHARS_PER_LINE]; // current visible command line +static char Command[CLI_CHARS_PER_LINE]; // current command in command line = lcommand + rcommand +static char LCommand[CLI_CHARS_PER_LINE]; // right hand side of cursor +static char RCommand[CLI_CHARS_PER_LINE]; // left hand side of cursor +static char VCommand[CLI_CHARS_PER_LINE]; // current visible command line static int CursorPos; // Current cursor position in CurrentCommand static int Offset; // CommandOffset (first visible char of command) - if command is too long to fit into console -int InsMode; // Insert or Overwrite characters? static int CommandScrollBack; // How much the users scrolled back in the command lines -/* Frees all the memory loaded by the console */ -static void CON_Free(void); +/* Frees all the memory loaded by the cli */ +static void cli_free(void); /* shift command history (the one you can switch with the up/down keys) */ -static void CON_NewLineCommand(void); +static void cli_newline(void); -/* Initializes the console */ +/* Initializes the cli */ void cli_init() { int loop; CommandLines = NULL; TotalCommands = 0; - InsMode = 1; + CLI_insert_mode = 1; CursorPos = 0; CommandScrollBack = 0; - Prompt = d_strdup(CON_DEFAULT_PROMPT); - LineBuffer = CON_NUM_LINES; + Prompt = d_strdup(CLI_DEFAULT_PROMPT); + LineBuffer = CLI_NUM_LINES; CommandLines = (char **)d_malloc(sizeof(char *) * LineBuffer); for (loop = 0; loop <= LineBuffer - 1; loop++) { - CommandLines[loop] = (char *)d_calloc(CON_CHARS_PER_LINE, sizeof(char)); + CommandLines[loop] = (char *)d_calloc(CLI_CHARS_PER_LINE, sizeof(char)); } - memset(Command, 0, CON_CHARS_PER_LINE); - memset(LCommand, 0, CON_CHARS_PER_LINE); - memset(RCommand, 0, CON_CHARS_PER_LINE); - memset(VCommand, 0, CON_CHARS_PER_LINE); + memset(Command, 0, CLI_CHARS_PER_LINE); + memset(LCommand, 0, CLI_CHARS_PER_LINE); + memset(RCommand, 0, CLI_CHARS_PER_LINE); + memset(VCommand, 0, CLI_CHARS_PER_LINE); - atexit(CON_Free); + atexit(cli_free); } /* Frees all the memory loaded by the console */ -static void CON_Free(void) +static void cli_free(void) { int i; @@ -105,7 +104,7 @@ static void CON_Free(void) /* Increments the command lines */ -static void CON_NewLineCommand(void) +static void cli_newline(void) { int loop; char *temp; @@ -117,7 +116,7 @@ static void CON_NewLineCommand(void) CommandLines[0] = temp; - memset(CommandLines[0], 0, CON_CHARS_PER_LINE); + memset(CommandLines[0], 0, CLI_CHARS_PER_LINE); if (TotalCommands < LineBuffer - 1) TotalCommands++; } @@ -125,7 +124,7 @@ static void CON_NewLineCommand(void) /* Draws the command line the user is typing in to the screen */ /* completely rewritten by C.Wacha */ -void DrawCommandLine(int y) +void cli_draw(int y) { int x, w, h, aw; float real_aw; @@ -143,7 +142,7 @@ void DrawCommandLine(int y) real_aw = (float)w/(float)strlen(Command); else real_aw = (float)aw; - commandbuffer = (GWIDTH - 2*CON_CHAR_BORDER)/real_aw - (int)strlen(Prompt) - 1; // -1 to make cursor visible + commandbuffer = (GWIDTH - 2*CLI_CHAR_BORDER)/real_aw - (int)strlen(Prompt) - 1; // -1 to make cursor visible //calculate display offset from current cursor position if (Offset < CursorPos - commandbuffer) @@ -158,12 +157,12 @@ void DrawCommandLine(int y) strncat(VCommand, &Command[Offset], strlen(&Command[Offset])); // now display the result - gr_string(CON_CHAR_BORDER, y-h, VCommand); + gr_string(CLI_CHAR_BORDER, y-h, VCommand); // at last add the cursor // check if the blink period is over if (get_msecs() > LastBlinkTime) { - LastBlinkTime = get_msecs() + CON_BLINK_RATE; + LastBlinkTime = get_msecs() + CLI_BLINK_RATE; if(Blink) Blink = 0; else @@ -173,7 +172,7 @@ void DrawCommandLine(int y) // check if cursor has moved - if yes display cursor anyway if (CursorPos != LastCursorPos) { LastCursorPos = CursorPos; - LastBlinkTime = get_msecs() + CON_BLINK_RATE; + LastBlinkTime = get_msecs() + CLI_BLINK_RATE; Blink = 1; } @@ -182,36 +181,36 @@ void DrawCommandLine(int y) gr_get_string_size(Prompt, &prompt_width, &h, &w); gr_get_string_size(LCommand + Offset, &cmd_width, &h, &w); - x = CON_CHAR_BORDER + prompt_width + cmd_width; - if (InsMode) - gr_string(x, y-h, CON_INS_CURSOR); + x = CLI_CHAR_BORDER + prompt_width + cmd_width; + if (CLI_insert_mode) + gr_string(x, y-h, CLI_INS_CURSOR); else - gr_string(x, y-h, CON_OVR_CURSOR); + gr_string(x, y-h, CLI_OVR_CURSOR); } } /* Executes the command entered */ -void CON_Execute(void) +void cli_execute(void) { if(strlen(Command) > 0) { - CON_NewLineCommand(); + cli_newline(); // copy the input into the past commands strings strcpy(CommandLines[0], Command); // display the command including the prompt - CON_Out("%s%s\n", Prompt, Command); + con_out("%s%s\n", Prompt, Command); cmd_append(Command); - Clear_Command(); + cli_clear(); CommandScrollBack = -1; } } -void CON_TabCompletion(void) +void cli_autocomplete(void) { int i, j; char *command; @@ -222,10 +221,10 @@ void CON_TabCompletion(void) return; // no tab completion took place so return silently j = (int)strlen(command); - if (j > CON_CHARS_PER_LINE - 2) - j = CON_CHARS_PER_LINE-1; + if (j > CLI_CHARS_PER_LINE - 2) + j = CLI_CHARS_PER_LINE-1; - memset(LCommand, 0, CON_CHARS_PER_LINE); + memset(LCommand, 0, CLI_CHARS_PER_LINE); CursorPos = 0; for (i = 0; i < j; i++) { @@ -239,9 +238,9 @@ void CON_TabCompletion(void) } -void Cursor_Left(void) +void cli_cursor_left(void) { - char temp[CON_CHARS_PER_LINE]; + char temp[CLI_CHARS_PER_LINE]; if (CursorPos > 0) { CursorPos--; @@ -253,9 +252,9 @@ void Cursor_Left(void) } -void Cursor_Right(void) +void cli_cursor_right(void) { - char temp[CON_CHARS_PER_LINE]; + char temp[CLI_CHARS_PER_LINE]; if(CursorPos < strlen(Command)) { CursorPos++; @@ -266,29 +265,29 @@ void Cursor_Right(void) } -void Cursor_Home(void) +void cli_cursor_home(void) { - char temp[CON_CHARS_PER_LINE]; + char temp[CLI_CHARS_PER_LINE]; CursorPos = 0; strcpy(temp, RCommand); strcpy(RCommand, LCommand); strncat(RCommand, temp, strlen(temp)); - memset(LCommand, 0, CON_CHARS_PER_LINE); + memset(LCommand, 0, CLI_CHARS_PER_LINE); } -void Cursor_End(void) +void cli_cursor_end(void) { CursorPos = (int)strlen(Command); strncat(LCommand, RCommand, strlen(RCommand)); - memset(RCommand, 0, CON_CHARS_PER_LINE); + memset(RCommand, 0, CLI_CHARS_PER_LINE); } -void Cursor_Del(void) +void cli_cursor_del(void) { - char temp[CON_CHARS_PER_LINE]; + char temp[CLI_CHARS_PER_LINE]; if (strlen(RCommand) > 0) { strcpy(temp, RCommand); @@ -296,7 +295,7 @@ void Cursor_Del(void) } } -void Cursor_BSpace(void) +void cli_cursor_backspace(void) { if (CursorPos > 0) { CursorPos--; @@ -308,9 +307,9 @@ void Cursor_BSpace(void) } -void Cursor_Add(char character) +void cli_add_character(char character) { - if (strlen(Command) < CON_CHARS_PER_LINE - 1) + if (strlen(Command) < CLI_CHARS_PER_LINE - 1) { CursorPos++; LCommand[strlen(LCommand)] = character; @@ -319,22 +318,22 @@ void Cursor_Add(char character) } -void Clear_Command(void) +void cli_clear(void) { CursorPos = 0; - memset( Command, 0, CON_CHARS_PER_LINE); - memset(LCommand, 0, CON_CHARS_PER_LINE); - memset(RCommand, 0, CON_CHARS_PER_LINE); - memset(VCommand, 0, CON_CHARS_PER_LINE); + memset( Command, 0, CLI_CHARS_PER_LINE); + memset(LCommand, 0, CLI_CHARS_PER_LINE); + memset(RCommand, 0, CLI_CHARS_PER_LINE); + memset(VCommand, 0, CLI_CHARS_PER_LINE); } -void Command_Up(void) +void cli_history_prev(void) { if(CommandScrollBack < TotalCommands - 1) { /* move back a line in the command strings and copy the command to the current input string */ CommandScrollBack++; - memset(RCommand, 0, CON_CHARS_PER_LINE); + memset(RCommand, 0, CLI_CHARS_PER_LINE); Offset = 0; strcpy(LCommand, CommandLines[CommandScrollBack]); CursorPos = (int)strlen(CommandLines[CommandScrollBack]); @@ -342,13 +341,13 @@ void Command_Up(void) } -void Command_Down(void) +void cli_history_next(void) { if(CommandScrollBack > -1) { /* move forward a line in the command strings and copy the command to the current input string */ CommandScrollBack--; - memset(RCommand, 0, CON_CHARS_PER_LINE); - memset(LCommand, 0, CON_CHARS_PER_LINE); + memset(RCommand, 0, CLI_CHARS_PER_LINE); + memset(LCommand, 0, CLI_CHARS_PER_LINE); Offset = 0; if(CommandScrollBack > -1) strcpy(LCommand, CommandLines[CommandScrollBack]); diff --git a/main/cli.h b/main/cli.h index b6cd1f6c..1030c163 100644 --- a/main/cli.h +++ b/main/cli.h @@ -14,34 +14,34 @@ #define _CLI_H_ 1 // Insert or Overwrite characters? -extern int InsMode; +extern int CLI_insert_mode; void cli_init(void); /* executes the command typed in at the console (called if you press ENTER)*/ -void CON_Execute(); +void cli_execute(); /* Gets called when TAB was pressed */ -void CON_TabCompletion(void); +void cli_autocomplete(void); /* draws the commandline the user is typing in to the screen. called by update? */ -void DrawCommandLine(int y); +void cli_draw(int y); /* Gets called if you press the LEFT key (move cursor left) */ -void Cursor_Left(void); +void cli_cursor_left(void); /* Gets called if you press the RIGHT key (move cursor right) */ -void Cursor_Right(void); +void cli_cursor_right(void); /* Gets called if you press the HOME key (move cursor to the beginning of the line */ -void Cursor_Home(void); +void cli_cursor_home(void); /* Gets called if you press the END key (move cursor to the end of the line*/ -void Cursor_End(void); +void cli_cursor_end(void); /* Called if you press DELETE (deletes character under the cursor) */ -void Cursor_Del(void); +void cli_cursor_del(void); /* Called if you press BACKSPACE (deletes character left of cursor) */ -void Cursor_BSpace(void); +void cli_cursor_backspace(void); /* Called if you type in a character (add the char to the command) */ -void Cursor_Add(char event); +void cli_add_character(char character); /* Called if you press Ctrl-C (deletes the commandline) */ -void Clear_Command(void); +void cli_clear(void); /* Called if you press UP key (switches through recent typed in commands */ -void Command_Up(void); +void cli_history_prev(void); /* Called if you press DOWN key (switches through recent typed in commands */ -void Command_Down(void); +void cli_history_next(void); #endif /* _CLI_H_ */ diff --git a/main/console.c b/main/console.c index a2f5a074..bbdf26c0 100644 --- a/main/console.c +++ b/main/console.c @@ -84,143 +84,143 @@ static int con_initialized; /* Internals */ -void CON_UpdateOffset(void); +static void con_update_offset(void); /* Frees all the memory loaded by the console */ -static void CON_Free(void); -int CON_Background(grs_bitmap *image); +static void con_free(void); +static int con_background(grs_bitmap *image); /* Sets font info for the console */ -void CON_Font(grs_font *font, int fg, int bg); +static void con_font(grs_font *font, int fg, int bg); /* Set the key, that invokes a CON_Hide() after press. default is ESCAPE and you can always hide using ESCAPE and the HideKey. compared against event->key.keysym.sym !! */ -void CON_SetHideKey(int key); +static void con_set_hide_key(int key); /* makes newline (same as printf("\n") or CON_Out("\n") ) */ -void CON_NewLineConsole(void); +static void con_newline(void); /* updates console after resize etc. */ -void CON_UpdateConsole(void); +static void con_update(void); /* Called if you press Ctrl-L (deletes the History) */ -void Clear_History(void); +static void con_clear(void); /* Takes keys from the keyboard and inputs them to the console * If the event was not handled (i.e. WM events or unknown ctrl-shift * sequences) the function returns the event for further processing. */ -int CON_Events(int event) +int con_key_handler(int key) { - if (!CON_isVisible()) - return event; + if (!con_is_visible()) + return key; - if (event & KEY_CTRLED) + if (key & KEY_CTRLED) { // CTRL pressed - switch (event & ~KEY_CTRLED) + switch (key & ~KEY_CTRLED) { case KEY_A: - Cursor_Home(); + cli_cursor_home(); break; case KEY_E: - Cursor_End(); + cli_cursor_end(); break; case KEY_C: - Clear_Command(); + cli_clear(); break; case KEY_L: - Clear_History(); - CON_UpdateConsole(); + con_clear(); + con_update(); break; default: - return event; + return key; } } - else if (event & KEY_ALTED) + else if (key & KEY_ALTED) { // the console does not handle ALT combinations! - return event; + return key; } else { // first of all, check if the console hide key was pressed - if (event == HideKey) + if (key == HideKey) { - CON_Hide(); + con_hide(); return 0; } - switch (event & 0xff) + switch (key & 0xff) { case KEY_LSHIFT: case KEY_RSHIFT: - return event; + return key; case KEY_HOME: - if(event & KEY_SHIFTED) + if(key & KEY_SHIFTED) { ConsoleScrollBack = LineBuffer-1; - CON_UpdateConsole(); + con_update(); } else { - Cursor_Home(); + cli_cursor_home(); } break; case KEY_END: - if(event & KEY_SHIFTED) + if(key & KEY_SHIFTED) { ConsoleScrollBack = 0; - CON_UpdateConsole(); + con_update(); } else { - Cursor_End(); + cli_cursor_end(); } break; case KEY_PAGEUP: ConsoleScrollBack += CON_LINE_SCROLL; if(ConsoleScrollBack > LineBuffer-1) ConsoleScrollBack = LineBuffer-1; - CON_UpdateConsole(); + con_update(); break; case KEY_PAGEDOWN: ConsoleScrollBack -= CON_LINE_SCROLL; if(ConsoleScrollBack < 0) ConsoleScrollBack = 0; - CON_UpdateConsole(); + con_update(); break; case KEY_UP: - Command_Up(); + cli_history_prev(); break; case KEY_DOWN: - Command_Down(); + cli_history_next(); break; case KEY_LEFT: - Cursor_Left(); + cli_cursor_left(); break; case KEY_RIGHT: - Cursor_Right(); + cli_cursor_right(); break; case KEY_BACKSP: - Cursor_BSpace(); + cli_cursor_backspace(); break; case KEY_DELETE: - Cursor_Del(); + cli_cursor_del(); break; case KEY_INSERT: - InsMode = 1-InsMode; + CLI_insert_mode = !CLI_insert_mode; break; case KEY_TAB: - CON_TabCompletion(); + cli_autocomplete(); break; case KEY_ENTER: - CON_Execute(); + cli_execute(); break; case KEY_LAPOSTRO: // deactivate Console - CON_Hide(); + con_hide(); return 0; default: { - unsigned char character = key_to_ascii(event); + unsigned char character = key_to_ascii(key); if (character == 255) break; - if (InsMode) - Cursor_Add(character); + if (CLI_insert_mode) + cli_add_character(character); else { - Cursor_Add(character); - Cursor_Del(); + cli_add_character(character); + cli_cursor_del(); } } } @@ -230,7 +230,7 @@ int CON_Events(int event) /* Updates the console buffer */ -void CON_UpdateConsole(void) +void con_update(void) { int loop; int loop2; @@ -238,7 +238,7 @@ void CON_UpdateConsole(void) grs_canvas *canv_save; /* Due to the Blits, the update is not very fast: So only update if it's worth it */ - if (!CON_isVisible()) + if (!con_is_visible()) return; Screenlines = ConsoleSurface->cv_h / (CON_LINE_SPACE + ConsoleSurface->cv_font->ft_h); @@ -267,7 +267,7 @@ void CON_UpdateConsole(void) } -void CON_UpdateOffset(void) +void con_update_offset(void) { switch (Visible) { case CON_CLOSING: @@ -292,7 +292,7 @@ void CON_UpdateOffset(void) /* Draws the console buffer to the screen if the console is "visible" */ -void CON_DrawConsole(void) +void con_draw(void) { grs_canvas *canv_save; grs_bitmap *clip; @@ -302,7 +302,7 @@ void CON_DrawConsole(void) return; /* Update the scrolling offset */ - CON_UpdateOffset(); + con_update_offset(); canv_save = grd_curcanv; @@ -312,7 +312,7 @@ void CON_DrawConsole(void) // restore InputBackground gr_bitmap(0, ConsoleSurface->cv_h - ConsoleSurface->cv_font->ft_h, InputBackground); - DrawCommandLine(ConsoleSurface->cv_h); + cli_draw(ConsoleSurface->cv_h); gr_set_current_canvas(&grd_curscreen->sc_canvas); @@ -326,7 +326,7 @@ void CON_DrawConsole(void) /* Initializes the console */ -void CON_Init() +void con_init() { int loop; @@ -336,7 +336,6 @@ void CON_Init() TotalConsoleLines = 0; ConsoleScrollBack = 0; BackgroundImage = NULL; - InsMode = 1; HideKey = CON_DEFAULT_HIDEKEY; /* load the console surface */ @@ -361,12 +360,12 @@ void CON_Init() con_initialized = 1; - atexit(CON_Free); + atexit(con_free); } void gr_init_bitmap_alloc( grs_bitmap *bm, int mode, int x, int y, int w, int h, int bytesperline); -void CON_InitGFX(int w, int h) +void con_init_gfx(int w, int h) { int pcx_error; grs_bitmap bmp; @@ -382,7 +381,7 @@ void CON_InitGFX(int w, int h) } /* Load the consoles font */ - CON_Font(SMALL_FONT, gr_find_closest_color(29,29,47), -1); + con_font(SMALL_FONT, gr_find_closest_color(29,29,47), -1); /* make sure that the size of the console is valid */ if (w > grd_curscreen->sc_w || w < ConsoleSurface->cv_font->ft_w * 32) @@ -406,21 +405,21 @@ void CON_InitGFX(int w, int h) pcx_error = pcx_read_bitmap(CON_BG, &bmp, BM_LINEAR, pal); Assert(pcx_error == PCX_ERROR_NONE); gr_remap_bitmap_good(&bmp, pal, -1, -1); - CON_Background(&bmp); + con_background(&bmp); gr_free_bitmap_data(&bmp); } /* Makes the console visible */ -void CON_Show(void) +void con_show(void) { Visible = CON_OPENING; - CON_UpdateConsole(); + con_update(); } /* Hides the console (make it invisible) */ -void CON_Hide(void) +void con_hide(void) { Visible = CON_CLOSING; key_flush(); @@ -428,14 +427,14 @@ void CON_Hide(void) /* tells wether the console is visible or not */ -int CON_isVisible(void) +int con_is_visible(void) { return((Visible == CON_OPEN) || (Visible == CON_OPENING)); } /* Frees all the memory loaded by the console */ -static void CON_Free(void) +static void con_free(void) { int i; @@ -463,7 +462,7 @@ static void CON_Free(void) /* Increments the console lines */ -void CON_NewLineConsole(void) +void con_newline(void) { int loop; char *temp; @@ -520,7 +519,7 @@ static inline int con_get_string_width(char *string) #endif /* Outputs text to the console (in game), up to CON_CHARS_PER_LINE chars can be entered */ -void CON_Out(const char *str, ...) +void con_out(const char *str, ...) { va_list marker; //keep some space free for stuff like CON_Out("blablabla %s", Command); @@ -543,12 +542,12 @@ void CON_Out(const char *str, ...) while (*p) { if (*p == '\n') { *p = '\0'; - CON_NewLineConsole(); + con_newline(); strcat(ConsoleLines[0], ptemp); ptemp = p+1; } else if (p - ptemp > VChars - strlen(ConsoleLines[0]) || con_get_string_width(ptemp) > con_get_width()) { - CON_NewLineConsole(); + con_newline(); strncat(ConsoleLines[0], ptemp, VChars - strlen(ConsoleLines[0])); ConsoleLines[0][VChars] = '\0'; ptemp = p; @@ -559,13 +558,13 @@ void CON_Out(const char *str, ...) strncat(ConsoleLines[0], ptemp, VChars - strlen(ConsoleLines[0])); ConsoleLines[0][VChars] = '\0'; } - CON_UpdateConsole(); + con_update(); } } /* Adds background image to the console, scaled to size of console*/ -int CON_Background(grs_bitmap *image) +int con_background(grs_bitmap *image) { /* Free the background from the console */ if (image == NULL) { @@ -588,7 +587,7 @@ int CON_Background(grs_bitmap *image) /* Sets font info for the console */ -void CON_Font(grs_font *font, int fg, int bg) +void con_font(grs_font *font, int fg, int bg) { grs_canvas *canv_save; @@ -602,7 +601,7 @@ void CON_Font(grs_font *font, int fg, int bg) /* resizes the console, has to reset alot of stuff * returns 1 on error */ -void CON_Resize(int w, int h) +void con_resize(int w, int h) { /* make sure that the size of the console is valid */ if(w > grd_curscreen->sc_w || w < ConsoleSurface->cv_font->ft_w * 32) @@ -629,13 +628,13 @@ void CON_Resize(int w, int h) /* Sets the key that deactivates (hides) the console. */ -void CON_SetHideKey(int key) +void con_set_hide_key(int key) { HideKey = key; } -void Clear_History(void) +void con_clear(void) { int loop; @@ -660,7 +659,7 @@ void con_printf(int priority, char *fmt, ...) va_end (arglist); if (con_initialized) - CON_Out(buffer); + con_out(buffer); if (!text_console_enabled) return; diff --git a/main/game.c b/main/game.c index eac015b6..57997811 100644 --- a/main/game.c +++ b/main/game.c @@ -735,7 +735,7 @@ int set_screen_mode(int sm) FontHires = 0; } - CON_InitGFX(grd_curscreen->sc_w, grd_curscreen->sc_h / 2); + con_init_gfx(grd_curscreen->sc_w, grd_curscreen->sc_h / 2); mouse_set_mode(Config_control_mouse.intval); newmenu_hide_cursor(); diff --git a/main/gamecntl.c b/main/gamecntl.c index 5b8c1891..5b6a7540 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -967,7 +967,7 @@ int HandleSystemKey(int key) case KEY_LAPOSTRO: case KEY_SHIFTED + KEY_LAPOSTRO: - CON_Show(); + con_show(); break; case KEY_SHIFTED + KEY_ESC: //quick exit @@ -2381,7 +2381,7 @@ void ReadControls() #endif #endif - if(!CON_Events(key)) + if(!con_key_handler(key)) continue; if (Player_is_dead) diff --git a/main/gamerend.c b/main/gamerend.c index 4d20ada2..61a199d7 100644 --- a/main/gamerend.c +++ b/main/gamerend.c @@ -1020,7 +1020,7 @@ void game_render_frame_mono(void) Game_mode = GM_NORMAL; } - CON_DrawConsole(); + con_draw(); vid_update(); #ifdef OGL diff --git a/main/inferno.c b/main/inferno.c index c30d4805..fef57147 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -401,7 +401,7 @@ int main(int argc, char *argv[]) ubyte title_pal[768]; mem_init(); - CON_Init(); // Initialise the console + con_init(); // Initialise the console error_init(NULL, NULL); PHYSFSX_init(argc, argv); @@ -609,7 +609,7 @@ int main(int argc, char *argv[]) con_printf( CON_DEBUG, "\nShowing loading screen..." ); show_loading_screen(title_pal); // title_pal is needed (see below) - CON_InitGFX(SWIDTH, SHEIGHT / 2); + con_init_gfx(SWIDTH, SHEIGHT / 2); con_printf( CON_DEBUG , "\nDoing bm_init..." ); #ifdef EDITOR -- 2.39.2