This issue was found by Cppcheck (static C/C++ code analysis tool).
extern short Ur[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT];
void mm_open_all(void);
-void mm_close_all(void);
void InitElementProperties_MM(void);
{
InitElementProperties_MM();
}
-
-void mm_close_all(void)
-{
-}
MarkTileDirty(x,y);
}
-void DrawGraphicShiftedThruMask_MM(int x,int y, int dx,int dy, int graphic,
- int cut_mode)
-{
- DrawGraphicShifted_MM(x, y, dx, dy, graphic, cut_mode, USE_MASKING);
-}
-
void DrawScreenElementExt_MM(int x, int y, int dx, int dy, int element,
int cut_mode, int mask_mode)
{
DrawScreenElementExt_MM(x, y, dx, dy, element, cut_mode, NO_MASKING);
}
-void DrawLevelElementShifted_MM(int x, int y, int dx, int dy, int element,
- int cut_mode)
-{
- DrawLevelElementExt_MM(x, y, dx, dy, element, cut_mode, NO_MASKING);
-}
-
-void DrawScreenElementThruMask_MM(int x, int y, int element)
-{
- DrawScreenElementExt_MM(x, y, 0, 0, element, NO_CUTTING, USE_MASKING);
-}
-
-void DrawLevelElementThruMask_MM(int x, int y, int element)
-{
- DrawLevelElementExt_MM(x, y, 0, 0, element, NO_CUTTING, USE_MASKING);
-}
-
-void DrawLevelFieldThruMask_MM(int x, int y)
-{
- DrawLevelElementExt_MM(x, y, 0, 0, Tile[x][y], NO_CUTTING, USE_MASKING);
-}
-
void DrawScreenElement_MM(int x, int y, int element)
{
DrawScreenElementExt_MM(x, y, 0, 0, element, NO_CUTTING, NO_MASKING);
}
-void DrawLevelElement_MM(int x, int y, int element)
-{
- if (IN_LEV_FIELD(x, y) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
- DrawScreenElement_MM(SCREENX(x), SCREENY(y), element);
-}
-
void DrawScreenField_MM(int x, int y)
{
int element = Tile[x][y];
}
#endif
-void DrawMiniLevel_MM(int size_x, int size_y, int scroll_x, int scroll_y)
-{
- int x, y;
-
- for (x = 0; x < size_x; x++)
- for (y = 0; y < size_y; y++)
- DrawMiniElementOrWall_MM(x, y, scroll_x, scroll_y);
-
- redraw_mask |= REDRAW_FIELD;
-}
-
// ----------------------------------------------------------------------------
// XSN
void getMiniGraphicSource(int, Bitmap **, int *, int *);
void DrawMiniGraphicExt_MM(DrawBuffer *, int, int, int);
void DrawGraphicShifted_MM(int, int, int, int, int, int, int);
-void DrawGraphicShiftedThruMask_MM(int, int, int, int, int, int);
void DrawScreenElementExt_MM(int, int, int, int, int, int, int);
void DrawLevelElementExt_MM(int, int, int, int, int, int, int);
void DrawScreenElementShifted_MM(int, int, int, int, int, int);
-void DrawLevelElementShifted_MM(int, int, int, int, int, int);
-void DrawScreenElementThruMask_MM(int, int, int);
-void DrawLevelElementThruMask_MM(int, int, int);
-void DrawLevelFieldThruMask_MM(int, int);
void ErdreichAnbroeckeln(int, int);
void DrawScreenElement_MM(int, int, int);
-void DrawLevelElement_MM(int, int, int);
void DrawScreenField_MM(int, int);
void DrawLevelField_MM(int, int);
void DrawMiniElement_MM(int, int, int);
void DrawWallsExt_MM(int, int, int, int);
void DrawWalls_MM(int, int, int);
void DrawWallsAnimation_MM(int, int, int, int, int);
-void DrawMiniLevel_MM(int, int, int, int);
void DrawMicroLevel_MM(int, int, boolean);
void DrawTileCursor_MM(int, boolean);
return (file_list != NULL ? file_list->token : NULL);
}
-char *getFilenameFromImageID(int graphic)
-{
- struct FileInfo *file_list = getImageListEntryFromImageID(graphic);
-
- return (file_list != NULL ? file_list->filename : NULL);
-}
-
int getImageIDFromToken(char *token)
{
struct FileInfo *file_list = image_info->file_list;
int getOriginalImageWidthFromImageID(int);
int getOriginalImageHeightFromImageID(int);
char *getTokenFromImageID(int);
-char *getFilenameFromImageID(int);
int getImageIDFromToken(char *);
char *getImageConfigFilename(void);
int getImageListPropertyMappingSize(void);
// platform independent joystick functions
// ============================================================================
-#define TRANSLATE_JOYSYMBOL_TO_JOYNAME 0
-#define TRANSLATE_JOYNAME_TO_JOYSYMBOL 1
-
-static void translate_joyname(int *joysymbol, char **name, int mode)
-{
- static struct
- {
- int joysymbol;
- char *name;
- } translate_joy[] =
- {
- { JOY_LEFT, "joystick_left" },
- { JOY_RIGHT, "joystick_right" },
- { JOY_UP, "joystick_up" },
- { JOY_DOWN, "joystick_down" },
- { JOY_BUTTON_1, "joystick_button_1" },
- { JOY_BUTTON_2, "joystick_button_2" },
- };
-
- int i;
-
- if (mode == TRANSLATE_JOYSYMBOL_TO_JOYNAME)
- {
- *name = "[undefined]";
-
- for (i = 0; i < 6; i++)
- {
- if (*joysymbol == translate_joy[i].joysymbol)
- {
- *name = translate_joy[i].name;
- break;
- }
- }
- }
- else if (mode == TRANSLATE_JOYNAME_TO_JOYSYMBOL)
- {
- *joysymbol = 0;
-
- for (i = 0; i < 6; i++)
- {
- if (strEqual(*name, translate_joy[i].name))
- {
- *joysymbol = translate_joy[i].joysymbol;
- break;
- }
- }
- }
-}
-
-char *getJoyNameFromJoySymbol(int joysymbol)
-{
- char *name;
-
- translate_joyname(&joysymbol, &name, TRANSLATE_JOYSYMBOL_TO_JOYNAME);
- return name;
-}
-
-int getJoySymbolFromJoyName(char *name)
-{
- int joysymbol;
-
- translate_joyname(&joysymbol, &name, TRANSLATE_JOYNAME_TO_JOYSYMBOL);
- return joysymbol;
-}
-
int getJoystickNrFromDeviceName(char *device_name)
{
char c;
return percent;
}
-void CheckJoystickData(void)
-{
- int i;
- int distance = 100;
-
- for (i = 0; i < MAX_PLAYERS; i++)
- {
- if (setup.input[i].joy.xleft >= setup.input[i].joy.xmiddle)
- setup.input[i].joy.xleft = setup.input[i].joy.xmiddle - distance;
- if (setup.input[i].joy.xright <= setup.input[i].joy.xmiddle)
- setup.input[i].joy.xright = setup.input[i].joy.xmiddle + distance;
-
- if (setup.input[i].joy.yupper >= setup.input[i].joy.ymiddle)
- setup.input[i].joy.yupper = setup.input[i].joy.ymiddle - distance;
- if (setup.input[i].joy.ylower <= setup.input[i].joy.ymiddle)
- setup.input[i].joy.ylower = setup.input[i].joy.ymiddle + distance;
- }
-}
-
int JoystickExt(int player_nr, boolean use_as_joystick_nr)
{
int joystick_nr = joystick.nr[player_nr];
return result;
}
-
-void DeactivateJoystick(void)
-{
- /* Temporarily deactivate joystick. This is needed for calibration
- screens, where the player has to select a joystick device that
- should be calibrated. If there is a totally uncalibrated joystick
- active, it may be impossible (due to messed up input from joystick)
- to select the joystick device to calibrate even when trying to use
- the mouse or keyboard to select the device. */
-
- if (joystick.status & JOYSTICK_AVAILABLE)
- joystick.status &= ~JOYSTICK_ACTIVE;
-}
-
-void ActivateJoystick(void)
-{
- // reactivate temporarily deactivated joystick
-
- if (joystick.status & JOYSTICK_AVAILABLE)
- joystick.status |= JOYSTICK_ACTIVE;
-}
#define JOY_BUTTON_NEW_PRESSED 2
#define JOY_BUTTON_NEW_RELEASED 3
-char *getJoyNameFromJoySymbol(int);
-int getJoySymbolFromJoyName(char *);
int getJoystickNrFromDeviceName(char *);
char *getDeviceNameFromJoystickNr(int);
char *getFormattedJoystickName(const char *);
-void CheckJoystickData(void);
int Joystick(int);
int JoystickExt(int, boolean);
int JoystickButton(int);
int AnyJoystick(void);
int AnyJoystickButton(void);
-void DeactivateJoystick(void);
-void ActivateJoystick(void);
-
#endif // JOYSTICK_H
// quick (no, it's slow) and dirty hack to "invert" rectangle inside SDL surface
// ----------------------------------------------------------------------------
-void SDLInvertArea(Bitmap *bitmap, int src_x, int src_y,
- int width, int height, Uint32 color)
-{
- int x, y;
-
- for (y = src_y; y < src_y + height; y++)
- {
- for (x = src_x; x < src_x + width; x++)
- {
- Uint32 pixel = SDLGetPixel(bitmap, x, y);
-
- SDLPutPixel(bitmap, x, y, pixel == BLACK_PIXEL ? color : BLACK_PIXEL);
- }
- }
-}
-
void SDLCopyInverseMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap,
int src_x, int src_y, int width, int height,
int dst_x, int dst_y)
Pixel SDLGetPixel(Bitmap *, int, int);
void SDLPutPixel(Bitmap *, int, int, Pixel);
-void SDLInvertArea(Bitmap *, int, int, int, int, Uint32);
void SDLCopyInverseMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
Bitmap *SDLZoomBitmap(Bitmap *, int, int);
#define TOKEN_VALUE_POSITION_DEFAULT 40
#define TOKEN_COMMENT_POSITION_DEFAULT 60
-#define MAX_COOKIE_LEN 256
-
#define TREE_NODE_TYPE_DEFAULT 0
#define TREE_NODE_TYPE_PARENT 1
#define TREE_NODE_TYPE_GROUP 2
chmod(filename, perms);
}
-char *getCookie(char *file_type)
-{
- static char cookie[MAX_COOKIE_LEN + 1];
-
- if (strlen(program.cookie_prefix) + 1 +
- strlen(file_type) + strlen("_FILE_VERSION_x.x") > MAX_COOKIE_LEN)
- return "[COOKIE ERROR]"; // should never happen
-
- sprintf(cookie, "%s_%s_FILE_VERSION_%d.%d",
- program.cookie_prefix, file_type,
- program.version_super, program.version_major);
-
- return cookie;
-}
-
void fprintFileHeader(FILE *file, char *basename)
{
char *prefix = "# ";
void InitUserDataDirectory(void);
void SetFilePermissions(char *, int);
-char *getCookie(char *);
void fprintFileHeader(FILE *, char *);
int getFileVersionFromCookieString(const char *);
boolean checkCookieString(const char *, const char *);
BlitTextureMasked(bitmap, src_x, src_y, width, height, dst_x, dst_y);
}
-void DrawSimpleBlackLine(Bitmap *bitmap, int from_x, int from_y,
- int to_x, int to_y)
-{
- SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, BLACK_PIXEL);
-}
-
void DrawSimpleWhiteLine(Bitmap *bitmap, int from_x, int from_y,
int to_x, int to_y)
{
return SDL_MapRGB(bitmap->surface->format, color_r, color_g, color_b);
}
-Pixel GetPixelFromRGBcompact(Bitmap *bitmap, unsigned int color)
-{
- unsigned int color_r = (color >> 16) & 0xff;
- unsigned int color_g = (color >> 8) & 0xff;
- unsigned int color_b = (color >> 0) & 0xff;
-
- return GetPixelFromRGB(bitmap, color_r, color_g, color_b);
-}
-
void KeyboardAutoRepeatOn(void)
{
keyrepeat_status = TRUE;
void BlitTextureMasked(Bitmap *, int, int, int, int, int, int);
void BlitToScreen(Bitmap *, int, int, int, int, int, int);
void BlitToScreenMasked(Bitmap *, int, int, int, int, int, int);
-void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
void DrawLines(Bitmap *, struct XY *, int, Pixel);
Pixel GetPixel(Bitmap *, int, int);
Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
-Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
void KeyboardAutoRepeatOn(void);
void KeyboardAutoRepeatOff(void);
gfx.sy + y, text, font_nr);
}
-void DrawTextAligned(int x, int y, char *text, int font_nr, int align)
-{
- DrawText(ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
- y, text, font_nr);
-}
-
void DrawText(int x, int y, char *text, int font_nr)
{
int mask_mode = BLIT_OPAQUE;
void DrawTextS(int, int, int, char *);
void DrawTextSCentered(int, int, char *);
void DrawTextSAligned(int, int, char *, int, int);
-void DrawTextAligned(int, int, char *, int, int);
void DrawText(int, int, char *, int);
void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
}
-static voidpf ZCALLBACK fopen_file_func(ZIP_UNUSED voidpf opaque, const char *filename, int mode);
static uint32_t ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uint32_t size);
static uint32_t ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size);
static uint64_t ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream);
return (voidpf)ioposix;
}
-static voidpf ZCALLBACK fopen_file_func(ZIP_UNUSED voidpf opaque, const char *filename, int mode)
-{
- FILE* file = NULL;
- const char *mode_fopen = NULL;
- if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ)
- mode_fopen = "rb";
- else if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
- mode_fopen = "r+b";
- else if (mode & ZLIB_FILEFUNC_MODE_CREATE)
- mode_fopen = "wb";
-
- if ((filename != NULL) && (mode_fopen != NULL))
- {
- file = fopen(filename, mode_fopen);
- return file_build_ioposix(file, filename);
- }
- return file;
-}
-
static voidpf ZCALLBACK fopen64_file_func(ZIP_UNUSED voidpf opaque, const void *filename, int mode)
{
FILE* file = NULL;
return ret;
}
-static voidpf ZCALLBACK fopendisk_file_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
-{
- FILE_IOPOSIX *ioposix = NULL;
- char *diskFilename = NULL;
- voidpf ret = NULL;
- int i = 0;
-
- if (stream == NULL)
- return NULL;
- ioposix = (FILE_IOPOSIX*)stream;
- diskFilename = (char*)malloc(ioposix->filenameLength * sizeof(char));
- strncpy(diskFilename, (const char*)ioposix->filename, ioposix->filenameLength);
- for (i = ioposix->filenameLength - 1; i >= 0; i -= 1)
- {
- if (diskFilename[i] != '.')
- continue;
- snprintf(&diskFilename[i], ioposix->filenameLength - i, ".z%02u", number_disk + 1);
- break;
- }
- if (i >= 0)
- ret = fopen_file_func(opaque, diskFilename, mode);
- free(diskFilename);
- return ret;
-}
-
static uint32_t ZCALLBACK fread_file_func(ZIP_UNUSED voidpf opaque, voidpf stream, void* buf, uint32_t size)
{
FILE_IOPOSIX *ioposix = NULL;
return written;
}
-static long ZCALLBACK ftell_file_func(ZIP_UNUSED voidpf opaque, voidpf stream)
-{
- FILE_IOPOSIX *ioposix = NULL;
- long ret = -1;
- if (stream == NULL)
- return ret;
- ioposix = (FILE_IOPOSIX*)stream;
- ret = ftell(ioposix->file);
- return ret;
-}
-
static uint64_t ZCALLBACK ftell64_file_func(ZIP_UNUSED voidpf opaque, voidpf stream)
{
FILE_IOPOSIX *ioposix = NULL;
return ret;
}
-static long ZCALLBACK fseek_file_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint32_t offset, int origin)
-{
- FILE_IOPOSIX *ioposix = NULL;
- int fseek_origin = 0;
- long ret = 0;
-
- if (stream == NULL)
- return -1;
- ioposix = (FILE_IOPOSIX*)stream;
-
- switch (origin)
- {
- case ZLIB_FILEFUNC_SEEK_CUR:
- fseek_origin = SEEK_CUR;
- break;
- case ZLIB_FILEFUNC_SEEK_END:
- fseek_origin = SEEK_END;
- break;
- case ZLIB_FILEFUNC_SEEK_SET:
- fseek_origin = SEEK_SET;
- break;
- default:
- return -1;
- }
- if (fseek(ioposix->file, offset, fseek_origin) != 0)
- ret = -1;
- return ret;
-}
-
static long ZCALLBACK fseek64_file_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint64_t offset, int origin)
{
FILE_IOPOSIX *ioposix = NULL;
return ret;
}
-void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def)
-{
- pzlib_filefunc_def->zopen_file = fopen_file_func;
- pzlib_filefunc_def->zopendisk_file = fopendisk_file_func;
- pzlib_filefunc_def->zread_file = fread_file_func;
- pzlib_filefunc_def->zwrite_file = fwrite_file_func;
- pzlib_filefunc_def->ztell_file = ftell_file_func;
- pzlib_filefunc_def->zseek_file = fseek_file_func;
- pzlib_filefunc_def->zclose_file = fclose_file_func;
- pzlib_filefunc_def->zerror_file = ferror_file_func;
- pzlib_filefunc_def->opaque = NULL;
-}
-
void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
voidpf opaque;
} zlib_filefunc64_def;
-void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def);
void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def);
/* now internal definition, only for zip.c and unzip.h */
return ret;
}
-void fill_win32_filefunc(zlib_filefunc_def *pzlib_filefunc_def)
-{
- pzlib_filefunc_def->zopen_file = win32_open_file_func;
- pzlib_filefunc_def->zopendisk_file = win32_opendisk_file_func;
- pzlib_filefunc_def->zread_file = win32_read_file_func;
- pzlib_filefunc_def->zwrite_file = win32_write_file_func;
- pzlib_filefunc_def->ztell_file = win32_tell_file_func;
- pzlib_filefunc_def->zseek_file = win32_seek_file_func;
- pzlib_filefunc_def->zclose_file = win32_close_file_func;
- pzlib_filefunc_def->zerror_file = win32_error_file_func;
- pzlib_filefunc_def->opaque = NULL;
-}
-
-void fill_win32_filefunc64(zlib_filefunc64_def *pzlib_filefunc_def)
-{
- pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
- pzlib_filefunc_def->zopendisk64_file = win32_opendisk64_file_func;
- pzlib_filefunc_def->zread_file = win32_read_file_func;
- pzlib_filefunc_def->zwrite_file = win32_write_file_func;
- pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
- pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
- pzlib_filefunc_def->zclose_file = win32_close_file_func;
- pzlib_filefunc_def->zerror_file = win32_error_file_func;
- pzlib_filefunc_def->opaque = NULL;
-}
-
void fill_win32_filefunc64A(zlib_filefunc64_def *pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
pzlib_filefunc_def->opaque = NULL;
}
-void fill_win32_filefunc64W(zlib_filefunc64_def *pzlib_filefunc_def)
-{
- pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
- pzlib_filefunc_def->zopendisk64_file = win32_opendisk64_file_funcW;
- pzlib_filefunc_def->zread_file = win32_read_file_func;
- pzlib_filefunc_def->zwrite_file = win32_write_file_func;
- pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
- pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
- pzlib_filefunc_def->zclose_file = win32_close_file_func;
- pzlib_filefunc_def->zerror_file = win32_error_file_func;
- pzlib_filefunc_def->opaque = NULL;
-}
-
#endif // _WIN32
extern "C" {
#endif
-void fill_win32_filefunc(zlib_filefunc_def *pzlib_filefunc_def);
-void fill_win32_filefunc64(zlib_filefunc64_def *pzlib_filefunc_def);
void fill_win32_filefunc64A(zlib_filefunc64_def *pzlib_filefunc_def);
-void fill_win32_filefunc64W(zlib_filefunc64_def *pzlib_filefunc_def);
#ifdef __cplusplus
}