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

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
117 results
Select Git revision
Show changes
Commits on Source (178)
version: 2.2.14.{branch}-{build}
version: 2.2.16.{branch}-{build}
os: MinGW
environment:
......
......@@ -21,6 +21,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
console.c
hu_stuff.c
i_time.c
i_threads.c
y_inter.c
st_stuff.c
m_aatree.c
......
......@@ -13,11 +13,6 @@ ifdef MINGW
libs+=-mconsole
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=dedicated/i_threads.c
endif
NOOPENMPT=1
NOGME=1
NOHW=1
......
......@@ -18,6 +18,11 @@ opts+=-DHWRENDER
sources+=$(call List,hardware/Sourcefile)
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=i_threads.c
endif
ifndef NOMD5
sources+=md5.c
endif
......
......@@ -43,11 +43,6 @@ sources+=sdl/mixer_sound.c
endif
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG
$(eval $(call Use_pkg_config,SDL))
else
......
......@@ -85,7 +85,7 @@ endif
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef DEBUGMODE
WFLAGS+=-Wno-error=inline
WFLAGS+=-Wno-inline
endif
ifdef GCC43
WFLAGS+=-funit-at-a-time
......@@ -152,12 +152,8 @@ else
endif
ifdef DEBUGMODE
ifdef GCC48
opts+=-Og
else
opts+=-O0
endif
endif
ifdef VALGRIND
ifdef GCC46
......
......@@ -27,23 +27,8 @@ void I_SetPalette(RGBA_t *palette)
(void)palette;
}
INT32 VID_NumModes(void)
{
return 1;
}
INT32 VID_GetModeForSize(INT32 w, INT32 h)
{
(void)w;
(void)h;
return 0;
}
void VID_PrepareModeList(void){}
INT32 VID_SetMode(INT32 modenum)
{
vid.modenum = 0;
vid.width = 320;
vid.height = 240;
vid.bpp = 1;
......@@ -61,11 +46,6 @@ void VID_CheckGLLoaded(rendermode_t oldrender)
(void)oldrender;
}
const char *VID_GetModeName(INT32 modenum)
{
return "A320x240";
}
void I_UpdateNoBlit(void){}
void I_FinishUpdate(void) {
......
......@@ -625,7 +625,7 @@ void B_HandleFlightIndicator(player_t *player)
}
// if the mobj isn't a flight indicator, let's not mess with it
if (tails->hnext->type != MT_OVERLAY || (tails->hnext->state != states+S_FLIGHTINDICATOR))
if (tails->hnext->type != MT_OVERLAY || (tails->hnext->state->num != S_FLIGHTINDICATOR))
return;
// if it shouldn't exist, remove it
......
......@@ -85,7 +85,7 @@ CV_PossibleValue_t CV_TrueFalse[] = {{0, "False"}, {1, "True"}, {0, NULL}};
// First implementation is 26 (2.1.21), so earlier configs default at 25 (2.1.20)
// Also set CV_HIDEN during runtime, after config is loaded
static boolean execversion_enabled = false;
consvar_t cv_execversion = CVAR_INIT ("execversion","25",CV_CALL,CV_Unsigned, CV_EnforceExecVersion);
consvar_t cv_execversion = CVAR_INIT ("execversion", "25", NULL, CV_CALL, CV_Unsigned, CV_EnforceExecVersion);
// for default joyaxis detection
static boolean joyaxis_default = false;
......@@ -315,6 +315,7 @@ void COM_ImmedExecute(const char *ptext)
typedef struct xcommand_s
{
const char *name;
const char *desc;
struct xcommand_s *next;
com_func_t function;
com_flags_t flags;
......@@ -338,17 +339,17 @@ void COM_Init(void)
VS_Alloc(&com_text, COM_BUF_SIZE);
// add standard commands
COM_AddCommand("alias", COM_Alias_f, 0);
COM_AddCommand("echo", COM_Echo_f, COM_LUA);
COM_AddCommand("cecho", COM_CEcho_f, COM_LUA);
COM_AddCommand("cechoflags", COM_CEchoFlags_f, COM_LUA);
COM_AddCommand("cechoduration", COM_CEchoDuration_f, COM_LUA);
COM_AddCommand("exec", COM_Exec_f, 0);
COM_AddCommand("wait", COM_Wait_f, 0);
COM_AddCommand("help", COM_Help_f, COM_LUA);
COM_AddCommand("find", COM_Find_f, COM_LUA);
COM_AddCommand("toggle", COM_Toggle_f, COM_LUA);
COM_AddCommand("add", COM_Add_f, COM_LUA);
COM_AddCommand("alias", "Create or list commands that expand to other commands", COM_Alias_f, 0);
COM_AddCommand("echo", "Print the specified text, useful for scripts", COM_Echo_f, COM_LUA);
COM_AddCommand("cecho", "Display text on-screen", COM_CEcho_f, COM_LUA);
COM_AddCommand("cechoflags", NULL, COM_CEchoFlags_f, COM_LUA);
COM_AddCommand("cechoduration", NULL, COM_CEchoDuration_f, COM_LUA);
COM_AddCommand("exec", "Run a script", COM_Exec_f, 0);
COM_AddCommand("wait", NULL, COM_Wait_f, 0);
COM_AddCommand("help", "Show information about a variable or command", COM_Help_f, COM_LUA);
COM_AddCommand("find", "Search commands and variables", COM_Find_f, COM_LUA);
COM_AddCommand("toggle", "Toggle a variable on or off", COM_Toggle_f, COM_LUA);
COM_AddCommand("add", NULL, COM_Add_f, COM_LUA);
RegisterNetXCmd(XD_NETVAR, Got_NetVar);
}
......@@ -487,7 +488,7 @@ static void COM_TokenizeString(char *ptext)
* \param name Name of the command.
* \param func Function called when the command is run.
*/
void COM_AddCommand(const char *name, com_func_t func, com_flags_t flags)
void COM_AddCommand(const char *name, const char *desc, com_func_t func, com_flags_t flags)
{
xcommand_t *cmd;
......@@ -516,6 +517,7 @@ void COM_AddCommand(const char *name, com_func_t func, com_flags_t flags)
cmd = ZZ_Alloc(sizeof *cmd);
cmd->name = name;
cmd->desc = desc;
cmd->function = func;
cmd->flags = flags;
cmd->next = com_commands;
......@@ -527,7 +529,7 @@ void COM_AddCommand(const char *name, com_func_t func, com_flags_t flags)
*
* \param name Name of the command.
*/
int COM_AddLuaCommand(const char *name)
int COM_AddLuaCommand(const char *name, const char *desc)
{
xcommand_t *cmd;
......@@ -549,6 +551,7 @@ int COM_AddLuaCommand(const char *name)
// Add a new command.
cmd = ZZ_Alloc(sizeof *cmd);
cmd->name = name;
cmd->desc = desc;
cmd->function = COM_Lua_f;
cmd->flags = COM_LUA;
cmd->next = com_commands;
......@@ -892,7 +895,12 @@ static void COM_Help_f(void)
{
boolean floatmode = false;
const char *cvalue = NULL;
CONS_Printf("\x82""Variable %s:\n", cvar->name);
CONS_Printf("\x82""Variable %s: \x80", cvar->name);
if (cvar->desc != NULL)
CONS_Printf("%s\n", cvar->desc);
else
CONS_Printf("No description provided\n");
CONS_Printf(M_GetText(" flags: "));
if (cvar->flags & CV_SAVE)
CONS_Printf("AUTOSAVE ");
......@@ -984,14 +992,15 @@ static void COM_Help_f(void)
if (strcmp(cmd->name, help))
continue;
CONS_Printf("\x82""Command %s:\n", cmd->name);
CONS_Printf(" help is not available for commands");
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing <name> without arguments\n");
CONS_Printf("\x82""Command %s: \x80", cmd->name);
if (cmd->desc != NULL)
CONS_Printf("%s\n", cmd->desc);
else
CONS_Printf("No description provided\n");
return;
}
CONS_Printf("No variable or command named %s", help);
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing help without arguments\n");
CONS_Printf("No variable or command named %s\n", help);
}
return;
}
......@@ -1014,8 +1023,7 @@ static void COM_Help_f(void)
CONS_Printf("%s ",cmd->name);
i++;
}
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or type help <command or variable>\n");
CONS_Printf("\n");
CONS_Debug(DBG_GAMELOGIC, "\x82Total : %d\n", i);
}
......@@ -2482,22 +2490,6 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
if (!CV_FilterJoyAxisVars(v, valstr))
return false;
}
if (GETMAJOREXECVERSION(cv_execversion.value) < 57) // 57 = 2.2.16
{
if (
(!stricmp(v->name, "movebob") && atoi(valstr) == FRACUNIT) ||
(!stricmp(v->name, "playersforexit") && atoi(valstr) == 4) || // 4 = all
(!stricmp(v->name, "advancemap") && atoi(valstr) == 1) || // 1 = next
(!stricmp(v->name, "cam_speed") && !stricmp(valstr, "0.3")) ||
(!stricmp(v->name, "cam2_speed") && !stricmp(valstr, "0.3")) ||
(!stricmp(v->name, "timerres") && atoi(valstr) == 0) || // 0 = classic
(!stricmp(v->name, "gr_modelinterpolation")) || // Force reset
(!stricmp(v->name, "fov") && atoi(valstr) == 90)
)
return false;
}
return true;
}
......
......@@ -37,8 +37,8 @@ typedef enum
typedef void (*com_func_t)(void);
void COM_AddCommand(const char *name, com_func_t func, com_flags_t flags);
int COM_AddLuaCommand(const char *name);
void COM_AddCommand(const char *name, const char *desc, com_func_t func, com_flags_t flags);
int COM_AddLuaCommand(const char *name, const char *desc);
size_t COM_Argc(void);
const char *COM_Argv(size_t arg); // if argv > argc, returns empty string
......@@ -137,6 +137,7 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
{
const char *name;
const char *defaultvalue;
const char *desc;
INT32 flags; // flags see cvflags_t above
CV_PossibleValue_t *PossibleValue; // table of possible values
void (*func)(void); // called on change, if CV_CALL set
......@@ -161,7 +162,7 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
struct consvar_s *next;
} consvar_t;
/* name, defaultvalue, flags, PossibleValue, func */
/* name, defaultvalue, desc, flags, PossibleValue, func */
#define CVAR_INIT( ... ) \
{ __VA_ARGS__, NULL, 0, NULL, NULL, {0, {NULL}}, 0U, (char)0, NULL }
......
......@@ -123,23 +123,23 @@ static char con_buffer[CON_BUFFERSIZE];
// how many seconds the hud messages lasts on the screen
// CV_Unsigned can overflow when multiplied by TICRATE later, so let's use a 3-year limit instead
static CV_PossibleValue_t hudtime_cons_t[] = {{0, "MIN"}, {99999999, "MAX"}, {0, NULL}};
static consvar_t cons_hudtime = CVAR_INIT ("con_hudtime", "5", CV_SAVE, hudtime_cons_t, NULL);
static consvar_t cons_hudtime = CVAR_INIT ("con_hudtime", "5", NULL, CV_SAVE, hudtime_cons_t, NULL);
// number of lines displayed on the HUD
static CV_PossibleValue_t hudlines_cons_t[] = {{0, "MIN"}, {MAXHUDLINES, "MAX"}, {0, NULL}};
static consvar_t cons_hudlines = CVAR_INIT ("con_hudlines", "5", CV_CALL|CV_SAVE, hudlines_cons_t, CONS_hudlines_Change);
static consvar_t cons_hudlines = CVAR_INIT ("con_hudlines", "5", NULL, CV_CALL|CV_SAVE, hudlines_cons_t, CONS_hudlines_Change);
// number of lines console move per frame
// (con_speed needs a limit, apparently)
static CV_PossibleValue_t speed_cons_t[] = {{0, "MIN"}, {64, "MAX"}, {0, NULL}};
static consvar_t cons_speed = CVAR_INIT ("con_speed", "8", CV_SAVE, speed_cons_t, NULL);
static consvar_t cons_speed = CVAR_INIT ("con_speed", "8", NULL, CV_SAVE, speed_cons_t, NULL);
// percentage of screen height to use for console
static consvar_t cons_height = CVAR_INIT ("con_height", "50", CV_CALL|CV_SAVE, CV_Unsigned, CONS_height_Change);
static consvar_t cons_height = CVAR_INIT ("con_height", "50", NULL, CV_CALL|CV_SAVE, CV_Unsigned, CONS_height_Change);
static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"}, {0, NULL}};
// whether to use console background picture, or translucent mode
static consvar_t cons_backpic = CVAR_INIT ("con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL);
static consvar_t cons_backpic = CVAR_INIT ("con_backpic", "translucent", NULL, CV_SAVE, backpic_cons_t, NULL);
static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {2, "Sepia"},
{3, "Brown"}, {4, "Pink"}, {5, "Raspberry"},
......@@ -151,7 +151,7 @@ static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {
{0, NULL}};
consvar_t cons_backcolor = CVAR_INIT ("con_backcolor", "Green", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change);
consvar_t cons_backcolor = CVAR_INIT ("con_backcolor", "Green", "Color of the console background", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change);
static void CON_Print(char *msg);
......@@ -477,7 +477,7 @@ void CON_Init(void)
// register our commands
//
COM_AddCommand("cls", CONS_Clear_f, 0);
COM_AddCommand("cls", "Clear the console", CONS_Clear_f, 0);
//COM_AddCommand("english", CONS_English_f);
// set console full screen for game startup MAKE SURE VID_Init() done !!!
Lock_state();
......@@ -504,7 +504,7 @@ void CON_Init(void)
CV_RegisterVar(&cons_height);
CV_RegisterVar(&cons_backpic);
CV_RegisterVar(&cons_backcolor);
COM_AddCommand("bind", CONS_Bind_f, 0);
COM_AddCommand("bind", "Bind a command to a button", CONS_Bind_f, 0);
}
else
{
......@@ -918,6 +918,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); // inverse, since this is changed next tic.
consoletoggle = true;
return true;
}
return false;
}
//
// Handles console key input
//
boolean CON_Responder(event_t *ev)
......@@ -1557,13 +1573,6 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
//
void CONS_Error(const char *msg)
{
#if defined(RPC_NO_WINDOWS_H) && defined(_WINDOWS)
if (!graphics_started)
{
MessageBoxA(vid.WndParent, msg, "SRB2 Warning", MB_OK);
return;
}
#endif
CONS_Printf("\x82%s", msg); // write error msg in different colour
CONS_Printf(M_GetText("Press ENTER to continue\n"));
......
......@@ -19,6 +19,7 @@ void CON_Init(void);
void CON_StartRefresh(void);
void CON_StopRefresh(void);
boolean CON_PreResponder(event_t *ev);
boolean CON_Responder(event_t *ev);
#ifdef HAVE_THREADS
......@@ -37,7 +38,8 @@ extern boolean con_refresh;
// 0 means console if off, or moving out
extern INT32 con_destlines;
extern UINT32 con_scalefactor; // console text scale factor
// console text scale factor
extern UINT32 con_scalefactor;
extern consvar_t cons_backcolor;
......
......@@ -101,9 +101,6 @@ int SUBVERSION;
// platform independant focus loss
UINT8 window_notinfocus = false;
static addfilelist_t startupwadfiles;
static addfilelist_t startuppwads;
boolean devparm = false; // started game with -devparm
boolean singletics = false; // timedemo
......@@ -227,6 +224,9 @@ void D_ProcessEvents(void)
}
}
if (CON_PreResponder(ev))
continue;
// Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev))
continue; // ate the event
......@@ -328,7 +328,7 @@ static void D_Display(void)
// 4. The frame is ready to be drawn!
// Check for change of renderer or screen size (video mode)
if ((setrenderneeded || setmodeneeded) && !wipe)
if (vid.change.set && !wipe)
SCR_SetMode(); // change video mode
// Recalc the screen
......@@ -509,18 +509,20 @@ static void D_Display(void)
// render the second screen
if (splitscreen && players[secondarydisplayplayer].mo)
{
viewwindowy = vid.height / 2;
#ifdef HWRENDER
if (rendermode == render_opengl)
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(1, &players[secondarydisplayplayer]);
else
#endif
if (rendermode != render_none)
{
viewwindowy = vid.height / 2;
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
R_RenderPlayerView(&players[secondarydisplayplayer]);
viewwindowy = 0;
}
viewwindowy = 0;
......@@ -1123,7 +1125,7 @@ static void ChangeDirForUrlHandler(void)
// Identify the SRB2 version, and IWAD file to use.
// ==========================================================================
static void IdentifyVersion(void)
static void IdentifyVersion(addfilelist_t *startupwadfiles)
{
char *srb2wad;
const char *srb2waddir = NULL;
......@@ -1166,7 +1168,7 @@ static void IdentifyVersion(void)
// Load the IWAD
if (srb2wad != NULL && FIL_ReadFileOK(srb2wad))
D_AddFile(&startupwadfiles, srb2wad);
D_AddFile(startupwadfiles, srb2wad);
else
I_Error("srb2.pk3 not found! Expected in %s, ss file: %s\n", srb2waddir, srb2wad);
......@@ -1177,14 +1179,14 @@ static void IdentifyVersion(void)
// checking in D_SRB2Main
// Add the maps
D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "zones.pk3"));
D_AddFile(startupwadfiles, va(pandf,srb2waddir, "zones.pk3"));
// Add the characters
D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "characters.pk3"));
D_AddFile(startupwadfiles, va(pandf,srb2waddir, "characters.pk3"));
#ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs
D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "patch.pk3"));
D_AddFile(startupwadfiles, va(pandf,srb2waddir, "patch.pk3"));
#endif
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
......@@ -1194,7 +1196,7 @@ static void IdentifyVersion(void)
const char *musicpath = va(pandf,srb2waddir,str);\
int ms = W_VerifyNMUSlumps(musicpath, false); \
if (ms == 1) \
D_AddFile(&startupwadfiles, musicpath); \
D_AddFile(startupwadfiles, musicpath); \
else if (ms == 0) \
I_Error("File "str" has been modified with non-music/sound lumps"); \
}
......@@ -1239,6 +1241,14 @@ void D_SRB2Main(void)
INT32 pstartmap = 1;
boolean autostart = false;
addfilelist_t startupwads;
addfilelist_t startupwadfiles;
startupwads.files = NULL;
startupwads.numfiles = 0;
startupwadfiles.files = NULL;
startupwadfiles.numfiles = 0;
/* break the version string into version numbers, for netplay */
D_ConvertVersionNumbers();
......@@ -1270,6 +1280,9 @@ void D_SRB2Main(void)
// initialise locale code
M_StartupLocale();
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
Z_Init();
// get parameters from a response file (eg: srb2 @parms.txt)
M_FindResponseFile();
......@@ -1283,7 +1296,7 @@ void D_SRB2Main(void)
ChangeDirForUrlHandler();
// identify the main IWAD file to use
IdentifyVersion();
IdentifyVersion(&startupwadfiles);
#if !defined(NOTERMIOS)
setbuf(stdout, NULL); // non-buffered output
......@@ -1367,15 +1380,12 @@ void D_SRB2Main(void)
P_SetRandSeed(M_RandomizedSeed());
if (M_CheckParm("-password") && M_IsNextParm())
D_SetPassword(M_GetNextParm());
// player setup menu colors must be initialized before
// any wad file is added, as they may contain colors themselves
M_InitPlayerSetupColors();
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
Z_Init();
if (M_CheckParm("-password") && M_IsNextParm())
D_SetPassword(M_GetNextParm());
clientGamedata = M_NewGameDataStruct();
serverGamedata = M_NewGameDataStruct();
......@@ -1383,7 +1393,7 @@ void D_SRB2Main(void)
// Do this up here so that WADs loaded through the command line can use ExecCfg
COM_Init();
COM_AddCommand("assert", Command_assert, COM_LUA);
COM_AddCommand("assert", NULL, Command_assert, COM_LUA);
// Add any files specified on the command line with
// "-file <file>" or "-folder <folder>" to the add-on list
......@@ -1401,9 +1411,9 @@ void D_SRB2Main(void)
else if (myargv[i][0] == '-' || myargv[i][0] == '+')
addontype = 0;
else if (addontype == 1)
D_AddFile(&startuppwads, myargv[i]);
D_AddFile(&startupwads, myargv[i]);
else if (addontype == 2)
D_AddFolder(&startuppwads, myargv[i]);
D_AddFolder(&startupwads, myargv[i]);
}
}
......@@ -1429,7 +1439,8 @@ void D_SRB2Main(void)
I_InitializeTime();
// Make backups of some SOCcable tables.
P_BackupTables();
P_InitializeTables();
//P_BackupTables();
mainwads = 3; // doesn't include music.pk3
#ifdef USE_PATCH_DTA
......@@ -1488,11 +1499,11 @@ void D_SRB2Main(void)
CON_StopRefresh(); // Temporarily stop refreshing the screen for wad loading
if (startuppwads.numfiles)
if (startupwads.numfiles)
{
CONS_Printf("W_InitMultipleFiles(): Adding extra PWADs.\n");
W_InitMultipleFiles(&startuppwads);
D_CleanFile(&startuppwads);
W_InitMultipleFiles(&startupwads);
D_CleanFile(&startupwads);
}
CON_StartRefresh(); // Restart the refresh!
......@@ -1513,7 +1524,7 @@ void D_SRB2Main(void)
G_LoadGameData(clientGamedata);
M_CopyGameData(serverGamedata, clientGamedata);
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
allow_fullscreen = true;
// set user default mode or mode set at cmdline
SCR_CheckDefaultMode();
......@@ -1776,7 +1787,7 @@ const char *D_Home(void)
const char *userhome = NULL;
#ifdef ANDROID
return "/data/data/org.srb2/";
return "/data/data/org.srb2classic/";
#endif
if (M_CheckParm("-home") && M_IsNextParm())
......@@ -1865,8 +1876,8 @@ boolean D_IsPathAllowed(const char *path)
// Sort folder paths by longest to shortest so
// overlapping paths work. E.g.:
// Path 1: /home/james/.srb2/addons
// Path 2: /home/james/.srb2
// Path 1: /home/james/.srb2classic/addons
// Path 2: /home/james/.srb2classic
qsort(paths, n_paths, sizeof *paths, cmp_strlen_desc);
// These paths are allowed to be absolute
......
......@@ -7,7 +7,7 @@ rendermode_t chosenrendermode = render_none;
boolean allow_fullscreen = false;
consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", "Has no effect on this build", CV_SAVE, CV_OnOff, NULL);
void I_StartupGraphics(void){}
void I_ShutdownGraphics(void){}
......@@ -19,26 +19,6 @@ void I_SetPalette(RGBA_t *palette)
(void)palette;
}
INT32 VID_NumModes(void)
{
return 0;
}
INT32 VID_GetModeForSize(INT32 w, INT32 h)
{
(void)w;
(void)h;
return 0;
}
void VID_PrepareModeList(void){}
INT32 VID_SetMode(INT32 modenum)
{
(void)modenum;
return 0;
}
boolean VID_CheckRenderer(void)
{
return false;
......@@ -49,12 +29,6 @@ void VID_CheckGLLoaded(rendermode_t oldrender)
(void)oldrender;
}
const char *VID_GetModeName(INT32 modenum)
{
(void)modenum;
return NULL;
}
UINT32 I_GetRefreshRate(void) { return 35; }
void I_UpdateNoBlit(void){}
......@@ -76,3 +50,15 @@ void I_ReadScreen(UINT8 *scr)
void I_BeginRead(void){}
void I_EndRead(void){}
void VID_SetSize(INT32 width, INT32 height)
{
(void)width;
(void)height;
}
boolean VID_IsMaximized(void)
{
return false;
}
void VID_RestoreWindow(void){}
......@@ -12,6 +12,10 @@
#include "deh_lua.h"
#ifdef MUSICSLOT_COMPATIBILITY
#include "deh_soc.h" // for get_mus
#endif
// freeslot takes a name (string only!)
// and allocates it to the appropriate free slot.
// Returns the slot number allocated for it or nil if failed.
......@@ -55,7 +59,7 @@ static inline int lib_freeslot(lua_State *L)
sfxenum_t sfx;
strlwr(word);
CONS_Printf("Sound sfx_%s allocated.\n",word);
sfx = S_AddSoundFx(word, false, 0, false);
sfx = S_AddSoundFx(word, false, 0);
if (sfx != sfx_None) {
lua_pushinteger(L, sfx);
r++;
......@@ -65,56 +69,23 @@ static inline int lib_freeslot(lua_State *L)
else if (fastcmp(type, "SPR"))
{
spritenum_t j;
if (strlen(word) > MAXSPRITENAME)
return luaL_error(L, "Sprite name is longer than %d characters\n", MAXSPRITENAME);
for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++)
{
if (in_bit_array(used_spr, j - SPR_FIRSTFREESLOT))
continue; // Already allocated, next.
// Found a free slot!
CONS_Printf("Sprite SPR_%s allocated.\n",word);
strcpy(sprnames[j], word);
set_bit_array(used_spr, j - SPR_FIRSTFREESLOT); // Okay, this sprite slot has been named now.
// Lua needs to update the value in _G if it exists
LUA_UpdateSprName(word, j);
lua_pushinteger(L, j);
r++;
break;
}
if (j > SPR_LASTFREESLOT)
CONS_Alert(CONS_WARNING, "Ran out of free sprite slots!\n");
CONS_Printf("Sprite SPR_%s allocated.\n",word);
j = P_AllocateSpriteinfo(Z_StrDup(word));
LUA_UpdateSprName(word, j);
lua_pushinteger(L, j);
r++;
}
else if (fastcmp(type, "S"))
{
statenum_t i;
for (i = 0; i < NUMSTATEFREESLOTS; i++)
if (!FREE_STATES[i]) {
CONS_Printf("State S_%s allocated.\n",word);
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_STATES[i],word);
lua_pushinteger(L, S_FIRSTFREESLOT + i);
r++;
break;
}
if (i == NUMSTATEFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free State slots!\n");
CONS_Printf("State S_%s allocated.\n",word);
lua_pushinteger(L, P_AllocateState(Z_StrDup(word)));
r++;
}
else if (fastcmp(type, "MT"))
{
mobjtype_t i;
for (i = 0; i < NUMMOBJFREESLOTS; i++)
if (!FREE_MOBJS[i]) {
CONS_Printf("MobjType MT_%s allocated.\n",word);
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_MOBJS[i],word);
lua_pushinteger(L, MT_FIRSTFREESLOT + i);
r++;
break;
}
if (i == NUMMOBJFREESLOTS)
CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n");
CONS_Printf("MobjType MT_%s allocated.\n",word);
lua_pushinteger(L, P_AllocateMobjinfo(Z_StrDup(word)));
r++;
}
else if (fastcmp(type, "SKINCOLOR"))
{
......@@ -136,21 +107,15 @@ static inline int lib_freeslot(lua_State *L)
{
// Search if we already have an SPR2 by that name...
playersprite_t i;
for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++)
if (memcmp(spr2names[i],word,4) == 0)
for (i = 0; i < numplayersprites; i++)
if (memcmp(playersprites[i]->name,word,4) == 0)
break;
// We don't, so allocate a new one.
if (i >= free_spr2) {
if (free_spr2 < NUMPLAYERSPRITES)
{
CONS_Printf("Sprite SPR2_%s allocated.\n",word);
strncpy(spr2names[free_spr2],word,4);
spr2defaults[free_spr2] = 0;
lua_pushinteger(L, free_spr2);
r++;
spr2names[free_spr2++][4] = 0;
} else
CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n");
if (i >= numplayersprites)
{
// We don't, so allocate a new one.
CONS_Printf("Sprite SPR2_%s allocated.\n",word);
lua_pushinteger(L, P_AllocatePlayersprite(Z_StrDup(word)));
r++;
}
}
else if (fastcmp(type, "TOL"))
......@@ -421,42 +386,32 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word)
}
else if (fastncmp("S_",word,2)) {
p = word+2;
for (i = 0; i < NUMSTATEFREESLOTS; i++) {
if (!FREE_STATES[i])
break;
if (fastcmp(p, FREE_STATES[i])) {
CacheAndPushConstant(L, word, S_FIRSTFREESLOT+i);
return 1;
}
}
for (i = 0; i < S_FIRSTFREESLOT; i++)
if (fastcmp(p, STATE_LIST[i]+2)) {
for (i = 0; (UINT32)i < numstates; i++)
{
if (fastcmp(p, states[i]->name))
{
CacheAndPushConstant(L, word, i);
return 1;
}
}
return luaL_error(L, "state '%s' does not exist.\n", word);
}
else if (fastncmp("MT_",word,3)) {
p = word+3;
for (i = 0; i < NUMMOBJFREESLOTS; i++) {
if (!FREE_MOBJS[i])
break;
if (fastcmp(p, FREE_MOBJS[i])) {
CacheAndPushConstant(L, word, MT_FIRSTFREESLOT+i);
return 1;
}
}
for (i = 0; i < MT_FIRSTFREESLOT; i++)
if (fastcmp(p, MOBJTYPE_LIST[i]+3)) {
for (i = 0; (UINT32)i < nummobjinfo; i++)
{
if (fastcmp(p, mobjinfo[i]->name))
{
CacheAndPushConstant(L, word, i);
return 1;
}
}
return luaL_error(L, "mobjtype '%s' does not exist.\n", word);
}
else if (fastncmp("SPR_",word,4)) {
p = word+4;
i = R_GetSpriteNumByName(p);
if (i != NUMSPRITES)
if ((UINT32)i != numspriteinfo)
{
// updating overridden sprnames is not implemented for soc parser,
// so don't use cache
......@@ -472,18 +427,20 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word)
}
else if (fastncmp("SPR2_",word,5)) {
p = word+5;
for (i = 0; i < (fixed_t)free_spr2; i++)
if (!spr2names[i][4])
for (i = 0; i < (fixed_t)numplayersprites; i++)
if (!playersprites[i]->name[4])
{
// special 3-char cases, e.g. SPR2_RUN
// the spr2names entry will have "_" on the end, as in "RUN_"
if (spr2names[i][3] == '_' && !p[3]) {
if (fastncmp(p,spr2names[i],3)) {
// the playersprites entry will have "_" on the end, as in "RUN_"
if (playersprites[i]->name[3] == '_' && !p[3])
{
if (fastncmp(p,playersprites[i]->name,3))
{
CacheAndPushConstant(L, word, i);
return 1;
}
}
else if (fastncmp(p,spr2names[i],4)) {
else if (fastncmp(p,playersprites[i]->name,4)) {
CacheAndPushConstant(L, word, i);
return 1;
}
......@@ -493,8 +450,8 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word)
}
else if (!mathlib && fastncmp("sfx_",word,4)) {
p = word+4;
for (i = 0; i < NUMSFX; i++)
if (S_sfx[i].name && fastcmp(p, S_sfx[i].name)) {
for (i = 0; (UINT32)i < S_numsfx; i++)
if (S_sfx[i]->name && fastcmp(p, S_sfx[i]->name)) {
CacheAndPushConstant(L, word, i);
return 1;
}
......@@ -502,8 +459,8 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word)
}
else if (mathlib && fastncmp("SFX_",word,4)) { // SOCs are ALL CAPS!
p = word+4;
for (i = 0; i < NUMSFX; i++)
if (S_sfx[i].name && fasticmp(p, S_sfx[i].name)) {
for (i = 0; (UINT32)i < S_numsfx; i++)
if (S_sfx[i]->name && fasticmp(p, S_sfx[i]->name)) {
CacheAndPushConstant(L, word, i);
return 1;
}
......@@ -511,14 +468,37 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word)
}
else if (mathlib && fastncmp("DS",word,2)) {
p = word+2;
for (i = 0; i < NUMSFX; i++)
if (S_sfx[i].name && fasticmp(p, S_sfx[i].name)) {
for (i = 0; (UINT32)i < S_numsfx; i++)
if (S_sfx[i]->name && fasticmp(p, S_sfx[i]->name)) {
CacheAndPushConstant(L, word, i);
return 1;
}
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
return 0;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (!mathlib && fastncmp("mus_",word,4)) {
p = word+4;
if ((i = get_mus(p, false)) == 0)
return 0;
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS!
p = word+4;
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) {
p = word+2;
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
#endif
else if (!mathlib && fastncmp("pw_",word,3)) {
p = word+3;
for (i = 0; i < NUMPOWERS; i++)
......
This diff is collapsed.
......@@ -43,7 +43,7 @@
#include "info.h"
#include "dehacked.h"
#include "doomdef.h" // HWRENDER
#include "doomdef.h" // MUSICSLOT_COMPATIBILITY, HWRENDER
// Crazy word-reading stuff
/// \todo Put these in a seperate file or something.
......@@ -52,6 +52,9 @@ statenum_t get_state(const char *word);
spritenum_t get_sprite(const char *word);
playersprite_t get_sprite2(const char *word);
sfxenum_t get_sfx(const char *word);
#ifdef MUSICSLOT_COMPATIBILITY
UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
hudnum_t get_huditem(const char *word);
menutype_t get_menutype(const char *word);
//INT16 get_gametype(const char *word);
......
This diff is collapsed.
......@@ -20,14 +20,10 @@
// Free slot names
// The crazy word-reading stuff uses these.
extern char *FREE_STATES[NUMSTATEFREESLOTS];
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
extern char *FREE_SKINCOLORS[NUMCOLORFREESLOTS];
extern bitarray_t used_spr[BIT_ARRAY_SIZE(NUMSPRITEFREESLOTS)]; // Sprite freeslots in use
#define initfreeslots() {\
memset(FREE_STATES, 0, sizeof(FREE_STATES));\
memset(FREE_MOBJS, 0, sizeof(FREE_MOBJS));\
memset(FREE_SKINCOLORS, 0, sizeof(FREE_SKINCOLORS));\
memset(used_spr, 0, sizeof(used_spr));\
memset(actionsoverridden, LUA_REFNIL, sizeof(actionsoverridden));\
......@@ -57,8 +53,6 @@ struct int_const_s {
extern const char NIGHTSGRADE_LIST[];
extern struct flickytypes_s FLICKYTYPES[];
extern actionpointer_t actionpointers[]; // Array mapping action names to action functions.
extern const char *const STATE_LIST[];
extern const char *const MOBJTYPE_LIST[];
extern const char *const MOBJFLAG_LIST[];
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
extern const char *const MOBJEFLAG_LIST[];
......
......@@ -305,11 +305,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_mobjtype(word2); // find a thing by name
if (i < NUMMOBJTYPES && i > 0)
if (i < (INT32)nummobjinfo && i > 0)
readthing(f, i);
else
{
deh_warning("Thing %d out of range (1 - %d)", i, NUMMOBJTYPES-1);
deh_warning("Thing %d out of range (1 - %d)", i, nummobjinfo-1);
ignorelines(f);
}
}
......@@ -329,11 +329,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_sprite2(word2); // find a sprite by name
if (i < (INT32)free_spr2 && i >= (INT32)SPR2_FIRSTFREESLOT)
if (i < (INT32)numplayersprites && i >= 0)
readsprite2(f, i);
else
{
deh_warning("Sprite2 number %d out of range (%d - %d)", i, SPR2_FIRSTFREESLOT, free_spr2-1);
deh_warning("Sprite2 number %d out of range (1 - %d)", i, numplayersprites-1);
ignorelines(f);
}
}
......@@ -354,11 +354,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_sprite(word2); // find a sprite by name
if (i < NUMSPRITES && i > 0)
if ((UINT32)i < numspriteinfo && i > 0)
readspriteinfo(f, i, false);
else
{
deh_warning("Sprite number %d out of range (0 - %d)", i, NUMSPRITES-1);
deh_warning("Sprite number %d out of range (0 - %d)", i, numspriteinfo-1);
ignorelines(f);
}
}
......@@ -366,11 +366,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_sprite2(word2); // find a sprite by name
if (i < NUMPLAYERSPRITES && i >= 0)
if ((UINT32)i < numplayersprites && i >= 0)
readspriteinfo(f, i, true);
else
{
deh_warning("Sprite2 number %d out of range (0 - %d)", i, NUMPLAYERSPRITES-1);
deh_warning("Sprite2 number %d out of range (0 - %d)", i, numplayersprites-1);
ignorelines(f);
}
}
......@@ -445,11 +445,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_state(word2); // find a state by name
if (i < NUMSTATES && i >= 0)
if ((UINT32)i < numstates && i >= 0)
readframe(f, i);
else
{
deh_warning("Frame %d out of range (0 - %d)", i, NUMSTATES-1);
deh_warning("Frame %d out of range (0 - %d)", i, numstates-1);
ignorelines(f);
}
}
......@@ -457,11 +457,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_sfx(word2); // find a sound by name
if (i < NUMSFX && i > 0)
if ((UINT32)i < S_numsfx && i > 0)
readsound(f, i);
else
{
deh_warning("Sound %d out of range (1 - %d)", i, NUMSFX-1);
deh_warning("Sound %d out of range (1 - %d)", i, S_numsfx-1);
ignorelines(f);
}
}
......