diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f33aa96..4ea2b7e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,6 +145,7 @@ include_directories( "ddebug" # -*- "fix" # -*- "lib" # TODO: Remove after untying all modules + "linux" # -*- "Descent3" ${PLATFORM_INCLUDES} ) @@ -161,19 +162,17 @@ add_subdirectory(ddebug) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") add_subdirectory(dd_grwin32) - add_subdirectory(dd_vidwin32) add_subdirectory(win32) add_subdirectory(dd_sndlib) add_subdirectory(ddio_win) else() add_subdirectory(linux) - add_subdirectory(ddvid_lnx) add_subdirectory(dd_lnxsound) - add_subdirectory(lnxcontroller) add_subdirectory(ddio_lnx) endif() add_subdirectory(ddio_common) +add_subdirectory(dd_video) add_subdirectory(fix) add_subdirectory(manage) add_subdirectory(grtext) diff --git a/Descent3/BriefingParse.h b/Descent3/BriefingParse.h index d4f46b32..4d448f00 100644 --- a/Descent3/BriefingParse.h +++ b/Descent3/BriefingParse.h @@ -51,7 +51,7 @@ #define __BRIEFPARSE_H_ #if defined(__LINUX__) -#include "linux/linux_fix.h" //for stricmp +#include "linux_fix.h" //for stricmp #endif #include "TelComEfxStructs.h" diff --git a/Descent3/CMakeLists.txt b/Descent3/CMakeLists.txt index 20233b90..5f43a0be 100644 --- a/Descent3/CMakeLists.txt +++ b/Descent3/CMakeLists.txt @@ -273,19 +273,19 @@ set(CPPS weather.cpp) if(WIN32) - set(PLATFORM_LIBS dd_sndlib dd_grwin32 dd_vidwin32 ddio_win win32 wsock32.lib winmm.lib + set(PLATFORM_LIBS dd_sndlib dd_grwin32 ddio_win win32 wsock32.lib winmm.lib ${DSOUND_LIBRARY} ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} ${DDRAW_LIBRARY}) set(PLATFORM_CPPS winmain.cpp) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC") endif() if(UNIX AND NOT APPLE) - set(PLATFORM_LIBS linux dd_lnxsound ddvid_lnx lnxcontroller ddio_lnx SDL2::SDL2 m ${CMAKE_DL_LIBS} ${CURSES_LIBRARIES}) + set(PLATFORM_LIBS linux dd_lnxsound ddio_lnx SDL2::SDL2 m ${CMAKE_DL_LIBS} ${CURSES_LIBRARIES}) set(PLATFORM_CPPS loki_utils.c lnxmain.cpp) endif() if(APPLE) - set(PLATFORM_LIBS linux dd_lnxsound ddvid_lnx lnxcontroller ddio_lnx SDL2::SDL2 ${CURSES_LIBRARIES}) + set(PLATFORM_LIBS linux dd_lnxsound ddio_lnx SDL2::SDL2 ${CURSES_LIBRARIES}) set(PLATFORM_CPPS loki_utils.c lnxmain.cpp) set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework Cocoa -framework OpenGL -framework Carbon") endif() @@ -297,7 +297,7 @@ add_executable(Descent3 ${HEADERS} ${CPPS} ${PLATFORM_CPPS} ${INCS} ) target_link_libraries(Descent3 - 2dlib AudioEncode bitmap cfile czip d3music ddebug ddio_common libmve libacm + 2dlib AudioEncode bitmap cfile czip d3music dd_video ddebug ddio_common libmve libacm fix grtext manage mem misc model module movie stream_audio music networking physics renderer rtperformance sndlib ui unzip vecmat md5 ${PLATFORM_LIBS}) diff --git a/Descent3/credits.cpp b/Descent3/credits.cpp index 4b992d2e..28faeb38 100644 --- a/Descent3/credits.cpp +++ b/Descent3/credits.cpp @@ -95,7 +95,7 @@ #include "psrand.h" #if defined(__LINUX__) -#include "linux/linux_fix.h" +#include "linux_fix.h" #endif /* diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index 89d6576f..aa01f6d0 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -791,12 +791,9 @@ void PrintDedicatedMessage(const char *fmt, ...) { #include #include #include -#include -#include -#include #include -#include "linux/linux_fix.h" +#include "linux_fix.h" #include "errno.h" #define BOOL bool #ifndef SOCKET diff --git a/Descent3/lnxmain.cpp b/Descent3/lnxmain.cpp index a2262f33..85aadfef 100644 --- a/Descent3/lnxmain.cpp +++ b/Descent3/lnxmain.cpp @@ -23,36 +23,26 @@ * $NoKeywords: $ */ -#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include "SDL.h" +#include + #include "program.h" -#include "mono.h" #include "descent.h" #include "application.h" #include "appdatabase.h" -#include "pserror.h" #include "args.h" #include "init.h" -#include "renderer.h" #include "ddio.h" -#include "ddvid.h" #include "osiris_dll.h" #include "loki_utils.h" #include "log.h" -#if defined(MACOSX) -#include -#endif - extern bool ddio_mouseGrabbed; int no_debug_dialog = 0; const char *DMFCGetString(int d); @@ -184,7 +174,6 @@ void fatal_signal_handler(int signum) { break; } - sync(); // just in case. _exit(-10); } diff --git a/Descent3/menu.cpp b/Descent3/menu.cpp index 4fafd798..6718635d 100644 --- a/Descent3/menu.cpp +++ b/Descent3/menu.cpp @@ -651,6 +651,10 @@ * * $NoKeywords: $ */ + +#include +#include + #include "menu.h" #include "mmItem.h" #include "game.h" @@ -681,9 +685,6 @@ bool Directplay_lobby_launched_game = false; #include "d3music.h" #include "newui_core.h" -#include -#include - #define IDV_QUIT 0xff // Menu Item Defines #define IDV_NEWGAME 10 @@ -1381,7 +1382,7 @@ int DisplayLevelWarpDlg(int max_level) { } sheet->NewGroup(buffer, 0, 0); input_text = sheet->AddEditBox(NULL, 4, 64, IDV_QUIT, UIED_NUMBERS); - itoa(chosen_level, input_text, 10); + sprintf(input_text, "%d", chosen_level); redo_level_choose: hwnd.Open(); res = hwnd.DoUI(); diff --git a/Descent3/multi.h b/Descent3/multi.h index 9666fd81..6ba88c8a 100644 --- a/Descent3/multi.h +++ b/Descent3/multi.h @@ -499,7 +499,7 @@ #include "player_external.h" #if defined(__LINUX__) -#include "linux/linux_fix.h" +#include "linux_fix.h" #endif #include "multi_external.h" //defines and structs are in here diff --git a/Descent3/newui.h b/Descent3/newui.h index e2de29fb..250d6768 100644 --- a/Descent3/newui.h +++ b/Descent3/newui.h @@ -188,7 +188,7 @@ #define NEWUI_H #if defined(__LINUX__) -#include "linux/linux_fix.h" //fix some of the stricmp's +#include "linux_fix.h" //fix some of the stricmp's #endif #include "newui_core.h" diff --git a/cfile/cfile.cpp b/cfile/cfile.cpp index 200b300d..f0f8468c 100644 --- a/cfile/cfile.cpp +++ b/cfile/cfile.cpp @@ -29,7 +29,7 @@ #include #else // Linux Build Includes -#include "linux/linux_fix.h" +#include "linux_fix.h" #endif #include "byteswap.h" diff --git a/dd_sndlib/ddsoundload.cpp b/dd_sndlib/ddsoundload.cpp index 3cec0ae9..996f9287 100644 --- a/dd_sndlib/ddsoundload.cpp +++ b/dd_sndlib/ddsoundload.cpp @@ -92,7 +92,7 @@ #include "windows.h" #include "winbase.h" #elif defined(__LINUX__) -#include "linux/linux_fix.h" +#include "linux_fix.h" #endif #include "ssl_lib.h" diff --git a/dd_video/CMakeLists.txt b/dd_video/CMakeLists.txt new file mode 100644 index 00000000..bea4a244 --- /dev/null +++ b/dd_video/CMakeLists.txt @@ -0,0 +1,17 @@ +set(CPPS + $<$: + video_win32.cpp + vidWin32FS.cpp + vidWin32Win.cpp + > + $<$: + video_lnx.cpp + > +) + +add_library(dd_video STATIC ${CPPS}) +target_link_libraries(dd_video PRIVATE + $<$: + linux + > +) diff --git a/dd_vidwin32/ddvidlib.h b/dd_video/ddvidlib.h similarity index 100% rename from dd_vidwin32/ddvidlib.h rename to dd_video/ddvidlib.h diff --git a/dd_vidwin32/vidWin32FS.cpp b/dd_video/vidWin32FS.cpp similarity index 100% rename from dd_vidwin32/vidWin32FS.cpp rename to dd_video/vidWin32FS.cpp diff --git a/dd_vidwin32/vidWin32Win.cpp b/dd_video/vidWin32Win.cpp similarity index 100% rename from dd_vidwin32/vidWin32Win.cpp rename to dd_video/vidWin32Win.cpp diff --git a/ddvid_lnx/video_lnx.cpp b/dd_video/video_lnx.cpp similarity index 96% rename from ddvid_lnx/video_lnx.cpp rename to dd_video/video_lnx.cpp index 4720ff9a..8fd8b201 100644 --- a/ddvid_lnx/video_lnx.cpp +++ b/dd_video/video_lnx.cpp @@ -22,15 +22,13 @@ * $NoKeywords: $ */ -#include "pserror.h" +#include +#include + #include "ddvid.h" #include "application.h" -#include "linux/lnxapp.h" -#include -#include -#include -#undef EGA -// #include +#include "lnxapp.h" + typedef struct { int width, height, bytesperpixel, linewidth; } tinfo; diff --git a/dd_vidwin32/video_win32.cpp b/dd_video/video_win32.cpp similarity index 100% rename from dd_vidwin32/video_win32.cpp rename to dd_video/video_win32.cpp diff --git a/dd_vidwin32/CMakeLists.txt b/dd_vidwin32/CMakeLists.txt deleted file mode 100644 index 2ad6692a..00000000 --- a/dd_vidwin32/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -set(HEADERS - ddvidlib.h) -set(CPPS - video_win32.cpp - vidWin32FS.cpp - vidWin32Win.cpp) - -add_library(dd_vidwin32 STATIC ${HEADERS} ${CPPS}) diff --git a/ddio_lnx/lnxfile.cpp b/ddio_lnx/lnxfile.cpp index 83f66ea6..8bd052ab 100644 --- a/ddio_lnx/lnxfile.cpp +++ b/ddio_lnx/lnxfile.cpp @@ -58,15 +58,17 @@ */ #include "ddio.h" -#include "ddio_lnx.h" #include "pserror.h" #include "mem.h" -#include "lnxfix.h" +#include "linux_fix.h" + +#if MACOSX +#include +#endif #include #include #include -#include #include #include #include @@ -76,7 +78,6 @@ #include #include #include -#include #define _MAX_DIR 256 diff --git a/ddvid_lnx/CMakeLists.txt b/ddvid_lnx/CMakeLists.txt deleted file mode 100644 index d28fea76..00000000 --- a/ddvid_lnx/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(HEADERS) -set(CPPS - video_lnx.cpp) - -add_library(ddvid_lnx STATIC ${HEADERS} ${CPPS}) diff --git a/lib/Controller.h b/lib/Controller.h index 0ffabffb..ed6a0a9a 100644 --- a/lib/Controller.h +++ b/lib/Controller.h @@ -258,7 +258,7 @@ void DestroyController(gameController *ctl); #if defined(WIN32) #include "win\WinController.h" #elif defined(__LINUX__) -#include "linux/lnxcontroller.h" +#include "lnxcontroller.h" #endif #endif diff --git a/lib/application.h b/lib/application.h index 51f48b9c..8ee6e1e4 100644 --- a/lib/application.h +++ b/lib/application.h @@ -112,6 +112,6 @@ public: #if defined(WIN32) #include "win\Win32App.h" #elif defined(__LINUX__) -#include "linux/lnxapp.h" +#include "lnxapp.h" #endif #endif diff --git a/lib/bitmap.h b/lib/bitmap.h index c3083149..bc67c2d2 100644 --- a/lib/bitmap.h +++ b/lib/bitmap.h @@ -23,7 +23,7 @@ #include "cfile.h" #ifdef __LINUX__ -#include "linux/linux_fix.h" //needed for stricmp's throughout bitmap lib +#include "linux_fix.h" //needed for stricmp's throughout bitmap lib #endif #define MAX_BITMAPS 5000 diff --git a/lib/lnxfix.h b/lib/lnxfix.h deleted file mode 100644 index b61f8de9..00000000 --- a/lib/lnxfix.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Descent 3 -* Copyright (C) 2024 Parallax Software -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . - ---- HISTORICAL COMMENTS FOLLOW --- - - * $Logfile: /DescentIII/Main/lnxfix.h $ - * $Revision: 1.2 $ - * $Date: 2004/02/09 04:14:49 $ - * $Author: kevinb $ - * - * File operations not covered properly in ANSI C - * - * $Log: lnxfix.h,v $ - * Revision 1.2 2004/02/09 04:14:49 kevinb - * Added newlines to all headers to reduce number of warnings printed - * - * Made some small changes to get everything compiling. - * - * All Ready to merge the 1.5 tree. - * - * Revision 1.1.1.1 2000/04/18 00:00:32 icculus - * initial checkin - * - * - * 2 4/15/99 1:39a Jeff - * changes for linux compile - * - * 1 4/14/99 7:51p Jeff - * - * - * $NoKeywords: $ - */ - -#ifndef LINUX_FIX_H_ -#define LINUX_FIX_H_ -#if defined(__LINUX__) - -#define stricmp(x, y) strcasecmp(x, y) -#define _vsnprintf(a, b, c, d) vsnprintf(a, b, c, d) - -extern bool Dedicated_server; -#endif -#endif diff --git a/lib/lnxscreenmode.h b/lib/lnxscreenmode.h index 9d5729bb..7f10e4dd 100644 --- a/lib/lnxscreenmode.h +++ b/lib/lnxscreenmode.h @@ -52,7 +52,7 @@ #ifndef __LNXVIDEOMODE_H__ #define __LNXVIDEOMODE_H__ -#include "linux/linux_fix.h" +#include "linux_fix.h" #include #define MODE_OK 0 diff --git a/lib/manage.h b/lib/manage.h index 1eb63ecf..05284020 100644 --- a/lib/manage.h +++ b/lib/manage.h @@ -26,7 +26,7 @@ #include "manage_external.h" #if defined(__LINUX__) -#include "linux/linux_fix.h" //for strnicmp,etc. +#include "linux_fix.h" //for strnicmp,etc. #endif #define LOCAL_TABLE "Table.loc" diff --git a/lib/networking.h b/lib/networking.h index 4e73248f..f1eeaeb8 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -211,7 +211,7 @@ static inline void INADDR_GET_SUN_SUNB(struct in_addr *st, unsigned char *s_b1, #include "SDL.h" #include "SDL_thread.h" -#include "linux/linux_fix.h" +#include "linux_fix.h" #define SOCKET int #define BOOL bool diff --git a/lib/ui.h b/lib/ui.h index f22cc598..a48e6f0b 100644 --- a/lib/ui.h +++ b/lib/ui.h @@ -268,7 +268,7 @@ #define UI_H #if defined(__LINUX__) -#include "linux/linux_fix.h" //for stricmp's through code +#include "linux_fix.h" //for stricmp's through code #endif #include "uires.h" diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 0f982db6..1f959c16 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,10 +1,19 @@ -set(HEADERS registry.h) set(CPPS lnxcon.cpp lnxcon_raw.cpp + lnxcontroller.cpp lnxapp.cpp lnxcon_null.cpp lnxdata.cpp - registry.cpp) -# DynXLib.cpp -add_library(linux STATIC ${HEADERS} ${CPPS}) + registry.cpp +) + +add_library(linux STATIC ${CPPS}) +target_link_libraries(linux PRIVATE + cfile +) +target_include_directories(linux PUBLIC + $ +) diff --git a/lib/linux/linux_fix.h b/linux/linux_fix.h similarity index 84% rename from lib/linux/linux_fix.h rename to linux/linux_fix.h index 3d500065..16aae8e4 100644 --- a/lib/linux/linux_fix.h +++ b/linux/linux_fix.h @@ -20,7 +20,6 @@ #define __LINUX_FIX_H_ #include -#include #define LOKI_VERSION "" @@ -30,8 +29,8 @@ void GlobalFree(void *); void *GlobalAlloc(int flags, int size); void *GlobalLock(HGLOBAL hMem); void Sleep(int millis); -char *itoa(int value, char *string, int radix); char *strupr(char *string); + // Replace missing defines from stdlib.h #define _MAX_PATH 260 /* max. length of full pathname*/ #define _MAX_FNAME 256 /* max. length of path component*/ @@ -45,25 +44,12 @@ char *strupr(char *string); // _stdcall replacement #define _stdcall __attribute__((stdcall)) -static inline int _filelength(int fd) { - struct stat statbuf; - - if (fstat(fd, &statbuf) != 0) { - return -1; - } - - return statbuf.st_size; -} - #ifndef stricmp #define stricmp(a, b) strcasecmp(a, b) #endif #define strnicmp(a, b, c) strncasecmp(a, b, c) -#define _fstat(a, b) fstat(a, b) -#define _fileno(a) fileno(a) #define strcmpi(a, b) stricmp(a, b) -#define strcmpni(a, b, c) strnicmp(a, b, c) #define _chmod(a, b) chmod(a, b) #if defined(__aarch64__) #define _finite(a) isfinite(a) diff --git a/linux/lnxapp.cpp b/linux/lnxapp.cpp index fcd90e33..b2ee52db 100644 --- a/linux/lnxapp.cpp +++ b/linux/lnxapp.cpp @@ -68,39 +68,27 @@ * $NoKeywords: $ */ -#include "application.h" -#include "linux/lnxapp.h" -#include "mono.h" -#include -#include "ddio.h" -// #include "local_malloc.h" -#include -#include +#include +#include #include -#include #include #include +#include "application.h" +#include "lnxapp.h" + #ifdef buttons // termios.h defines buttons, but SDL's headers use that symbol. #undef buttons #endif -#include -#include -#include -#include -#include -#include -#include - static struct termios Linux_initial_terminal_settings; bool oeLnxApplication::os_initialized = false; bool oeLnxApplication::first_time = true; bool con_Create(int flags); -void con_Destroy(void); -void con_Defer(void); +void con_Destroy(); +void con_Defer(); void GlobalFree(void *mptr) { if (mptr) @@ -109,17 +97,17 @@ void GlobalFree(void *mptr) { void *GlobalAlloc(int flags, int size) { if (size <= 0) - return NULL; + return nullptr; return malloc(size); } void *GlobalLock(HGLOBAL hMem) { return hMem; } void Sleep(int millis) { - struct timeval tv; + struct timeval tv{}; tv.tv_sec = 0; tv.tv_usec = millis * 1000; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); } char *strupr(char *string) { @@ -130,23 +118,12 @@ char *strupr(char *string) { return string; } -char *itoa(int value, char *string, int radix) { - if (radix == 10) { - sprintf(string, "%d", value); - } else if (radix == 16) { - sprintf(string, "%x", value); - } else { - mprintf((0, "!!!!!!!!!!!!!!!WARNING CALLING itoa WITHOUT 10 or 16 RADIX!!!!!!!!!!!!!!!!!!!!!!\n")); - sprintf(string, "%d", value); - } - return string; -} - static unsigned int LinuxAppFlags = 0; // static Display *LinuxAppDisplay=NULL; static bool LinuxAppSetAtExit = false; static bool LinuxAppDontCallShutdown = false; -void LnxAppShutdown(void) { + +void LnxAppShutdown() { if (LinuxAppDontCallShutdown) return; LinuxAppDontCallShutdown = true; @@ -240,7 +217,7 @@ void oeLnxApplication::delay(float secs) { } // Function to get the flags -int oeLnxApplication::flags(void) const { return m_Flags; } +int oeLnxApplication::flags() const { return m_Flags; } // Sizes the displayable region of the app (the window) void oeLnxApplication::set_sizepos(int x, int y, int w, int h) { diff --git a/lib/linux/lnxapp.h b/linux/lnxapp.h similarity index 100% rename from lib/linux/lnxapp.h rename to linux/lnxapp.h diff --git a/lnxcontroller/lnxcontroller.cpp b/linux/lnxcontroller.cpp similarity index 99% rename from lnxcontroller/lnxcontroller.cpp rename to linux/lnxcontroller.cpp index 51d0137b..71c731cd 100644 --- a/lnxcontroller/lnxcontroller.cpp +++ b/linux/lnxcontroller.cpp @@ -41,13 +41,13 @@ * $NoKeywords: $ */ +#include #include "Controller.h" -#include -#include #include "ddio.h" #include "pserror.h" #include "joystick.h" #include "inffile.h" +#include "lnxcontroller.h" // Sorry! This is needed for the semi-hacky mouselook support #include "descent.h" diff --git a/lib/linux/lnxcontroller.h b/linux/lnxcontroller.h similarity index 100% rename from lib/linux/lnxcontroller.h rename to linux/lnxcontroller.h diff --git a/lnxcontroller/CMakeLists.txt b/lnxcontroller/CMakeLists.txt deleted file mode 100644 index 912ba4e6..00000000 --- a/lnxcontroller/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(HEADERS) -set(CPPS lnxcontroller.cpp) - -add_library(lnxcontroller STATIC ${HEADERS} ${CPPS}) -target_link_libraries(lnxcontroller PRIVATE - cfile -) diff --git a/manage/manage.cpp b/manage/manage.cpp index 3927833a..0a7ee429 100644 --- a/manage/manage.cpp +++ b/manage/manage.cpp @@ -441,7 +441,7 @@ #include #include #if defined(__LINUX__) -#include "linux/linux_fix.h" +#include "linux_fix.h" #endif #include "descent.h" #include "manage.h" diff --git a/module/module.cpp b/module/module.cpp index be0284cc..e9c59d67 100644 --- a/module/module.cpp +++ b/module/module.cpp @@ -109,7 +109,7 @@ static bool mod_FindRealFileNameCaseInsenstive(const char *directory, const char #include #include #if defined(__LINUX__) -#include "linux/linux_fix.h" +#include "linux_fix.h" #endif #if defined(WIN32) // INSTEAD OF MAKING MODULE HAVE DEPENDENCIES, PUT THE 2 DDIO FUNCTIONS I NEED HERE // Split a pathname into its component parts diff --git a/netcon/includes/con_dll.h b/netcon/includes/con_dll.h index bf36edc3..2f37f046 100644 --- a/netcon/includes/con_dll.h +++ b/netcon/includes/con_dll.h @@ -269,7 +269,7 @@ #ifdef __LINUX__ #include -#include "linux/linux_fix.h" +#include "linux_fix.h" #endif // Uncomment out this line of code to build the demo version of the multiplayer connection dlls diff --git a/netcon/includes/inetgetfile.h b/netcon/includes/inetgetfile.h index bae0d231..0d285b06 100644 --- a/netcon/includes/inetgetfile.h +++ b/netcon/includes/inetgetfile.h @@ -98,7 +98,7 @@ #include #include -#include "linux/linux_fix.h" +#include "linux_fix.h" // Linux includes/defines #if !MACOSX diff --git a/renderer/HardwareOpenGL.cpp b/renderer/HardwareOpenGL.cpp index 56fc968e..939bb839 100644 --- a/renderer/HardwareOpenGL.cpp +++ b/renderer/HardwareOpenGL.cpp @@ -20,18 +20,14 @@ #if defined(WIN32) #include #elif defined(__LINUX__) -#include "linux/linux_fix.h" #include "lnxscreenmode.h" #else #endif -#include "pstypes.h" #include "pserror.h" #include "mono.h" #include "3d.h" #include "renderer.h" -#include "ddvid.h" -#include "ddio.h" #include "application.h" #include "bitmap.h" #include "lightmap.h" diff --git a/scripts/DallasFuncs.cpp b/scripts/DallasFuncs.cpp index 20f80232..06c6a935 100644 --- a/scripts/DallasFuncs.cpp +++ b/scripts/DallasFuncs.cpp @@ -1217,14 +1217,11 @@ Parameters: $$END */ void aShowHUDMessage(const char *format, ...) { -#if defined(__LINUX__) -#define _vsnprintf vsnprintf -#endif msafe_struct mstruct; va_list args; va_start(args, format); - _vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); + vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); va_end(args); mstruct.message[sizeof(mstruct.message) - 1] = 0; // if message too long, vsnprintf() won't terminate @@ -1252,7 +1249,7 @@ void aShowHUDMessageObj(const char *format, int objhandle, ...) { va_list args; va_start(args, objhandle); - _vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); + vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); va_end(args); mstruct.message[sizeof(mstruct.message) - 1] = 0; // if message too long, vsnprintf() won't terminate @@ -1283,7 +1280,7 @@ void aShowColoredHUDMessage(int red, int green, int blue, const char *format, .. va_list args; va_start(args, format); - _vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); + vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); va_end(args); mstruct.message[sizeof(mstruct.message) - 1] = 0; // if message too long, vsnprintf() won't terminate @@ -1314,7 +1311,7 @@ void aShowColoredHUDMessageObj(int red, int green, int blue, const char *format, va_list args; va_start(args, objhandle); - _vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); + vsnprintf(mstruct.message, sizeof(mstruct.message) - 1, format, args); va_end(args); mstruct.message[sizeof(mstruct.message) - 1] = 0; // if message too long, vsnprintf() won't terminate diff --git a/scripts/linux_lib.cpp b/scripts/linux_lib.cpp index 5f74da67..7db347c7 100644 --- a/scripts/linux_lib.cpp +++ b/scripts/linux_lib.cpp @@ -16,14 +16,7 @@ * along with this program. If not, see . */ -#include -#include -#include -#include - -void _splitpath(const char *path, char *drive, char *dir, char *fname, char *ext); -int _vsnprintf(char *buffer, size_t count, const char *format, va_list argptr); -int stricmp(const char *string1, const char *string2); +#include void _splitpath(const char *srcPath, char *drive, char *path, char *filename, char *ext) { int pathStart = -1; @@ -103,8 +96,4 @@ void _splitpath(const char *srcPath, char *drive, char *path, char *filename, ch } } -int _vsnprintf(char *buffer, size_t count, const char *format, va_list argptr) { - return vsnprintf(buffer, count, format, argptr); -} - int stricmp(const char *string1, const char *string2) { return strcasecmp(string1, string2); } \ No newline at end of file diff --git a/scripts/linux_lib.h b/scripts/linux_lib.h index 39248cee..3afa74fe 100644 --- a/scripts/linux_lib.h +++ b/scripts/linux_lib.h @@ -19,12 +19,11 @@ #ifndef __LINUX_LIB_H_ #define __LINUX_LIB_H_ -#include -#include -#include +#include +#include +#include void _splitpath(const char *path, char *drive, char *dir, char *fname, char *ext); -int _vsnprintf(char *buffer, size_t count, const char *format, va_list argptr); int stricmp(const char *string1, const char *string2); #endif diff --git a/scripts/osiris_import.h b/scripts/osiris_import.h index 1a28e3ea..33eacb47 100644 --- a/scripts/osiris_import.h +++ b/scripts/osiris_import.h @@ -25,13 +25,7 @@ #include "osiris_common.h" #ifdef __LINUX__ -#ifndef MACOSX -// typedef unsigned int size_t; -#endif -#include -void _splitpath(const char *path, char *drive, char *dir, char *fname, char *ext); -int _vsnprintf(char *buffer, size_t count, const char *format, va_list argptr); -int stricmp(const char *string1, const char *string2); +#include "linux_lib.h" #endif // =========================================================== diff --git a/ui/UIEdit.cpp b/ui/UIEdit.cpp index acfdb05a..783590ef 100644 --- a/ui/UIEdit.cpp +++ b/ui/UIEdit.cpp @@ -132,13 +132,15 @@ * $NoKeywords: $ */ +#include +#include +#include + #include "UIlib.h" #include "grtext.h" #include "Macros.h" #include "mem.h" -#include -#include static UIEdit *UI_current_editbox = NULL; @@ -203,7 +205,7 @@ void UIEdit::SetText(const char *text) { if (CHECK_FLAG(m_Flags, UIED_NUMBERS)) { int num = atoi(text); - itoa(num, m_TextBuf, 10); + sprintf(m_TextBuf, "%d", num); } else { strcpy(m_TextBuf, text); }