diff --git a/SRB2.cbp b/SRB2.cbp index 5aa623fa8..2a1eb87b8 100644 --- a/SRB2.cbp +++ b/SRB2.cbp @@ -1549,6 +1549,9 @@ HW3SOUND for 3D hardware sound support + + diff --git a/assets/debian/README.Debian b/assets/debian/README.Debian index 4d9f067ac..68c952a4e 100644 --- a/assets/debian/README.Debian +++ b/assets/debian/README.Debian @@ -3,10 +3,45 @@ srb2 for Debian SRB2 Debian package! Hi there, to rebuild this package just use the SRB2 Makefile system, or, optionally, run -dpkg-buildpackage in the in /bin/Resources directory. You can build these with or without a key +dpkg-buildpackage in the in /assets directory. You can build these with or without a key if you want, but if you want to put these on a repo, generate your own GnuPG key as per the https://help.ubuntu.com/community/GnuPrivacyGuardHowto instructions and pass the -k command to debuild. Make sure you export the key footprint and give them to your users to install with apt-key add. Thanks! -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300 + + +Signing for Launchpad PPA + +First, follow the above instructions to generate a GnuPG key with your identity. You will need +to publish the fingerprint of that key to Ubuntu's key server. + + https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver + +Next, you will have to add that key fingerprint to your Launchpad account. Go to your Launchpad +profile and click the yellow Edit button next to "OpenPGP keys". Once you add the key, you can +upload signed source packages and publish them onto your PPA. + +IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that +means your key is not set up correctly with your Launchpad account. + + +Building for Launchpad PPA + +Use these steps to prepare building a source package for Launchpad: + + 1. Highly recommend copying the assets/ folder to outside your repo folder, or else the asset + files may be included in the main source package, when you build that. + 2. cd [wherever-your-assets-folder-is]/assets/ + 3. debuild -T clean (optional, if you already have asset files) + +Building the source package is a two-step process: + + 1. debuild -T build (this downloads the asset files from srb2.org if necessary) + 2. debuild -S (builds the source package for Launchpad, including the asset files) + +Then follow the instructions at to upload +to your PPA and have Launchpad build your binary deb packages. + + -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500 diff --git a/assets/debian/changelog b/assets/debian/changelog index a316b7df7..f3a92e1cd 100644 --- a/assets/debian/changelog +++ b/assets/debian/changelog @@ -1,3 +1,10 @@ +srb2-data (2.1.21~7) trusty; urgency=high + + * Updated for SRB2 v2.1.21 + + -- Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 + + srb2-data (2.1.14~1) unstable; urgency=low * Updated for SRB2 v2.1.14 diff --git a/assets/debian/control b/assets/debian/control index 123b58429..22d9643ee 100644 --- a/assets/debian/control +++ b/assets/debian/control @@ -3,8 +3,9 @@ Source: srb2-data Section: games Priority: extra -Maintainer: Callum Dickinson -Build-Depends: debhelper (>= 7.0.50~) +Maintainer: Sonic Team Junior +Build-Depends: debhelper (>= 7.0.50~), + wget Standards-Version: 3.8.4 Homepage: http://www.srb2.org @@ -15,8 +16,7 @@ Description: A cross-platform 3D Sonic fangame fangame built using a modified version of the Doom Legacy port of Doom. SRB2 is closely inspired by the original Sonic games from the Sega Genesis, and attempts to recreate - the design in 3D. While SRB2 isn't fully completed, it already - features tons of levels, enemies, speed, and quite a lot - of the fun that the original Sonic games provided. + the design in 3D. It features tons of levels, enemies, speed, + and quite a lot of the fun that the original Sonic games provided. This is the data package that provides the data files that - SRB2 requires to run, it will not work without it. + SRB2 requires to run; it will not work without it. diff --git a/assets/debian/copyright b/assets/debian/copyright index 8a8705190..97d606b0f 100644 --- a/assets/debian/copyright +++ b/assets/debian/copyright @@ -1,6 +1,6 @@ This work was packaged for Debian by: - Callum Dickinson on Fri, 26 Nov 2010 15:19:16 +1300 + Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 It was downloaded from: @@ -12,7 +12,7 @@ Upstream Author(s): Copyright: - Copyright (C) 1998-2010 Sonic Team Junior + Copyright (C) 1998-2018 Sonic Team Junior License: @@ -21,6 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson + Copyright (C) 2010-2018 Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/assets/debian/rules b/assets/debian/rules index d86f92af2..a34a3393f 100755 --- a/assets/debian/rules +++ b/assets/debian/rules @@ -37,7 +37,7 @@ RM := rm -rf DIR := $(shell pwd) PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g') -DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta +DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta patch.dta README.txt LICENSE.txt LICENSE-3RD-PARTY.txt DATADIR := usr/games/SRB2 RESOURCEDIR := . @@ -45,16 +45,21 @@ WGET := wget -P $(RESOURCEDIR) -c -nc build: $(MKDIR) $(DIR)/debian/tmp/$(DATADIR) + > $(DIR)/debian/source/include-binaries # This will need to be updated every time SRB2 official version is # Copy data files to their install locations, and add data files to include-binaries for file in $(DATAFILES); do \ - $(WGET) http://alam.srb2.org/SRB2/2.1.14-Final/Resources/$$file; \ - if test "$$file" = "srb2.wad"; then \ - $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/srb2.srb; \ - else \ - $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/$$file; \ + if [ ! -f $(RESOURCEDIR)/$$file ]; then \ + $(WGET) http://alam.srb2.org/SRB2/2.1.21-Final/Resources/$$file; \ + fi; \ + if [ -f $(RESOURCEDIR)/$$file ]; then \ + $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/$$file; \ + echo $(RESOURCEDIR)/$$file >> $(DIR)/debian/source/include-binaries; \ + fi; \ + if [ ! -f $(DIR)/debian/tmp/$(DATADIR)/$$file ]; then \ + echo $(DIR)/debian/tmp/$(DATADIR)/$$file not found and could not be downloaded!; \ + return 1; \ fi; \ - echo $(RESOURCEDIR)/$$file >> $(DIR)/debian/source/include-binaries; \ done binary-indep: @@ -95,15 +100,18 @@ binary: binary-indep dh_builddeb clean: - $(RM) $(RESOURCEDIR)/*.wad - $(RM) $(RESOURCEDIR)/*.dta - $(RM) $(RESOURCEDIR)/*.plr - $(RM) $(RESOURCEDIR)/*.wpn - $(RM) $(RESOURCEDIR)/*.srb - $(RM) $(RESOURCEDIR)/*.dll - $(RM) $(DIR)/debian/tmp/* - $(RM) $(DIR)/debian/$(PACKAGE).install - $(RM) $(DIR)/debian/files - $(RM) $(DIR)/debian/source/include-binaries + $(RM) $(DIR)/debian/tmp/*; \ + $(RM) $(DIR)/debian/$(PACKAGE).install; \ + $(RM) $(DIR)/debian/files; \ + +clean-all: clean + $(RM) $(RESOURCEDIR)/*.wad; \ + $(RM) $(RESOURCEDIR)/*.dta; \ + $(RM) $(RESOURCEDIR)/*.plr; \ + $(RM) $(RESOURCEDIR)/*.wpn; \ + $(RM) $(RESOURCEDIR)/*.srb; \ + $(RM) $(RESOURCEDIR)/*.dll; \ + $(RM) $(RESOURCEDIR)/*.txt; \ + $(RM) $(DIR)/debian/source/include-binaries; \ .PHONY: all clean binary binary-arch binary-indep build diff --git a/assets/debian/source/options b/assets/debian/source/options new file mode 100644 index 000000000..8b331485a --- /dev/null +++ b/assets/debian/source/options @@ -0,0 +1 @@ +tar-ignore = "tmp/*" diff --git a/debian/README.Debian b/debian/README.Debian index bbc306b16..4b724816e 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -9,3 +9,38 @@ instructions and pass the -k command to debuild. Make sure you export the and give them to your users to install with apt-key add. Thanks! -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300 + + +Signing for Launchpad PPA + +First, follow the above instructions to generate a GnuPG key with your identity. You will need +to publish the fingerprint of that key to Ubuntu's key server. + + https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver + +Next, you will have to add that key fingerprint to your Launchpad account. Go to your Launchpad +profile and click the yellow Edit button next to "OpenPGP keys". Once you add the key, you can +upload signed source packages and publish them onto your PPA. + +IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that +means your key is not set up correctly with your Launchpad account. + + +Building for Launchpad PPA + +Use these steps to prepare building a source package for Launchpad: + + 1. cd [srb2repo] + 2. git reset --hard; git clean -fd; git clean -fx; + * Resets your repo folder to a committed state and removes untracked files + * If you built srb2-data in the assets/ folder, MAKE SURE THAT FOLDER DOES NOT HAVE ASSETS, + OR THEY MAY BE INCLUDED IN THE MAIN SOURCE PACKAGE! + +Building the source package takes just one step: + + 1. debuild -S (builds the source package for Launchpad) + +Then follow the instructions at to upload +to your PPA and have Launchpad build your binary deb packages. + + -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500 diff --git a/debian/README.source b/debian/README.source index ff2dddd41..f63a42cac 100644 --- a/debian/README.source +++ b/debian/README.source @@ -22,6 +22,10 @@ Build instructions: make -C src LINUX=1 +Build instructions for non-X86 devices (such as X64): + +make -C src LINUX=1 NONX86=1 + Build instructions to build for Wii Linux/SRB2Wii on a PowerPC system, follow cross-compiling instructions for cross-compiling on a x86 system: diff --git a/debian/changelog b/debian/changelog index b454b1abd..855c1c1b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +srb2 (2.1.21~9) trusty; urgency=high + + * SRB2 v2.1.21 release + + -- Marco Zafra Mon, 27 Nov 2018 16:45:00 -0500 + + srb2 (2.0.6-5) maverick; urgency=high * Initial proper release.. diff --git a/debian/control b/debian/control index 63b075f17..ce3b33fbd 100644 --- a/debian/control +++ b/debian/control @@ -3,11 +3,13 @@ Source: srb2 Section: games Priority: extra -Maintainer: Callum Dickinson +Maintainer: Sonic Team Junior Build-Depends: debhelper (>= 7.0.50~), libsdl2-dev, libsdl2-mixer-dev, - libpng12-dev (>= 1.2.7), + libpng12-dev (>= 1.2.7) | libpng-dev, + zlib1g-dev, + libgme-dev, libglu1-dev | libglu-dev, libosmesa6-dev | libgl-dev, nasm [i386] @@ -16,27 +18,26 @@ Homepage: http://www.srb2.org Package: srb2 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14) +Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.21) Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy port of Doom. SRB2 is closely inspired by the original Sonic games from the Sega Genesis, and attempts to recreate - the design in 3D. While SRB2 isn't fully completed, it already - features tons of levels, enemies, speed, and quite a lot - of the fun that the original Sonic games provided. + the design in 3D. It features tons of levels, enemies, speed, + and quite a lot of the fun that the original Sonic games provided. + Package: srb2-dbg Architecture: any # FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat -Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14), srb2 +Depends: libc6, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.21), srb2 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy port of Doom. SRB2 is closely inspired by the original Sonic games from the Sega Genesis, and attempts to recreate - the design in 3D. While SRB2 isn't fully completed, it already - features tons of levels, enemies, speed, and quite a lot - of the fun that the original Sonic games provided. - This is a debug binary, its symbols will be loaded by gdb + the design in 3D. It features tons of levels, enemies, speed, + and quite a lot of the fun that the original Sonic games provided. + This is a debug binary; its symbols will be loaded by gdb when the user starts the game with gdb for debugging. diff --git a/debian/copyright b/debian/copyright index b17abf20d..97d606b0f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,6 +1,6 @@ This work was packaged for Debian by: - Callum Dickinson on Fri, 26 Nov 2010 15:19:16 +1300 + Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 It was downloaded from: @@ -21,6 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson + Copyright (C) 2010-2018 Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/debian/docs b/debian/docs index b43bf86b5..dba2cd4c8 100644 --- a/debian/docs +++ b/debian/docs @@ -1 +1,4 @@ README.md +assets/README.txt +assets/LICENSE.txt +assets/LICENSE-3RD-PARTY.txt diff --git a/debian/rules b/debian/rules index e49784a0f..02e3dc78e 100755 --- a/debian/rules +++ b/debian/rules @@ -57,21 +57,32 @@ SECTION = Games/Action EXENAME = srb2 DBGNAME = debug/$(EXENAME) -PKGDIR = usr/games +PKGDIR = usr/games/SRB2 DBGDIR = usr/lib/debug/$(PKGDIR) PIXMAPS_DIR = usr/share/pixmaps DESKTOP_DIR = usr/share/applications PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)") OS = LINUX=1 NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1") -MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng NOOBJDUMP=1 +MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) NOOBJDUMP=1 # SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)" MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)" -# FIXME pkg-config dir hacks -export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig BINDIR := $(DIR)/bin/Linux/Release + +# FIXME pkg-config dir hacks +# Launchpad doesn't need this; it actually makes i386 builds fail due to cross-compile +# export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)" +# Some libgme-dev packages don't use pkg-config yet, so include the linker flag ourselves +PKG_CONFIG?=pkg-config +LIBGME_PKGCONFIG?=libgme +LIBGME_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --libs) + +ifeq ($(LIBGME_LDFLAGS),) +MAKEARGS += LIBGME_LDFLAGS=-lgme +endif + build: $(MKDIR) $(BINDIR)/debug $(MAKE) -C $(DIR)/src $(MAKEARGS) @@ -100,8 +111,8 @@ binary-arch: echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install - -binary: binary-arch +# Launchpad only calls binary-arch, so just move everything up +#binary: binary-arch # Generate .desktop specifications echo "`echo '$(MENUFILE1)\\'`" > $(DIR)/debian/menu echo " `echo '$(MENUFILE2)'`" >> $(DIR)/debian/menu @@ -133,6 +144,8 @@ binary: binary-arch dh_md5sums dh_builddeb +binary: binary-arch + clean: $(MAKE) -C $(DIR)/src $(MAKEARGS) clean cleandep $(RM) $(BINDIR)/* @@ -145,4 +158,4 @@ clean: $(RM) $(DIR)/debian/files $(RM) $(DIR)/debian/source/include-binaries -.PHONY: all clean binary binary-arch binary-indep build +.PHONY: all clean binary binary-indep build diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 000000000..841c65a6f --- /dev/null +++ b/debian/source/options @@ -0,0 +1,10 @@ +tar-ignore = "assets/*.srb" +tar-ignore = "assets/*.pk3" +tar-ignore = "assets/*.dta" +tar-ignore = "assets/*.wad" +tar-ignore = "assets/debian/srb2-data/*" +tar-ignore = "assets/debian/tmp/*" +tar-ignore = "*.obj" +tar-ignore = "*.dep" +tar-ignore = ".git/*" +tar-ignore = ".git*" diff --git a/debian/srb2.desktop b/debian/srb2.desktop index 661832b93..3a1cac9f6 100644 --- a/debian/srb2.desktop +++ b/debian/srb2.desktop @@ -1,8 +1,8 @@ [Desktop Entry] Name=Sonic Robo Blast 2 -Comment=A free 3D Sonic the Hedgehog fan-game built using a modified ver. of the Doom Legacy source port +Comment=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis. Encoding=UTF-8 -Exec=srb2 +Exec=/usr/games/SRB2/srb2 Icon=/usr/share/pixmaps/srb2.png Terminal=false Type=Application diff --git a/srb2.png b/srb2.png index 9c13eae9a..72a08f664 100644 Binary files a/srb2.png and b/srb2.png differ diff --git a/srb2banner.png b/srb2banner.png new file mode 100644 index 000000000..9c13eae9a Binary files /dev/null and b/srb2banner.png differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 90a4f44cb..f4e2898e4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -239,6 +239,7 @@ if(${SRB2_CONFIG_HAVE_BLUA}) add_definitions(-DHAVE_BLUA) set(SRB2_LUA_SOURCES lua_baselib.c + lua_blockmaplib.c lua_consolelib.c lua_hooklib.c lua_hudlib.c diff --git a/src/blua/Makefile.cfg b/src/blua/Makefile.cfg index e3fb3df46..b1131eaca 100644 --- a/src/blua/Makefile.cfg +++ b/src/blua/Makefile.cfg @@ -39,6 +39,7 @@ OBJS:=$(OBJS) \ $(OBJDIR)/lvm.o \ $(OBJDIR)/lua_script.o \ $(OBJDIR)/lua_baselib.o \ + $(OBJDIR)/lua_blockmaplib.o \ $(OBJDIR)/lua_mathlib.o \ $(OBJDIR)/lua_hooklib.o \ $(OBJDIR)/lua_consolelib.o \ diff --git a/src/config.h.in b/src/config.h.in index fd45d38fd..885d21d65 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -52,7 +52,7 @@ #define ASSET_HASH_CHARS_KART "784ee9177b01c8cb26edff43eaf93d87" #define ASSET_HASH_MAPS_KART "84018d9b35d181ca9fcc2be5a9d43a45" #ifdef USE_PATCH_KART -#define ASSET_HASH_PATCH_KART "20e5dbae7609787d135f0e52850e6545" +#define ASSET_HASH_PATCH_KART "843a13a73935dc4df721427a8948fb89" #endif #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7c0618b35..f29798382 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2310,6 +2310,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) INT32 resetplayer = 1, lastgametype; UINT8 skipprecutscene, FLS; boolean pencoremode; +/*#ifdef HAVE_BLUA + INT16 mapnumber; +#endif*/ forceresetplayers = deferencoremode = false; @@ -2376,9 +2379,10 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) if (modeattacking) // i remember moving this here in internal fixed a heisenbug so SetPlayerSkinByNum(0, cv_chooseskin.value-1); -#ifdef HAVE_BLUA - LUAh_MapChange(); -#endif +/*#ifdef HAVE_BLUA + mapnumber = M_MapNumber(mapname[3], mapname[4]); + LUAh_MapChange(mapnumber); +#endif*/ G_InitNew(pencoremode, mapname, resetplayer, skipprecutscene); if (demoplayback && !timingdemo) diff --git a/src/g_game.c b/src/g_game.c index 7051bdf19..64b763639 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1383,8 +1383,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls { + axis = JoyAxis(AXISMOVE, ssplayer); if (InputDown(gc_accelerate, ssplayer) || (usejoystick && axis > 0)) cmd->buttons |= BT_ACCELERATE; + axis = JoyAxis(AXISBRAKE, ssplayer); if (InputDown(gc_brake, ssplayer) || (usejoystick && axis > 0)) cmd->buttons |= BT_BRAKE; axis = JoyAxis(AXISAIM, ssplayer); @@ -2986,14 +2988,12 @@ void G_DoReborn(INT32 playernum) } } else -#ifdef HAVE_BLUA { - LUAh_MapChange(); +#ifdef HAVE_BLUA + LUAh_MapChange(gamemap); #endif G_DoLoadLevel(true); -#ifdef HAVE_BLUA } -#endif }*/ else { @@ -4398,7 +4398,12 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool if (!skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking) // Start a custom cutscene. F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer); else + { +#ifdef HAVE_BLUA + LUAh_MapChange(gamemap); +#endif G_DoLoadLevel(resetplayer); + } if (netgame) { @@ -5912,9 +5917,9 @@ void G_DoPlayDemo(char *defdemoname) // didn't start recording right away. demo_start = false; -#ifdef HAVE_BLUA - LUAh_MapChange(); -#endif +/*#ifdef HAVE_BLUA + LUAh_MapChange(gamemap); +#endif*/ displayplayer = consoleplayer = 0; memset(playeringame,0,sizeof(playeringame)); playeringame[0] = true; diff --git a/src/info.c b/src/info.c index b0c58875e..d952fd1c6 100644 --- a/src/info.c +++ b/src/info.c @@ -14856,8 +14856,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_kc2e, // deathsound 60*FRACUNIT, // speed - 36*FRACUNIT, // radius - 36*FRACUNIT, // height + 48*FRACUNIT, // radius + 48*FRACUNIT, // height 0, // display offset 100, // mass MT_RANDOMITEMPOP, // damage @@ -14910,8 +14910,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_itpick, // deathsound 0, // speed - 24*FRACUNIT, // radius - 24*FRACUNIT, // height + 32*FRACUNIT, // radius + 32*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage diff --git a/src/k_kart.c b/src/k_kart.c index a40d4838b..b462d961c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8046,10 +8046,10 @@ static void K_drawCheckpointDebugger(void) if (stplyr != &players[displayplayer]) // only for p1 return; - if (stplyr->starpostnum >= (numstarposts - (2*numstarposts)/5)) + if (stplyr->starpostnum >= (numstarposts - (numstarposts/2))) V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Can finish)", stplyr->starpostnum, numstarposts)); else - V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, ((2*numstarposts)/5 + stplyr->starpostnum))); + V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, ((numstarposts/2) + stplyr->starpostnum))); V_DrawString(8, 192, 0, va("Waypoint dist: Prev %d, Next %d", stplyr->kartstuff[k_prevcheck], stplyr->kartstuff[k_nextcheck])); } diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c new file mode 100644 index 000000000..dabbdd9f6 --- /dev/null +++ b/src/lua_blockmaplib.c @@ -0,0 +1,266 @@ +// SONIC ROBO BLAST 2 +//----------------------------------------------------------------------------- +// Copyright (C) 2016 by Iestyn "Monster Iestyn" Jealous. +// Copyright (C) 2016 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 lua_blockmaplib.c +/// \brief blockmap library for Lua scripting + +#include "doomdef.h" +#ifdef HAVE_BLUA +#include "p_local.h" +#include "r_main.h" // validcount +#include "lua_script.h" +#include "lua_libs.h" +//#include "lua_hud.h" // hud_running errors + +static const char *const search_opt[] = { + "objects", + "lines", + NULL}; + +// a quickly-made function pointer typedef used by lib_searchBlockmap... +// return values: +// 0 - normal, no interruptions +// 1 - stop search through current block +// 2 - stop search completely +typedef UINT8 (*blockmap_func)(lua_State *, INT32, INT32, mobj_t *); + +static boolean blockfuncerror = false; // errors should only print once per search blockmap call + +// Helper function for "objects" search +static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t *thing) +{ + mobj_t *mobj, *bnext = NULL; + + if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) + return 0; + + // Check interaction with the objects in the blockmap. + for (mobj = blocklinks[y*bmapwidth + x]; mobj; mobj = bnext) + { + P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed! + if (mobj == thing) + continue; // our thing just found itself, so move on + lua_pushvalue(L, 1); // push function + LUA_PushUserdata(L, thing, META_MOBJ); + LUA_PushUserdata(L, mobj, META_MOBJ); + if (lua_pcall(gL, 2, 1, 0)) { + if (!blockfuncerror || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + blockfuncerror = true; + return 0; // *shrugs* + } + if (!lua_isnil(gL, -1)) + { // if nil, continue + if (lua_toboolean(gL, -1)) + return 2; // stop whole search + else + return 1; // stop block search + } + lua_pop(gL, 1); + if (P_MobjWasRemoved(thing) // func just popped our thing, cannot continue. + || (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue. + { + P_SetTarget(&bnext, NULL); + return (P_MobjWasRemoved(thing)) ? 2 : 1; + } + } + return 0; +} + +// Helper function for "lines" search +static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *thing) +{ + INT32 offset; + const INT32 *list; // Big blockmap +#ifdef POLYOBJECTS + polymaplink_t *plink; // haleyjd 02/22/06 +#endif + line_t *ld; + + if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) + return 0; + + offset = y*bmapwidth + x; + +#ifdef POLYOBJECTS + // haleyjd 02/22/06: consider polyobject lines + plink = polyblocklinks[offset]; + + while (plink) + { + polyobj_t *po = plink->po; + + if (po->validcount != validcount) // if polyobj hasn't been checked + { + size_t i; + po->validcount = validcount; + + for (i = 0; i < po->numLines; ++i) + { + if (po->lines[i]->validcount == validcount) // line has been checked + continue; + po->lines[i]->validcount = validcount; + + lua_pushvalue(L, 1); + LUA_PushUserdata(L, thing, META_MOBJ); + LUA_PushUserdata(L, po->lines[i], META_LINE); + if (lua_pcall(gL, 2, 1, 0)) { + if (!blockfuncerror || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + blockfuncerror = true; + return 0; // *shrugs* + } + if (!lua_isnil(gL, -1)) + { // if nil, continue + if (lua_toboolean(gL, -1)) + return 2; // stop whole search + else + return 1; // stop block search + } + lua_pop(gL, 1); + if (P_MobjWasRemoved(thing)) + return 2; + } + } + plink = (polymaplink_t *)(plink->link.next); + } +#endif + + offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x]; + + // First index is really empty, so +1 it. + for (list = blockmaplump + offset + 1; *list != -1; list++) + { + ld = &lines[*list]; + + if (ld->validcount == validcount) + continue; // Line has already been checked. + + ld->validcount = validcount; + + lua_pushvalue(L, 1); + LUA_PushUserdata(L, thing, META_MOBJ); + LUA_PushUserdata(L, ld, META_LINE); + if (lua_pcall(gL, 2, 1, 0)) { + if (!blockfuncerror || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + blockfuncerror = true; + return 0; // *shrugs* + } + if (!lua_isnil(gL, -1)) + { // if nil, continue + if (lua_toboolean(gL, -1)) + return 2; // stop whole search + else + return 1; // stop block search + } + lua_pop(gL, 1); + if (P_MobjWasRemoved(thing)) + return 2; + } + return 0; // Everything was checked. +} + +// The searchBlockmap function +// arguments: searchBlockmap(searchtype, function, mobj, [x1, x2, y1, y2]) +// return value: +// true = search completely uninteruppted, +// false = searching of at least one block stopped mid-way (including if the whole search was stopped) +static int lib_searchBlockmap(lua_State *L) +{ + int searchtype = luaL_checkoption(L, 1, "objects", search_opt); + int n; + mobj_t *mobj; + INT32 xl, xh, yl, yh, bx, by; + fixed_t x1, x2, y1, y2; + boolean retval = true; + UINT8 funcret = 0; + blockmap_func searchFunc; + + lua_remove(L, 1); // remove searchtype, stack is now function, mobj, [x1, x2, y1, y2] + luaL_checktype(L, 1, LUA_TFUNCTION); + + switch (searchtype) + { + case 0: // "objects" + default: + searchFunc = lib_searchBlockmap_Objects; + break; + case 1: // "lines" + searchFunc = lib_searchBlockmap_Lines; + break; + } + + // the mobj we are searching around, the "calling" mobj we could say + mobj = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); + if (!mobj) + return LUA_ErrInvalid(L, "mobj_t"); + + n = lua_gettop(L); + + if (n > 2) // specific x/y ranges have been supplied + { + if (n < 6) + return luaL_error(L, "arguments 4 to 6 not all given (expected 4 fixed-point integers)"); + + x1 = luaL_checkfixed(L, 3); + x2 = luaL_checkfixed(L, 4); + y1 = luaL_checkfixed(L, 5); + y2 = luaL_checkfixed(L, 6); + } + else // mobj and function only - search around mobj's radius by default + { + fixed_t radius = mobj->radius + MAXRADIUS; + x1 = mobj->x - radius; + x2 = mobj->x + radius; + y1 = mobj->y - radius; + y2 = mobj->y + radius; + } + lua_settop(L, 2); // pop everything except function, mobj + + xl = (unsigned)(x1 - bmaporgx)>>MAPBLOCKSHIFT; + xh = (unsigned)(x2 - bmaporgx)>>MAPBLOCKSHIFT; + yl = (unsigned)(y1 - bmaporgy)>>MAPBLOCKSHIFT; + yh = (unsigned)(y2 - bmaporgy)>>MAPBLOCKSHIFT; + + BMBOUNDFIX(xl, xh, yl, yh); + + blockfuncerror = false; // reset + validcount++; + for (bx = xl; bx <= xh; bx++) + for (by = yl; by <= yh; by++) + { + funcret = searchFunc(L, bx, by, mobj); + // return value of searchFunc determines searchFunc's return value and/or when to stop + if (funcret == 2){ // stop whole search + lua_pushboolean(L, false); // return false + return 1; + } + else if (funcret == 1) // search was interrupted for this block + retval = false; // this changes the return value, but doesn't stop the whole search + // else don't do anything, continue as normal + if (P_MobjWasRemoved(mobj)){ // ...unless the original object was removed + lua_pushboolean(L, false); // in which case we have to stop now regardless + return 1; + } + } + lua_pushboolean(L, retval); + return 1; +} + +int LUA_BlockmapLib(lua_State *L) +{ + lua_register(L, "searchBlockmap", lib_searchBlockmap); + return 0; +} + +#endif diff --git a/src/lua_hook.h b/src/lua_hook.h index 81970dfed..2c9cd346b 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -55,7 +55,7 @@ enum hook { }; extern const char *const hookNames[]; -void LUAh_MapChange(void); // Hook for map change (before load) +void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load) void LUAh_MapLoad(void); // Hook for map load void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 761254d07..13ad03d35 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -333,14 +333,14 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which) } // Hook for map change (before load) -void LUAh_MapChange(void) +void LUAh_MapChange(INT16 mapnumber) { hook_p hookp; if (!gL || !(hooksAvailable[hook_MapChange/8] & (1<<(hook_MapChange%8)))) return; lua_settop(gL, 0); - lua_pushinteger(gL, gamemap); + lua_pushinteger(gL, mapnumber); for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_MapChange) diff --git a/src/lua_libs.h b/src/lua_libs.h index 7bf0de387..cb1cb49c7 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -71,6 +71,7 @@ int LUA_PlayerLib(lua_State *L); int LUA_SkinLib(lua_State *L); int LUA_ThinkerLib(lua_State *L); int LUA_MapLib(lua_State *L); +int LUA_BlockmapLib(lua_State *L); int LUA_HudLib(lua_State *L); #endif diff --git a/src/lua_script.c b/src/lua_script.c index a9469864d..34a260527 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -51,6 +51,7 @@ static lua_CFunction liblist[] = { LUA_SkinLib, // skin_t, skins[] LUA_ThinkerLib, // thinker_t LUA_MapLib, // line_t, side_t, sector_t, subsector_t + LUA_BlockmapLib, // blockmap stuff LUA_HudLib, // HUD stuff NULL }; diff --git a/src/p_inter.c b/src/p_inter.c index 93bca79ec..7c599016a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -504,6 +504,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) for (i = 0; i < 5; i++) { mobj_t *firework = P_SpawnMobj(special->x, special->y, special->z, MT_KARMAFIREWORK); + firework->momx = (special->target->momx + toucher->momx) / 2; + firework->momy = (special->target->momy + toucher->momy) / 2; + firework->momz = (special->target->momz + toucher->momz) / 2; P_Thrust(firework, FixedAngle((72*i)<scale); P_SetObjectMomZ(firework, P_RandomRange(1,8)*special->scale, false); firework->color = special->target->color; @@ -638,6 +641,18 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->kartstuff[k_itemroulette] = 1; player->kartstuff[k_roulettetype] = 1; + // Karma fireworks + for (i = 0; i < 5; i++) + { + mobj_t *firework = P_SpawnMobj(special->x, special->y, special->z, MT_KARMAFIREWORK); + firework->momx = toucher->momx; + firework->momy = toucher->momy; + firework->momz = toucher->momz; + P_Thrust(firework, FixedAngle((72*i)<scale); + P_SetObjectMomZ(firework, P_RandomRange(1,8)*special->scale, false); + firework->color = toucher->color; + } + S_StartSound(toucher, sfx_cdfm73); // they don't make this sound in the original game but it's nice to have a "reward" for good play //special->momx = special->momy = special->momz = 0; @@ -1425,7 +1440,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } // // SRB2kart: make sure the player will have enough checkpoints to touch - if (circuitmap && special->health >= ((2*numstarposts)/5 + player->starpostnum)) + if (circuitmap && special->health >= ((numstarposts/2) + player->starpostnum)) { // blatant reuse of a variable that's normally unused in circuit if (!player->tossdelay) diff --git a/src/p_mobj.c b/src/p_mobj.c index 88405bd6c..18458f34c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6362,7 +6362,7 @@ void P_RunShadows(void) } if (mobj->target->type == MT_FLOATINGITEM) - P_SetScale(mobj, mobj->scale/2); + P_SetScale(mobj, mobj->scale/3); } P_SetTarget(&shadowcap, NULL); } @@ -8490,7 +8490,7 @@ void P_MobjThinker(mobj_t *mobj) // Give items an item-sized hitbox if (mobj->target->player->kartstuff[k_comebackmode] == 1) - mobj->radius = 36*mobj->target->scale; + mobj->radius = 48*mobj->target->scale; else mobj->radius = 24*mobj->target->scale; mobj->height = 2*mobj->radius; diff --git a/src/p_spec.c b/src/p_spec.c index 88b44c537..d8aed0e9d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4193,12 +4193,12 @@ DoneSection2: case 10: // Finish Line // SRB2kart - 150117 - if (G_RaceGametype() && (player->starpostnum >= (numstarposts - (2*numstarposts)/5) || player->exiting)) + if (G_RaceGametype() && (player->starpostnum >= (numstarposts - (numstarposts/2)) || player->exiting)) player->kartstuff[k_starpostwp] = player->kartstuff[k_waypoint] = 0; // if (G_RaceGametype() && !player->exiting) { - if (player->starpostnum >= (numstarposts - (2*numstarposts)/5)) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)") + if (player->starpostnum >= (numstarposts - (numstarposts/2))) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)") { UINT8 nump = 0; diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index 83851ba39..df582865c 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -304,6 +304,7 @@ + diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index d30478dbd..09287436d 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -642,6 +642,9 @@ LUA + + LUA + LUA diff --git a/src/w_wad.c b/src/w_wad.c index 914ee1707..512320c2a 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -118,10 +118,10 @@ void W_Shutdown(void) while (numwadfiles--) { fclose(wadfiles[numwadfiles]->handle); - Z_Free(wadfiles[numwadfiles]->lumpinfo); Z_Free(wadfiles[numwadfiles]->filename); while (wadfiles[numwadfiles]->numlumps--) Z_Free(wadfiles[numwadfiles]->lumpinfo[wadfiles[numwadfiles]->numlumps].name2); + Z_Free(wadfiles[numwadfiles]->lumpinfo); Z_Free(wadfiles[numwadfiles]); } } diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj index 0722c0b68..5bfa29b8c 100644 --- a/src/win32/Srb2win-vc10.vcxproj +++ b/src/win32/Srb2win-vc10.vcxproj @@ -132,6 +132,7 @@ + diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters index 95e79cab1..d20dd672b 100644 --- a/src/win32/Srb2win-vc10.vcxproj.filters +++ b/src/win32/Srb2win-vc10.vcxproj.filters @@ -228,6 +228,9 @@ LUA + + LUA + LUA