From f1596273a3e991448ca7e04415a74f916b2c9810 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 20 Jul 2009 00:37:41 +0000 Subject: Save and display the loading disk icon as a fixed 16x16 square, from an image drawn at the bottom right corner of the screen. This seems to be the same as how Vanilla behaves, and fixes chook3.wad, that uses an STDISK replacement with an offset that pushes the image to the left. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1629 --- src/i_video.c | 65 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 3412051b..582a7fa7 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -50,6 +50,9 @@ #include "w_wad.h" #include "z_zone.h" +#define LOADING_DISK_W 16 +#define LOADING_DISK_H 16 + // Non aspect ratio-corrected modes (direct multiples of 320x200) static screen_mode_t *screen_modes[] = { @@ -145,7 +148,6 @@ boolean screenvisible; // restored by EndRead static byte *disk_image = NULL; -static int disk_image_w, disk_image_h; static byte *saved_background; static boolean window_focused; @@ -258,6 +260,8 @@ static void LoadDiskImage(void) patch_t *disk; char *disk_name; int y; + int xoffset = SCREENWIDTH - LOADING_DISK_W; + int yoffset = SCREENHEIGHT - LOADING_DISK_H; char buf[20]; SDL_VideoDriverName(buf, 15); @@ -278,19 +282,20 @@ static void LoadDiskImage(void) disk = W_CacheLumpName(disk_name, PU_STATIC); - V_DrawPatch(0, 0, 0, disk); - disk_image_w = SHORT(disk->width); - disk_image_h = SHORT(disk->height); + // Draw the disk to the screen: + + V_DrawPatch(SCREENWIDTH - LOADING_DISK_W, + SCREENHEIGHT - LOADING_DISK_H, + 0, disk); - disk_image = Z_Malloc(disk_image_w * disk_image_h, PU_STATIC, NULL); - saved_background = Z_Malloc(disk_image_w * disk_image_h, PU_STATIC, NULL); + disk_image = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); + saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); - for (y=0; yh; + break; + + case KEY_PGDN: + pagey = scrollpane->h - 1; + break; + + default: // We shouldn't even be in this function + return 0; + } + + if (scrollpane->child->widget_class == &txt_table_class) + { + return TXT_PageTable(scrollpane->child, pagex, pagey); + } + + return 0; +} + // Interpret arrow key presses as scroll commands static int InterpretScrollKey(txt_scrollpane_t *scrollpane, int key) { + int maxy; + switch (key) { case KEY_UPARROW: @@ -292,6 +335,31 @@ static int InterpretScrollKey(txt_scrollpane_t *scrollpane, int key) } break; + case KEY_PGUP: + if (scrollpane->y > 0) + { + scrollpane->y -= scrollpane->h; + if (scrollpane->y < 0) + { + scrollpane->y = 0; + } + return 1; + } + break; + + case KEY_PGDN: + maxy = FullHeight(scrollpane) - scrollpane->h; + if (scrollpane->y < maxy) + { + scrollpane->y += scrollpane->h; + if (scrollpane->y > maxy) + { + scrollpane->y = maxy; + } + return 1; + } + break; + default: break; } @@ -316,8 +384,14 @@ static int TXT_ScrollPaneKeyPress(TXT_UNCAST_ARG(scrollpane), int key) if (scrollpane->child->widget_class == &txt_table_class && (key == KEY_UPARROW || key == KEY_DOWNARROW - || key == KEY_LEFTARROW || key == KEY_RIGHTARROW)) + || key == KEY_LEFTARROW || key == KEY_RIGHTARROW + || key == KEY_PGUP || key == KEY_PGDN)) { + if (PageSelectedWidget(scrollpane, key)) + { + result = 1; + } + ShowSelectedWidget(scrollpane); } diff --git a/textscreen/txt_table.c b/textscreen/txt_table.c index 0d4d1e35..1b432681 100644 --- a/textscreen/txt_table.c +++ b/textscreen/txt_table.c @@ -770,3 +770,85 @@ void TXT_SetColumnWidths(TXT_UNCAST_ARG(table), ...) va_end(args); } +// Moves the select by at least the given number of characters. +// Currently quietly ignores pagex, as we don't use it. + +int TXT_PageTable(TXT_UNCAST_ARG(table), int pagex, int pagey) +{ + TXT_CAST_ARG(txt_table_t, table); + unsigned int *column_widths; + unsigned int *row_heights; + int rows; + int changed = 0; + + rows = TableRows(table); + + row_heights = malloc(sizeof(int) * rows); + column_widths = malloc(sizeof(int) * table->columns); + + CalcRowColSizes(table, row_heights, column_widths); + + if (pagex) + { + // @todo Jump selection to the left or right as needed + } + + if (pagey) + { + int new_x, new_y; + int distance = 0; + int dir; + + // What direction are we moving? + + if (pagey > 0) + { + dir = 1; + } + else + { + dir = -1; + } + + // Move the cursor until the desired distance is reached. + + new_y = table->selected_y; + + while (new_y >= 0 && new_y < rows) + { + // We are about to travel a distance equal to the height of the row + // we are about to leave. + + distance += row_heights[new_y]; + + // *Now* increment the loop. + + new_y += dir; + + new_x = FindSelectableColumn(table, new_y, table->selected_x); + + if (new_x >= 0) + { + // Found a selectable widget in this column! + // Select it anyway in case we don't find something better. + + table->selected_x = new_x; + table->selected_y = new_y; + changed = 1; + + // ...but is it far enough away? + + if (distance >= abs(pagey)) + { + break; + } + } + } + } + + free(row_heights); + free(column_widths); + + return changed; +} + diff --git a/textscreen/txt_table.h b/textscreen/txt_table.h index 0e7fbe94..0166abee 100644 --- a/textscreen/txt_table.h +++ b/textscreen/txt_table.h @@ -178,6 +178,19 @@ void TXT_SetColumnWidths(TXT_UNCAST_ARG(table), ...); void TXT_ClearTable(TXT_UNCAST_ARG(table)); +/** + * Hack to move the selection in a table by a 'page', triggered by the + * scrollpane. This acts as per the keyboard events for the arrows, but moves + * the selection by at least the specified number of characters. + * + * @param table The table. + * @param pagex Minimum distance to move the selection horizontally. + * @param pagey Minimum distance to move the selection vertically. + * @return Non-zero if the selection has been changed. + */ + +int TXT_PageTable(TXT_UNCAST_ARG(table), int pagex, int pagey); + #endif /* #ifndef TXT_TABLE_T */ -- cgit v1.2.3 From 0de7210f96259b4bc6850d4119e8069e31c4a14c Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 6 Sep 2009 18:15:52 +0000 Subject: Fixes for MSVC compile (thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1657 --- src/i_main.c | 4 ++-- src/i_sdlsound.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/i_main.c b/src/i_main.c index 03f8a5ac..cdfb531a 100644 --- a/src/i_main.c +++ b/src/i_main.c @@ -47,7 +47,7 @@ static void LockCPUAffinity(void) #define WIN32_LEAN_AND_MEAN #include -typedef BOOL WINAPI (*SetAffinityFunc)(HANDLE hProcess, DWORD_PTR mask); +typedef BOOL (WINAPI *SetAffinityFunc)(HANDLE hProcess, DWORD mask); // This is a bit more complicated than it really needs to be. We really // just need to call the SetProcessAffinityMask function, but that @@ -74,7 +74,7 @@ static void LockCPUAffinity(void) // Find the SetProcessAffinityMask function. - SetAffinity = GetProcAddress(kernel32_dll, "SetProcessAffinityMask"); + SetAffinity = (SetAffinityFunc)GetProcAddress(kernel32_dll, "SetProcessAffinityMask"); // If the function was not found, we are on an old (Win9x) system // that doesn't have this function. That's no problem, because diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c index bb8229e4..ea5c92a5 100644 --- a/src/i_sdlsound.c +++ b/src/i_sdlsound.c @@ -275,12 +275,15 @@ static boolean LoadSoundLump(int sound, uint32_t *length, byte **data_ref) { + int lumplen; + byte *data; + // Load the sound *lumpnum = S_sfx[sound].lumpnum; *data_ref = W_CacheLumpNum(*lumpnum, PU_STATIC); - int lumplen = W_LumpLength(*lumpnum); - byte *data = *data_ref; + lumplen = W_LumpLength(*lumpnum); + data = *data_ref; // Ensure this is a valid sound -- cgit v1.2.3 From be3bba2a1cf9551778683e25f61bffc7c187f93c Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 7 Sep 2009 19:43:04 +0000 Subject: Fix compilation under MacOS X. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1659 --- acinclude.m4 | 31 +++++++++++++++++++++++++++++++ configure.in | 52 +++++++++++++++++++++++++++++++++------------------- wince/Makefile.am | 2 +- wince/dummy.c | 8 ++++++++ 4 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 acinclude.m4 create mode 100644 wince/dummy.c diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..ac54f4b9 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,31 @@ + +dnl Macro to check if autoconf's compile tests have been broken by +dnl SDL. Tries to build the simplest possible program, and if it +dnl fails, calls the given block. + +AC_DEFUN([AC_CHECK_SDL_BREAKAGE], [ + AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [], [ + $1 + ]) +]) + +dnl Macro to work around SDL redefining main. The provided block +dnl is run with main #defined to SDL_main via a compiler switch +dnl if autoconf tests are found to be broken. + +AC_DEFUN([AC_SDL_MAIN_WORKAROUND], [ + sdl_workaround_saved_CFLAGS="$CFLAGS" + + AC_CHECK_SDL_BREAKAGE([ + CFLAGS="$CFLAGS -Dmain=SDL_main" + ]) + + AC_CHECK_SDL_BREAKAGE([ + AC_MSG_ERROR([Autoconf checks broken by SDL, and can't figure out how to fix them.]) + ]) + + $1 + + CFLAGS="$sdl_workaround_saved_CFLAGS" +]) + diff --git a/configure.in b/configure.in index 4b29cee5..f77d6ebd 100644 --- a/configure.in +++ b/configure.in @@ -39,20 +39,42 @@ AM_PATH_SDL(1.1.3) CFLAGS="$CFLAGS $SDL_CFLAGS" LDFLAGS="$LDFLAGS $SDL_LIBS" -AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[ - SDLMIXER_LIBS="$SDLMIXER_LIBS -lSDL_mixer" -],[ - echo "*** Could not find SDL_mixer. Please install it." - exit -1 -]) +# On some platforms, SDL renames main() to SDL_main() using a #define, +# so that its own main, stored in the SDLmain library, can be run first. +# Unfortunately, this causes problems for autoconf, which builds +# test programs to probe the system. All library/header/symbol checks +# must be run in this block, that performs a workaround for the problem. + +AC_SDL_MAIN_WORKAROUND([ + + # Check for SDL_mixer. + + AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[ + SDLMIXER_LIBS="$SDLMIXER_LIBS -lSDL_mixer" + ],[ + echo "*** Could not find SDL_mixer. Please install it." + exit -1 + ]) + + # Check for SDL_net. + + AC_CHECK_LIB(SDL_net,SDLNet_UDP_Send,[ + SDLNET_LIBS="$SDLNET_LIBS -lSDL_net" + ],[ + echo "*** Could not find SDL_net. Please install it." + exit -1 + ]) + + # Check for libsamplerate. -AC_CHECK_LIB(SDL_net,SDLNet_UDP_Send,[ - SDLNET_LIBS="$SDLNET_LIBS -lSDL_net" -],[ - echo "*** Could not find SDL_net. Please install it." - exit -1 + AC_CHECK_LIB(samplerate, src_new) + + AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h]) + AC_CHECK_FUNCS(mmap sched_setaffinity) ]) +AC_CHECK_TOOL(WINDRES, windres, ) + # Windows CE build? WINDOWS_CE=false @@ -66,14 +88,6 @@ case "$host" in ;; esac -AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h]) -AC_CHECK_FUNCS(mmap sched_setaffinity) - -# DWF 2008-02-10: FIXME -AC_CHECK_LIB(samplerate, src_new) - -AC_CHECK_TOOL(WINDRES, windres, ) - AM_CONDITIONAL(WINDOWS_CE, $WINDOWS_CE) AM_CONDITIONAL(HAVE_WINDRES, test "$WINDRES" != "") AM_CONDITIONAL(HAVE_PYTHON, $HAVE_PYTHON) diff --git a/wince/Makefile.am b/wince/Makefile.am index 7d694377..476b9a67 100644 --- a/wince/Makefile.am +++ b/wince/Makefile.am @@ -10,7 +10,7 @@ libc_wince_a_SOURCES = \ else -libc_wince_a_SOURCES = +libc_wince_a_SOURCES = dummy.c endif diff --git a/wince/dummy.c b/wince/dummy.c new file mode 100644 index 00000000..68af0caa --- /dev/null +++ b/wince/dummy.c @@ -0,0 +1,8 @@ + +// Dummy source file so that the Windows CE workaround library is +// not empty. Some platforms don't like empty libraries. + +void DummyWindowsCEFunction(void) +{ +} + -- cgit v1.2.3 From 10da45b90cba29506c142982e76abc35c39d5d26 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 11 Sep 2009 21:56:47 +0000 Subject: Add (lack of) copyright notice for SDL workaround. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1665 --- acinclude.m4 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index ac54f4b9..ed7e4d31 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,4 +1,9 @@ +dnl +dnl SDL workaround autoconf macros, by Simon Howard. +dnl I release the contents of this file to the public domain. +dnl + dnl Macro to check if autoconf's compile tests have been broken by dnl SDL. Tries to build the simplest possible program, and if it dnl fails, calls the given block. -- cgit v1.2.3 From 42f7a9b8a27ae1192b49005f5be3eba32f740d05 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 20 Sep 2009 15:27:40 +0000 Subject: Use "const char" in libtextscreen where appropriate (thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1679 --- textscreen/txt_desktop.c | 4 ++-- textscreen/txt_dropdown.c | 2 +- textscreen/txt_gui.c | 8 ++++---- textscreen/txt_gui.h | 6 +++--- textscreen/txt_io.c | 6 +++--- textscreen/txt_io.h | 2 +- textscreen/txt_sdl.c | 6 +++--- textscreen/txt_widget.c | 4 ++-- textscreen/txt_widget.h | 4 ++-- textscreen/txt_window_action.c | 2 +- textscreen/txt_window_action.h | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/textscreen/txt_desktop.c b/textscreen/txt_desktop.c index 99a5062d..f833441f 100644 --- a/textscreen/txt_desktop.c +++ b/textscreen/txt_desktop.c @@ -61,7 +61,7 @@ void TXT_RemoveDesktopWindow(txt_window_t *win) num_windows = to; } -static void DrawDesktopBackground(char *title) +static void DrawDesktopBackground(const char *title) { int i; unsigned char *screendata; @@ -117,7 +117,7 @@ void TXT_SetDesktopTitle(char *title) void TXT_DrawDesktop(void) { int i; - char *title; + const char *title; TXT_InitClipArea(); diff --git a/textscreen/txt_dropdown.c b/textscreen/txt_dropdown.c index c5c4f99f..efed8d67 100644 --- a/textscreen/txt_dropdown.c +++ b/textscreen/txt_dropdown.c @@ -193,7 +193,7 @@ static void TXT_DropdownListDrawer(TXT_UNCAST_ARG(list), int selected) { TXT_CAST_ARG(txt_dropdown_list_t, list); unsigned int i; - char *str; + const char *str; // Set bg/fg text colors. diff --git a/textscreen/txt_gui.c b/textscreen/txt_gui.c index 276176ec..ec166415 100644 --- a/textscreen/txt_gui.c +++ b/textscreen/txt_gui.c @@ -55,7 +55,7 @@ static txt_cliparea_t *cliparea = NULL; #define VALID_X(x) ((x) >= cliparea->x1 && (x) < cliparea->x2) #define VALID_Y(y) ((y) >= cliparea->y1 && (y) < cliparea->y2) -void TXT_DrawDesktopBackground(char *title) +void TXT_DrawDesktopBackground(const char *title) { int i; unsigned char *screendata; @@ -125,7 +125,7 @@ void TXT_DrawShadow(int x, int y, int w, int h) } } -void TXT_DrawWindowFrame(char *title, int x, int y, int w, int h) +void TXT_DrawWindowFrame(const char *title, int x, int y, int w, int h) { int x1, y1; int bx, by; @@ -224,11 +224,11 @@ void TXT_DrawSeparator(int x, int y, int w) } } -void TXT_DrawString(char *s) +void TXT_DrawString(const char *s) { int x, y; int x1; - char *p; + const char *p; TXT_GetXY(&x, &y); diff --git a/textscreen/txt_gui.h b/textscreen/txt_gui.h index 3795c65a..ad7ae428 100644 --- a/textscreen/txt_gui.h +++ b/textscreen/txt_gui.h @@ -27,10 +27,10 @@ #ifndef TXT_GUI_H #define TXT_GUI_H -void TXT_DrawDesktopBackground(char *title); -void TXT_DrawWindowFrame(char *title, int x, int y, int w, int h); +void TXT_DrawDesktopBackground(const char *title); +void TXT_DrawWindowFrame(const char *title, int x, int y, int w, int h); void TXT_DrawSeparator(int x, int y, int w); -void TXT_DrawString(char *s); +void TXT_DrawString(const char *s); void TXT_DrawHorizScrollbar(int x, int y, int w, int cursor, int range); void TXT_DrawVertScrollbar(int x, int y, int h, int cursor, int range); diff --git a/textscreen/txt_io.c b/textscreen/txt_io.c index 1e8106e7..1ecc7bd6 100644 --- a/textscreen/txt_io.c +++ b/textscreen/txt_io.c @@ -33,7 +33,7 @@ static struct { txt_color_t color; - char *name; + const char *name; } colors[] = { {TXT_COLOR_BLACK, "black"}, {TXT_COLOR_BLUE, "blue"}, @@ -147,11 +147,11 @@ void TXT_PutChar(int c) PutChar(screen, c); } -void TXT_Puts(char *s) +void TXT_Puts(const char *s) { int previous_color = TXT_COLOR_BLACK; unsigned char *screen; - char *p; + const char *p; char colorname_buf[20]; char *ending; int col; diff --git a/textscreen/txt_io.h b/textscreen/txt_io.h index 78c68f46..dc25aa93 100644 --- a/textscreen/txt_io.h +++ b/textscreen/txt_io.h @@ -30,7 +30,7 @@ #include "txt_main.h" void TXT_PutChar(int c); -void TXT_Puts(char *s); +void TXT_Puts(const char *s); void TXT_GotoXY(int x, int y); void TXT_GetXY(int *x, int *y); void TXT_FGColor(txt_color_t color); diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index 367ed095..bc98a51b 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -217,7 +217,7 @@ static inline void UpdateCharacter(int x, int y) unsigned char *p; unsigned char *s, *s1; int bg, fg; - int x1, y1; + unsigned int x1, y1; p = &screendata[(y * TXT_SCREEN_W + x) * 2]; character = p[0]; @@ -458,7 +458,7 @@ signed int TXT_GetChar(void) return -1; } -static char *SpecialKeyName(int key) +static const char *SpecialKeyName(int key) { switch (key) { @@ -524,7 +524,7 @@ static char *SpecialKeyName(int key) void TXT_GetKeyDescription(int key, char *buf) { - char *keyname; + const char *keyname; keyname = SpecialKeyName(key); diff --git a/textscreen/txt_widget.c b/textscreen/txt_widget.c index 2f019c94..2300b32c 100644 --- a/textscreen/txt_widget.c +++ b/textscreen/txt_widget.c @@ -94,7 +94,7 @@ void TXT_InitWidget(TXT_UNCAST_ARG(widget), txt_widget_class_t *widget_class) } void TXT_SignalConnect(TXT_UNCAST_ARG(widget), - char *signal_name, + const char *signal_name, TxtWidgetSignalFunc func, void *user_data) { @@ -117,7 +117,7 @@ void TXT_SignalConnect(TXT_UNCAST_ARG(widget), callback->user_data = user_data; } -void TXT_EmitSignal(TXT_UNCAST_ARG(widget), char *signal_name) +void TXT_EmitSignal(TXT_UNCAST_ARG(widget), const char *signal_name) { TXT_CAST_ARG(txt_widget_t, widget); txt_callback_table_t *table; diff --git a/textscreen/txt_widget.h b/textscreen/txt_widget.h index 63cc5f35..9688829d 100644 --- a/textscreen/txt_widget.h +++ b/textscreen/txt_widget.h @@ -106,7 +106,7 @@ struct txt_widget_s void TXT_InitWidget(TXT_UNCAST_ARG(widget), txt_widget_class_t *widget_class); void TXT_CalcWidgetSize(TXT_UNCAST_ARG(widget)); void TXT_DrawWidget(TXT_UNCAST_ARG(widget), int selected); -void TXT_EmitSignal(TXT_UNCAST_ARG(widget), char *signal_name); +void TXT_EmitSignal(TXT_UNCAST_ARG(widget), const char *signal_name); int TXT_WidgetKeyPress(TXT_UNCAST_ARG(widget), int key); void TXT_WidgetMousePress(TXT_UNCAST_ARG(widget), int x, int y, int b); void TXT_DestroyWidget(TXT_UNCAST_ARG(widget)); @@ -121,7 +121,7 @@ void TXT_LayoutWidget(TXT_UNCAST_ARG(widget)); * @param user_data User-specified pointer to pass to the callback function. */ -void TXT_SignalConnect(TXT_UNCAST_ARG(widget), char *signal_name, +void TXT_SignalConnect(TXT_UNCAST_ARG(widget), const char *signal_name, TxtWidgetSignalFunc func, void *user_data); /** diff --git a/textscreen/txt_window_action.c b/textscreen/txt_window_action.c index 45a2482c..a326a5ed 100644 --- a/textscreen/txt_window_action.c +++ b/textscreen/txt_window_action.c @@ -101,7 +101,7 @@ txt_widget_class_t txt_window_action_class = NULL, }; -txt_window_action_t *TXT_NewWindowAction(int key, char *label) +txt_window_action_t *TXT_NewWindowAction(int key, const char *label) { txt_window_action_t *action; diff --git a/textscreen/txt_window_action.h b/textscreen/txt_window_action.h index ab87f72c..7f93dd48 100644 --- a/textscreen/txt_window_action.h +++ b/textscreen/txt_window_action.h @@ -59,7 +59,7 @@ struct txt_window_action_s * @return Pointer to the new window action widget. */ -txt_window_action_t *TXT_NewWindowAction(int key, char *label); +txt_window_action_t *TXT_NewWindowAction(int key, const char *label); /** * Create a new window action that closes the window when the -- cgit v1.2.3 From 410579ec66f7df8757cb980c0a78e3161b7f20d5 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 30 Sep 2009 23:07:03 +0000 Subject: Change British English spellings to American English, for consistency. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1699 --- pcsound/pcsound.c | 2 +- pcsound/pcsound_sdl.c | 18 +++++++++--------- setup/joystick.c | 2 +- setup/mainmenu.c | 6 +++--- setup/multiplayer.c | 2 +- src/d_iwad.c | 2 +- src/d_iwad.h | 2 +- src/d_main.c | 4 ++-- src/d_net.h | 2 +- src/deh_defs.h | 2 +- src/deh_main.c | 4 ++-- src/deh_ptr.c | 2 +- src/deh_text.c | 2 +- src/doomdef.h | 2 +- src/i_joystick.c | 2 +- src/i_pcsound.c | 18 +++++++++--------- src/i_sdlmusic.c | 44 ++++++++++++++++++++++---------------------- src/i_sdlsound.c | 18 +++++++++--------- src/i_timer.c | 2 +- src/i_timer.h | 2 +- src/i_video.c | 22 ++++++++++++---------- src/net_client.c | 4 ++-- src/net_common.c | 4 ++-- src/net_defs.h | 4 ++-- src/net_gui.c | 2 +- src/net_loop.c | 4 ++-- src/net_sdl.c | 2 +- src/net_server.c | 14 +++++++------- src/net_server.h | 2 +- src/s_sound.c | 10 +++++----- src/s_sound.h | 6 +++--- src/w_merge.c | 2 +- textscreen/txt_inputbox.c | 2 +- textscreen/txt_main.h | 2 +- textscreen/txt_sdl.c | 2 +- 35 files changed, 111 insertions(+), 109 deletions(-) diff --git a/pcsound/pcsound.c b/pcsound/pcsound.c index 4695e6e1..529349ef 100644 --- a/pcsound/pcsound.c +++ b/pcsound/pcsound.c @@ -109,7 +109,7 @@ int PCSound_Init(pcsound_callback_func callback_func) } else { - printf("Failed to initialise PC sound driver: %s\n", + printf("Failed to initialize PC sound driver: %s\n", drivers[i]->name); break; } diff --git a/pcsound/pcsound_sdl.c b/pcsound/pcsound_sdl.c index 6ba06785..d62b57e6 100644 --- a/pcsound/pcsound_sdl.c +++ b/pcsound/pcsound_sdl.c @@ -35,10 +35,10 @@ #define MAX_SOUND_SLICE_TIME 70 /* ms */ #define SQUARE_WAVE_AMP 0x2000 -// If true, we initialised SDL and have the responsibility to shut it +// If true, we initialized SDL and have the responsibility to shut it // down -static int sdl_was_initialised = 0; +static int sdl_was_initialized = 0; // Callback function to invoke when we want new sound data @@ -146,7 +146,7 @@ static void PCSound_Mix_Callback(void *udata, Uint8 *stream, int len) } } -static int SDLIsInitialised(void) +static int SDLIsInitialized(void) { int freq, channels; Uint16 format; @@ -156,11 +156,11 @@ static int SDLIsInitialised(void) static void PCSound_SDL_Shutdown(void) { - if (sdl_was_initialised) + if (sdl_was_initialized) { Mix_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); - sdl_was_initialised = 0; + sdl_was_initialized = 0; } } @@ -196,9 +196,9 @@ static int PCSound_SDL_Init(pcsound_callback_func callback_func) int slicesize; // Check if SDL_mixer has been opened already - // If not, we must initialise it now + // If not, we must initialize it now - if (!SDLIsInitialised()) + if (!SDLIsInitialized()) { if (SDL_Init(SDL_INIT_AUDIO) < 0) { @@ -210,7 +210,7 @@ static int PCSound_SDL_Init(pcsound_callback_func callback_func) if (Mix_OpenAudio(pcsound_sample_rate, AUDIO_S16SYS, 2, slicesize) < 0) { - fprintf(stderr, "Error initialising SDL_mixer: %s\n", Mix_GetError()); + fprintf(stderr, "Error initializing SDL_mixer: %s\n", Mix_GetError()); SDL_QuitSubSystem(SDL_INIT_AUDIO); return 0; @@ -221,7 +221,7 @@ static int PCSound_SDL_Init(pcsound_callback_func callback_func) // When this module shuts down, it has the responsibility to // shut down SDL. - sdl_was_initialised = 1; + sdl_was_initialized = 1; } // Get the mixer frequency, format and number of channels. diff --git a/setup/joystick.c b/setup/joystick.c index fa59c559..867fa5c2 100644 --- a/setup/joystick.c +++ b/setup/joystick.c @@ -34,7 +34,7 @@ typedef enum CALIBRATE_UP, } calibration_stage_t; -// SDL joystick successfully initialised? +// SDL joystick successfully initialized? static int joystick_initted = 0; diff --git a/setup/mainmenu.c b/setup/mainmenu.c index c7e4f48d..ba85ca1f 100644 --- a/setup/mainmenu.c +++ b/setup/mainmenu.c @@ -138,7 +138,7 @@ void MainMenu(void) } // -// Initialise all configuration variables, load config file, etc +// Initialize all configuration variables, load config file, etc // static void InitConfig(void) @@ -194,7 +194,7 @@ static void SetIcon(void) } // -// Initialise and run the textscreen GUI. +// Initialize and run the textscreen GUI. // static void RunGUI(void) @@ -203,7 +203,7 @@ static void RunGUI(void) if (!TXT_Init()) { - fprintf(stderr, "Failed to initialise GUI\n"); + fprintf(stderr, "Failed to initialize GUI\n"); exit(-1); } diff --git a/setup/multiplayer.c b/setup/multiplayer.c index ee46c3f1..c5d0d1e9 100644 --- a/setup/multiplayer.c +++ b/setup/multiplayer.c @@ -716,7 +716,7 @@ void SetChatMacroDefaults(void) HUSTR_CHATMACRO0, }; - // If the chat macros have not been set, initialise with defaults. + // If the chat macros have not been set, initialize with defaults. for (i=0; i<10; ++i) { diff --git a/src/d_iwad.c b/src/d_iwad.c index d1c2f0bf..0e48420d 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -19,7 +19,7 @@ // 02111-1307, USA. // // DESCRIPTION: -// Search for and locate an IWAD file, and initialise according +// Search for and locate an IWAD file, and initialize according // to the IWAD type. // //----------------------------------------------------------------------------- diff --git a/src/d_iwad.h b/src/d_iwad.h index 281d3467..cb101305 100644 --- a/src/d_iwad.h +++ b/src/d_iwad.h @@ -19,7 +19,7 @@ // 02111-1307, USA. // // DESCRIPTION: -// Find IWAD and initialise according to IWAD type. +// Find IWAD and initialize according to IWAD type. // //----------------------------------------------------------------------------- diff --git a/src/d_main.c b/src/d_main.c index c59a8fb7..3580c346 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -666,7 +666,7 @@ static struct { NULL, NULL, 0}, }; -// Initialise the game version +// Initialize the game version static void InitGameVersion(void) { @@ -1450,7 +1450,7 @@ void D_DoomMain (void) I_Init (); #ifdef FEATURE_MULTIPLAYER - printf ("NET_Init: Initialise network subsystem.\n"); + printf ("NET_Init: Init network subsystem.\n"); NET_Init (); #endif diff --git a/src/d_net.h b/src/d_net.h index df3d2d4b..e5980a9b 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -47,7 +47,7 @@ void D_QuitNetGame (void); //? how many ticks to run? void TryRunTics (void); -// Called at start of game loop to initialise timers +// Called at start of game loop to initialize timers void D_StartGameLoop(void); extern boolean drone; diff --git a/src/deh_defs.h b/src/deh_defs.h index a6650544..e7b76182 100644 --- a/src/deh_defs.h +++ b/src/deh_defs.h @@ -41,7 +41,7 @@ struct deh_section_s { char *name; - // Called on startup to initialise code + // Called on startup to initialize code deh_section_init_t init; diff --git a/src/deh_main.c b/src/deh_main.c index 616b30e0..dcdfb00d 100644 --- a/src/deh_main.c +++ b/src/deh_main.c @@ -108,7 +108,7 @@ void DEH_Checksum(md5_digest_t digest) // Called on startup to call the Init functions -static void InitialiseSections(void) +static void InitializeSections(void) { unsigned int i; @@ -383,7 +383,7 @@ void DEH_Init(void) char *filename; int p; - InitialiseSections(); + InitializeSections(); //! // @category mod diff --git a/src/deh_ptr.c b/src/deh_ptr.c index a819ddc0..9841e38c 100644 --- a/src/deh_ptr.c +++ b/src/deh_ptr.c @@ -56,7 +56,7 @@ static void DEH_PointerInit(void) { int i; - // Initialise list of dehacked pointers + // Initialize list of dehacked pointers for (i=0; iabuf = Z_Malloc(expanded_length, PU_STATIC, &destination->abuf); - // If we can, use the standard / optimised SDL conversion routines. + // If we can, use the standard / optimized SDL conversion routines. if (samplerate <= mixer_freq && ConvertibleRatio(samplerate, mixer_freq) @@ -548,7 +548,7 @@ static void I_SDL_UpdateSoundParams(int handle, int vol, int sep) { int left, right; - if (!sound_initialised) + if (!sound_initialized) { return; } @@ -577,7 +577,7 @@ static int I_SDL_StartSound(int id, int channel, int vol, int sep) { Mix_Chunk *chunk; - if (!sound_initialised) + if (!sound_initialized) { return -1; } @@ -611,7 +611,7 @@ static int I_SDL_StartSound(int id, int channel, int vol, int sep) static void I_SDL_StopSound (int handle) { - if (!sound_initialised) + if (!sound_initialized) { return; } @@ -659,7 +659,7 @@ static void I_SDL_UpdateSound(void) static void I_SDL_ShutdownSound(void) { - if (!sound_initialised) + if (!sound_initialized) { return; } @@ -667,7 +667,7 @@ static void I_SDL_ShutdownSound(void) Mix_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); - sound_initialised = false; + sound_initialized = false; } // Calculate slice size, based on MAX_SOUND_SLICE_TIME. @@ -721,7 +721,7 @@ static boolean I_SDL_InitSound(void) if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, GetSliceSize()) < 0) { - fprintf(stderr, "Error initialising SDL_mixer: %s\n", Mix_GetError()); + fprintf(stderr, "Error initializing SDL_mixer: %s\n", Mix_GetError()); return false; } @@ -751,7 +751,7 @@ static boolean I_SDL_InitSound(void) SDL_PauseAudio(0); - sound_initialised = true; + sound_initialized = true; return true; } diff --git a/src/i_timer.c b/src/i_timer.c index 5fd7fba9..48be83be 100644 --- a/src/i_timer.c +++ b/src/i_timer.c @@ -76,7 +76,7 @@ void I_Sleep(int ms) void I_InitTimer(void) { - // initialise timer + // initialize timer SDL_Init(SDL_INIT_TIMER); } diff --git a/src/i_timer.h b/src/i_timer.h index 83ccecc9..d90094c8 100644 --- a/src/i_timer.h +++ b/src/i_timer.h @@ -38,7 +38,7 @@ int I_GetTimeMS (void); // Pause for a specified number of ms void I_Sleep(int ms); -// Initialise timer +// Initialize timer void I_InitTimer(void); #endif diff --git a/src/i_video.c b/src/i_video.c index 582a7fa7..5f5979d2 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -101,7 +101,7 @@ static int windowwidth, windowheight; // display has been set up? -static boolean initialised = false; +static boolean initialized = false; // disable mouse? @@ -246,7 +246,7 @@ static void UpdateFocus(void) state = SDL_GetAppState(); // We should have input (keyboard) focus and be visible - // (not minimised) + // (not minimized) window_focused = (state & SDL_APPINPUTFOCUS) && (state & SDL_APPACTIVE); @@ -396,14 +396,14 @@ static int TranslateKey(SDL_keysym *sym) void I_ShutdownGraphics(void) { - if (initialised) + if (initialized) { SDL_ShowCursor(1); SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_QuitSubSystem(SDL_INIT_VIDEO); - initialised = false; + initialized = false; } } @@ -622,7 +622,7 @@ static void I_ReadMouse(void) // void I_StartTic (void) { - if (!initialised) + if (!initialized) { return; } @@ -741,7 +741,7 @@ void I_BeginRead(void) + (SCREENWIDTH - LOADING_DISK_W); int y; - if (!initialised || disk_image == NULL) + if (!initialized || disk_image == NULL) return; // save background and copy the disk image in @@ -769,7 +769,7 @@ void I_EndRead(void) + (SCREENWIDTH - LOADING_DISK_W); int y; - if (!initialised || disk_image == NULL) + if (!initialized || disk_image == NULL) return; // save background and copy the disk image in @@ -797,7 +797,7 @@ void I_FinishUpdate (void) int i; // UNUSED static unsigned char *bigscreen=0; - if (!initialised) + if (!initialized) return; if (noblit) @@ -1500,7 +1500,7 @@ void I_InitGraphics(void) if (SDL_Init(SDL_INIT_VIDEO) < 0) { - I_Error("Failed to initialise video: %s", SDL_GetError()); + I_Error("Failed to initialize video: %s", SDL_GetError()); } // Check for command-line video-related parameters. @@ -1564,6 +1564,8 @@ void I_InitGraphics(void) flags |= SDL_FULLSCREEN; } + flags |= SDL_NOFRAME; + screen = SDL_SetVideoMode(windowwidth, windowheight, 8, flags); if (screen == NULL) @@ -1679,6 +1681,6 @@ void I_InitGraphics(void) CenterMouse(); } - initialised = true; + initialized = true; } diff --git a/src/net_client.c b/src/net_client.c index 36dafe7a..0d6dd2fc 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -1152,7 +1152,7 @@ boolean NET_CL_Connect(net_addr_t *addr) client_context = NET_NewContext(); - // initialise module for client mode + // initialize module for client mode if (!addr->module->InitClient()) { @@ -1164,7 +1164,7 @@ boolean NET_CL_Connect(net_addr_t *addr) net_client_connected = true; net_client_received_wait_data = false; - // Initialise connection + // Initialize connection NET_Conn_InitClient(&client_connection, addr); diff --git a/src/net_common.c b/src/net_common.c index 5af6aaa7..da3d7fd5 100644 --- a/src/net_common.c +++ b/src/net_common.c @@ -59,7 +59,7 @@ static void NET_Conn_Init(net_connection_t *conn, net_addr_t *addr) conn->reliable_recv_seq = 0; } -// Initialise as a client connection +// Initialize as a client connection void NET_Conn_InitClient(net_connection_t *conn, net_addr_t *addr) { @@ -67,7 +67,7 @@ void NET_Conn_InitClient(net_connection_t *conn, net_addr_t *addr) conn->state = NET_CONN_STATE_CONNECTING; } -// Initialise as a server connection +// Initialize as a server connection void NET_Conn_InitServer(net_connection_t *conn, net_addr_t *addr) { diff --git a/src/net_defs.h b/src/net_defs.h index c575020f..66b17c77 100644 --- a/src/net_defs.h +++ b/src/net_defs.h @@ -45,11 +45,11 @@ struct _net_packet_s struct _net_module_s { - // Initialise this module for use as a client + // Initialize this module for use as a client boolean (*InitClient)(void); - // Initialise this module for use as a server + // Initialize this module for use as a server boolean (*InitServer)(void); diff --git a/src/net_gui.c b/src/net_gui.c index 9816346b..ed9a58e9 100644 --- a/src/net_gui.c +++ b/src/net_gui.c @@ -262,7 +262,7 @@ void NET_WaitForStart(void) { if (!TXT_Init()) { - fprintf(stderr, "Failed to initialise GUI\n"); + fprintf(stderr, "Failed to initialize GUI\n"); exit(-1); } diff --git a/src/net_loop.c b/src/net_loop.c index 890dcbf2..abba96e0 100644 --- a/src/net_loop.c +++ b/src/net_loop.c @@ -99,7 +99,7 @@ static boolean NET_CL_InitClient(void) static boolean NET_CL_InitServer(void) { - I_Error("NET_CL_InitServer: attempted to initialise client pipe end as a server!"); + I_Error("NET_CL_InitServer: attempted to initialize client pipe end as a server!"); return false; } @@ -161,7 +161,7 @@ net_module_t net_loop_client_module = static boolean NET_SV_InitClient(void) { - I_Error("NET_SV_InitClient: attempted to initialise server pipe end as a client!"); + I_Error("NET_SV_InitClient: attempted to initialize server pipe end as a client!"); return false; } diff --git a/src/net_sdl.c b/src/net_sdl.c index 92606fac..9c647cc9 100644 --- a/src/net_sdl.c +++ b/src/net_sdl.c @@ -57,7 +57,7 @@ typedef struct static addrpair_t **addr_table; static int addr_table_size = -1; -// Initialises the address table +// Initializes the address table static void NET_SDL_InitAddrTable(void) { diff --git a/src/net_server.c b/src/net_server.c index a90ed4fd..383608be 100644 --- a/src/net_server.c +++ b/src/net_server.c @@ -119,7 +119,7 @@ typedef struct } net_client_recv_t; static net_server_state_t server_state; -static boolean server_initialised = false; +static boolean server_initialized = false; static net_client_t clients[MAXNETNODES]; static net_client_t *sv_players[MAXPLAYERS]; static net_context_t *server_context; @@ -612,7 +612,7 @@ static void NET_SV_ParseSYN(net_packet_t *packet, return; } - // Activate, initialise connection + // Activate, initialize connection NET_SV_InitNewClient(client, addr, player_name); @@ -1489,13 +1489,13 @@ void NET_SV_AddModule(net_module_t *module) NET_AddModule(server_context, module); } -// Initialise server and wait for connections +// Initialize server and wait for connections void NET_SV_Init(void) { int i; - // initialise send/receive context + // initialize send/receive context server_context = NET_NewContext(); @@ -1510,7 +1510,7 @@ void NET_SV_Init(void) server_state = SERVER_WAITING_START; sv_gamemode = indetermined; - server_initialised = true; + server_initialized = true; } // Run server code to check for new packets/send packets as the server @@ -1522,7 +1522,7 @@ void NET_SV_Run(void) net_packet_t *packet; int i; - if (!server_initialised) + if (!server_initialized) { return; } @@ -1564,7 +1564,7 @@ void NET_SV_Shutdown(void) boolean running; int start_time; - if (!server_initialised) + if (!server_initialized) { return; } diff --git a/src/net_server.h b/src/net_server.h index 3d0cf6e4..93b22fc3 100644 --- a/src/net_server.h +++ b/src/net_server.h @@ -24,7 +24,7 @@ #ifndef NET_SERVER_H #define NET_SERVER_H -// initialise server and wait for connections +// initialize server and wait for connections void NET_SV_Init(void); diff --git a/src/s_sound.c b/src/s_sound.c index 70fa75f3..9b4f71aa 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -176,7 +176,7 @@ static boolean SndDeviceInList(snddevice_t device, snddevice_t *list, return false; } -// Find and initialise a sound_module_t appropriate for the setting +// Find and initialize a sound_module_t appropriate for the setting // in snd_sfxdevice. static void InitSfxModule(void) @@ -194,7 +194,7 @@ static void InitSfxModule(void) sound_modules[i]->sound_devices, sound_modules[i]->num_sound_devices)) { - // Initialise the module + // Initialize the module if (sound_modules[i]->Init()) { @@ -205,7 +205,7 @@ static void InitSfxModule(void) } } -// Initialise music according to snd_musicdevice. +// Initialize music according to snd_musicdevice. static void InitMusicModule(void) { @@ -222,7 +222,7 @@ static void InitMusicModule(void) music_modules[i]->sound_devices, music_modules[i]->num_sound_devices)) { - // Initialise the module + // Initialize the module if (music_modules[i]->Init()) { @@ -268,7 +268,7 @@ void S_Init(int sfxVolume, int musicVolume) nomusic = M_CheckParm("-nomusic") > 0; - // Initialise the sound and music subsystems. + // Initialize the sound and music subsystems. if (!nosound && !screensaver_mode) { diff --git a/src/s_sound.h b/src/s_sound.h index 67071338..b8d0e766 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -54,8 +54,8 @@ typedef struct snddevice_t *sound_devices; int num_sound_devices; - // Initialise sound module - // Returns true if successfully initialised + // Initialize sound module + // Returns true if successfully initialized boolean (*Init)(void); @@ -99,7 +99,7 @@ typedef struct snddevice_t *sound_devices; int num_sound_devices; - // Initialise the music subsystem + // Initialize the music subsystem boolean (*Init)(void); diff --git a/src/w_merge.c b/src/w_merge.c index 372b3583..6b6ae659 100644 --- a/src/w_merge.c +++ b/src/w_merge.c @@ -143,7 +143,7 @@ static void SetupLists(void) SetupList(&pwad_sprites, &pwad, "S_START", "S_END", "SS_START", "SS_END"); } -// Initialise the replace list +// Initialize the replace list static void InitSpriteList(void) { diff --git a/textscreen/txt_inputbox.c b/textscreen/txt_inputbox.c index 9151d431..3e52bae9 100644 --- a/textscreen/txt_inputbox.c +++ b/textscreen/txt_inputbox.c @@ -53,7 +53,7 @@ static void TXT_InputBoxDrawer(TXT_UNCAST_ARG(inputbox), int selected) w = inputbox->widget.w; - // Select the background colour based on whether we are currently + // Select the background color based on whether we are currently // editing, and if not, whether the widget is selected. if (inputbox->editing && selected) diff --git a/textscreen/txt_main.h b/textscreen/txt_main.h index 4357d656..add30fa3 100644 --- a/textscreen/txt_main.h +++ b/textscreen/txt_main.h @@ -67,7 +67,7 @@ typedef enum TXT_COLOR_BRIGHT_WHITE, } txt_color_t; -// Initialise the screen +// Initialize the screen // Returns 1 if successful, 0 if failed. int TXT_Init(void); diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index bc98a51b..0b11aeab 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -162,7 +162,7 @@ static void ChooseFont(void) } // -// Initialise text mode screen +// Initialize text mode screen // // Returns 1 if successful, 0 if an error occurred // -- cgit v1.2.3 From 508c3fd3fa5b3149d329e15ea3e072ad2a7aa2f2 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 1 Oct 2009 01:04:00 +0000 Subject: Oops. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1701 --- src/i_sdlmusic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c index 29f00a97..81f492b5 100644 --- a/src/i_sdlmusic.c +++ b/src/i_sdlmusic.c @@ -304,7 +304,7 @@ static void *I_SDL_RegisterSong(void *data, int len) // remove file now -// remove(filename); + remove(filename); Z_Free(filename); -- cgit v1.2.3 From a034c665c088904d9061e13cf73f5de33ef2268b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 1 Oct 2009 19:08:21 +0000 Subject: Oops. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1703 --- src/i_video.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 5f5979d2..062c9c9c 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1564,8 +1564,6 @@ void I_InitGraphics(void) flags |= SDL_FULLSCREEN; } - flags |= SDL_NOFRAME; - screen = SDL_SetVideoMode(windowwidth, windowheight, 8, flags); if (screen == NULL) -- cgit v1.2.3 From 55789cf12de42cc893bd903f84435ed90015dd4a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 4 Oct 2009 23:38:14 +0000 Subject: Provide pointer to STARTUPINFO structure when calling CreateProcessW, to stop crash under normal Windows (not CE) when launching Doom from the setup tools (thanks Janizdreg). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1709 --- setup/execute.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup/execute.c b/setup/execute.c index 03a4f65c..ae23bf2e 100644 --- a/setup/execute.c +++ b/setup/execute.c @@ -232,6 +232,7 @@ static wchar_t *GetPaddedWideArg(const char *arg) static int ExecuteCommand(const char *program, const char *arg) { + STARTUPINFOW startup_info; PROCESS_INFORMATION proc_info; wchar_t *exe_path; wchar_t *warg; @@ -245,8 +246,8 @@ static int ExecuteCommand(const char *program, const char *arg) memset(&proc_info, 0, sizeof(proc_info)); if (!CreateProcessW(exe_path, warg, - NULL, NULL, FALSE, 0, NULL, NULL, NULL, - &proc_info)) + NULL, NULL, FALSE, 0, NULL, NULL, + &startup_info, &proc_info)) { result = -1; } -- cgit v1.2.3 From a91a40f18eb3a353025b21bf22599c30f65a1cd3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 5 Oct 2009 20:25:53 +0000 Subject: Fix desync in ep1-0500.lmp on 64-bit (thanks exp(x)). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1710 --- src/p_doors.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/p_doors.c b/src/p_doors.c index b681a8d0..89b65328 100644 --- a/src/p_doors.c +++ b/src/p_doors.c @@ -420,8 +420,41 @@ EV_VerticalDoor { if (!thing->player) return; // JDC: bad guys never close doors - - door->direction = -1; // start going down immediately + + // When is a door not a door? + // In Vanilla, door->direction is set, even though + // "specialdata" might not actually point at a door. + + if (door->thinker.function.acp1 == (actionf_p1) T_VerticalDoor) + { + door->direction = -1; // start going down immediately + } + else if (door->thinker.function.acp1 == (actionf_p1) T_PlatRaise) + { + // Erm, this is a plat, not a door. + // This notably causes a problem in ep1-0500.lmp where + // a plat and a door are cross-referenced; the door + // doesn't open on 64-bit. + // The direction field in vldoor_t corresponds to the wait + // field in plat_t. Let's set that to -1 instead. + + plat_t *plat; + + plat = (plat_t *) door; + plat->wait = -1; + } + else + { + // This isn't a door OR a plat. Now we're in trouble. + + fprintf(stderr, "EV_VerticalDoor: Tried to close " + "something that wasn't a door.\n"); + + // Try closing it anyway. At least it will work on 32-bit + // machines. + + door->direction = -1; + } } return; } -- cgit v1.2.3 From cc92d31eeaa40ae966196cfa5402474ffda0bbc7 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 10 Oct 2009 01:02:58 +0000 Subject: Don't crash when using the donut special type and the joining linedef is one sided (thanks Alexander Waldmann). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1711 --- src/p_spec.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index 27042b5d..5bb6f19d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1199,6 +1199,24 @@ int EV_DoDonut(line_t* line) rtn = 1; s2 = getNextSector(s1->lines[0],s1); + + // Vanilla Doom does not check if the linedef is one sided. The + // game does not crash, but reads invalid memory and causes the + // sector floor to move "down" to some unknown height. + // DOSbox prints a warning about an invalid memory access. + // + // I'm not sure exactly what invalid memory is being read. This + // isn't something that should be done, anyway. + // Just print a warning and return. + + if (s2 == NULL) + { + fprintf(stderr, + "EV_DoDonut: linedef had no second sidedef! " + "Unexpected behavior may occur in Vanilla Doom. \n"); + break; + } + for (i = 0;i < s2->linecount;i++) { if ((!s2->lines[i]->flags & ML_TWOSIDED) || -- cgit v1.2.3 From 6e717690078ca8877631180501d7369d3dfc6468 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 10 Oct 2009 21:46:14 +0000 Subject: Add pkg directory to make dist. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1712 --- Makefile.am | 1 + configure.in | 1 + pkg/Makefile.am | 3 +++ pkg/wince/Makefile.am | 2 ++ 4 files changed, 7 insertions(+) create mode 100644 pkg/Makefile.am diff --git a/Makefile.am b/Makefile.am index e4b7c825..dc3a40d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,6 +45,7 @@ MAINTAINERCLEANFILES = $(AUX_DIST_GEN) docdir=$(prefix)/share/doc/@PACKAGE@ SUBDIRS=wince textscreen pcsound src man setup +DIST_SUBDIRS=pkg $(SUBDIRS) if HAVE_PYTHON diff --git a/configure.in b/configure.in index f77d6ebd..74890978 100644 --- a/configure.in +++ b/configure.in @@ -121,6 +121,7 @@ setup/Makefile man/Makefile src/Makefile pcsound/Makefile +pkg/Makefile pkg/wince/Makefile src/resource.rc src/doom-screensaver.desktop diff --git a/pkg/Makefile.am b/pkg/Makefile.am new file mode 100644 index 00000000..00ab5d6f --- /dev/null +++ b/pkg/Makefile.am @@ -0,0 +1,3 @@ + +DIST_SUBDIRS=wince + diff --git a/pkg/wince/Makefile.am b/pkg/wince/Makefile.am index 13b48d2e..e710e679 100644 --- a/pkg/wince/Makefile.am +++ b/pkg/wince/Makefile.am @@ -3,6 +3,8 @@ DEPS=$(shell ./wince-cabgen -d $(CONFIG_FILE)) CONFIG_FILE=wince-cab.cfg OUTPUT_FILE=@PACKAGE_TARNAME@-@PACKAGE_VERSION@.cab +EXTRA_DIST=wince-cabgen $(CONFIG_FILE) + noinst_DATA = $(OUTPUT_FILE) $(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS) -- cgit v1.2.3 From 86d786342816666d70f9abdb57b46438a079ff5a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 10 Oct 2009 22:58:25 +0000 Subject: Rename pkg/wince/Makefile to pkg/wince/GNUmakefile (it uses GNU extensions). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1714 --- configure.in | 2 +- pkg/wince/GNUmakefile.am | 12 ++++++++++++ pkg/wince/Makefile.am | 12 ------------ 3 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 pkg/wince/GNUmakefile.am delete mode 100644 pkg/wince/Makefile.am diff --git a/configure.in b/configure.in index 74890978..f4a3f507 100644 --- a/configure.in +++ b/configure.in @@ -122,7 +122,7 @@ man/Makefile src/Makefile pcsound/Makefile pkg/Makefile -pkg/wince/Makefile +pkg/wince/GNUmakefile src/resource.rc src/doom-screensaver.desktop setup/setup-res.rc diff --git a/pkg/wince/GNUmakefile.am b/pkg/wince/GNUmakefile.am new file mode 100644 index 00000000..e710e679 --- /dev/null +++ b/pkg/wince/GNUmakefile.am @@ -0,0 +1,12 @@ + +DEPS=$(shell ./wince-cabgen -d $(CONFIG_FILE)) +CONFIG_FILE=wince-cab.cfg +OUTPUT_FILE=@PACKAGE_TARNAME@-@PACKAGE_VERSION@.cab + +EXTRA_DIST=wince-cabgen $(CONFIG_FILE) + +noinst_DATA = $(OUTPUT_FILE) + +$(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS) + ./wince-cabgen $< $@ + diff --git a/pkg/wince/Makefile.am b/pkg/wince/Makefile.am deleted file mode 100644 index e710e679..00000000 --- a/pkg/wince/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ - -DEPS=$(shell ./wince-cabgen -d $(CONFIG_FILE)) -CONFIG_FILE=wince-cab.cfg -OUTPUT_FILE=@PACKAGE_TARNAME@-@PACKAGE_VERSION@.cab - -EXTRA_DIST=wince-cabgen $(CONFIG_FILE) - -noinst_DATA = $(OUTPUT_FILE) - -$(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS) - ./wince-cabgen $< $@ - -- cgit v1.2.3 From df49602893b3bbe625dfc757949b93ea6b7339e0 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 16 Oct 2009 18:10:30 +0000 Subject: Fix compilation under MSVC (thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1717 --- msvc/ChocolateDoom.vcproj | 40 ++++++++++++++++++++++++++++++++++++++++ setup/mainmenu.c | 1 + 2 files changed, 41 insertions(+) diff --git a/msvc/ChocolateDoom.vcproj b/msvc/ChocolateDoom.vcproj index 6302ac86..5e01a47d 100644 --- a/msvc/ChocolateDoom.vcproj +++ b/msvc/ChocolateDoom.vcproj @@ -9631,6 +9631,46 @@ /> + + + + + + + + + + + + + + + + diff --git a/setup/mainmenu.c b/setup/mainmenu.c index ba85ca1f..4ad1ac02 100644 --- a/setup/mainmenu.c +++ b/setup/mainmenu.c @@ -19,6 +19,7 @@ // 02111-1307, USA. // +#include #include #include -- cgit v1.2.3 From a3ab0a6910f55c6f45a3f4eaf48b4a99c4e16e22 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 17 Oct 2009 19:29:46 +0000 Subject: Import donut overrun emulation code from PrBoom+ (Thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1720 --- src/m_misc.c | 8 ++++ src/m_misc.h | 1 + src/p_spec.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 129 insertions(+), 12 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index acab0a5b..9a5fb84a 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -198,3 +198,11 @@ char *M_TempFile(char *s) return result; } +boolean M_StrToInt(const char *str, int *result) +{ + return sscanf(str, " 0x%x", result) == 1 + || sscanf(str, " 0X%x", result) == 1 + || sscanf(str, " 0%o", result) == 1 + || sscanf(str, " %d", result) == 1; +} + diff --git a/src/m_misc.h b/src/m_misc.h index 0fea7e92..0fe8e62e 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -39,6 +39,7 @@ void M_MakeDirectory(char *dir); char *M_TempFile(char *s); boolean M_FileExists(char *file); long M_FileLength(FILE *handle); +boolean M_StrToInt(const char *str, int *result); #endif diff --git a/src/p_spec.c b/src/p_spec.c index 5bb6f19d..37beb850 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -38,6 +38,7 @@ #include "i_system.h" #include "z_zone.h" #include "m_argv.h" +#include "m_misc.h" #include "m_random.h" #include "w_wad.h" @@ -1169,10 +1170,94 @@ void P_UpdateSpecials (void) memset(&buttonlist[i],0,sizeof(button_t)); } } - } +// +// Donut overrun emulation +// +// Derived from the code from PrBoom+. Thanks go to Andrey Budko (entryway) +// as usual :-) +// + +#define DONUT_FLOORHEIGHT_DEFAULT 0x00000000 +#define DONUT_FLOORPIC_DEFAULT 0x16 + +static void DonutOverrun(fixed_t *s3_floorheight, short *s3_floorpic, + line_t *line, sector_t *pillar_sector) +{ + static int first = 1; + static int tmp_s3_floorheight; + static int tmp_s3_floorpic; + + extern int numflats; + + if (first) + { + int p; + + // This is the first time we have had an overrun. + first = 0; + + // Default values + tmp_s3_floorheight = DONUT_FLOORHEIGHT_DEFAULT; + tmp_s3_floorpic = DONUT_FLOORPIC_DEFAULT; + + //! + // @category compat + // @arg + // + // Use the specified magic values when emulating behavior caused + // by memory overruns from improperly constructed donuts. + // In Vanilla Doom this can differ depending on the operating + // system. The default (if this option is not specified) is to + // emulate the behavior when running under Windows 98. + + p = M_CheckParm("-donut"); + + if (p > 0 && p < myargc - 2) + { + // Dump of needed memory: (fixed_t)0000:0000 and (short)0000:0008 + // + // C:\>debug + // -d 0:0 + // + // DOS 6.22: + // 0000:0000 (57 92 19 00) F4 06 70 00-(16 00) + // DOS 7.1: + // 0000:0000 (9E 0F C9 00) 65 04 70 00-(16 00) + // Win98: + // 0000:0000 (00 00 00 00) 65 04 70 00-(16 00) + // DOSBox under XP: + // 0000:0000 (00 00 00 F1) ?? ?? ?? 00-(07 00) + + M_StrToInt(myargv[p + 1], &tmp_s3_floorheight); + M_StrToInt(myargv[p + 2], &tmp_s3_floorpic); + + if (tmp_s3_floorpic >= numflats) + { + fprintf(stderr, + "DonutOverrun: The second parameter for \"-donut\" " + "switch should be greater than 0 and less than number " + "of flats (%d). Using default value (%d) instead. \n", + numflats, DONUT_FLOORPIC_DEFAULT); + tmp_s3_floorpic = DONUT_FLOORPIC_DEFAULT; + } + } + } + + /* + fprintf(stderr, + "Linedef: %d; Sector: %d; " + "New floor height: %d; New floor pic: %d\n", + line->iLineID, pillar_sector->iSectorID, + tmp_s3_floorheight >> 16, tmp_s3_floorpic); + */ + + *s3_floorheight = (fixed_t) tmp_s3_floorheight; + *s3_floorpic = (short) tmp_s3_floorpic; +} + // // Special Stuff that can not be categorized @@ -1186,17 +1271,19 @@ int EV_DoDonut(line_t* line) int rtn; int i; floormove_t* floor; - + fixed_t s3_floorheight; + short s3_floorpic; + secnum = -1; rtn = 0; while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { s1 = §ors[secnum]; - + // ALREADY MOVING? IF SO, KEEP GOING... if (s1->specialdata) continue; - + rtn = 1; s2 = getNextSector(s1->lines[0],s1); @@ -1217,13 +1304,34 @@ int EV_DoDonut(line_t* line) break; } - for (i = 0;i < s2->linecount;i++) + for (i = 0; i < s2->linecount; i++) { - if ((!s2->lines[i]->flags & ML_TWOSIDED) || - (s2->lines[i]->backsector == s1)) - continue; s3 = s2->lines[i]->backsector; - + + if (s3 == s1) + continue; + + if (s3 == NULL) + { + // e6y + // s3 is NULL, so + // s3->floorheight is an int at 0000:0000 + // s3->floorpic is a short at 0000:0008 + // Trying to emulate + + fprintf(stderr, + "EV_DoDonut: WARNING: emulating buffer overrun due to " + "NULL back sector. " + "Unexpected behavior may occur in Vanilla Doom.\n"); + + DonutOverrun(&s3_floorheight, &s3_floorpic, line, s1); + } + else + { + s3_floorheight = s3->floorheight; + s3_floorpic = s3->floorpic; + } + // Spawn rising slime floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0); P_AddThinker (&floor->thinker); @@ -1234,9 +1342,9 @@ int EV_DoDonut(line_t* line) floor->direction = 1; floor->sector = s2; floor->speed = FLOORSPEED / 2; - floor->texture = s3->floorpic; + floor->texture = s3_floorpic; floor->newspecial = 0; - floor->floordestheight = s3->floorheight; + floor->floordestheight = s3_floorheight; // Spawn lowering donut-hole floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0); @@ -1248,7 +1356,7 @@ int EV_DoDonut(line_t* line) floor->direction = -1; floor->sector = s1; floor->speed = FLOORSPEED / 2; - floor->floordestheight = s3->floorheight; + floor->floordestheight = s3_floorheight; break; } } -- cgit v1.2.3 From 1290c2496e85105871ab457b91e159d43c4cc7b4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 17 Oct 2009 19:39:37 +0000 Subject: Use M_StrToInt() when processing values passed with -spechit, so that hex values can be specified. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1721 --- src/p_map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 42f2a60f..db512673 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -36,6 +36,7 @@ #include "doomdef.h" #include "m_argv.h" +#include "m_misc.h" #include "p_local.h" #include "s_sound.h" @@ -1412,7 +1413,7 @@ static void SpechitOverrun(line_t *ld) if (p > 0) { - baseaddr = atoi(myargv[p+1]); + M_StrToInt(atoi(myargv[p+1]), &baseaddr); } else { -- cgit v1.2.3 From 42454af827d204444874558ccb340fc6e65f9ac1 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 17 Oct 2009 20:13:54 +0000 Subject: Fix error in last change. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1722 --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index db512673..89f8f3f8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1413,7 +1413,7 @@ static void SpechitOverrun(line_t *ld) if (p > 0) { - M_StrToInt(atoi(myargv[p+1]), &baseaddr); + M_StrToInt(myargv[p+1], (int *) &baseaddr); } else { -- cgit v1.2.3 From 3771126689527293eb4ad658b338d7910bf79012 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 26 Oct 2009 19:28:12 +0000 Subject: Initial hacks for compiling under SDL 1.3. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1726 --- src/i_video.c | 24 ++++++++++++++++++++++-- textscreen/txt_sdl.c | 10 +++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 062c9c9c..481ee0ea 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -334,7 +334,9 @@ static int TranslateKey(SDL_keysym *sym) case SDLK_PAUSE: return KEY_PAUSE; +#if !SDL_VERSION_ATLEAST(1, 3, 0) case SDLK_EQUALS: return KEY_EQUALS; +#endif case SDLK_MINUS: return KEY_MINUS; @@ -347,9 +349,11 @@ static int TranslateKey(SDL_keysym *sym) return KEY_RCTRL; case SDLK_LALT: - case SDLK_LMETA: case SDLK_RALT: +#if !SDL_VERSION_ATLEAST(1, 3, 0) + case SDLK_LMETA: case SDLK_RMETA: +#endif return KEY_RALT; case SDLK_CAPSLOCK: return KEY_CAPSLOCK; @@ -420,9 +424,15 @@ void I_StartFrame (void) static int MouseButtonState(void) { - Uint8 state = SDL_GetMouseState(NULL, NULL); + Uint8 state; int result = 0; +#if SDL_VERSION_ATLEAST(1, 3, 0) + state = SDL_GetMouseState(0, NULL, NULL); +#else + state = SDL_GetMouseState(NULL, NULL); +#endif + // Note: button "0" is left, button "1" is right, // button "2" is middle for Doom. This is different // to how SDL sees things. @@ -585,7 +595,11 @@ static void CenterMouse(void) // Clear any relative movement caused by warping SDL_PumpEvents(); +#if SDL_VERSION_ATLEAST(1, 3, 0) + SDL_GetRelativeMouseState(0, NULL, NULL); +#else SDL_GetRelativeMouseState(NULL, NULL); +#endif } // @@ -599,7 +613,11 @@ static void I_ReadMouse(void) int x, y; event_t ev; +#if SDL_VERSION_ATLEAST(1, 3, 0) + SDL_GetRelativeMouseState(0, &x, &y); +#else SDL_GetRelativeMouseState(&x, &y); +#endif if (x != 0 || y != 0) { @@ -1553,7 +1571,9 @@ void I_InitGraphics(void) // has to be done before the call to SDL_SetVideoMode. I_SetWindowCaption(); +#if !SDL_VERSION_ATLEAST(1, 3, 0) I_SetWindowIcon(); +#endif // Set the video mode. diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index 0b11aeab..4f8bc2a8 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -285,7 +285,11 @@ void TXT_UpdateScreen(void) void TXT_GetMousePosition(int *x, int *y) { +#if SDL_VERSION_ATLEAST(1, 3, 0) + SDL_GetMouseState(0, x, y); +#else SDL_GetMouseState(x, y); +#endif *x /= font->w; *y /= font->h; @@ -324,7 +328,9 @@ static int TranslateKey(SDL_keysym *sym) case SDLK_PAUSE: return KEY_PAUSE; +#if !SDL_VERSION_ATLEAST(1, 3, 0) case SDLK_EQUALS: return KEY_EQUALS; +#endif case SDLK_LSHIFT: case SDLK_RSHIFT: @@ -335,9 +341,11 @@ static int TranslateKey(SDL_keysym *sym) return KEY_RCTRL; case SDLK_LALT: - case SDLK_LMETA: case SDLK_RALT: +#if !SDL_VERSION_ATLEAST(1, 3, 0) + case SDLK_LMETA: case SDLK_RMETA: +#endif return KEY_RALT; case SDLK_CAPSLOCK: return KEY_CAPSLOCK; -- cgit v1.2.3 From 9ea3cb62c94b2f293cc5dbc95518b8312434e093 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 5 Nov 2009 19:57:55 +0000 Subject: Perform bounds checking on values passed to TXT_UpdateScreenArea() to avoid crashes. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1728 --- textscreen/txt_sdl.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index 4f8bc2a8..cd7dd77d 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -263,19 +263,44 @@ static inline void UpdateCharacter(int x, int y) } } +static int LimitToRange(int val, int min, int max) +{ + if (val < min) + { + return min; + } + else if (val > max) + { + return max; + } + else + { + return val; + } +} + void TXT_UpdateScreenArea(int x, int y, int w, int h) { int x1, y1; + int x_end; + int y_end; + + x_end = LimitToRange(x + w, 0, TXT_SCREEN_W - 1); + y_end = LimitToRange(y + h, 0, TXT_SCREEN_H - 1); + x = LimitToRange(x, 0, TXT_SCREEN_W - 1); + y = LimitToRange(y, 0, TXT_SCREEN_H - 1); - for (y1=y; y1w, y * font->h, w * font->w, h * font->h); + SDL_UpdateRect(screen, + x * font->w, y * font->h, + (x_end - x) * font->w, (y_end - y) * font->h); } void TXT_UpdateScreen(void) -- cgit v1.2.3 From e62fdd771f01ef7b50fe3cb8f456eae5d7db3748 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 19 Nov 2009 21:07:31 +0000 Subject: Make chocolate-setup use its own location in the filesystem to find the location of the chocolate-doom executable. Remove INSTALL_DIR define. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1729 --- setup/Makefile.am | 2 +- setup/execute.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/setup/Makefile.am b/setup/Makefile.am index 22bcb224..af80d525 100644 --- a/setup/Makefile.am +++ b/setup/Makefile.am @@ -1,7 +1,7 @@ gamesdir = $(prefix)/games -AM_CFLAGS = -I../textscreen -I../src -DINSTALL_DIR="\"$(gamesdir)\"" +AM_CFLAGS = -I../textscreen -I../src games_PROGRAMS = chocolate-setup diff --git a/setup/execute.c b/setup/execute.c index ae23bf2e..9672a334 100644 --- a/setup/execute.c +++ b/setup/execute.c @@ -55,7 +55,7 @@ #ifdef _WIN32 #define DOOM_BINARY PACKAGE_TARNAME ".exe" #else -#define DOOM_BINARY INSTALL_DIR "/" PACKAGE_TARNAME +#define DOOM_BINARY PACKAGE_TARNAME #endif #ifdef _WIN32 @@ -269,11 +269,41 @@ static int ExecuteCommand(const char *program, const char *arg) #else +// Given the specified program name, get the full path to the program, +// assuming that it is in the same directory as this program is. + +static char *GetFullExePath(const char *program) +{ + char *result; + char *sep; + unsigned int path_len; + + sep = strrchr(myargv[0], DIR_SEPARATOR); + + if (sep == NULL) + { + result = strdup(program); + } + else + { + path_len = sep - myargv[0] + 1; + + result = malloc(strlen(program) + path_len + 1); + + strncpy(result, myargv[0], path_len); + result[path_len] = '\0'; + + strcat(result, program); + } + + return result; +} + static int ExecuteCommand(const char *program, const char *arg) { pid_t childpid; int result; - const char *argv[] = { program, arg, NULL }; + const char *argv[3]; childpid = fork(); @@ -281,6 +311,10 @@ static int ExecuteCommand(const char *program, const char *arg) { // This is the child. Execute the command. + argv[0] = GetFullExePath(program); + argv[1] = arg; + argv[2] = NULL; + execv(argv[0], (char **) argv); exit(-1); -- cgit v1.2.3 From 43b0dbd272da1d590797d2974e94413971131129 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 19 Nov 2009 21:49:13 +0000 Subject: Rework the OS X MIDI disabling code, as SDL_mixer 1.2.11 fixes the crash. Check and disable MIDI by default if using an older version of SDL on OS X. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1730 --- setup/Makefile.am | 3 ++- setup/configfile.c | 18 ++++++++++++++++++ setup/sound.c | 25 +------------------------ setup/sound.h | 14 ++++++++++++++ src/i_sdlmusic.c | 32 +++++++++++++++++++++----------- src/m_config.c | 19 +++++++++++++++++++ src/s_sound.c | 10 +--------- 7 files changed, 76 insertions(+), 45 deletions(-) diff --git a/setup/Makefile.am b/setup/Makefile.am index af80d525..92b4e394 100644 --- a/setup/Makefile.am +++ b/setup/Makefile.am @@ -1,7 +1,7 @@ gamesdir = $(prefix)/games -AM_CFLAGS = -I../textscreen -I../src +AM_CFLAGS = -I../textscreen -I../src @SDLMIXER_CFLAGS@ games_PROGRAMS = chocolate-setup @@ -34,6 +34,7 @@ endif chocolate_setup_LDADD = \ ../wince/libc_wince.a \ ../textscreen/libtextscreen.a \ + @SDLMIXER_LIBS@ \ @LDFLAGS@ .rc.o: diff --git a/setup/configfile.c b/setup/configfile.c index fe3c13de..6d57a107 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -42,6 +42,8 @@ #include #endif +#include "SDL_mixer.h" + #include "config.h" #include "doomfeatures.h" @@ -721,5 +723,21 @@ void M_ApplyPlatformDefaults(void) #ifdef _WIN32_WCE M_ApplyWindowsCEDefaults(); #endif + + // Before SDL_mixer version 1.2.11, MIDI music caused the game + // to crash when it looped. If this is an old SDL_mixer version, + // disable MIDI. + +#ifdef __MACOSX__ + { + const SDL_version *v = Mix_Linked_Version(); + + if (SDL_VERSIONNUM(v->major, v->minor, v->patch) + < SDL_VERSIONNUM(1, 2, 11)) + { + snd_musicdevice = SNDDEVICE_NONE; + } + } +#endif } diff --git a/setup/sound.c b/setup/sound.c index 72414c83..9e02aeec 100644 --- a/setup/sound.c +++ b/setup/sound.c @@ -27,20 +27,6 @@ #include "sound.h" -enum -{ - SNDDEVICE_NONE = 0, - SNDDEVICE_PCSPEAKER = 1, - SNDDEVICE_ADLIB = 2, - SNDDEVICE_SB = 3, - SNDDEVICE_PAS = 4, - SNDDEVICE_GUS = 5, - SNDDEVICE_WAVEBLASTER = 6, - SNDDEVICE_SOUNDCANVAS = 7, - SNDDEVICE_GENMIDI = 8, - SNDDEVICE_AWE32 = 9, -}; - typedef enum { SFXMODE_DISABLED, @@ -56,20 +42,11 @@ static char *sfxmode_strings[] = "Digital", }; -// Disable MIDI music on OSX: there are problems with the native -// MIDI code in SDL_mixer. - -#ifdef __MACOSX__ -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_NONE -#else -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB -#endif - int snd_sfxdevice = SNDDEVICE_SB; int numChannels = 8; int sfxVolume = 15; -int snd_musicdevice = DEFAULT_MUSIC_DEVICE; +int snd_musicdevice = SNDDEVICE_SB; int musicVolume = 15; int snd_samplerate = 22050; diff --git a/setup/sound.h b/setup/sound.h index 170dda0a..6c366151 100644 --- a/setup/sound.h +++ b/setup/sound.h @@ -22,6 +22,20 @@ #ifndef SETUP_SOUND_H #define SETUP_SOUND_H +enum +{ + SNDDEVICE_NONE = 0, + SNDDEVICE_PCSPEAKER = 1, + SNDDEVICE_ADLIB = 2, + SNDDEVICE_SB = 3, + SNDDEVICE_PAS = 4, + SNDDEVICE_GUS = 5, + SNDDEVICE_WAVEBLASTER = 6, + SNDDEVICE_SOUNDCANVAS = 7, + SNDDEVICE_GENMIDI = 8, + SNDDEVICE_AWE32 = 9, +}; + extern int snd_sfxdevice; extern int numChannels; extern int sfxVolume; diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c index 81f492b5..7f9bd8ec 100644 --- a/src/i_sdlmusic.c +++ b/src/i_sdlmusic.c @@ -81,18 +81,28 @@ static boolean SDLIsInitialized(void) // Initialize music subsystem static boolean I_SDL_InitMusic(void) -{ - // When trying to run with music enabled on OSX, display - // a warning message. - -#ifdef __APPLE__ - printf("\n" - " *** WARNING ***\n" - " Music playback on OSX may cause crashes and\n" - " is disabled by default.\n" - "\n"); +{ + // SDL_mixer prior to v1.2.11 has a bug that causes crashes + // with MIDI playback. Print a warning message if we are + // using an old version. + +#ifdef __MACOSX__ + { + const SDL_version *v = Mix_Linked_Version(); + + if (SDL_VERSIONNUM(v->major, v->minor, v->patch) + < SDL_VERSIONNUM(1, 2, 11)) + { + printf("\n" + " *** WARNING ***\n" + " You are using an old version of SDL_mixer.\n" + " Music playback on this version may cause crashes\n" + " under OS X and is disabled by default.\n" + "\n"); + } + } #endif - + // If SDL_mixer is not initialized, we have to initialize it // and have the responsibility to shut it down later on. diff --git a/src/m_config.c b/src/m_config.c index 4f789845..73f0da2c 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -36,6 +36,8 @@ #include #endif +#include "SDL_mixer.h" + #include "config.h" #include "deh_main.h" #include "doomdef.h" @@ -53,6 +55,7 @@ #include "i_swap.h" #include "i_system.h" #include "i_video.h" +#include "s_sound.h" #include "v_video.h" #include "hu_stuff.h" @@ -1456,5 +1459,21 @@ void M_ApplyPlatformDefaults(void) #ifdef _WIN32_WCE M_ApplyWindowsCEDefaults(); #endif + + // Before SDL_mixer version 1.2.11, MIDI music caused the game + // to crash when it looped. If this is an old SDL_mixer version, + // disable MIDI. + +#ifdef __MACOSX__ + { + const SDL_version *v = Mix_Linked_Version(); + + if (SDL_VERSIONNUM(v->major, v->minor, v->patch) + < SDL_VERSIONNUM(1, 2, 11)) + { + snd_musicdevice = SNDDEVICE_NONE; + } + } +#endif } diff --git a/src/s_sound.c b/src/s_sound.c index 9b4f71aa..1c56efb2 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -69,14 +69,6 @@ #define NORM_PRIORITY 64 #define NORM_SEP 128 -// Disable music on OSX by default; there are problems with SDL_mixer. - -#ifndef __APPLE__ -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB -#else -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_NONE -#endif - typedef struct { // sound information (if null, channel avail.) @@ -128,7 +120,7 @@ static musicinfo_t *mus_playing = NULL; int numChannels = 8; -int snd_musicdevice = DEFAULT_MUSIC_DEVICE; +int snd_musicdevice = SNDDEVICE_SB; int snd_sfxdevice = SNDDEVICE_SB; // Sound modules -- cgit v1.2.3 From f9c922149717242958f065c8718e7e7586c165a5 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 21 Nov 2009 00:24:59 +0000 Subject: Fix crash with chocolate-setup under Windows (thanks Janizdreg). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1731 --- setup/execute.c | 80 ++++++++++++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 47 deletions(-) diff --git a/setup/execute.c b/setup/execute.c index 9672a334..fb9885fa 100644 --- a/setup/execute.c +++ b/setup/execute.c @@ -172,60 +172,47 @@ static unsigned int WaitForProcessExit(HANDLE subprocess) } } -static wchar_t *GetFullExePath(const char *program) +static void ConcatWCString(wchar_t *buf, const char *value) +{ + MultiByteToWideChar(CP_OEMCP, 0, + value, strlen(value) + 1, + buf + wcslen(buf), strlen(value) + 1); +} + +// Build the command line string, a wide character string of the form: +// +// "program" "arg" + +static wchar_t *BuildCommandLine(const char *program, const char *arg) { wchar_t *result; - unsigned int path_len; char *sep; - // Find the full path to the EXE to execute, by taking the path - // to this program and concatenating the EXE name: + result = calloc(strlen(myargv[0]) + strlen(program) + strlen(arg) + 6, + sizeof(wchar_t)); + + wcscpy(result, L"\""); sep = strrchr(myargv[0], DIR_SEPARATOR); - if (sep == NULL) - { - path_len = 0; - result = calloc(strlen(program) + 1, sizeof(wchar_t)); - } - else + if (sep != NULL) { - path_len = sep - myargv[0] + 1; - - result = calloc(path_len + strlen(program) + 1, - sizeof(wchar_t)); - MultiByteToWideChar(CP_OEMCP, 0, - myargv[0], path_len, - result, path_len); - } - - MultiByteToWideChar(CP_OEMCP, 0, - program, strlen(program) + 1, - result + path_len, strlen(program) + 1); - - return result; -} + ConcatWCString(result, myargv[0]); -// Convert command line argument to wchar_t string and add surrounding -// "" quotes: + // Cut off the string after the last directory separator, + // before appending the actual program. -static wchar_t *GetPaddedWideArg(const char *arg) -{ - wchar_t *result; - unsigned int len = strlen(arg); + result[sep - myargv[0] + 2] = '\0'; + + } - // Convert the command line arg to a wide char string: + ConcatWCString(result, program); - result = calloc(len + 3, sizeof(wchar_t)); - MultiByteToWideChar(CP_OEMCP, 0, - arg, len + 1, - result + 1, len + 1); + wcscat(result, L"\" \""); - // Surrounding quotes: + ConcatWCString(result, arg); - result[0] = '"'; - result[len + 1] = '"'; - result[len + 2] = 0; + wcscat(result, L"\""); return result; } @@ -234,18 +221,18 @@ static int ExecuteCommand(const char *program, const char *arg) { STARTUPINFOW startup_info; PROCESS_INFORMATION proc_info; - wchar_t *exe_path; - wchar_t *warg; + wchar_t *command; int result = 0; - exe_path = GetFullExePath(program); - warg = GetPaddedWideArg(arg); + command = BuildCommandLine(program, arg); // Invoke the program: memset(&proc_info, 0, sizeof(proc_info)); + memset(&startup_info, 0, sizeof(startup_info)); + startup_info.cb = sizeof(startup_info); - if (!CreateProcessW(exe_path, warg, + if (!CreateProcessW(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &proc_info)) { @@ -261,8 +248,7 @@ static int ExecuteCommand(const char *program, const char *arg) CloseHandle(proc_info.hThread); } - free(exe_path); - free(warg); + free(command); return result; } -- cgit v1.2.3 From 1dfad75870fa6b8e0a3aa41b3f9bb6ea260c9d9f Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 21 Nov 2009 00:38:16 +0000 Subject: Don't crash if key settings are set in a configuration file that are out of range (thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1732 --- src/m_config.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/m_config.c b/src/m_config.c index 73f0da2c..a2f3ac58 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -1237,7 +1237,14 @@ static void LoadDefaultCollection(default_collection_t *collection) intparm = ParseIntParameter(strparm); defaults[i].untranslated = intparm; - intparm = scantokey[intparm]; + if (intparm >= 0 && intparm < 128) + { + intparm = scantokey[intparm]; + } + else + { + intparm = 0; + } defaults[i].original_translated = intparm; * (int *) def->location = intparm; -- cgit v1.2.3 From 892ad7c072a6717e8935053d7837a33974d0d824 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 21 Nov 2009 00:40:58 +0000 Subject: Apply configuration file invalid key setting fix to setup code. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1733 --- setup/configfile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup/configfile.c b/setup/configfile.c index 6d57a107..99ec2e03 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -532,7 +532,15 @@ static void LoadDefaultCollection(default_collection_t *collection) intparm = ParseIntParameter(strparm); defaults[i].untranslated = intparm; - intparm = scantokey[intparm]; + + if (intparm >= 0 && intparm < 128) + { + intparm = scantokey[intparm]; + } + else + { + intparm = 0; + } defaults[i].original_translated = intparm; * (int *) def->location = intparm; -- cgit v1.2.3 From 944a39e9d17b9cd88985553cfb304df6e99a7720 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 21 Nov 2009 02:05:56 +0000 Subject: Use execvp() rather than execv(), to look up Doom binary in the PATH if necessary. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1735 --- setup/execute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/execute.c b/setup/execute.c index fb9885fa..8c4580e8 100644 --- a/setup/execute.c +++ b/setup/execute.c @@ -301,7 +301,7 @@ static int ExecuteCommand(const char *program, const char *arg) argv[1] = arg; argv[2] = NULL; - execv(argv[0], (char **) argv); + execvp(argv[0], (char **) argv); exit(-1); } -- cgit v1.2.3 From 2c6e7b2f10c32ca0406ca6753e7701d83e6dea8f Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 21 Nov 2009 03:56:59 +0000 Subject: Add Makefile to build Win32 packages. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1736 --- configure.in | 2 ++ pkg/Makefile.am | 2 +- pkg/win32/GNUmakefile.am | 34 ++++++++++++++++++++++++++++++++++ pkg/win32/README | 4 ++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pkg/win32/GNUmakefile.am create mode 100644 pkg/win32/README diff --git a/configure.in b/configure.in index f4a3f507..60610ea1 100644 --- a/configure.in +++ b/configure.in @@ -74,6 +74,7 @@ AC_SDL_MAIN_WORKAROUND([ ]) AC_CHECK_TOOL(WINDRES, windres, ) +AC_CHECK_TOOL(STRIP, strip, ) # Windows CE build? @@ -123,6 +124,7 @@ src/Makefile pcsound/Makefile pkg/Makefile pkg/wince/GNUmakefile +pkg/win32/GNUmakefile src/resource.rc src/doom-screensaver.desktop setup/setup-res.rc diff --git a/pkg/Makefile.am b/pkg/Makefile.am index 00ab5d6f..66cb9ba0 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -1,3 +1,3 @@ -DIST_SUBDIRS=wince +DIST_SUBDIRS=wince win32 diff --git a/pkg/win32/GNUmakefile.am b/pkg/win32/GNUmakefile.am new file mode 100644 index 00000000..edd57b6e --- /dev/null +++ b/pkg/win32/GNUmakefile.am @@ -0,0 +1,34 @@ + +TOPLEVEL=../.. + +EXE_FILES=$(TOPLEVEL)/src/@PACKAGE_TARNAME@.exe \ + $(TOPLEVEL)/src/chocolate-server.exe \ + $(TOPLEVEL)/setup/chocolate-setup.exe + +DLL_FILES=$(TOPLEVEL)/src/SDL.dll \ + $(TOPLEVEL)/src/SDL_mixer.dll \ + $(TOPLEVEL)/src/SDL_net.dll + +DOC_FILES=README \ + COPYING \ + ChangeLog \ + NEWS \ + BUGS \ + CMDLINE \ + TODO + +noinst_DATA=@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win32.zip + +@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win32.zip : staging + zip -j -r $@ staging/ + +staging: $(EXE_FILES) $(DLL_FILES) $(patsubst %,../../%,$(DOC_FILES)) + rm -rf staging + mkdir staging + cp $(EXE_FILES) $(DLL_FILES) staging/ + $(STRIP) staging/*.exe + for f in $(DOC_FILES); do \ + cp $(TOPLEVEL)/$$f staging/$$f.txt; \ + unix2dos staging/$$f.txt; \ + done + diff --git a/pkg/win32/README b/pkg/win32/README new file mode 100644 index 00000000..1f43f52c --- /dev/null +++ b/pkg/win32/README @@ -0,0 +1,4 @@ + +Makefile to build Windows packages. Requires zip and unix2dos cygwin +packages to be installed. + -- cgit v1.2.3