Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 2212-pre1
  • 2212-pre2
  • 2212-pre3
  • 2212-rc1
  • 2213
  • 2214-pre1
  • 2214-pre2
  • 2214-pre3
  • 2214-pre4
  • 2_2_12
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • acs
  • action-args
  • alpha-fixes
  • any-resolution
  • appveyor
  • better-distance-math
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • clipmidtex
  • cmake-valgrind
  • crawlacommander-sprites
  • custom-map-names
  • custom-teams
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile2
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • extra-textures
  • few-kart-lua-changes
  • ffloorclip
  • fix-167
  • fix-cvar-conflicts
  • fix-opengl-parameter-crash
  • fix-opengl-shear-roll
  • flipfuncpointers
  • fof-lightlist-fixes
  • font-FUCK
  • frictionrefactor
  • fuck-macros-1
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • gametype-refactor
  • gametype-refactor-1
  • gametype-refactor-player-spawns
  • ghost-networking
  • gif-splitting
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-maxconditionsets
  • increase-packet-tics
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • just-in-case
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-change-gametype
  • lua-command-netids
  • lua-gfx-2
  • lua-gfx-sprites
  • lua-local
  • makefile-auto-mingw-gcc
  • makefile-tinkering
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.12
  • SRB2_release_2.2.13
  • SRB2_release_2.2.15
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
142 results

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
  • voltybystorm/SRB2
  • ZenithNeko/srb-2-xp
  • Nep2Disk/SRB2
120 results
Select Git revision
Show changes
Commits on Source (254)
version: 2.2.14.{branch}-{build} version: 2.2.16.{branch}-{build}
os: MinGW os: MinGW
environment: environment:
......
...@@ -104,6 +104,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ...@@ -104,6 +104,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
lua_hudlib_drawlist.c lua_hudlib_drawlist.c
lua_colorlib.c lua_colorlib.c
lua_inputlib.c lua_inputlib.c
lua_interceptlib.c
) )
# This updates the modification time for comptime.c at the # This updates the modification time for comptime.c at the
...@@ -143,7 +144,7 @@ if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows") ...@@ -143,7 +144,7 @@ if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
endif() endif()
endif() endif()
target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17) target_compile_features(SRB2SDL2 PRIVATE c_std_23 cxx_std_17)
### Configuration ### Configuration
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
...@@ -192,9 +193,6 @@ endif() ...@@ -192,9 +193,6 @@ endif()
target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE) target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
set(SRB2_HAVE_THREADS ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
if("${SRB2_CONFIG_HWRENDER}") if("${SRB2_CONFIG_HWRENDER}")
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER) target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_subdirectory(hardware) add_subdirectory(hardware)
......
...@@ -13,10 +13,7 @@ ifdef MINGW ...@@ -13,10 +13,7 @@ ifdef MINGW
libs+=-mconsole libs+=-mconsole
endif endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=dedicated/i_threads.c sources+=dedicated/i_threads.c
endif
NOOPENMPT=1 NOOPENMPT=1
NOGME=1 NOGME=1
......
...@@ -43,10 +43,7 @@ sources+=sdl/mixer_sound.c ...@@ -43,10 +43,7 @@ sources+=sdl/mixer_sound.c
endif endif
endif endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG ifdef SDL_PKGCONFIG
$(eval $(call Use_pkg_config,SDL)) $(eval $(call Use_pkg_config,SDL))
......
...@@ -98,3 +98,4 @@ lua_hudlib.c ...@@ -98,3 +98,4 @@ lua_hudlib.c
lua_hudlib_drawlist.c lua_hudlib_drawlist.c
lua_inputlib.c lua_inputlib.c
lua_colorlib.c lua_colorlib.c
lua_interceptlib.c
...@@ -39,13 +39,26 @@ ...@@ -39,13 +39,26 @@
// Allow scripters to write files of these types to SRB2's folder // Allow scripters to write files of these types to SRB2's folder
static const char *whitelist[] = { static const char *whitelist[] = {
".bmp",
".cfg",
".csv",
".dat", ".dat",
".bin",
".bmp",
".png", ".png",
".sav2",
".obj",
".json",
".yaml",
".xml",
".csv",
".soc",
".cfg",
".ini",
".txt", ".txt",
".log",
".md",
".sav2",
}; };
...@@ -183,7 +196,7 @@ void MakePathDirs(char *path) ...@@ -183,7 +196,7 @@ void MakePathDirs(char *path)
} }
static int CheckFileName(lua_State *L, const char *filename) static int CheckFileName(lua_State* L, const char* filename, boolean extensioncheck)
{ {
int length = strlen(filename); int length = strlen(filename);
boolean pass = false; boolean pass = false;
...@@ -195,12 +208,20 @@ static int CheckFileName(lua_State *L, const char *filename) ...@@ -195,12 +208,20 @@ static int CheckFileName(lua_State *L, const char *filename)
return pushresult(L, 0, filename); return pushresult(L, 0, filename);
} }
if (extensioncheck)
{
for (i = 0; i < (sizeof(whitelist) / sizeof(const char*)); i++) for (i = 0; i < (sizeof(whitelist) / sizeof(const char*)); i++)
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i])) if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
{ {
pass = true; pass = true;
break; break;
} }
}
else
{
pass = true;
}
if (strstr(filename, "./") if (strstr(filename, "./")
|| strstr(filename, "..") || strchr(filename, ':') || strstr(filename, "..") || strchr(filename, ':')
|| filename[0] == '/' || filename[0] == '/'
...@@ -218,7 +239,7 @@ static int io_open (lua_State *L) { ...@@ -218,7 +239,7 @@ static int io_open (lua_State *L) {
const char *mode = luaL_optstring(L, 2, "r"); const char *mode = luaL_optstring(L, 2, "r");
int checkresult; int checkresult;
checkresult = CheckFileName(L, filename); checkresult = CheckFileName(L, filename, false);
if (checkresult) if (checkresult)
return checkresult; return checkresult;
...@@ -241,7 +262,10 @@ static int io_openlocal (lua_State *L) { ...@@ -241,7 +262,10 @@ static int io_openlocal (lua_State *L) {
luafiletransfer_t *filetransfer; luafiletransfer_t *filetransfer;
int checkresult; int checkresult;
checkresult = CheckFileName(L, filename); // Decision was made for normal reading (binary + text) to have no whitelist restrictions
boolean readcheck = (strchr(mode, 'w') != NULL) || (strchr(mode, 'a') != NULL) || (strchr(mode, '+') != NULL);
checkresult = CheckFileName(L, filename, readcheck);
if (checkresult) if (checkresult)
return checkresult; return checkresult;
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
/// ///
/// code shamelessly inspired by the QuakeC sources, thanks Id :) /// code shamelessly inspired by the QuakeC sources, thanks Id :)
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#include "command.h" #include "command.h"
...@@ -277,7 +281,11 @@ void COM_BufExecute(void) ...@@ -277,7 +281,11 @@ void COM_BufExecute(void)
/** Executes a string immediately. Used for skirting around WAIT commands. /** Executes a string immediately. Used for skirting around WAIT commands.
*/ */
void COM_ImmedExecute(const char *ptext) void
#ifdef __EMSCRIPTEN__
EMSCRIPTEN_KEEPALIVE
#endif
COM_ImmedExecute(const char *ptext)
{ {
size_t i = 0, j = 0; size_t i = 0, j = 0;
char line[1024] = ""; char line[1024] = "";
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "m_menu.h" #include "m_menu.h"
#include "filesrch.h" #include "filesrch.h"
#include "m_misc.h" #include "m_misc.h"
#include "lua_libs.h"
#ifdef _WINDOWS #ifdef _WINDOWS
#include "win32/win_main.h" #include "win32/win_main.h"
...@@ -45,15 +46,10 @@ ...@@ -45,15 +46,10 @@
#define MAXHUDLINES 20 #define MAXHUDLINES 20
#ifdef HAVE_THREADS
I_mutex con_mutex; I_mutex con_mutex;
# define Lock_state() I_lock_mutex(&con_mutex) # define Lock_state() I_lock_mutex(&con_mutex)
# define Unlock_state() I_unlock_mutex(con_mutex) # define Unlock_state() I_unlock_mutex(con_mutex)
#else/*HAVE_THREADS*/
# define Lock_state()
# define Unlock_state()
#endif/*HAVE_THREADS*/
static boolean con_started = false; // console has been initialised static boolean con_started = false; // console has been initialised
boolean con_startup = false; // true at game startup boolean con_startup = false; // true at game startup
...@@ -918,6 +914,22 @@ static void CON_InputDelChar(void) ...@@ -918,6 +914,22 @@ static void CON_InputDelChar(void)
// ---- // ----
// //
//
// Same as CON_Responder, but is process before everything else, so it cannot be blocked.
//
boolean CON_PreResponder(event_t *ev)
{
if (ev->type == ev_keydown && shiftdown == 1 && ev->key == KEY_ESCAPE)
{
I_SetTextInputMode(con_destlines == 0 ? true : textinputmodeenabledbylua); // inverse, since this is changed next tic.
consoletoggle = true;
return true;
}
return false;
}
//
// Handles console key input // Handles console key input
// //
boolean CON_Responder(event_t *ev) boolean CON_Responder(event_t *ev)
...@@ -954,7 +966,10 @@ boolean CON_Responder(event_t *ev) ...@@ -954,7 +966,10 @@ boolean CON_Responder(event_t *ev)
if ((key == gamecontrol[GC_CONSOLE][0] || key == gamecontrol[GC_CONSOLE][1]) && !shiftdown) if ((key == gamecontrol[GC_CONSOLE][0] || key == gamecontrol[GC_CONSOLE][1]) && !shiftdown)
{ {
I_SetTextInputMode(con_destlines == 0); // inverse, since this is changed next tic. if (con_destlines == 0 && I_GetTextInputMode())
return false; // some other component is holding keyboard input, don't hijack it!
I_SetTextInputMode(con_destlines == 0 ? true : textinputmodeenabledbylua); // inverse, since this is changed next tic.
consoletoggle = true; consoletoggle = true;
return true; return true;
} }
...@@ -974,7 +989,7 @@ boolean CON_Responder(event_t *ev) ...@@ -974,7 +989,7 @@ boolean CON_Responder(event_t *ev)
// escape key toggle off console // escape key toggle off console
if (key == KEY_ESCAPE) if (key == KEY_ESCAPE)
{ {
I_SetTextInputMode(false); I_SetTextInputMode(textinputmodeenabledbylua);
consoletoggle = true; consoletoggle = true;
return true; return true;
} }
...@@ -1342,11 +1357,11 @@ static void CON_Print(char *msg) ...@@ -1342,11 +1357,11 @@ static void CON_Print(char *msg)
return; return;
if (*msg == '\3') // chat text, makes ding sound if (*msg == '\3') // chat text, makes ding sound
S_StartSound(NULL, sfx_radio); S_StartSoundFromEverywhere(sfx_radio);
else if (*msg == '\4') // chat action, dings and is in yellow else if (*msg == '\4') // chat action, dings and is in yellow
{ {
*msg = '\x82'; // yellow *msg = '\x82'; // yellow
S_StartSound(NULL, sfx_radio); S_StartSoundFromEverywhere(sfx_radio);
} }
Lock_state(); Lock_state();
...@@ -1737,6 +1752,8 @@ static void CON_DrawBackpic(void) ...@@ -1737,6 +1752,8 @@ static void CON_DrawBackpic(void)
// Cache the patch. // Cache the patch.
con_backpic = W_CachePatchNum(piclump, PU_PATCH); con_backpic = W_CachePatchNum(piclump, PU_PATCH);
if (con_backpic == NULL)
return;
// Center the backpic, and draw a vertically cropped patch. // Center the backpic, and draw a vertically cropped patch.
w = con_backpic->width * vid.dup; w = con_backpic->width * vid.dup;
......
...@@ -19,11 +19,10 @@ void CON_Init(void); ...@@ -19,11 +19,10 @@ void CON_Init(void);
void CON_StartRefresh(void); void CON_StartRefresh(void);
void CON_StopRefresh(void); void CON_StopRefresh(void);
boolean CON_PreResponder(event_t *ev);
boolean CON_Responder(event_t *ev); boolean CON_Responder(event_t *ev);
#ifdef HAVE_THREADS
extern I_mutex con_mutex; extern I_mutex con_mutex;
#endif
// set true when screen size has changed, to adapt console // set true when screen size has changed, to adapt console
extern boolean con_recalc; extern boolean con_recalc;
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
/// plus functions to parse command line parameters, configure game /// plus functions to parse command line parameters, configure game
/// parameters, and call the startup functions. /// parameters, and call the startup functions.
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -93,6 +97,7 @@ ...@@ -93,6 +97,7 @@
#endif #endif
#include "lua_script.h" #include "lua_script.h"
#include "lua_hud.h"
// Version numbers for netplay :upside_down_face: // Version numbers for netplay :upside_down_face:
int VERSION; int VERSION;
...@@ -227,6 +232,9 @@ void D_ProcessEvents(void) ...@@ -227,6 +232,9 @@ void D_ProcessEvents(void)
} }
} }
if (CON_PreResponder(ev))
continue;
// Screenshots over everything so that they can be taken anywhere. // Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev)) if (M_ScreenshotResponder(ev))
continue; // ate the event continue; // ate the event
...@@ -244,15 +252,11 @@ void D_ProcessEvents(void) ...@@ -244,15 +252,11 @@ void D_ProcessEvents(void)
} }
// Menu input // Menu input
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex); I_lock_mutex(&m_menu_mutex);
#endif
{ {
eaten = M_Responder(ev); eaten = M_Responder(ev);
} }
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex); I_unlock_mutex(m_menu_mutex);
#endif
if (eaten) if (eaten)
continue; // menu ate the event continue; // menu ate the event
...@@ -264,15 +268,11 @@ void D_ProcessEvents(void) ...@@ -264,15 +268,11 @@ void D_ProcessEvents(void)
} }
// console input // console input
#ifdef HAVE_THREADS
I_lock_mutex(&con_mutex); I_lock_mutex(&con_mutex);
#endif
{ {
eaten = CON_Responder(ev); eaten = CON_Responder(ev);
} }
#ifdef HAVE_THREADS
I_unlock_mutex(con_mutex); I_unlock_mutex(con_mutex);
#endif
if (eaten) if (eaten)
continue; // ate the event continue; // ate the event
...@@ -575,7 +575,7 @@ static void D_Display(void) ...@@ -575,7 +575,7 @@ static void D_Display(void)
V_SetPalette(0); V_SetPalette(0);
// draw pause pic // draw pause pic
if (paused && cv_showhud.value && (!menuactive || netgame)) if (paused && cv_showhud.value && LUA_HudEnabled(hud_pause) && (!menuactive || netgame))
{ {
#if 0 #if 0
INT32 py; INT32 py;
...@@ -596,13 +596,9 @@ static void D_Display(void) ...@@ -596,13 +596,9 @@ static void D_Display(void)
// vid size change is now finished if it was on... // vid size change is now finished if it was on...
vid.recalc = 0; vid.recalc = 0;
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex); I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of everything M_Drawer(); // menu is drawn even on top of everything
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex); I_unlock_mutex(m_menu_mutex);
#endif
// focus lost moved to M_Drawer // focus lost moved to M_Drawer
CON_Drawer(); CON_Drawer();
...@@ -705,16 +701,11 @@ static void D_Display(void) ...@@ -705,16 +701,11 @@ static void D_Display(void)
tic_t rendergametic; tic_t rendergametic;
static void D_RunFrame(void);
static tic_t oldentertics = 0;
void D_SRB2Loop(void) void D_SRB2Loop(void)
{ {
tic_t entertic = 0, oldentertics = 0, realtics = 0, rendertimeout = INFTICS;
double deltatics = 0.0;
double deltasecs = 0.0;
static lumpnum_t gstartuplumpnum;
boolean interp = false;
boolean doDisplay = false;
if (dedicated) if (dedicated)
server = true; server = true;
...@@ -750,21 +741,68 @@ void D_SRB2Loop(void) ...@@ -750,21 +741,68 @@ void D_SRB2Loop(void)
// hack to start on a nice clear console screen. // hack to start on a nice clear console screen.
COM_ImmedExecute("cls;version"); COM_ImmedExecute("cls;version");
#ifdef __EMSCRIPTEN__
EM_ASM(
try {
StartedMainLoopCallback();
} catch (err) {
console.log('Faild to find StartedMainLoopCallback()');
}
);
#endif
I_FinishUpdate(); // page flip or blit buffer I_FinishUpdate(); // page flip or blit buffer
/* /*
LMFAO this was showing garbage under OpenGL LMFAO this was showing garbage under OpenGL
because I_FinishUpdate was called afterward because I_FinishUpdate was called afterward
*/ */
/* Smells like a hack... Don't fade Sonic's ass into the title screen. */ /* Smells like a hack... Don't fade Sonic's ass into the title screen. */
if (gamestate != GS_TITLESCREEN) if (gamestate != GS_TITLESCREEN)
{ {
gstartuplumpnum = W_CheckNumForPatchName("STARTUP"); lumpnum_t gstartuplumpnum = W_CheckNumForPatchName("STARTUP");
if (gstartuplumpnum == LUMPERROR) if (gstartuplumpnum == LUMPERROR)
gstartuplumpnum = W_GetNumForPatchName("MISSING"); gstartuplumpnum = W_GetNumForPatchName("MISSING");
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(gstartuplumpnum, PU_PATCH)); V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(gstartuplumpnum, PU_PATCH));
} }
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(D_RunFrame, 0, 1);
#else
for (;;) for (;;)
{
D_RunFrame();
}
#endif
}
static boolean D_LockFrame = false;
#ifdef __EMSCRIPTEN__
int EMSCRIPTEN_KEEPALIVE pause_loop(void)
{
D_LockFrame = true;
emscripten_pause_main_loop();
return 0;
}
int EMSCRIPTEN_KEEPALIVE resume_loop(void)
{
D_LockFrame = false;
emscripten_resume_main_loop();
return 0;
}
#endif
static void D_RunFrame(void)
{
static tic_t entertic = 0, realtics = 0, rendertimeout = INFTICS;
static double deltatics = 0.0;
static double deltasecs = 0.0;
static boolean interp = false;
static boolean doDisplay = false;
if (!D_LockFrame)
{ {
// capbudget is the minimum precise_t duration of a single loop iteration // capbudget is the minimum precise_t duration of a single loop iteration
precise_t capbudget; precise_t capbudget;
...@@ -920,6 +958,7 @@ void D_SRB2Loop(void) ...@@ -920,6 +958,7 @@ void D_SRB2Loop(void)
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision(); deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
deltatics = deltasecs * NEWTICRATE; deltatics = deltasecs * NEWTICRATE;
} }
return;
} }
// //
...@@ -1367,9 +1406,6 @@ void D_SRB2Main(void) ...@@ -1367,9 +1406,6 @@ void D_SRB2Main(void)
P_SetRandSeed(M_RandomizedSeed()); P_SetRandSeed(M_RandomizedSeed());
if (M_CheckParm("-password") && M_IsNextParm())
D_SetPassword(M_GetNextParm());
// player setup menu colors must be initialized before // player setup menu colors must be initialized before
// any wad file is added, as they may contain colors themselves // any wad file is added, as they may contain colors themselves
M_InitPlayerSetupColors(); M_InitPlayerSetupColors();
...@@ -1377,6 +1413,9 @@ void D_SRB2Main(void) ...@@ -1377,6 +1413,9 @@ void D_SRB2Main(void)
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n"); CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
Z_Init(); Z_Init();
if (M_CheckParm("-password") && M_IsNextParm())
D_SetPassword(M_GetNextParm());
clientGamedata = M_NewGameDataStruct(); clientGamedata = M_NewGameDataStruct();
serverGamedata = M_NewGameDataStruct(); serverGamedata = M_NewGameDataStruct();
......
...@@ -28,18 +28,11 @@ ...@@ -28,18 +28,11 @@
// To compile this as "ANSI C with classes" we will need to handle the various // To compile this as "ANSI C with classes" we will need to handle the various
// action functions cleanly. // action functions cleanly.
// //
typedef void (*actionf_v)();
typedef void (*actionf_p1)(void *); typedef void (*actionf_p1)(void *);
typedef union
{
actionf_v acv;
actionf_p1 acp1;
} actionf_t;
// Historically, "think_t" is yet another function pointer to a routine // Historically, "think_t" is yet another function pointer to a routine
// to handle an actor. // to handle an actor.
typedef actionf_t think_t; typedef actionf_p1 think_t;
// Doubly linked list of actors. // Doubly linked list of actors.
typedef struct thinker_s typedef struct thinker_s
......
...@@ -1181,10 +1181,8 @@ static void I_RegisterSignals (void) ...@@ -1181,10 +1181,8 @@ static void I_RegisterSignals (void)
INT32 I_StartupSystem(void) INT32 I_StartupSystem(void)
{ {
#ifdef HAVE_THREADS
I_start_threads(); I_start_threads();
I_AddExitFunc(I_stop_threads); I_AddExitFunc(I_stop_threads);
#endif
I_StartupConsole(); I_StartupConsole();
I_RegisterSignals(); I_RegisterSignals();
#ifndef NOMUMBLE #ifndef NOMUMBLE
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "../i_threads.h" #include "../i_threads.h"
#include "../doomdef.h" #include "../doomdef.h"
#include "../doomtype.h"
typedef struct thread_s thread_t; typedef struct thread_s thread_t;
...@@ -42,10 +41,11 @@ static void *HandleThread(void *data) ...@@ -42,10 +41,11 @@ static void *HandleThread(void *data)
return NULL; return NULL;
} }
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata) int I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
{ {
thread_t *thread; thread_t *thread;
(void)name; (void)name;
pthread_mutex_lock(&thread_lock); pthread_mutex_lock(&thread_lock);
thread = thread_list; thread = thread_list;
while (thread != NULL) while (thread != NULL)
...@@ -69,6 +69,13 @@ void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata) ...@@ -69,6 +69,13 @@ void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
thread->userdata = userdata; thread->userdata = userdata;
pthread_create(&thread->thread, NULL, HandleThread, thread); pthread_create(&thread->thread, NULL, HandleThread, thread);
pthread_mutex_unlock(&thread_lock); pthread_mutex_unlock(&thread_lock);
return true;
}
int I_can_thread(void)
{
return true;
} }
int I_thread_is_stopped(void) int I_thread_is_stopped(void)
......
...@@ -188,7 +188,7 @@ static inline int lib_freeslot(lua_State *L) ...@@ -188,7 +188,7 @@ static inline int lib_freeslot(lua_State *L)
// Arguments: mobj_t actor, int var1, int var2 // Arguments: mobj_t actor, int var1, int var2
static int action_call(lua_State *L) static int action_call(lua_State *L)
{ {
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION)); actionf_p1 *action = *((actionf_p1 **)luaL_checkudata(L, 1, META_ACTION));
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
var1 = (INT32)luaL_optinteger(L, 3, 0); var1 = (INT32)luaL_optinteger(L, 3, 0);
...@@ -199,7 +199,7 @@ static int action_call(lua_State *L) ...@@ -199,7 +199,7 @@ static int action_call(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
} }
action->acp1(actor); (*action)(actor);
return 0; return 0;
} }
...@@ -632,7 +632,7 @@ FUNCINLINE static ATTRINLINE int getEnum(lua_State *L, boolean mathlib, const ch ...@@ -632,7 +632,7 @@ FUNCINLINE static ATTRINLINE int getEnum(lua_State *L, boolean mathlib, const ch
{ {
if (fasticmp(word, actionpointers[i].name)) if (fasticmp(word, actionpointers[i].name))
{ {
// We push the actionf_t* itself as userdata! // We push the actionf_p1* itself as userdata!
LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION); LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION);
return 1; return 1;
} }
...@@ -770,7 +770,7 @@ static int lib_getActionName(lua_State *L) ...@@ -770,7 +770,7 @@ static int lib_getActionName(lua_State *L)
{ {
if (lua_isuserdata(L, 1)) // arg 1 is built-in action, expect action userdata if (lua_isuserdata(L, 1)) // arg 1 is built-in action, expect action userdata
{ {
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION)); actionf_p1 *action = *((actionf_p1 **)luaL_checkudata(L, 1, META_ACTION));
const char *name = NULL; const char *name = NULL;
if (!action) if (!action)
return luaL_error(L, "not a valid action?"); return luaL_error(L, "not a valid action?");
...@@ -840,11 +840,11 @@ int LUA_SOCLib(lua_State *L) ...@@ -840,11 +840,11 @@ int LUA_SOCLib(lua_State *L)
const char *LUA_GetActionName(void *action) const char *LUA_GetActionName(void *action)
{ {
actionf_t *act = (actionf_t *)action; actionf_p1 *act = (actionf_p1 *)action;
size_t z; size_t z;
for (z = 0; actionpointers[z].name; z++) for (z = 0; actionpointers[z].name; z++)
{ {
if (actionpointers[z].action.acv == act->acv) if (actionpointers[z].action == *act)
return actionpointers[z].name; return actionpointers[z].name;
} }
return NULL; return NULL;
...@@ -859,8 +859,6 @@ void LUA_SetActionByName(void *state, const char *actiontocompare) ...@@ -859,8 +859,6 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
if (fasticmp(actiontocompare, actionpointers[z].name)) if (fasticmp(actiontocompare, actionpointers[z].name))
{ {
st->action = actionpointers[z].action; st->action = actionpointers[z].action;
st->action.acv = actionpointers[z].action.acv; // assign
st->action.acp1 = actionpointers[z].action.acp1;
return; return;
} }
} }
......
...@@ -2844,7 +2844,7 @@ void readframe(MYFILE *f, INT32 num) ...@@ -2844,7 +2844,7 @@ void readframe(MYFILE *f, INT32 num)
for (z = 0; actionpointers[z].name; z++) for (z = 0; actionpointers[z].name; z++)
{ {
if (actionpointers[z].action.acv == states[num].action.acv) if (actionpointers[z].action == states[num].action)
break; break;
} }
...@@ -2856,8 +2856,6 @@ void readframe(MYFILE *f, INT32 num) ...@@ -2856,8 +2856,6 @@ void readframe(MYFILE *f, INT32 num)
if (fastcmp(actiontocompare, actionpointers[z].name)) if (fastcmp(actiontocompare, actionpointers[z].name))
{ {
states[num].action = actionpointers[z].action; states[num].action = actionpointers[z].action;
states[num].action.acv = actionpointers[z].action.acv; // assign
states[num].action.acp1 = actionpointers[z].action.acp1;
found = true; found = true;
break; break;
} }
...@@ -3490,6 +3488,18 @@ static void readcondition(UINT8 set, UINT32 id, char *word2) ...@@ -3490,6 +3488,18 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
return; return;
} }
} }
else if (fastcmp(params[0], "LUA"))
{
PARAMCHECK(1);
ty = UC_LUA;
re = atoi(params[1]);
if (re <= 0 || re > MAXLUACONDITIONS)
{
deh_warning("Lua condition %d out of range (1 - %d)", re, MAXLUACONDITIONS);
return;
}
}
else if (fastcmp(params[0], "CONDITIONSET")) else if (fastcmp(params[0], "CONDITIONSET"))
{ {
PARAMCHECK(1); PARAMCHECK(1);
......
This diff is collapsed.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define __DEH_TABLES_H__ #define __DEH_TABLES_H__
#include "doomdef.h" // Constants #include "doomdef.h" // Constants
#include "d_think.h" // actionf_t #include "d_think.h" // actionf_p1
#include "info.h" // Mobj, state, sprite, etc constants #include "info.h" // Mobj, state, sprite, etc constants
#include "lua_script.h" #include "lua_script.h"
...@@ -44,7 +44,7 @@ struct flickytypes_s { ...@@ -44,7 +44,7 @@ struct flickytypes_s {
*/ */
typedef struct typedef struct
{ {
actionf_t action; ///< Function pointer corresponding to the actual action. actionf_p1 action; ///< Function pointer corresponding to the actual action.
const char *name; ///< Name of the action in ALL CAPS. const char *name; ///< Name of the action in ALL CAPS.
} actionpointer_t; } actionpointer_t;
......
...@@ -77,6 +77,31 @@ typedef struct ...@@ -77,6 +77,31 @@ typedef struct
INT16 x, y; INT16 x, y;
}ATTRPACK mapvertex_t; }ATTRPACK mapvertex_t;
typedef enum {
UDMF_TYPE_STRING,
UDMF_TYPE_FIXED,
UDMF_TYPE_NUMERIC,
UDMF_TYPE_BOOLEAN
} udmf_field_type_t;
typedef union { // v added to avoid random compilers cry about nonsense
char* vstring;
fixed_t vfloat;
INT32 vint;
boolean vbool;
} udmf_field_value_t;
// UDMF's Custom Arguments
typedef struct customargs_s
{
char* name;
udmf_field_type_t type;
udmf_field_value_t value;
struct customargs_s* next;
}ATTRPACK customargs_t;
// A SideDef, defining the visual appearance of a wall, // A SideDef, defining the visual appearance of a wall,
// by setting textures and offsets. // by setting textures and offsets.
typedef struct typedef struct
...@@ -218,6 +243,7 @@ typedef struct ...@@ -218,6 +243,7 @@ typedef struct
fixed_t spritexscale, spriteyscale; fixed_t spritexscale, spriteyscale;
INT32 args[NUMMAPTHINGARGS]; INT32 args[NUMMAPTHINGARGS];
char *stringargs[NUMMAPTHINGSTRINGARGS]; char *stringargs[NUMMAPTHINGSTRINGARGS];
struct customargs_s* customargs;
struct mobj_s *mobj; struct mobj_s *mobj;
} mapthing_t; } mapthing_t;
......
...@@ -703,7 +703,9 @@ extern int ...@@ -703,7 +703,9 @@ extern int
/// This stops the game from storing backups of the states, sprites, and mobjinfo tables. /// This stops the game from storing backups of the states, sprites, and mobjinfo tables.
/// Though this info is compressed under normal circumstances, it's still a lot of extra /// Though this info is compressed under normal circumstances, it's still a lot of extra
/// memory that never gets touched. /// memory that never gets touched.
#if !(defined (__EMSCRIPTEN__) && (__SIZEOF_SIZE_T__ == 4))
#define ALLOW_RESETDATA #define ALLOW_RESETDATA
#endif
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.) /// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG //#define REDSANALOG
...@@ -731,7 +733,7 @@ extern int ...@@ -731,7 +733,7 @@ extern int
/// Maintain compatibility with older 2.2 demos /// Maintain compatibility with older 2.2 demos
#define OLD22DEMOCOMPAT #define OLD22DEMOCOMPAT
#ifdef HAVE_CURL #if defined (HAVE_CURL) && !(defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__))
#define MASTERSERVER #define MASTERSERVER
#else #else
#undef UPDATE_ALERT #undef UPDATE_ALERT
......
...@@ -110,7 +110,7 @@ int startswith (const char *base, const char *tag); ...@@ -110,7 +110,7 @@ int startswith (const char *base, const char *tag);
int endswith (const char *base, const char *tag); int endswith (const char *base, const char *tag);
char *xstrtok(char *line, const char *delims); char *xstrtok(char *line, const char *delims);
#if defined (_WIN32) || defined (__HAIKU__) #if defined (_WIN32) || defined (__HAIKU__) || defined (__EMSCRIPTEN__)
#define HAVE_DOSSTR_FUNCS #define HAVE_DOSSTR_FUNCS
#endif #endif
...@@ -156,6 +156,7 @@ typedef int32_t boolean; ...@@ -156,6 +156,7 @@ typedef int32_t boolean;
#endif #endif
#ifndef __cplusplus #ifndef __cplusplus
#ifndef __bool_true_false_are_defined
#ifndef _WIN32 #ifndef _WIN32
enum {false = 0, true = 1}; enum {false = 0, true = 1};
#else #else
...@@ -163,6 +164,7 @@ enum {false = 0, true = 1}; ...@@ -163,6 +164,7 @@ enum {false = 0, true = 1};
#define true TRUE #define true TRUE
#endif #endif
#endif #endif
#endif
/* 7.18.2.1 Limits of exact-width integer types */ /* 7.18.2.1 Limits of exact-width integer types */
...@@ -245,6 +247,8 @@ enum {false = 0, true = 1}; ...@@ -245,6 +247,8 @@ enum {false = 0, true = 1};
#define FUNCNOINLINE __attribute__((noinline)) #define FUNCNOINLINE __attribute__((noinline))
#define FUNCWARNRV __attribute__((warn_unused_result))
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
#ifdef __i386__ // i386 only #ifdef __i386__ // i386 only
#define FUNCTARGET(X) __attribute__ ((__target__ (X))) #define FUNCTARGET(X) __attribute__ ((__target__ (X)))
...@@ -296,6 +300,9 @@ enum {false = 0, true = 1}; ...@@ -296,6 +300,9 @@ enum {false = 0, true = 1};
#ifndef FUNCTARGET #ifndef FUNCTARGET
#define FUNCTARGET(x) #define FUNCTARGET(x)
#endif #endif
#ifndef FUNCWARNRV
#define FUNCWARNRV
#endif
#ifndef ATTRPACK #ifndef ATTRPACK
#define ATTRPACK #define ATTRPACK
#endif #endif
......