Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into rulesify

# Conflicts:
#	src/k_boss.h
#	src/k_specialstage.h
#	src/y_inter.h
This commit is contained in:
toaster 2023-01-01 16:02:05 +00:00
commit a020ea86c8
162 changed files with 2763 additions and 6 deletions

54
.clang-format Normal file
View file

@ -0,0 +1,54 @@
---
Language: Cpp
Standard: c++17
IndentWidth: 4
UseTab: Always
TabWidth: 4
ColumnLimit: 120
AccessModifierOffset: -4
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach # K&R/OTBS, braces on same line, Java style
BreakConstructorInitializers: BeforeComma
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
Cpp11BracedListStyle: true
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
FixNamespaceComments: true
IndentCaseBlocks: true
IndentCaseLabels: false
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
PointerAlignment: Left # Pointer and reference marker is an integral part of type ID
ReferenceAlignment: Left
ReflowComments: true
SortIncludes: CaseInsensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

43
.editorconfig Normal file
View file

@ -0,0 +1,43 @@
root = true
[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
[.editorconfig]
indent_size = 4
indent_style = tab
tab_width = 4
[src/**.{c,h,cpp,hpp}]
indent_style = tab
indent_size = 4
tab_width = 4
[{CMakeLists.txt,*.cmake}]
indent_size = 4
indent_style = tab
tab_width = 4
[{Makefile,*.mk}]
indent_size = 8
indent_style = tab
tab_width = 8
[*{.yml,.yaml}]
indent_size = 2
indent_style = space
tab_width = 8
[*.sh]
indent_size = 4
indent_style = tab
tab_width = 4
end_of_line = lf
[*.bat]
indent_size = 4
indent_style = tab
tab_width = 4
end_of_line = crlf

View file

@ -10,4 +10,4 @@ git_current_branch(SRB2_COMP_BRANCH)
git_summary(SRB2_COMP_REVISION) git_summary(SRB2_COMP_REVISION)
git_working_tree_dirty(SRB2_COMP_UNCOMMITTED) git_working_tree_dirty(SRB2_COMP_UNCOMMITTED)
configure_file(src/config.h.in src/config.h) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/config.h")

View file

@ -1,5 +1,6 @@
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
comptime.c comptime.c
cxxutil.hpp
md5.c md5.c
config.h.in config.h.in
string.c string.c
@ -146,7 +147,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
add_custom_command( add_custom_command(
TARGET SRB2SDL2 TARGET SRB2SDL2
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_BINARY_DIR}/comptime.c COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/comptime.c
) )
# config.h is generated by this command. It should be done at # config.h is generated by this command. It should be done at
@ -224,6 +225,8 @@ target_link_libraries(SRB2SDL2 PRIVATE DiscordRPC::DiscordRPC)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_DISCORDRPC -DUSE_STUN) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_DISCORDRPC -DUSE_STUN)
target_sources(SRB2SDL2 PRIVATE discord.c stun.c) target_sources(SRB2SDL2 PRIVATE discord.c stun.c)
target_link_libraries(SRB2SDL2 PRIVATE tcbrindle::span)
set(SRB2_HAVE_THREADS ON) set(SRB2_HAVE_THREADS ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
@ -535,6 +538,7 @@ if(SRB2_CONFIG_PROFILEMODE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
target_link_options(SRB2SDL2 PRIVATE -pg) target_link_options(SRB2SDL2 PRIVATE -pg)
endif() endif()
add_subdirectory(io)
add_subdirectory(sdl) add_subdirectory(sdl)
add_subdirectory(objects) add_subdirectory(objects)
add_subdirectory(tests) add_subdirectory(tests)

View file

@ -16,6 +16,10 @@
#include "d_event.h" #include "d_event.h"
#ifdef __cplusplus
extern "C" {
#endif
struct fpoint_t struct fpoint_t
{ {
INT32 x, y; INT32 x, y;
@ -44,4 +48,8 @@ void AM_Start(void);
// Called to force the automap to quit if the level is completed while it is up. // Called to force the automap to quit if the level is completed while it is up.
void AM_Stop(void); void AM_Stop(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -3,10 +3,18 @@
#include <jni.h> #include <jni.h>
#ifdef __cplusplus
extern "C" {
#endif
UINT8 *android_surface; UINT8 *android_surface;
JNIEnv* jni_env; JNIEnv* jni_env;
jobject androidVideo; jobject androidVideo;
jmethodID videoFrameCB; jmethodID videoFrameCB;
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <png.h> #include <png.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct apng_info_def apng_info; typedef struct apng_info_def apng_info;
typedef apng_info * apng_infop; typedef apng_info * apng_infop;
typedef const apng_info * apng_const_infop; typedef const apng_info * apng_const_infop;
@ -77,4 +81,8 @@ void apng_set_write_fn (png_structp png_ptr, apng_infop ainfo_ptr,
void apng_set_set_acTL_fn (png_structp png_ptr, apng_infop ainfo_ptr, void apng_set_set_acTL_fn (png_structp png_ptr, apng_infop ainfo_ptr,
apng_set_acTL_ptr set_acTL_fn); apng_set_acTL_ptr set_acTL_fn);
#ifdef __cplusplus
} // extern "C"
#endif
#endif/* APNG_H */ #endif/* APNG_H */

View file

@ -11,12 +11,19 @@
/// \brief Macros to read/write from/to a UINT8 *, /// \brief Macros to read/write from/to a UINT8 *,
/// used for packet creation and such /// used for packet creation and such
#ifndef __BYTEPTR_H__
#define __BYTEPTR_H__
#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__) #if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__)
#define DEALIGNED #define DEALIGNED
#endif #endif
#include "endian.h" #include "endian.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SRB2_BIG_ENDIAN #ifndef SRB2_BIG_ENDIAN
// //
// Little-endian machines // Little-endian machines
@ -214,3 +221,9 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
memcpy(s, p, n); \ memcpy(s, p, n); \
p += n; \ p += n; \
} while (0) } while (0)
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __BYTEPTR_H__

View file

@ -16,6 +16,10 @@
#include <stdio.h> #include <stdio.h>
#include "doomdef.h" #include "doomdef.h"
#ifdef __cplusplus
extern "C" {
#endif
//=================================== //===================================
// Command buffer & command execution // Command buffer & command execution
//=================================== //===================================
@ -238,4 +242,8 @@ void CV_CheaterWarning(UINT8 playerID, const char *command);
// Returns cvar by name. Exposed here for Lua. // Returns cvar by name. Exposed here for Lua.
consvar_t *CV_FindVar(const char *name); consvar_t *CV_FindVar(const char *name);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __COMMAND_H__ #endif // __COMMAND_H__

View file

@ -10,10 +10,17 @@
/// \file console.h /// \file console.h
/// \brief Console drawing and input /// \brief Console drawing and input
#ifndef __CONSOLE_H__
#define __CONSOLE_H__
#include "d_event.h" #include "d_event.h"
#include "command.h" #include "command.h"
#include "i_threads.h" #include "i_threads.h"
#ifdef __cplusplus
extern "C" {
#endif
void CON_Init(void); void CON_Init(void);
boolean CON_Responder(event_t *ev); boolean CON_Responder(event_t *ev);
@ -89,3 +96,9 @@ void CON_LogMessage(const char *msg);
// Startup loading bar // Startup loading bar
void CON_SetLoadingProgress(con_loadprogress_t newStep); void CON_SetLoadingProgress(con_loadprogress_t newStep);
void CON_DrawLoadBar(void); void CON_DrawLoadBar(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __CONSOLE_H__

View file

@ -23,6 +23,10 @@
#include "k_pwrlv.h" // PWRLV_NUMTYPES #include "k_pwrlv.h" // PWRLV_NUMTYPES
#ifdef __cplusplus
extern "C" {
#endif
/* /*
The 'packet version' is used to distinguish packet formats. The 'packet version' is used to distinguish packet formats.
This version is independent of VERSION and SUBVERSION. Different This version is independent of VERSION and SUBVERSION. Different
@ -544,4 +548,8 @@ void CL_ClearRewinds(void);
rewind_t *CL_SaveRewindPoint(size_t demopos); rewind_t *CL_SaveRewindPoint(size_t demopos);
rewind_t *CL_RewindToTime(tic_t time); rewind_t *CL_RewindToTime(tic_t time);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "doomtype.h" #include "doomtype.h"
#include "g_state.h" #include "g_state.h"
#ifdef __cplusplus
extern "C" {
#endif
// Input event types. // Input event types.
typedef enum typedef enum
{ {
@ -45,4 +49,8 @@ struct event_t
extern event_t events[MAXEVENTS]; extern event_t events[MAXEVENTS];
extern INT32 eventhead, eventtail; extern INT32 eventhead, eventtail;
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "d_event.h" #include "d_event.h"
#include "w_wad.h" // for MAX_WADFILES #include "w_wad.h" // for MAX_WADFILES
#ifdef __cplusplus
extern "C" {
#endif
// make sure not to write back the config until it's been correctly loaded // make sure not to write back the config until it's been correctly loaded
extern tic_t rendergametic; extern tic_t rendergametic;
@ -52,4 +56,8 @@ const char *D_Home(void);
// //
void D_StartTitle(void); void D_StartTitle(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__D_MAIN__ #endif //__D_MAIN__

View file

@ -18,6 +18,10 @@
#ifndef __D_NET__ #ifndef __D_NET__
#define __D_NET__ #define __D_NET__
#ifdef __cplusplus
extern "C" {
#endif
// Max computers in a game // Max computers in a game
// 127 is probably as high as this can go, because // 127 is probably as high as this can go, because
// SINT8 is used for nodes sometimes >:( // SINT8 is used for nodes sometimes >:(
@ -64,4 +68,8 @@ void Net_AbortPacketType(UINT8 packettype);
void Net_SendAcks(INT32 node); void Net_SendAcks(INT32 node);
void Net_WaitAllAckReceived(UINT32 timeout); void Net_WaitAllAckReceived(UINT32 timeout);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "command.h" #include "command.h"
#include "d_player.h" #include "d_player.h"
#ifdef __cplusplus
extern "C" {
#endif
// console vars // console vars
extern consvar_t cv_playername[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_playername[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_playercolor[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_playercolor[MAXSPLITSCREENPLAYERS];
@ -277,4 +281,8 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...);
UINT8 CanChangeSkin(INT32 playernum); UINT8 CanChangeSkin(INT32 playernum);
boolean CanChangeSkinWhilePlaying(INT32 playernum); boolean CanChangeSkinWhilePlaying(INT32 playernum);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "d_clisrv.h" #include "d_clisrv.h"
#include "w_wad.h" #include "w_wad.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum typedef enum
{ {
SF_FILE, SF_FILE,
@ -162,4 +166,8 @@ void CURLGetFile(void);
HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next); HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next);
#endif #endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __D_NETFIL__ #endif // __D_NETFIL__

View file

@ -32,6 +32,10 @@
// the player struct stores a waypoint for racing // the player struct stores a waypoint for racing
#include "k_waypoint.h" #include "k_waypoint.h"
#ifdef __cplusplus
extern "C" {
#endif
// Extra abilities/settings for skins (combinable stuff) // Extra abilities/settings for skins (combinable stuff)
typedef enum typedef enum
{ {
@ -657,4 +661,8 @@ struct player_t
#endif #endif
}; };
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#ifndef __D_THINK__ #ifndef __D_THINK__
#define __D_THINK__ #define __D_THINK__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
@ -51,4 +55,8 @@ struct thinker_t
INT32 references; INT32 references;
}; };
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "m_fixed.h" #include "m_fixed.h"
#include "doomtype.h" #include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
@ -78,4 +82,8 @@ struct ticcmd_t
#pragma pack() #pragma pack()
#endif #endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -13,9 +13,17 @@
#ifndef __DEH_LUA_H__ #ifndef __DEH_LUA_H__
#define __DEH_LUA_H__ #define __DEH_LUA_H__
#ifdef __cplusplus
extern "C" {
#endif
boolean LUA_SetLuaAction(void *state, const char *actiontocompare); boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
const char *LUA_GetActionName(void *action); const char *LUA_GetActionName(void *action);
void LUA_SetActionByName(void *state, const char *actiontocompare); void LUA_SetActionByName(void *state, const char *actiontocompare);
size_t LUA_GetActionNumByName(const char *actiontocompare); size_t LUA_GetActionNumByName(const char *actiontocompare);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -45,6 +45,10 @@
#include "dehacked.h" #include "dehacked.h"
#include "doomdef.h" // HWRENDER #include "doomdef.h" // HWRENDER
#ifdef __cplusplus
extern "C" {
#endif
// Crazy word-reading stuff // Crazy word-reading stuff
/// \todo Put these in a seperate file or something. /// \todo Put these in a seperate file or something.
mobjtype_t get_mobjtype(const char *word); mobjtype_t get_mobjtype(const char *word);
@ -87,4 +91,8 @@ void readfollowercategory(MYFILE *f);
preciptype_t get_precip(const char *word); preciptype_t get_precip(const char *word);
void readweather(MYFILE *f, INT32 num); void readweather(MYFILE *f, INT32 num);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "info.h" // Mobj, state, sprite, etc constants #include "info.h" // Mobj, state, sprite, etc constants
#include "lua_script.h" #include "lua_script.h"
#ifdef __cplusplus
extern "C" {
#endif
// Free slot names // Free slot names
// The crazy word-reading stuff uses these. // The crazy word-reading stuff uses these.
extern char *FREE_STATES[NUMSTATEFREESLOTS]; extern char *FREE_STATES[NUMSTATEFREESLOTS];
@ -78,4 +82,8 @@ extern struct int_const_s const INT_CONST[];
// Moved to this file because it can't work compile-time otherwise // Moved to this file because it can't work compile-time otherwise
void DEH_TableCheck(void); void DEH_TableCheck(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -15,6 +15,10 @@
#include "m_fixed.h" // for get_number #include "m_fixed.h" // for get_number
#ifdef __cplusplus
extern "C" {
#endif
typedef enum typedef enum
{ {
UNDO_NONE = 0x00, UNDO_NONE = 0x00,
@ -69,5 +73,8 @@ char *myfgets(char *buf, size_t bufsize, MYFILE *f);
char *myhashfgets(char *buf, size_t bufsize, MYFILE *f); char *myhashfgets(char *buf, size_t bufsize, MYFILE *f);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include <discord_rpc.h> #include <discord_rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern consvar_t cv_discordrp; extern consvar_t cv_discordrp;
extern consvar_t cv_discordstreamer; extern consvar_t cv_discordstreamer;
extern consvar_t cv_discordasks; extern consvar_t cv_discordasks;
@ -77,4 +81,8 @@ void DRPC_UpdatePresence(void);
#endif // HAVE_DISCORDRPC #endif // HAVE_DISCORDRPC
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __DISCORD__ #endif // __DISCORD__

View file

@ -26,6 +26,10 @@
#include "taglist.h" #include "taglist.h"
#include "m_fixed.h" // See the mapthing_t scale. #include "m_fixed.h" // See the mapthing_t scale.
#ifdef __cplusplus
extern "C" {
#endif
// //
// Map level types. // Map level types.
// The following data structures define the persistent format // The following data structures define the persistent format
@ -234,4 +238,8 @@ enum
CEILING_SLOPE_THING = 778, CEILING_SLOPE_THING = 778,
}; };
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __DOOMDATA__ #endif // __DOOMDATA__

View file

@ -97,6 +97,10 @@
#include <io.h> #include <io.h>
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
//#define NOMD5 //#define NOMD5
// Uncheck this to compile debugging code // Uncheck this to compile debugging code
@ -746,4 +750,8 @@ extern int compuncommitted;
/// Other karma comeback modes /// Other karma comeback modes
//#define OTHERKARMAMODES //#define OTHERKARMAMODES
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __DOOMDEF__ #endif // __DOOMDEF__

View file

@ -28,6 +28,10 @@
// For lumpnum_t. // For lumpnum_t.
#include "w_wad.h" #include "w_wad.h"
#ifdef __cplusplus
extern "C" {
#endif
// ============================= // =============================
// Selected map etc. // Selected map etc.
// ============================= // =============================
@ -771,4 +775,8 @@ extern INT32 adminplayers[MAXPLAYERS];
/// \note put these in d_clisrv outright? /// \note put these in d_clisrv outright?
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__DOOMSTAT__ #endif //__DOOMSTAT__

View file

@ -19,6 +19,10 @@
#include "d_event.h" #include "d_event.h"
#include "p_mobj.h" #include "p_mobj.h"
#ifdef __cplusplus
extern "C" {
#endif
// //
// FINALE // FINALE
// //
@ -196,4 +200,8 @@ enum
extern UINT8 wipedefs[NUMWIPEDEFS]; extern UINT8 wipedefs[NUMWIPEDEFS];
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -1,6 +1,10 @@
#ifndef __FASTCMP_H__ #ifndef __FASTCMP_H__
#define __FASTCMP_H__ #define __FASTCMP_H__
#ifdef __cplusplus
extern "C" {
#endif
// returns false if s != c // returns false if s != c
// returns true if s == c // returns true if s == c
FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c) FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c)
@ -24,4 +28,8 @@ FUNCINLINE static ATTRINLINE boolean fastncmp(const char *s, const char *c, UINT
return !l; // make sure you reached the end return !l; // make sure you reached the end
} }
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -8,6 +8,10 @@
#include "d_netfil.h" #include "d_netfil.h"
#include "k_menu.h" // MAXSTRINGLENGTH #include "k_menu.h" // MAXSTRINGLENGTH
#ifdef __cplusplus
extern "C" {
#endif
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type; extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
/** \brief The filesearch function /** \brief The filesearch function
@ -93,4 +97,8 @@ void closefilemenu(boolean validsize);
void searchfilemenu(char *tempname); void searchfilemenu(char *tempname);
boolean preparefilemenu(boolean samedepth, boolean replayhut); boolean preparefilemenu(boolean samedepth, boolean replayhut);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __FILESRCH_H__ #endif // __FILESRCH_H__

View file

@ -13,6 +13,10 @@
#ifndef __FONT_H__ #ifndef __FONT_H__
#define __FONT_H__ #define __FONT_H__
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_FONTS 32 #define MAX_FONTS 32
struct font_t struct font_t
@ -44,4 +48,8 @@ Register a new font, but do not load it yet.
*/ */
int Font_DumbRegister (const font_t *); int Font_DumbRegister (const font_t *);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "doomstat.h" #include "doomstat.h"
#include "d_event.h" #include "d_event.h"
#ifdef __cplusplus
extern "C" {
#endif
extern UINT8 *demo_p; extern UINT8 *demo_p;
// ====================================== // ======================================
@ -203,4 +207,8 @@ boolean G_DemoTitleResponder(event_t *ev);
boolean G_CheckDemoTitleEntry(void); boolean G_CheckDemoTitleEntry(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __G_DEMO__ #endif // __G_DEMO__

View file

@ -20,6 +20,10 @@
#include "g_demo.h" #include "g_demo.h"
#include "m_cheat.h" // objectplacing #include "m_cheat.h" // objectplacing
#ifdef __cplusplus
extern "C" {
#endif
extern char gamedatafilename[64]; extern char gamedatafilename[64];
extern char timeattackfolder[64]; extern char timeattackfolder[64];
extern char customversionstring[32]; extern char customversionstring[32];
@ -255,4 +259,8 @@ INT16 G_GetFirstMapOfGametype(UINT8 pgametype);
INT16 G_RandMap(UINT32 tolflags, INT16 pprevmap, UINT8 ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer); INT16 G_RandMap(UINT32 tolflags, INT16 pprevmap, UINT8 ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer);
void G_AddMapToBuffer(INT16 map); void G_AddMapToBuffer(INT16 map);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "keys.h" #include "keys.h"
#include "command.h" #include "command.h"
#ifdef __cplusplus
extern "C" {
#endif
// number of total 'button' inputs, include keyboard keys, plus virtual // number of total 'button' inputs, include keyboard keys, plus virtual
// keys (mousebuttons and joybuttons becomes keys) // keys (mousebuttons and joybuttons becomes keys)
#define NUMKEYS 256 #define NUMKEYS 256
@ -156,4 +160,8 @@ void G_CopyControls(INT32 (*setupcontrols)[MAXINPUTMAPPING], INT32 (*fromcontrol
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[MAXINPUTMAPPING], INT32 (*fromcontrolsb)[MAXINPUTMAPPING], INT32 (*fromcontrolsc)[MAXINPUTMAPPING], INT32 (*fromcontrolsd)[MAXINPUTMAPPING]); void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[MAXINPUTMAPPING], INT32 (*fromcontrolsb)[MAXINPUTMAPPING], INT32 (*fromcontrolsc)[MAXINPUTMAPPING], INT32 (*fromcontrolsd)[MAXINPUTMAPPING]);
INT32 G_CheckDoubleUsage(INT32 keynum, INT32 playernum, boolean modify); INT32 G_CheckDoubleUsage(INT32 keynum, INT32 playernum, boolean modify);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -15,6 +15,10 @@
#include "doomtype.h" #include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
// the current state of the game // the current state of the game
typedef enum typedef enum
{ {
@ -58,4 +62,8 @@ extern UINT8 titlemapinaction;
extern UINT8 ultimatemode; // was sk_insane extern UINT8 ultimatemode; // was sk_insane
extern gameaction_t gameaction; extern gameaction_t gameaction;
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__G_STATE__ #endif //__G_STATE__

View file

@ -16,6 +16,10 @@
#include "hw_dll.h" #include "hw_dll.h"
#include "hws_data.h" #include "hws_data.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined (HAVE_SDL) || !defined (HWD) #if defined (HAVE_SDL) || !defined (HWD)
EXPORT void HWRAPI(Shutdown) (void); EXPORT void HWRAPI(Shutdown) (void);
#endif #endif
@ -74,4 +78,8 @@ extern struct hardware3ds_s hw3ds_driver;
#endif // _CREATE_DLL_ #endif // _CREATE_DLL_
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __HW_3DS_DRV_H__ #endif // __HW_3DS_DRV_H__

View file

@ -17,6 +17,10 @@
//#include "../s_sound.h" //#include "../s_sound.h"
//#include "../p_mobj.h" //#include "../p_mobj.h"
#ifdef __cplusplus
extern "C" {
#endif
// Default sound mode (original stereo mode) // Default sound mode (original stereo mode)
enum enum
{ {
@ -95,4 +99,8 @@ void HW3S_FreeSfx(sfxinfo_t *sfx);
INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source,
INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo); INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __HW3_SOUND_H__ #endif // __HW3_SOUND_H__

View file

@ -16,6 +16,10 @@
#include "hw_data.h" #include "hw_data.h"
#include "hw_drv.h" #include "hw_drv.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct typedef struct
{ {
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
@ -33,4 +37,8 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture);
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial); void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial);
void HWR_RenderBatches(void); void HWR_RenderBatches(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -7,11 +7,18 @@
* *
*/ */
#ifndef __HARDWARE_HW_CLIP_H__
#define __HARDWARE_HW_CLIP_H__
// OpenGL BSP clipping // OpenGL BSP clipping
#include "../doomdef.h" #include "../doomdef.h"
#include "../tables.h" #include "../tables.h"
#include "../doomtype.h" #include "../doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
//#define HAVE_SPHEREFRUSTRUM // enable if you want gld_SphereInFrustum and related code //#define HAVE_SPHEREFRUSTRUM // enable if you want gld_SphereInFrustum and related code
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle); boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
@ -22,3 +29,9 @@ angle_t gld_FrustumAngle(angle_t tiltangle);
void gld_FrustrumSetup(void); void gld_FrustrumSetup(void);
boolean gld_SphereInFrustum(float x, float y, float z, float radius); boolean gld_SphereInFrustum(float x, float y, float z, float radius);
#endif #endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __HARDWARE_HW_CLIP_H__

View file

@ -22,6 +22,10 @@
#include "../doomdef.h" #include "../doomdef.h"
#include "../screen.h" #include "../screen.h"
#ifdef __cplusplus
extern "C" {
#endif
// ========================================================================== // ==========================================================================
// TEXTURE INFO // TEXTURE INFO
// ========================================================================== // ==========================================================================
@ -86,4 +90,8 @@ struct GLPatch_s
}; };
typedef struct GLPatch_s GLPatch_t; typedef struct GLPatch_s GLPatch_t;
#ifdef __cplusplus
} // extern "C"
#endif
#endif //_HWR_DATA_ #endif //_HWR_DATA_

View file

@ -15,6 +15,10 @@
#include "../doomtype.h" #include "../doomtype.h"
#include "../r_defs.h" #include "../r_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing #define ZCLIP_PLANE 4.0f // Used for the actual game drawing
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures #define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
@ -330,4 +334,8 @@ enum hwdfiltermode
HWD_SET_TEXTUREFILTER_MIXED3, HWD_SET_TEXTUREFILTER_MIXED3,
}; };
#ifdef __cplusplus
} // extern "C"
#endif
#endif //_HWR_DEFS_ #endif //_HWR_DEFS_

View file

@ -12,6 +12,10 @@
#ifndef __HWR_DLL_H__ #ifndef __HWR_DLL_H__
#define __HWR_DLL_H__ #define __HWR_DLL_H__
#ifdef __cplusplus
extern "C" {
#endif
// Function declaration for exports from the DLL : // Function declaration for exports from the DLL :
// EXPORT <return-type> HWRAPI(<function-name>) (<arguments>); // EXPORT <return-type> HWRAPI(<function-name>) (<arguments>);
// If _CREATE_DLL_ is defined the above declaration translates to : // If _CREATE_DLL_ is defined the above declaration translates to :
@ -56,4 +60,8 @@ void _init();
void _fini(); void _fini();
#endif #endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -21,6 +21,10 @@
#include "hw_dll.h" #include "hw_dll.h"
#ifdef __cplusplus
extern "C" {
#endif
// ========================================================================== // ==========================================================================
// STANDARD DLL EXPORTS // STANDARD DLL EXPORTS
// ========================================================================== // ==========================================================================
@ -129,4 +133,8 @@ extern struct hwdriver_s hwdriver;
#endif //not defined _CREATE_DLL_ #endif //not defined _CREATE_DLL_
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__HWR_DRV_H__ #endif //__HWR_DRV_H__

View file

@ -19,6 +19,10 @@
#include "../r_defs.h" #include "../r_defs.h"
#include "../p_setup.h" #include "../p_setup.h"
#ifdef __cplusplus
extern "C" {
#endif
// the original aspect ratio of Doom graphics isn't square // the original aspect ratio of Doom graphics isn't square
#define ORIGINAL_ASPECT (320.0f/200.0f) #define ORIGINAL_ASPECT (320.0f/200.0f)
@ -143,4 +147,8 @@ void HWR_SetPalette(RGBA_t *palette);
extern INT32 patchformat; extern INT32 patchformat;
extern INT32 textureformat; extern INT32 textureformat;
#ifdef __cplusplus
} // extern "C"
#endif
#endif //_HW_GLOB_ #endif //_HW_GLOB_

View file

@ -16,6 +16,10 @@
#include "hw_glob.h" #include "hw_glob.h"
#include "hw_defs.h" #include "hw_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
#define NUMLIGHTFREESLOTS 32 // Free light slots (for SOCs) #define NUMLIGHTFREESLOTS 32 // Free light slots (for SOCs)
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
@ -91,4 +95,9 @@ typedef enum
extern light_t lspr[NUMLIGHTS]; extern light_t lspr[NUMLIGHTS];
extern light_t *t_lspr[NUMSPRITES]; extern light_t *t_lspr[NUMSPRITES];
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -20,6 +20,10 @@
#include "../d_player.h" #include "../d_player.h"
#include "../r_defs.h" #include "../r_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
// Startup & Shutdown the hardware mode renderer // Startup & Shutdown the hardware mode renderer
void HWR_Startup(void); void HWR_Startup(void);
void HWR_Switch(void); void HWR_Switch(void);
@ -150,4 +154,8 @@ extern boolean gl_maptexturesloaded;
extern boolean gl_sessioncommandsadded; extern boolean gl_sessioncommandsadded;
extern boolean gl_shadersavailable; extern boolean gl_shadersavailable;
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "hw_glob.h" #include "hw_glob.h"
#include "hw_model.h" #include "hw_model.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack() #pragma pack()
#endif #endif
@ -46,4 +50,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr);
#define PLAYERMODELPREFIX "PLAYER" #define PLAYERMODELPREFIX "PLAYER"
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _HW_MD2_H_ #endif // _HW_MD2_H_

View file

@ -13,7 +13,15 @@
#include "hw_model.h" #include "hw_model.h"
#include "../doomtype.h" #include "../doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
// Load the Model // Load the Model
model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat); model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -13,7 +13,15 @@
#include "hw_model.h" #include "hw_model.h"
#include "../doomtype.h" #include "../doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
// Load the Model // Load the Model
model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat); model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -12,6 +12,10 @@
#include "../doomtype.h" #include "../doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct typedef struct
{ {
float x, y, z; float x, y, z;
@ -132,4 +136,8 @@ void CreateVBOTiny(mesh_t *mesh, tinyframe_t *frame);
void CreateVBO(mesh_t *mesh, mdlframe_t *frame); void CreateVBO(mesh_t *mesh, mdlframe_t *frame);
void DeleteVBOs(model_t *model); void DeleteVBOs(model_t *model);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -12,6 +12,10 @@
#ifndef __HWS_DATA_H__ #ifndef __HWS_DATA_H__
#define __HWS_DATA_H__ #define __HWS_DATA_H__
#ifdef __cplusplus
extern "C" {
#endif
#define NORMAL_SEP 128 #define NORMAL_SEP 128
// abuse? // abuse?
@ -113,4 +117,8 @@ typedef struct snddev_s
#endif #endif
} snddev_t; } snddev_t;
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__HWS_DATA_H__ #endif //__HWS_DATA_H__

View file

@ -47,6 +47,10 @@
#include "../../doomdef.h" #include "../../doomdef.h"
#include "../hw_drv.h" #include "../hw_drv.h"
#ifdef __cplusplus
extern "C" {
#endif
// ========================================================================== // ==========================================================================
// DEFINITIONS // DEFINITIONS
// ========================================================================== // ==========================================================================
@ -138,4 +142,8 @@ typedef enum
GLF_NOTEXENV = 0x02, GLF_NOTEXENV = 0x02,
} oglflags_t; } oglflags_t;
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -9,6 +9,10 @@
#ifndef _R_VBO_H_ #ifndef _R_VBO_H_
#define _R_VBO_H_ #define _R_VBO_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct typedef struct
{ {
float x, y, z; // Vertex float x, y, z; // Vertex
@ -49,4 +53,8 @@ typedef struct
unsigned char r, g, b, a; // Color unsigned char r, g, b, a; // Color
} vbo64_t; } vbo64_t;
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -10,6 +10,10 @@
#ifndef _U_LIST_H_ #ifndef _U_LIST_H_
#define _U_LIST_H_ #define _U_LIST_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct listitem_s typedef struct listitem_s
{ {
struct listitem_s *next; struct listitem_s *next;
@ -26,4 +30,8 @@ void ListRemoveNoFree(void *pItem, listitem_t **itemHead);
unsigned int ListGetCount(void *itemHead); unsigned int ListGetCount(void *itemHead);
listitem_t *ListGetByIndex(void *itemHead, unsigned int index); listitem_t *ListGetByIndex(void *itemHead, unsigned int index);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -19,6 +19,10 @@
#include "r_defs.h" #include "r_defs.h"
#include "font.h" #include "font.h"
#ifdef __cplusplus
extern "C" {
#endif
//------------------------------------ //------------------------------------
// heads up font // heads up font
//------------------------------------ //------------------------------------
@ -152,4 +156,9 @@ void HU_DoCEcho(const char *msg);
// Demo playback info // Demo playback info
extern UINT32 hu_demotime; extern UINT32 hu_demotime;
extern UINT32 hu_demolap; extern UINT32 hu_demolap;
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -12,6 +12,10 @@
#ifndef __I_ADDRINFO__ #ifndef __I_ADDRINFO__
#define __I_ADDRINFO__ #define __I_ADDRINFO__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
@ -68,4 +72,8 @@ int I_getaddrinfo(const char *node, const char *service,
#endif #endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -15,6 +15,10 @@
#include "g_input.h" #include "g_input.h"
#ifdef __cplusplus
extern "C" {
#endif
/*! /*!
\brief -JOYAXISRANGE to +JOYAXISRANGE for each axis \brief -JOYAXISRANGE to +JOYAXISRANGE for each axis
@ -54,4 +58,8 @@ struct JoyType_t
extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS]; extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __I_JOY_H__ #endif // __I_JOY_H__

View file

@ -33,6 +33,10 @@
#define NO_BAN_TIME (time_t)(-1) #define NO_BAN_TIME (time_t)(-1)
#ifdef __cplusplus
extern "C" {
#endif
extern INT16 hardware_MAXPACKETLENGTH; extern INT16 hardware_MAXPACKETLENGTH;
extern INT32 net_bandwidth; // in byte/s extern INT32 net_bandwidth; // in byte/s
@ -182,4 +186,8 @@ extern bannednode_t *bannednode;
/// \brief Called by D_SRB2Main to be defined by extern network driver /// \brief Called by D_SRB2Main to be defined by extern network driver
boolean I_InitNetwork(void); boolean I_InitNetwork(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -18,6 +18,10 @@
#include "sounds.h" #include "sounds.h"
#include "command.h" #include "command.h"
#ifdef __cplusplus
extern "C" {
#endif
// copied from SDL mixer, plus GME // copied from SDL mixer, plus GME
typedef enum { typedef enum {
MU_NONE, MU_NONE,
@ -241,4 +245,8 @@ boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void));
boolean I_FadeOutStopSong(UINT32 ms); boolean I_FadeOutStopSong(UINT32 ms);
boolean I_FadeInPlaySong(UINT32 ms, boolean looping); boolean I_FadeInPlaySong(UINT32 ms, boolean looping);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "d_ticcmd.h" #include "d_ticcmd.h"
#include "d_event.h" #include "d_event.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
@ -361,4 +365,8 @@ void I_RegisterSysCommands(void);
void I_CursedWindowMovement(int xd, int yd); void I_CursedWindowMovement(int xd, int yd);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -13,6 +13,10 @@
#ifndef __I_TCP__ #ifndef __I_TCP__
#define __I_TCP__ #define __I_TCP__
#ifdef __cplusplus
extern "C" {
#endif
extern UINT16 current_port; extern UINT16 current_port;
/** \brief The I_InitTcpNetwork function /** \brief The I_InitTcpNetwork function
@ -28,4 +32,8 @@ boolean I_InitTcpNetwork(void);
boolean I_InitTcpDriver(void); boolean I_InitTcpDriver(void);
void I_ShutdownTcpDriver(void); void I_ShutdownTcpDriver(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -14,6 +14,10 @@
#ifndef I_THREADS_H #ifndef I_THREADS_H
#define I_THREADS_H #define I_THREADS_H
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*I_thread_fn)(void *userdata); typedef void (*I_thread_fn)(void *userdata);
typedef void * I_mutex; typedef void * I_mutex;
@ -35,5 +39,9 @@ void I_hold_cond (I_cond *, I_mutex);
void I_wake_one_cond (I_cond *); void I_wake_one_cond (I_cond *);
void I_wake_all_cond (I_cond *); void I_wake_all_cond (I_cond *);
#ifdef __cplusplus
} // extern "C"
#endif
#endif/*I_THREADS_H*/ #endif/*I_THREADS_H*/
#endif/*HAVE_THREADS*/ #endif/*HAVE_THREADS*/

View file

@ -16,6 +16,10 @@
#include "doomtype.h" #include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
@ -153,4 +157,8 @@ void I_EndRead(void);
UINT32 I_GetRefreshRate(void); UINT32 I_GetRefreshRate(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -19,6 +19,10 @@
#include "sounds.h" #include "sounds.h"
#include "m_fixed.h" #include "m_fixed.h"
#ifdef __cplusplus
extern "C" {
#endif
// deh_tables.c now has lists for the more named enums! PLEASE keep them up to date! // deh_tables.c now has lists for the more named enums! PLEASE keep them up to date!
// For great modding!! // For great modding!!
@ -6739,4 +6743,8 @@ void P_BackupTables(void);
void P_ResetData(INT32 flags); void P_ResetData(INT32 flags);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

4
src/io/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
target_sources(SRB2SDL2 PRIVATE
streams.cpp
streams.hpp
)

4
src/io/streams.cpp Normal file
View file

@ -0,0 +1,4 @@
#include "streams.hpp"
template class srb2::io::ZlibInputStream<srb2::io::SpanStream>;
template class srb2::io::ZlibInputStream<srb2::io::VecStream>;

733
src/io/streams.hpp Normal file
View file

@ -0,0 +1,733 @@
#ifndef __SRB2_IO_STREAMS_HPP__
#define __SRB2_IO_STREAMS_HPP__
#include <cstddef>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include <tcb/span.hpp>
#include <zlib.h>
namespace srb2::io {
using StreamSize = uint64_t;
using StreamOffset = int64_t;
enum class SeekFrom {
kStart,
kCurrent,
kEnd
};
template <typename T>
struct IsInputStream
: public std::is_same<decltype(std::declval<T&>().read(std::declval<tcb::span<std::byte>>())), StreamSize> {};
template <typename T>
struct IsOutputStream
: public std::is_same<decltype(std::declval<T&>().write(std::declval<tcb::span<const std::byte>>())), StreamSize> {
};
template <typename T>
struct IsSeekableStream
: public std::is_same<decltype(std::declval<T&>().seek(std::declval<SeekFrom>(), std::declval<StreamOffset>())),
StreamSize> {};
template <typename T>
struct IsStream : public std::disjunction<IsInputStream<T>, IsOutputStream<T>> {};
template <typename T>
struct IsInputOutputStream : public std::conjunction<IsInputStream<T>, IsOutputStream<T>> {};
template <typename T>
inline constexpr const bool IsInputStreamV = IsInputStream<T>::value;
template <typename T>
inline constexpr const bool IsOutputStreamV = IsOutputStream<T>::value;
template <typename T>
inline constexpr const bool IsSeekableStreamV = IsSeekableStream<T>::value;
template <typename T>
inline constexpr const bool IsStreamV = IsStream<T>::value;
template <typename T>
inline constexpr const bool IsInputOutputStreamV = IsInputOutputStream<T>::value;
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read_exact(I& stream, tcb::span<std::byte> buffer) {
std::size_t total = 0;
const std::size_t buf_size = buffer.size();
while (total < buf_size) {
total += stream.read(buffer.subspan(total, buf_size - total));
}
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write_exact(O& stream, tcb::span<const std::byte> buffer) {
std::size_t total = 0;
const std::size_t buf_size = buffer.size();
while (total < buf_size) {
total += stream.write(buffer.subspan(total, buf_size - total));
}
}
enum class Endian {
kLE,
kBE,
};
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(std::byte& value, I& stream) {
read_exact(stream, tcb::span {&value, 1});
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(std::byte value, O& stream) {
write_exact(stream, tcb::span {&value, 1});
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(uint8_t& value, I& stream) {
std::byte in;
read_exact(stream, tcb::span {&in, 1});
value = std::to_integer<uint8_t>(in);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
uint8_t read_uint8(I& stream) {
uint8_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(uint8_t value, O& stream) {
std::byte out {value};
write_exact(stream, tcb::span {&out, 1});
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(bool& value, I& stream) {
uint8_t v;
read(v, stream);
value = !(v == 0);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
bool read_bool(I& stream) {
bool ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(bool value, O& stream) {
uint8_t out;
if (value)
out = 1;
else
out = 0;
write(out, stream);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(int8_t& value, I& stream) {
uint8_t in;
read(in, stream);
value = *reinterpret_cast<int8_t*>(&in);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
int8_t read_int8(I& stream) {
int8_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(int8_t value, O& stream) {
write(*reinterpret_cast<uint8_t*>(&value), stream);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(uint16_t& value, I& stream, Endian endian = Endian::kLE) {
std::array<std::byte, 2> out;
read_exact(stream, tcb::make_span(out));
if (endian == Endian::kBE)
value = std::to_integer<uint16_t>(out[1]) + (std::to_integer<uint16_t>(out[0]) << 8);
else
value = std::to_integer<uint16_t>(out[0]) + (std::to_integer<uint16_t>(out[1]) << 8);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
uint16_t read_uint16(I& stream) {
uint16_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(uint16_t value, O& stream, Endian endian = Endian::kLE) {
std::array<std::byte, 2> out;
if (endian == Endian::kBE)
out = {std::byte {static_cast<uint8_t>((value & 0xFF00) >> 8)},
std::byte {static_cast<uint8_t>((value & 0x00FF) >> 0)}};
else
out = {std::byte {static_cast<uint8_t>((value & 0x00FF) >> 0)},
std::byte {static_cast<uint8_t>((value & 0xFF00) >> 8)}};
write_exact(stream, tcb::make_span(out));
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(int16_t& value, I& stream, Endian endian = Endian::kLE) {
uint16_t r;
read(r, stream, endian);
value = *reinterpret_cast<int16_t*>(&r);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
int16_t read_int16(I& stream) {
int16_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(int16_t value, O& stream, Endian endian = Endian::kLE) {
write(*reinterpret_cast<int16_t*>(&value), stream, endian);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(uint32_t& value, I& stream, Endian endian = Endian::kLE) {
std::array<std::byte, 4> out;
read_exact(stream, tcb::make_span(out));
if (endian == Endian::kBE)
value = std::to_integer<uint32_t>(out[3]) + (std::to_integer<uint32_t>(out[2]) << 8) +
(std::to_integer<uint32_t>(out[1]) << 16) + (std::to_integer<uint32_t>(out[0]) << 24);
else
value = std::to_integer<uint32_t>(out[0]) + (std::to_integer<uint32_t>(out[1]) << 8) +
(std::to_integer<uint32_t>(out[2]) << 16) + (std::to_integer<uint32_t>(out[3]) << 24);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
uint32_t read_uint32(I& stream) {
uint32_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(uint32_t value, O& stream, Endian endian = Endian::kLE) {
std::array<std::byte, 4> out;
if (endian == Endian::kBE)
out = {std::byte {static_cast<uint8_t>((value & 0xFF000000) >> 24)},
std::byte {static_cast<uint8_t>((value & 0x00FF0000) >> 16)},
std::byte {static_cast<uint8_t>((value & 0x0000FF00) >> 8)},
std::byte {static_cast<uint8_t>((value & 0x000000FF) >> 0)}};
else
out = {std::byte {static_cast<uint8_t>((value & 0x000000FF) >> 0)},
std::byte {static_cast<uint8_t>((value & 0x0000FF00) >> 8)},
std::byte {static_cast<uint8_t>((value & 0x00FF0000) >> 16)},
std::byte {static_cast<uint8_t>((value & 0xFF000000) >> 24)}};
write_exact(stream, tcb::make_span(out));
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(int32_t& value, I& stream, Endian endian = Endian::kLE) {
uint32_t r;
read(r, stream, endian);
value = *reinterpret_cast<int32_t*>(&r);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
int32_t read_int32(I& stream) {
int32_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(int32_t value, O& stream, Endian endian = Endian::kLE) {
write(*reinterpret_cast<uint32_t*>(&value), stream, endian);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(uint64_t& value, I& stream, Endian endian = Endian::kLE) {
std::array<std::byte, 8> out;
read_exact(stream, tcb::make_span(out));
if (endian == Endian::kBE)
value = std::to_integer<uint64_t>(out[7]) + (std::to_integer<uint64_t>(out[6]) << 8) +
(std::to_integer<uint64_t>(out[5]) << 16) + (std::to_integer<uint64_t>(out[4]) << 24) +
(std::to_integer<uint64_t>(out[3]) << 32) + (std::to_integer<uint64_t>(out[2]) << 40) +
(std::to_integer<uint64_t>(out[1]) << 48) + (std::to_integer<uint64_t>(out[0]) << 56);
else
value = std::to_integer<uint64_t>(out[0]) + (std::to_integer<uint64_t>(out[1]) << 8) +
(std::to_integer<uint64_t>(out[2]) << 16) + (std::to_integer<uint64_t>(out[3]) << 24) +
(std::to_integer<uint64_t>(out[4]) << 32) + (std::to_integer<uint64_t>(out[5]) << 40) +
(std::to_integer<uint64_t>(out[6]) << 48) + (std::to_integer<uint64_t>(out[7]) << 56);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
uint64_t read_uint64(I& stream) {
uint64_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(uint64_t value, O& stream, Endian endian = Endian::kLE) {
std::array<std::byte, 8> out;
if (endian == Endian::kBE)
out = {std::byte {static_cast<uint8_t>((value & 0xFF00000000000000) >> 56)},
std::byte {static_cast<uint8_t>((value & 0x00FF000000000000) >> 48)},
std::byte {static_cast<uint8_t>((value & 0x0000FF0000000000) >> 40)},
std::byte {static_cast<uint8_t>((value & 0x000000FF00000000) >> 32)},
std::byte {static_cast<uint8_t>((value & 0x00000000FF000000) >> 24)},
std::byte {static_cast<uint8_t>((value & 0x0000000000FF0000) >> 16)},
std::byte {static_cast<uint8_t>((value & 0x000000000000FF00) >> 8)},
std::byte {static_cast<uint8_t>((value & 0x00000000000000FF) >> 0)}};
else
out = {std::byte {static_cast<uint8_t>((value & 0x00000000000000FF) >> 0)},
std::byte {static_cast<uint8_t>((value & 0x000000000000FF00) >> 8)},
std::byte {static_cast<uint8_t>((value & 0x0000000000FF0000) >> 16)},
std::byte {static_cast<uint8_t>((value & 0x00000000FF000000) >> 24)},
std::byte {static_cast<uint8_t>((value & 0x000000FF00000000) >> 32)},
std::byte {static_cast<uint8_t>((value & 0x0000FF0000000000) >> 40)},
std::byte {static_cast<uint8_t>((value & 0x00FF000000000000) >> 48)},
std::byte {static_cast<uint8_t>((value & 0xFF00000000000000) >> 56)}};
write_exact(stream, tcb::make_span(out));
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(int64_t& value, I& stream, Endian endian = Endian::kLE) {
uint64_t r;
read(r, stream, endian);
value = *reinterpret_cast<int64_t*>(&r);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
int64_t read_int64(I& stream) {
int64_t ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(int64_t value, O& stream, Endian endian = Endian::kLE) {
write(*reinterpret_cast<uint64_t*>(&value), stream, endian);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(float& value, I& stream, Endian endian = Endian::kLE) {
uint32_t r;
read(r, stream, endian);
value = *reinterpret_cast<float*>(&r);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
float read_float(I& stream) {
float ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(float value, O& stream, Endian endian = Endian::kLE) {
write(*reinterpret_cast<int32_t*>(&value), stream, endian);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
void read(double& value, I& stream, Endian endian = Endian::kLE) {
uint64_t r;
read(r, stream, endian);
value = *reinterpret_cast<double*>(&r);
}
template <typename I, typename std::enable_if_t<IsInputStreamV<I>>* = nullptr>
double read_double(I& stream) {
double ret;
read(ret, stream);
return ret;
}
template <typename O, typename std::enable_if_t<IsOutputStreamV<O>>* = nullptr>
void write(double value, O& stream, Endian endian = Endian::kLE) {
write(*reinterpret_cast<int64_t*>(&value), stream, endian);
}
template <typename S, typename std::enable_if_t<IsSeekableStreamV<S>>* = nullptr>
StreamSize remaining(S& stream) {
const StreamSize current = stream.seek(SeekFrom::kCurrent, 0);
const StreamSize end = stream.seek(SeekFrom::kEnd, 0);
stream.seek(SeekFrom::kStart, current);
return end - current;
}
// Kinds of streams
class SpanStream {
public:
SpanStream() noexcept = default;
SpanStream(tcb::span<std::byte> span) : span_(span), head_(0) {
if (span_.size() > static_cast<StreamSize>(static_cast<StreamOffset>(-1))) {
throw std::logic_error("Span must not be greater than 2 billion bytes");
}
};
StreamSize read(tcb::span<std::byte> buffer) {
if (head_ >= span_.size())
return 0;
const auto begin = buffer.begin();
const auto end = std::copy(
span_.begin() + head_, span_.begin() + head_ + std::min(buffer.size(), span_.size() - head_), begin);
head_ += std::distance(begin, end);
return std::distance(begin, end);
}
StreamSize write(tcb::span<const std::byte> buffer) {
if (head_ >= span_.size())
return 0;
const auto begin = span_.begin() + head_;
const auto end =
std::copy(buffer.begin(), buffer.begin() + std::min(span_.size() - head_, buffer.size()), begin);
head_ += std::distance(begin, end);
return std::distance(begin, end);
}
StreamSize seek(SeekFrom seek_from, StreamOffset offset) {
std::size_t head = 0;
switch (seek_from) {
case SeekFrom::kStart:
if (offset < 0 || offset >= static_cast<StreamOffset>(span_.size())) {
throw std::logic_error("start offset is out of bounds");
}
head = offset;
break;
case SeekFrom::kEnd:
if (-offset >= static_cast<StreamOffset>(span_.size())) {
throw std::logic_error("end offset is out of bounds");
}
head = span_.size() - offset;
break;
case SeekFrom::kCurrent:
if (head_ + offset < 0 || head_ + offset >= span_.size()) {
throw std::logic_error("offset is out of bounds");
}
head = head_ + offset;
break;
}
std::swap(head, head_);
return head_;
}
private:
tcb::span<std::byte> span_;
std::size_t head_ {0};
};
class VecStream {
std::vector<std::byte> vec_;
std::size_t head_ {0};
public:
VecStream() = default;
VecStream(const std::vector<std::byte>& vec) : vec_(vec) {}
VecStream(std::vector<std::byte>&& vec) : vec_(std::move(vec)) {}
VecStream(const VecStream& rhs) = default;
VecStream(VecStream&& rhs) = default;
VecStream& operator=(const VecStream& rhs) = default;
VecStream& operator=(VecStream&& rhs) = default;
StreamSize read(tcb::span<std::byte> buffer) {
if (head_ >= vec_.size())
return 0;
const auto begin = buffer.begin();
const auto end =
std::copy(vec_.begin() + head_, vec_.begin() + head_ + std::min(buffer.size(), vec_.size() - head_), begin);
head_ += std::distance(begin, end);
return std::distance(begin, end);
}
StreamSize write(tcb::span<const std::byte> buffer) {
const std::size_t buffer_size = buffer.size();
if (head_ + buffer_size >= vec_.size()) {
vec_.resize(head_ + buffer_size);
}
const auto begin = vec_.begin() + head_;
const auto end =
std::copy(buffer.begin(), buffer.begin() + std::min(vec_.size() - head_, buffer.size()), begin);
head_ += std::distance(begin, end);
return std::distance(begin, end);
}
StreamSize seek(SeekFrom seek_from, StreamOffset offset) {
std::size_t head = 0;
switch (seek_from) {
case SeekFrom::kStart:
if (offset < 0 || offset >= static_cast<StreamOffset>(vec_.size())) {
throw std::logic_error("start offset is out of bounds");
}
head = offset;
break;
case SeekFrom::kEnd:
if (-offset >= static_cast<StreamOffset>(vec_.size())) {
throw std::logic_error("end offset is out of bounds");
}
head = vec_.size() - offset;
break;
case SeekFrom::kCurrent:
if (head_ + offset < 0 || head_ + offset >= vec_.size()) {
throw std::logic_error("offset is out of bounds");
}
head = head_ + offset;
break;
}
std::swap(head, head_);
return head_;
}
std::vector<std::byte>& vector() { return vec_; }
};
class ZlibException : public std::exception {
int err_ {0};
std::string msg_;
public:
ZlibException(int err, const char* msg = nullptr) : err_(err), msg_("srb2::io::ZlibException: zlib error: ") {
const char* err_msg = "(UNKNOWN) ";
switch (err_) {
case Z_OK:
err_msg = "(Z_OK) ";
break;
case Z_STREAM_END:
err_msg = "(Z_STREAM_END) ";
break;
case Z_NEED_DICT:
err_msg = "(Z_NEED_DICT) ";
break;
case Z_ERRNO:
err_msg = "(Z_ERRNO) ";
break;
case Z_STREAM_ERROR:
err_msg = "(Z_STREAM_ERROR) ";
break;
case Z_DATA_ERROR:
err_msg = "(Z_DATA_ERROR) ";
break;
case Z_MEM_ERROR:
err_msg = "(Z_MEM_ERROR) ";
break;
case Z_BUF_ERROR:
err_msg = "(Z_BUF_ERROR) ";
break;
case Z_VERSION_ERROR:
err_msg = "(Z_VERSION_ERROR) ";
break;
}
msg_.append(err_msg);
if (msg != nullptr)
msg_.append(msg);
else
msg_.append("nullptr");
}
virtual const char* what() const noexcept override final { return msg_.c_str(); }
};
template <typename I,
typename std::enable_if_t<IsInputStreamV<I> && std::is_move_constructible_v<I> &&
std::is_move_assignable_v<I>>* = nullptr>
class ZlibInputStream {
I inner_;
z_stream stream_;
std::vector<std::byte> buf_;
std::size_t buf_head_;
bool zstream_initialized_;
bool zstream_ended_;
public:
ZlibInputStream(I&& inner)
: inner_(std::move(inner))
, stream_ {}
, buf_()
, buf_head_(0)
, zstream_initialized_ {false}
, zstream_ended_ {false} {}
ZlibInputStream(const ZlibInputStream& rhs) = delete;
ZlibInputStream(ZlibInputStream&& rhs) = delete;
ZlibInputStream& operator=(const ZlibInputStream& rhs) = delete;
ZlibInputStream& operator=(ZlibInputStream&& rhs) = delete;
StreamSize read(tcb::span<std::byte> buffer) {
if (zstream_ended_)
return 0;
std::size_t written = 0;
const std::size_t buffer_size = buffer.size();
while (written < buffer_size && !zstream_ended_) {
_fill_read_buffer();
if (buf_.size() == 0) {
break;
}
const std::size_t written_this_time = _inflate(buffer.subspan(written));
written += written_this_time;
}
return written;
}
I& stream() { return inner_; }
void close() {
if (!zstream_initialized_)
return;
int ret = inflateEnd(&stream_);
if (ret != Z_OK)
throw ZlibException {ret, stream_.msg};
zstream_initialized_ = false;
zstream_ended_ = true;
}
~ZlibInputStream() {
if (zstream_initialized_) {
int ret = inflateEnd(&stream_);
if (ret != Z_OK)
// can't throw exceptions in destructors
std::terminate();
zstream_initialized_ = false;
zstream_ended_ = true;
}
};
private:
constexpr static const std::size_t kReadHighWater = 2048;
void _init() {
stream_.avail_in = buf_.size() - buf_head_;
const std::size_t start_avail_in = stream_.avail_in;
stream_.next_in = reinterpret_cast<Bytef*>(buf_.data() + buf_head_);
int ret = inflateInit2(&stream_, 32);
if (ret != Z_OK) {
throw ZlibException {ret, stream_.msg};
}
buf_head_ += start_avail_in - stream_.avail_in;
_move_buf_backwards();
zstream_initialized_ = true;
zstream_ended_ = false;
}
void _fill_read_buffer() {
const std::size_t old_size = buf_.size();
if (old_size < kReadHighWater) {
buf_.resize(kReadHighWater);
const std::size_t read = inner_.read(tcb::span(buf_.data() + old_size, buf_.size() - old_size));
buf_.resize(old_size + read);
}
}
StreamSize _inflate(tcb::span<std::byte> out) {
if (!zstream_initialized_) {
_init();
}
if (zstream_ended_)
return 0;
const std::size_t out_size = out.size();
stream_.avail_in = buf_.size() - buf_head_;
const std::size_t start_avail_in = stream_.avail_in;
stream_.next_in = reinterpret_cast<Bytef*>(buf_.data() + buf_head_);
stream_.avail_out = out_size;
const std::size_t start_avail_out = stream_.avail_out;
stream_.next_out = reinterpret_cast<Bytef*>(out.data());
int ret = inflate(&stream_, Z_NO_FLUSH);
if (ret == Z_STREAM_END) {
zstream_ended_ = true;
} else if (ret != Z_OK && ret != Z_BUF_ERROR) {
throw ZlibException {ret, stream_.msg};
}
buf_head_ += start_avail_in - stream_.avail_in;
const std::size_t written = start_avail_out - stream_.avail_out;
_move_buf_backwards();
return written;
}
void _move_buf_backwards() {
if (buf_head_ == 0) {
return;
}
if (buf_head_ >= buf_.size()) {
buf_.clear();
buf_head_ = 0;
return;
}
auto end = std::move(buf_.begin() + buf_head_, buf_.end(), buf_.begin());
buf_.resize(end - buf_.begin());
buf_head_ = 0;
}
};
// Utility functions
template <typename I, typename O>
StreamSize pipe_all(I& input, O& output) {
std::vector<std::byte> buf;
StreamSize total_written = 0;
StreamSize read_this_time = 0;
do {
buf.clear();
buf.resize(2048);
read_this_time = input.read(tcb::make_span(buf));
buf.resize(read_this_time);
write_exact(output, tcb::make_span(buf));
total_written += read_this_time;
} while (read_this_time != 0);
return total_written;
}
template <typename I>
std::vector<std::byte> read_to_vec(I& input) {
VecStream out;
pipe_all(input, out);
return std::move(out.vector());
}
// Instantiated templates
extern template class ZlibInputStream<SpanStream>;
extern template class ZlibInputStream<VecStream>;
} // namespace srb2::io
#endif // __SRB2_IO_STREAMS_HPP__

View file

@ -4,6 +4,10 @@
#include "doomtype.h" #include "doomtype.h"
#include "d_player.h" #include "d_player.h"
#ifdef __cplusplus
extern "C" {
#endif
extern struct battleovertime extern struct battleovertime
{ {
UINT16 enabled; ///< Has this been initalized yet? UINT16 enabled; ///< Has this been initalized yet?
@ -31,4 +35,8 @@ void K_SetupMovingCapsule(mapthing_t *mt, mobj_t *mobj);
void K_SpawnPlayerBattleBumpers(player_t *p); void K_SpawnPlayerBattleBumpers(player_t *p);
void K_BattleInit(boolean singleplayercontext); void K_BattleInit(boolean singleplayercontext);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -15,6 +15,10 @@
#include "doomdef.h" #include "doomdef.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void(*updateindexfunc)(void *const, const size_t); typedef void(*updateindexfunc)(void *const, const size_t);
struct bheapitem_t struct bheapitem_t
@ -150,4 +154,8 @@ size_t K_BHeapContains(bheap_t *const heap, void *const data, size_t index);
boolean K_BHeapFree(bheap_t *const heap); boolean K_BHeapFree(bheap_t *const heap);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -16,6 +16,10 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum typedef enum
{ {
SPOT_NONE = 0, SPOT_NONE = 0,
@ -125,4 +129,8 @@ void K_DeclareWeakspot(mobj_t *spot, spottype_t spottype, UINT16 color, boolean
boolean K_CheckBossIntro(void); boolean K_CheckBossIntro(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "d_player.h" #include "d_player.h"
#include "r_defs.h" #include "r_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
// Maximum value of botvars.difficulty // Maximum value of botvars.difficulty
#define MAXBOTDIFFICULTY 13 #define MAXBOTDIFFICULTY 13
@ -270,4 +274,8 @@ void K_UpdateBotGameplayVars(player_t *player);
void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt); void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomtype.h" #include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
struct brightmapStorage_t struct brightmapStorage_t
{ {
// Brightmap storage struct. // Brightmap storage struct.
@ -46,4 +50,8 @@ void K_InitBrightmapsPwad(INT32 wadNum);
void K_InitBrightmaps(void); void K_InitBrightmaps(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __K_BRIGHTMAP_H__ #endif // __K_BRIGHTMAP_H__

View file

@ -4,6 +4,10 @@
#include "doomtype.h" #include "doomtype.h"
#include "p_mobj.h" #include "p_mobj.h"
#ifdef __cplusplus
extern "C" {
#endif
angle_t K_GetCollideAngle(mobj_t *t1, mobj_t *t2); angle_t K_GetCollideAngle(mobj_t *t1, mobj_t *t2);
boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2); boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2);
@ -27,4 +31,8 @@ boolean K_SMKIceBlockCollide(mobj_t *t1, mobj_t *t2);
boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2); boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -15,6 +15,10 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomtype.h" #include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SKIN_RAMP_LENGTH 16 #define SKIN_RAMP_LENGTH 16
#define DEFAULT_STARTTRANSCOLOR 96 #define DEFAULT_STARTTRANSCOLOR 96
#define NUM_PALETTE_ENTRIES 256 #define NUM_PALETTE_ENTRIES 256
@ -110,4 +114,8 @@ void K_HitlagColormap(UINT8 *dest_colormap);
--------------------------------------------------*/ --------------------------------------------------*/
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color); void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -3,6 +3,13 @@
/// \file k_director.h /// \file k_director.h
/// \brief SRB2kart automatic spectator camera. /// \brief SRB2kart automatic spectator camera.
#ifndef __K_DIRECTOR_H__
#define __K_DIRECTOR_H__
#ifdef __cplusplus
extern "C" {
#endif
extern struct directorinfo extern struct directorinfo
{ {
tic_t cooldown; // how long has it been since we last switched? tic_t cooldown; // how long has it been since we last switched?
@ -18,4 +25,10 @@ extern struct directorinfo
void K_InitDirector(void); void K_InitDirector(void);
void K_UpdateDirector(void); void K_UpdateDirector(void);
void K_DrawDirectorDebugger(void); void K_DrawDirectorDebugger(void);
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source); void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __K_DIRECTOR_H__

View file

@ -16,6 +16,10 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#ifdef __cplusplus
extern "C" {
#endif
#define FOLLOWERCOLOR_MATCH UINT16_MAX #define FOLLOWERCOLOR_MATCH UINT16_MAX
#define FOLLOWERCOLOR_OPPOSITE (UINT16_MAX-1) #define FOLLOWERCOLOR_OPPOSITE (UINT16_MAX-1)
@ -211,5 +215,8 @@ void K_HandleFollower(player_t *player);
void K_RemoveFollower(player_t *player); void K_RemoveFollower(player_t *player);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __K_FOLLOWER__ #endif // __K_FOLLOWER__

View file

@ -16,6 +16,10 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#ifdef __cplusplus
extern "C" {
#endif
#define GPEVENT_NONE 0 #define GPEVENT_NONE 0
#define GPEVENT_BONUS 1 #define GPEVENT_BONUS 1
#define GPEVENT_SPECIAL 2 #define GPEVENT_SPECIAL 2
@ -166,4 +170,8 @@ void K_PlayerLoseLife(player_t *player);
boolean K_CanChangeRules(boolean allowdemos); boolean K_CanChangeRules(boolean allowdemos);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -9,12 +9,16 @@
/// \file k_hud.h /// \file k_hud.h
/// \brief HUD drawing functions exclusive to Kart /// \brief HUD drawing functions exclusive to Kart
#ifndef __K_HUD__
#define __K_HUD__
#include "doomtype.h" #include "doomtype.h"
#include "doomstat.h" #include "doomstat.h"
#include "hu_stuff.h" #include "hu_stuff.h"
#ifndef __K_HUD__ #ifdef __cplusplus
#define __K_HUD__ extern "C" {
#endif
#define RINGANIM_NUMFRAMES 10 #define RINGANIM_NUMFRAMES 10
#define RINGANIM_DELAYMAX 5 #define RINGANIM_DELAYMAX 5
@ -43,4 +47,8 @@ void K_DrawLikeMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, patch_t
extern patch_t *kp_facehighlight[8]; extern patch_t *kp_facehighlight[8];
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -10,6 +10,10 @@
#include "d_player.h" // Need for player_t #include "d_player.h" // Need for player_t
#include "command.h" // Need for player_t #include "command.h" // Need for player_t
#ifdef __cplusplus
extern "C" {
#endif
#define KART_FULLTURN 800 #define KART_FULLTURN 800
/* /*
@ -193,5 +197,9 @@ fixed_t K_ItemScaleForPlayer(player_t *player);
void K_SetItemOut(player_t *player); void K_SetItemOut(player_t *player);
void K_UnsetItemOut(player_t *player); void K_UnsetItemOut(player_t *player);
#ifdef __cplusplus
} // extern "C"
#endif
// ========================================================================= // =========================================================================
#endif // __K_KART__ #endif // __K_KART__

View file

@ -24,6 +24,10 @@
#include "i_threads.h" #include "i_threads.h"
#include "mserv.h" #include "mserv.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SERVERLISTDEBUG #define SERVERLISTDEBUG
// flags for items in the menu // flags for items in the menu
@ -1196,5 +1200,8 @@ boolean M_StatisticsInputs(INT32 ch);
NULL\ NULL\
} }
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__K_MENU__ #endif //__K_MENU__

View file

@ -2,6 +2,10 @@
#ifndef k_objects_H #ifndef k_objects_H
#define k_objects_H #define k_objects_H
#ifdef __cplusplus
extern "C" {
#endif
/* Hyudoro */ /* Hyudoro */
void Obj_InitHyudoroCenter(mobj_t *center, mobj_t *master); void Obj_InitHyudoroCenter(mobj_t *center, mobj_t *master);
void Obj_HyudoroDeploy(mobj_t *master); void Obj_HyudoroDeploy(mobj_t *master);
@ -69,4 +73,8 @@ void Obj_UFOPieceRemoved(mobj_t *piece);
mobj_t *Obj_CreateSpecialUFO(void); mobj_t *Obj_CreateSpecialUFO(void);
UINT32 K_GetSpecialUFODistance(void); UINT32 K_GetSpecialUFODistance(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif/*k_objects_H*/ #endif/*k_objects_H*/

View file

@ -15,6 +15,10 @@
#include "doomtype.h" #include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
// function pointer for returning a node's connected node data // function pointer for returning a node's connected node data
// should return a pointer to an array of pointers to the data, as arguments takes a node's data and a pointer that the // should return a pointer to an array of pointers to the data, as arguments takes a node's data and a pointer that the
// number of connected nodes should be placed into // number of connected nodes should be placed into
@ -84,4 +88,8 @@ struct pathfindsetup_t {
--------------------------------------------------*/ --------------------------------------------------*/
boolean K_PathfindAStar(path_t *const path, pathfindsetup_t *const pathfindsetup); boolean K_PathfindAStar(path_t *const path, pathfindsetup_t *const pathfindsetup);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -22,6 +22,10 @@
#include "g_game.h" // game CVs #include "g_game.h" // game CVs
#include "k_follower.h" // followers #include "k_follower.h" // followers
#ifdef __cplusplus
extern "C" {
#endif
// We have to redefine this because somehow including r_skins.h causes a redefinition of node_t since that's used for both net nodes and BSP nodes too...... // We have to redefine this because somehow including r_skins.h causes a redefinition of node_t since that's used for both net nodes and BSP nodes too......
// And honestly I don't wanna refactor that. // And honestly I don't wanna refactor that.
#define SKINNAMESIZE 16 #define SKINNAMESIZE 16
@ -152,4 +156,8 @@ SINT8 PR_ProfileUsedBy(profile_t *p);
profile_t *PR_GetPlayerProfile(player_t *player); profile_t *PR_GetPlayerProfile(player_t *player);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -15,6 +15,10 @@
#include "doomdef.h" #include "doomdef.h"
#include "d_player.h" #include "d_player.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum typedef enum
{ {
PWRLV_DISABLED = -1, PWRLV_DISABLED = -1,
@ -47,4 +51,8 @@ void K_CashInPowerLevels(void);
void K_SetPowerLevelScrambles(SINT8 powertype); void K_SetPowerLevelScrambles(SINT8 powertype);
void K_PlayerForfeit(UINT8 playernum, boolean nopointloss); void K_PlayerForfeit(UINT8 playernum, boolean nopointloss);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -14,6 +14,10 @@
#include "r_defs.h" #include "r_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
extern line_t *finishBeamLine; extern line_t *finishBeamLine;
#define FINISHLINEBEAM_SPACING (48*mapobjectscale) #define FINISHLINEBEAM_SPACING (48*mapobjectscale)
@ -66,4 +70,8 @@ boolean K_GenerateFinishBeamLine(void);
void K_RunFinishLineBeam(void); void K_RunFinishLineBeam(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -15,6 +15,10 @@
#include "k_waypoint.h" #include "k_waypoint.h"
#include "d_player.h" #include "d_player.h"
#ifdef __cplusplus
extern "C" {
#endif
#define RESPAWN_DIST 1024 #define RESPAWN_DIST 1024
#define RESPAWN_TIME 48 #define RESPAWN_TIME 48
#define RESPAWNST_NONE 0x00 #define RESPAWNST_NONE 0x00
@ -98,4 +102,8 @@ size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint);
void K_RespawnChecker(player_t *player); void K_RespawnChecker(player_t *player);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -16,6 +16,10 @@
#include "doomtype.h" #include "doomtype.h"
#include "d_player.h" #include "d_player.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ROULETTE_SPACING (36 << FRACBITS) #define ROULETTE_SPACING (36 << FRACBITS)
#define ROULETTE_SPACING_SPLITSCREEN (16 << FRACBITS) #define ROULETTE_SPACING_SPLITSCREEN (16 << FRACBITS)
@ -165,5 +169,8 @@ fixed_t K_GetRouletteOffset(itemroulette_t *const roulette, fixed_t renderDelta)
void K_KartItemRoulette(player_t *const player, ticcmd_t *cmd); void K_KartItemRoulette(player_t *const player, ticcmd_t *cmd);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __K_ROULETTE_H__ #endif // __K_ROULETTE_H__

View file

@ -16,6 +16,10 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#ifdef __cplusplus
extern "C" {
#endif
extern struct specialstageinfo extern struct specialstageinfo
{ {
boolean valid; ///< If true, then data in this struct is valid boolean valid; ///< If true, then data in this struct is valid
@ -62,4 +66,8 @@ void K_TickSpecialStage(void);
mobj_t *K_GetPossibleSpecialTarget(void); mobj_t *K_GetPossibleSpecialTarget(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -20,6 +20,10 @@
#include "m_fixed.h" #include "m_fixed.h"
#include "p_mobj.h" #include "p_mobj.h"
#ifdef __cplusplus
extern "C" {
#endif
#define TERRAIN_NAME_LEN 32 #define TERRAIN_NAME_LEN 32
struct t_splash_t struct t_splash_t
@ -565,4 +569,8 @@ void K_UpdateTerrainOverlay(mobj_t *mo);
void K_InitTerrain(UINT16 wadNum); void K_InitTerrain(UINT16 wadNum);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __K_TERRAIN_H__ #endif // __K_TERRAIN_H__

View file

@ -18,6 +18,10 @@
#include "p_mobj.h" #include "p_mobj.h"
#include "k_pathfind.h" #include "k_pathfind.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DEFAULT_WAYPOINT_RADIUS (384) #define DEFAULT_WAYPOINT_RADIUS (384)
struct waypoint_t struct waypoint_t
@ -419,4 +423,8 @@ void K_ClearWaypoints(void);
void K_AdjustWaypointsParameters (void); void K_AdjustWaypointsParameters (void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -13,6 +13,10 @@
#ifndef __KEYS_H__ #ifndef __KEYS_H__
#define __KEYS_H__ #define __KEYS_H__
#ifdef __cplusplus
extern "C" {
#endif
// These are the key codes as posted by the keyboard handler, // These are the key codes as posted by the keyboard handler,
// ascii codes are 0->127, // ascii codes are 0->127,
// scancodes are 0x80 + 0->127 // scancodes are 0x80 + 0->127
@ -94,4 +98,8 @@
#define KEY_OPENBRACKETS #define KEY_OPENBRACKETS
#define KEY_CLOSEBRACKETS #define KEY_CLOSEBRACKETS
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -10,6 +10,9 @@
/// \file lua_hook.h /// \file lua_hook.h
/// \brief hooks for Lua scripting /// \brief hooks for Lua scripting
#ifndef __LUA_HOOK_H__
#define __LUA_HOOK_H__
#include "r_defs.h" #include "r_defs.h"
#include "d_player.h" #include "d_player.h"
#include "s_sound.h" #include "s_sound.h"
@ -17,6 +20,10 @@
#include "lua_hudlib_drawlist.h" #include "lua_hudlib_drawlist.h"
#ifdef __cplusplus
extern "C" {
#endif
/* /*
Do you know what an 'X Macro' is? Such a macro is called over each element of Do you know what an 'X Macro' is? Such a macro is called over each element of
a list and expands the input. I use it for the hook lists because both an enum a list and expands the input. I use it for the hook lists because both an enum
@ -143,3 +150,9 @@ int LUA_HookViewpointSwitch(player_t *player, player_t *newdisplayplayer, boole
int LUA_HookSeenPlayer(player_t *player, player_t *seenfriend); int LUA_HookSeenPlayer(player_t *player, player_t *seenfriend);
int LUA_HookShouldJingleContinue(player_t *, const char *musname); int LUA_HookShouldJingleContinue(player_t *, const char *musname);
int LUA_HookMusicChange(const char *oldname, struct MusicChange *); int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __LUA_HOOK_H__

View file

@ -15,6 +15,10 @@
#include "lua_hudlib_drawlist.h" #include "lua_hudlib_drawlist.h"
#ifdef __cplusplus
extern "C" {
#endif
enum hud { enum hud {
hud_stagetitle = 0, hud_stagetitle = 0,
hud_textspectator, hud_textspectator,
@ -49,4 +53,8 @@ boolean LUA_HudEnabled(enum hud option);
void LUA_SetHudHook(int hook, huddrawlist_h list); void LUA_SetHudHook(int hook, huddrawlist_h list);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __LUA_HUD_H__ #endif // __LUA_HUD_H__

View file

@ -9,6 +9,12 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/// \file lua_libs.h /// \file lua_libs.h
/// \brief libraries for Lua scripting /// \brief libraries for Lua scripting
#ifndef __LUA_LIBS_H__
#define __LUA_LIBS_H__
#ifdef __cplusplus
extern "C" {
#endif
extern lua_State *gL; extern lua_State *gL;
@ -108,3 +114,9 @@ int LUA_TagLib(lua_State *L);
int LUA_PolyObjLib(lua_State *L); int LUA_PolyObjLib(lua_State *L);
int LUA_BlockmapLib(lua_State *L); int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L); int LUA_HudLib(lua_State *L);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __LUA_LIBS_H__

View file

@ -23,6 +23,10 @@
#include "blua/lualib.h" #include "blua/lualib.h"
#include "blua/lauxlib.h" #include "blua/lauxlib.h"
#ifdef __cplusplus
extern "C" {
#endif
#define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i)) #define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i))
#define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i)) #define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i))
@ -140,4 +144,8 @@ void COM_Lua_f(void);
#define INLEVEL if (! ISINLEVEL)\ #define INLEVEL if (! ISINLEVEL)\
return luaL_error(L, "This can only be used in a level!"); return luaL_error(L, "This can only be used in a level!");
#ifdef __cplusplus
} // extern "C"
#endif
#endif/*LUA_SCRIPT_H*/ #endif/*LUA_SCRIPT_H*/

View file

@ -13,6 +13,10 @@
#define LZF_H #define LZF_H
#include <stdio.h> #include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************** /***********************************************************************
** **
** lzf -- an extremely fast/free compression/decompression-method ** lzf -- an extremely fast/free compression/decompression-method
@ -71,5 +75,9 @@ size_t
lzf_decompress (const void *const in_data, size_t in_len, lzf_decompress (const void *const in_data, size_t in_len,
void *out_data, size_t out_len); void *out_data, size_t out_len);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -16,6 +16,10 @@
#include "doomtype.h" #include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
// Flags for AA trees. // Flags for AA trees.
#define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields #define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields
@ -27,4 +31,8 @@ void M_AATreeSet(aatree_t *aatree, INT32 key, void* value);
void *M_AATreeGet(aatree_t *aatree, INT32 key); void *M_AATreeGet(aatree_t *aatree, INT32 key);
void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback); void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -17,6 +17,10 @@
#include "command.h" #include "command.h"
#include "screen.h" #include "screen.h"
#ifdef __cplusplus
extern "C" {
#endif
#if NUMSCREENS > 2 #if NUMSCREENS > 2
#define HAVE_ANIGIF #define HAVE_ANIGIF
#endif #endif
@ -29,4 +33,8 @@ INT32 GIF_close(void);
extern consvar_t cv_gif_optimize, cv_gif_downscale, cv_gif_dynamicdelay, cv_gif_localcolortable; extern consvar_t cv_gif_optimize, cv_gif_downscale, cv_gif_dynamicdelay, cv_gif_localcolortable;
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -14,6 +14,10 @@
#ifndef __M_ARGV__ #ifndef __M_ARGV__
#define __M_ARGV__ #define __M_ARGV__
#ifdef __cplusplus
extern "C" {
#endif
// //
// MISC // MISC
// //
@ -39,4 +43,8 @@ const char *M_GetNextParm(void);
// Finds and loads a response file (@moreargs.txt) // Finds and loads a response file (@moreargs.txt)
void M_FindResponseFile(void); void M_FindResponseFile(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__M_ARGV__ #endif //__M_ARGV__

View file

@ -16,6 +16,10 @@
#include "m_fixed.h" #include "m_fixed.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \brief Bounding box coordinate storage /** \brief Bounding box coordinate storage
*/ */
@ -34,4 +38,8 @@ void M_AddToBox(fixed_t *box, fixed_t x, fixed_t y);
boolean M_PointInBox(fixed_t *box, fixed_t x, fixed_t y); boolean M_PointInBox(fixed_t *box, fixed_t x, fixed_t y);
boolean M_CircleTouchBox(fixed_t *box, fixed_t circlex, fixed_t circley, fixed_t circleradius); boolean M_CircleTouchBox(fixed_t *box, fixed_t circlex, fixed_t circley, fixed_t circleradius);
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

Some files were not shown because too many files have changed in this diff Show more