Merge branch 'master' of github.com:chocolate-doom/chocolate-doom

This commit is contained in:
Simon Howard 2019-01-27 23:37:51 -05:00
commit 79b2fed04c
22 changed files with 76 additions and 38 deletions

View file

@ -1,8 +1,14 @@
#!/bin/sh
set -e
if [ "$ANALYZE" = "true" ] ; then
cppcheck --error-exitcode=1 -j2 -UTESTING -Iopl -Isrc -Isrc/setup opl pcsound src textscreen > /dev/null
cppcheck --error-exitcode=1 -j2 -UTESTING -Iopl -Isrc -Isrc/setup opl pcsound src textscreen 2> stderr.txt
RET=$?
if [ -s stderr.txt ]
then
cat stderr.txt
fi
exit $RET
else
set -e
./autogen.sh --enable-werror
make
make install DESTDIR=/tmp/whatever

View file

@ -15,6 +15,7 @@ addons:
apt:
packages:
- cppcheck
- libpng-dev
- libsdl2-dev
- libsdl2-mixer-dev
- libsdl2-net-dev

View file

@ -62,7 +62,7 @@ AS_HELP_STRING([--without-libpng],
[with_libpng=check]
])
AS_IF([test "x$with_libpng" != xno], [
PKG_CHECK_MODULES(PNG, libpng >= 1.6.10, [
PKG_CHECK_MODULES(PNG, libpng >= 1.2.50, [
AC_DEFINE([HAVE_LIBPNG], [1], [libpng installed])
], [
AS_IF([test "x$with_libpng" != xcheck], [AC_MSG_FAILURE(

View file

@ -1173,7 +1173,7 @@ static void LoadIwadDeh(void)
// Look for chex.deh in the same directory as the IWAD file.
dirname = M_DirName(iwadfile);
chex_deh = M_StringJoin(dirname, DIR_SEPARATOR_S, "chex.deh");
chex_deh = M_StringJoin(dirname, DIR_SEPARATOR_S, "chex.deh", NULL);
free(dirname);
// If the dehacked patch isn't found, try searching the WAD

View file

@ -49,6 +49,7 @@
#include "m_argv.h"
#include "m_controls.h"
#include "p_saveg.h"
#include "p_setup.h"
#include "s_sound.h"
@ -634,8 +635,19 @@ void M_DoSave(int slot)
//
static void SetDefaultSaveName(int slot)
{
M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE - 1,
"JOYSTICK SLOT %i", itemOn + 1);
// map from IWAD or PWAD?
if (W_IsIWADLump(maplumpinfo))
{
M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
"%s", maplumpinfo->name);
}
else
{
M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
"%s: %s", W_WadNameForLump(maplumpinfo),
maplumpinfo->name);
}
M_ForceUppercase(savegamestrings[itemOn]);
joypadSave = false;
}

View file

@ -760,6 +760,9 @@ static void P_LoadReject(int lumpnum)
}
}
// pointer to the current map lump info struct
lumpinfo_t *maplumpinfo;
//
// P_SetupLevel
//
@ -816,6 +819,8 @@ P_SetupLevel
lumpnum = W_GetNumForName (lumpname);
maplumpinfo = lumpinfo[lumpnum];
leveltime = 0;
// note: most of this ordering is important

View file

@ -20,8 +20,10 @@
#ifndef __P_SETUP__
#define __P_SETUP__
#include "w_wad.h"
extern lumpinfo_t *maplumpinfo;
// NOT called by W_Ticker. Fixme.
void

View file

@ -195,13 +195,8 @@ boolean SC_GetString(void)
}
while (foundToken == false)
{
while (*ScriptPtr <= 32)
while (ScriptPtr < ScriptEndPtr && *ScriptPtr <= 32)
{
if (ScriptPtr >= ScriptEndPtr)
{
sc_End = true;
return false;
}
if (*ScriptPtr++ == '\n')
{
sc_Line++;

View file

@ -319,6 +319,11 @@ const char *I_NextGlob(glob_t *glob)
{
const char *result;
if (glob == NULL)
{
return NULL;
}
// In unsorted mode we just return the filenames as we read
// them back from the system API.
if ((glob->flags & GLOB_FLAG_SORTED) == 0)

View file

@ -291,7 +291,7 @@ char *M_DirName(const char *path)
// allocated.
const char *M_BaseName(const char *path)
{
char *p;
const char *p;
p = strrchr(path, DIR_SEPARATOR);
if (p == NULL)

View file

@ -54,9 +54,9 @@ struct execute_context_s
// Returns the path to a temporary file of the given name, stored
// inside the system temporary directory.
static char *TempFile(char *s)
static char *TempFile(const char *s)
{
char *tempdir;
const char *tempdir;
#ifdef _WIN32
// Check the TEMP environment variable to find the location.
@ -130,7 +130,7 @@ execute_context_t *NewExecuteContext(void)
return result;
}
void AddCmdLineParameter(execute_context_t *context, char *s, ...)
void AddCmdLineParameter(execute_context_t *context, const char *s, ...)
{
va_list args;

View file

@ -28,7 +28,7 @@ typedef struct execute_context_s execute_context_t;
#define IWAD_CHEX (1 << 5) /* chex.wad */
execute_context_t *NewExecuteContext(void);
void AddCmdLineParameter(execute_context_t *context, char *s, ...) PRINTF_ATTR(2, 3);
void AddCmdLineParameter(execute_context_t *context, const char *s, ...) PRINTF_ATTR(2, 3);
void PassThroughArguments(execute_context_t *context);
int ExecuteDoom(execute_context_t *context);
int FindInstalledIWADs(void);

View file

@ -33,13 +33,13 @@
typedef struct
{
char *name; // Config file name
const char *name; // Config file name
int value;
} joystick_config_t;
typedef struct
{
char *name;
const char *name;
int axes, buttons, hats;
const joystick_config_t *configs;
} known_joystick_t;
@ -972,7 +972,7 @@ static void CalibrateJoystick(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
// GUI
//
static void AddJoystickControl(TXT_UNCAST_ARG(table), char *label, int *var)
static void AddJoystickControl(TXT_UNCAST_ARG(table), const char *label, int *var)
{
TXT_CAST_ARG(txt_table_t, table);
txt_joystick_input_t *joy_input;

View file

@ -146,7 +146,7 @@ static void KeySetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable))
// Add a label and keyboard input to the specified table.
static void AddKeyControl(TXT_UNCAST_ARG(table), char *name, int *var)
static void AddKeyControl(TXT_UNCAST_ARG(table), const char *name, int *var)
{
TXT_CAST_ARG(txt_table_t, table);
txt_key_input_t *key_input;
@ -158,7 +158,7 @@ static void AddKeyControl(TXT_UNCAST_ARG(table), char *name, int *var)
TXT_SignalConnect(key_input, "set", KeySetCallback, var);
}
static void AddSectionLabel(TXT_UNCAST_ARG(table), char *title,
static void AddSectionLabel(TXT_UNCAST_ARG(table), const char *title,
boolean add_space)
{
TXT_CAST_ARG(txt_table_t, table);

View file

@ -181,7 +181,7 @@ static void LaunchDoom(void *unused1, void *unused2)
static txt_button_t *GetLaunchButton(void)
{
char *label;
const char *label;
switch (gamemission)
{

View file

@ -44,13 +44,13 @@ static const iwad_t **iwads;
typedef struct
{
char *label;
const char *label;
GameMission_t mission;
int mask;
char *name;
char *config_file;
char *extra_config_file;
char *executable;
const char *name;
const char *config_file;
const char *extra_config_file;
const char *executable;
} mission_config_t;
// Default mission to fall back on, if no IWADs are found at all:
@ -106,7 +106,7 @@ static int screenblocks = 9;
static int detailLevel = 0;
static char *savedir = NULL;
static char *executable = NULL;
static char *game_title = "Doom";
static const char *game_title = "Doom";
static char *back_flat = "F_PAVE01";
static int comport = 0;
static char *nickname = NULL;
@ -367,12 +367,12 @@ void SetupMission(GameSelectCallback callback)
}
}
char *GetExecutableName(void)
const char *GetExecutableName(void)
{
return executable;
}
char *GetGameTitle(void)
const char *GetGameTitle(void)
{
return game_title;
}

View file

@ -23,8 +23,8 @@ extern GameMission_t gamemission;
void SetupMission(GameSelectCallback callback);
void InitBindings(void);
char *GetExecutableName(void);
char *GetGameTitle(void);
const char *GetExecutableName(void);
const char *GetGameTitle(void);
const iwad_t **GetIwads(void);
#endif /* #ifndef SETUP_MODE_H */

View file

@ -67,7 +67,7 @@ static void MouseSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable))
}
}
static void AddMouseControl(TXT_UNCAST_ARG(table), char *label, int *var)
static void AddMouseControl(TXT_UNCAST_ARG(table), const char *label, int *var)
{
TXT_CAST_ARG(txt_table_t, table);
txt_mouse_input_t *mouse_input;

View file

@ -705,7 +705,7 @@ static txt_dropdown_list_t *GameTypeDropdown(void)
// and the single player warp menu. The parameters specify
// the window title and whether to display multiplayer options.
static void StartGameMenu(char *window_title, int multiplayer)
static void StartGameMenu(const char *window_title, int multiplayer)
{
txt_window_t *window;
txt_widget_t *iwad_selector;
@ -984,7 +984,7 @@ static void QueryWindowClosed(TXT_UNCAST_ARG(window), void *unused)
TXT_SetPeriodicCallback(NULL, NULL, 0);
}
static void ServerQueryWindow(char *title)
static void ServerQueryWindow(const char *title)
{
txt_table_t *results_table;
@ -1067,7 +1067,7 @@ void JoinMultiGame(TXT_UNCAST_ARG(widget), void *user_data)
void SetChatMacroDefaults(void)
{
int i;
char *defaults[] =
const char *const defaults[] =
{
HUSTR_CHATMACRO0,
HUSTR_CHATMACRO1,

View file

@ -32,7 +32,7 @@
#define JOYSTICK_AXIS_WIDTH 20
static char *CalibrationLabel(txt_joystick_axis_t *joystick_axis)
static const char *CalibrationLabel(txt_joystick_axis_t *joystick_axis)
{
switch (joystick_axis->config_stage)
{

View file

@ -618,3 +618,12 @@ void W_Reload(void)
W_GenerateHashTable();
}
const char *W_WadNameForLump(const lumpinfo_t *lump)
{
return M_BaseName(lump->wad_file->path);
}
boolean W_IsIWADLump(const lumpinfo_t *lump)
{
return lump->wad_file == lumpinfo[0]->wad_file;
}

View file

@ -72,4 +72,7 @@ extern unsigned int W_LumpNameHash(const char *s);
void W_ReleaseLumpNum(lumpindex_t lump);
void W_ReleaseLumpName(const char *name);
const char *W_WadNameForLump(const lumpinfo_t *lump);
boolean W_IsIWADLump(const lumpinfo_t *lump);
#endif