mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 04:11:18 +00:00
Merge branch 'master' into sdl2
This commit is contained in:
commit
f3bd8c6ef4
6 changed files with 226 additions and 10 deletions
173
CMakeLists.txt
Normal file
173
CMakeLists.txt
Normal file
|
@ -0,0 +1,173 @@
|
|||
#
|
||||
# Simple CMakeLists for Sonic Robo Blast 2
|
||||
#
|
||||
PROJECT(SRB2)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
FIND_PACKAGE(SDL)
|
||||
FIND_PACKAGE(SDL_mixer)
|
||||
FIND_PACKAGE(PNG)
|
||||
|
||||
#
|
||||
# Common stuff
|
||||
#
|
||||
|
||||
# not added defines:
|
||||
# -DHAVE_PNG - does not build (incorrect use of PNG_EXPORT etc.)
|
||||
ADD_DEFINITIONS(-DDIRECTFULLSCREEN -DSDL -DHAVE_MIXER -DNOHW -DHW3SOUND -DHAVE_BLUA -DNOASM)
|
||||
|
||||
SET(SDL_DIR sdl) # may be set to SDL2 optionally
|
||||
|
||||
SET(COMMON_SRCS
|
||||
src/${SDL_DIR}/dosstr.c
|
||||
src/${SDL_DIR}/endtxt.c
|
||||
src/${SDL_DIR}/hwsym_sdl.c
|
||||
src/${SDL_DIR}/i_cdmus.c
|
||||
src/${SDL_DIR}/i_main.c
|
||||
src/${SDL_DIR}/i_net.c
|
||||
src/${SDL_DIR}/i_system.c
|
||||
src/${SDL_DIR}/i_video.c
|
||||
src/${SDL_DIR}/mixer_sound.c
|
||||
src/am_map.c
|
||||
src/b_bot.c
|
||||
src/blua/lapi.c
|
||||
src/blua/lauxlib.c
|
||||
src/blua/lbaselib.c
|
||||
src/blua/lcode.c
|
||||
src/blua/ldebug.c
|
||||
src/blua/ldo.c
|
||||
src/blua/ldump.c
|
||||
src/blua/lfunc.c
|
||||
src/blua/lgc.c
|
||||
src/blua/linit.c
|
||||
src/blua/llex.c
|
||||
src/blua/lmem.c
|
||||
src/blua/lobject.c
|
||||
src/blua/lopcodes.c
|
||||
src/blua/lparser.c
|
||||
src/blua/lstate.c
|
||||
src/blua/lstring.c
|
||||
src/blua/lstrlib.c
|
||||
src/blua/ltable.c
|
||||
src/blua/ltablib.c
|
||||
src/blua/ltm.c
|
||||
src/blua/lundump.c
|
||||
src/blua/lvm.c
|
||||
src/blua/lzio.c
|
||||
src/command.c
|
||||
src/comptime.c
|
||||
src/console.c
|
||||
src/d_clisrv.c
|
||||
src/d_main.c
|
||||
src/d_net.c
|
||||
src/d_netcmd.c
|
||||
src/d_netfil.c
|
||||
src/dehacked.c
|
||||
src/f_finale.c
|
||||
src/f_wipe.c
|
||||
src/filesrch.c
|
||||
src/g_game.c
|
||||
src/g_input.c
|
||||
src/hardware/hw3sound.c
|
||||
src/hu_stuff.c
|
||||
src/i_tcp.c
|
||||
src/info.c
|
||||
src/lua_baselib.c
|
||||
src/lua_consolelib.c
|
||||
src/lua_hooklib.c
|
||||
src/lua_hudlib.c
|
||||
src/lua_infolib.c
|
||||
src/lua_maplib.c
|
||||
src/lua_mathlib.c
|
||||
src/lua_mobjlib.c
|
||||
src/lua_playerlib.c
|
||||
src/lua_script.c
|
||||
src/lua_skinlib.c
|
||||
src/lua_thinkerlib.c
|
||||
src/lzf.c
|
||||
src/m_anigif.c
|
||||
src/m_argv.c
|
||||
src/m_bbox.c
|
||||
src/m_cheat.c
|
||||
src/m_cond.c
|
||||
src/m_fixed.c
|
||||
src/m_menu.c
|
||||
src/m_misc.c
|
||||
src/m_queue.c
|
||||
src/m_random.c
|
||||
src/md5.c
|
||||
src/mserv.c
|
||||
src/p_ceilng.c
|
||||
src/p_enemy.c
|
||||
src/p_fab.c
|
||||
src/p_floor.c
|
||||
src/p_inter.c
|
||||
src/p_lights.c
|
||||
src/p_map.c
|
||||
src/p_maputl.c
|
||||
src/p_mobj.c
|
||||
src/p_polyobj.c
|
||||
src/p_saveg.c
|
||||
src/p_setup.c
|
||||
src/p_sight.c
|
||||
src/p_spec.c
|
||||
src/p_telept.c
|
||||
src/p_tick.c
|
||||
src/p_user.c
|
||||
src/r_bsp.c
|
||||
src/r_data.c
|
||||
src/r_draw.c
|
||||
src/r_main.c
|
||||
src/r_plane.c
|
||||
src/r_segs.c
|
||||
src/r_sky.c
|
||||
src/r_splats.c
|
||||
src/r_things.c
|
||||
src/s_sound.c
|
||||
src/screen.c
|
||||
src/sounds.c
|
||||
src/st_stuff.c
|
||||
src/string.c
|
||||
src/tables.c
|
||||
src/v_video.c
|
||||
src/w_wad.c
|
||||
src/y_inter.c
|
||||
src/z_zone.c
|
||||
)
|
||||
|
||||
#
|
||||
# Platform-specific stuff
|
||||
#
|
||||
|
||||
MACRO(EXTRALIB NAME)
|
||||
FIND_LIBRARY(${NAME}_LIBRARY NAMES ${NAME})
|
||||
IF(${NAME}_LIBRARY)
|
||||
MESSAGE(STATUS "Found lib${NAME}: ${${NAME}_LIBRARY}")
|
||||
SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} ${${NAME}_LIBRARY})
|
||||
ELSE(${NAME}_LIBRARY)
|
||||
MESSAGE(FATAL_ERROR "Could not find lib${NAME}!")
|
||||
ENDIF(${NAME}_LIBRARY)
|
||||
ENDMACRO(EXTRALIB)
|
||||
|
||||
IF(${CMAKE_SYSTEM} MATCHES "FreeBSD")
|
||||
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX -DFREEBSD)
|
||||
EXTRALIB(kvm)
|
||||
ELSEIF(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX)
|
||||
EXTRALIB(m)
|
||||
EXTRALIB(rt)
|
||||
ELSE(${CMAKE_SYSTEM} MATCHES "FreeBSD")
|
||||
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX)
|
||||
MESSAGE(WARNING "No specific settings for you system, it may be not supported!")
|
||||
ENDIF(${CMAKE_SYSTEM} MATCHES "FreeBSD")
|
||||
|
||||
#
|
||||
# Targets
|
||||
#
|
||||
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${SDL_MIXER_INCLUDE_DIRS})
|
||||
ADD_EXECUTABLE(SRB2 ${COMMON_SRCS})
|
||||
TARGET_LINK_LIBRARIES(SRB2 ${SDL_LIBRARY} ${SDL_MIXER_LIBRARIES} ${EXTRA_LIBRARIES})
|
45
src/endian.h
Normal file
45
src/endian.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2014 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file endian.h
|
||||
/// \brief Endian detection
|
||||
|
||||
#ifndef __ENDIAN__
|
||||
#define __ENDIAN__
|
||||
|
||||
#if defined(SRB2_BIG_ENDIAN) || defined(SRB2_LITTLE_ENDIAN)
|
||||
// defined externally
|
||||
#else
|
||||
#if defined(__FreeBSD__)
|
||||
// on FreeBSD, _BIG_ENDIAN is a constant to compare
|
||||
// _BYTE_ORDER to, not a big-endianess flag
|
||||
#include <sys/endian.h>
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
#define SRB2_BIG_ENDIAN
|
||||
#else
|
||||
#define SRB2_LITTLE_ENDIAN
|
||||
#endif
|
||||
#elif defined(__BYTE_ORDER__)
|
||||
// defined by at least gcc and clang
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define SRB2_BIG_ENDIAN
|
||||
#else
|
||||
#define SRB2_LITTLE_ENDIAN
|
||||
#endif
|
||||
#else
|
||||
// check used in vanilla SRB2 (may work incorrectly if
|
||||
// _BIG_ENDIAN is used as on FreeBSD)
|
||||
#if defined(_BIG_ENDIAN)
|
||||
#define SRB2_BIG_ENDIAN
|
||||
#else
|
||||
#define SRB2_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif //__ENDIAN__
|
|
@ -80,6 +80,7 @@ typedef off_t off64_t;
|
|||
#define _FILE_OFFSET_BITS 0
|
||||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
#include "png.h"
|
||||
#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4)
|
||||
#define NO_PNG_DEBUG // 1.4.0 move png_debug to pngpriv.h
|
||||
|
@ -691,7 +692,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
|
|||
else
|
||||
snprintf(locationtxt, 40, "Unknown");
|
||||
|
||||
png_memset(png_infotext,0x00,sizeof (png_infotext));
|
||||
memset(png_infotext,0x00,sizeof (png_infotext));
|
||||
|
||||
for (i = 0; i < SRB2PNGTXT; i++)
|
||||
png_infotext[i].key = keytxt[i];
|
||||
|
|
|
@ -14,9 +14,11 @@
|
|||
#ifndef __M_SWAP__
|
||||
#define __M_SWAP__
|
||||
|
||||
#include "endian.h"
|
||||
|
||||
// Endianess handling.
|
||||
// WAD files are stored little endian.
|
||||
#ifdef _BIG_ENDIAN
|
||||
#ifdef SRB2_BIG_ENDIAN
|
||||
|
||||
#define SHORT(x) ((INT16)(\
|
||||
(((UINT16)(x) & (UINT16)0x00ffU) << 8) \
|
||||
|
|
|
@ -44,14 +44,9 @@
|
|||
|
||||
#include "md5.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
#include <endian.h>
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define WORDS_BIGENDIAN 1
|
||||
#endif
|
||||
#endif
|
||||
#include "endian.h"
|
||||
|
||||
#if defined (WORDS_BIGENDIAN) || defined (_BIG_ENDIAN)
|
||||
#if defined (SRB2_BIG_ENDIAN)
|
||||
#define SWAP(n) \
|
||||
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
|
||||
#else
|
||||
|
|
|
@ -152,7 +152,7 @@ static Mix_Chunk *ds2chunk(void *stream)
|
|||
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
|
||||
newsamples = samples * (frac >> FRACBITS);
|
||||
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
||||
newsamples = FixedMul(frac, samples) + 1; // add 1 sample for security! the code below rounds up.
|
||||
newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
|
||||
if (newsamples >= UINT32_MAX>>2)
|
||||
return NULL; // would and/or did wrap, can't store.
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue