diff --git a/source/games/duke/src/actor.h b/source/games/duke/src/actor.h new file mode 100644 index 000000000..e077e0535 --- /dev/null +++ b/source/games/duke/src/actor.h @@ -0,0 +1,94 @@ +#pragma once + +// shared functions +void movecyclers(void); +void movedummyplayers(void); +void resetlanepics(void); +void moveplayers(); +void doanimations(); +void movefx(); + +void ms(short i); +void movecrane(int i, int crane); +void movefountain(int i, int fountain); +void moveflammable(int i, int tire, int box, int pool); +void detonate(int i, int explosion); +void movemasterswitch(int i, int spectype1, int spectype2); +void movetrash(int i); +void movewaterdrip(int i, int drip); +void movedoorshock(int i); +void movetouchplate(int i, int plate); +void movecanwithsomething(int i); +void bounce(int i); +void movetongue(int i, int tongue, int jaw); +void moveooz(int i, int seenine, int seeninedead, int ooz, int explosion); +void lotsofstuff(spritetype* s, short n, int spawntype); +bool respawnmarker(int i, int yellow, int green); +bool rat(int i, bool makesound); +bool queball(int i, int pocket, int queball, int stripeball); +void forcesphere(int i, int forcesphere); +void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(int i)); +void ooz(int i); +void reactor(int i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT); +void camera(int i); +void forcesphere(int i); +void watersplash2(int i); +void frameeffect1(int i); +bool money(int i, int BLOODPOOL); +bool jibs(int i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2); +bool bloodpool(int i, bool puke, int TIRE); +void shell(int i, bool morecheck); +void glasspieces(int i); +void scrap(int i, int SCRAP1, int SCRAP6); + +void handle_se00(int i, int LASERLINE); +void handle_se01(int i); +void handle_se14(int i, bool checkstat, int RPG, int JIBS6); +void handle_se30(int i, int JIBS6); +void handle_se02(int i); +void handle_se03(int i); +void handle_se04(int i); +void handle_se05(int i, int FIRELASER); +void handle_se08(int i, bool checkhitag1); +void handle_se10(int i, const int *); +void handle_se11(int i); +void handle_se12(int i, int planeonly = 0); +void handle_se13(int i); +void handle_se15(int i); +void handle_se16(int i, int REACTOR, int REACTOR2); +void handle_se17(int i); +void handle_se18(int i, bool morecheck); +void handle_se19(int i, int BIGFORCE); +void handle_se20(int i); +void handle_se21(int i); +void handle_se22(int i); +void handle_se26(int i); +void handle_se27(int i); +void handle_se32(int i); +void handle_se35(int i, int SMALLSMOKE, int EXPLOSION2); +void handle_se128(int i); +void handle_se130(int i, int countmax, int EXPLOSION2); + +void respawn_rrra(int i, int j); + +int dodge(spritetype*); +void alterang(int a, int g_i, int g_p); +void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*)); +void checkavailweapon(struct player_struct* p); + +// tile names which are identical for all games. +enum +{ + SECTOREFFECTOR = 1, + ACTIVATOR = 2, + TOUCHPLATE = 3, + ACTIVATORLOCKED = 4, + MUSICANDSFX = 5, + LOCATORS = 6, + CYCLER = 7, + MASTERSWITCH = 8, + RESPAWN = 9, + GPSPEED = 10, + FOF = 13, +}; + diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 3099438a0..c4ab7c73d 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -36,7 +36,7 @@ This file contains parts of DukeGDX by Alexander Makarov-[M210] (m210-2007@mail. #include "ns.h" #include "global.h" -#include "actors.h" +#include "zz_actors.h" #include "names.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index f0abd8c0e..3c45afbf6 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -27,7 +27,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms //------------------------------------------------------------------------- #include "ns.h" #include "global.h" -#include "actors.h" +#include "zz_actors.h" #include "names_rr.h" #include "serializer.h" diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index d8835dbef..f6515208d 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -28,7 +28,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" -#include "actors.h" +#include "zz_actors.h" #include "names_rr.h" #include "mmulti.h" diff --git a/source/games/duke/src/bowling.cpp b/source/games/duke/src/bowling.cpp index 1ae017c25..24342b5ff 100644 --- a/source/games/duke/src/bowling.cpp +++ b/source/games/duke/src/bowling.cpp @@ -28,7 +28,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" -#include "actors.h" +#include "zz_actors.h" #include "names_rr.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 3a4c66394..e485d25f1 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -108,7 +108,7 @@ EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES); END_DUKE_NS -#include "actors.h" +#include "zz_actors.h" #include "common_game.h" #include "gamecontrol.h" #include "game.h" @@ -123,7 +123,7 @@ END_DUKE_NS #include "player.h" #include "quotes.h" #include "rts.h" -#include "text.h" +#include "zz_text.h" #include "sector.h" #include "sounds.h" #include "soundefs.h" diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index b31678bee..7443949a4 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -33,7 +33,7 @@ source as it is released. #include "ns.h" #include "global.h" -#include "actors.h" +#include "zz_actors.h" #include "names.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 4b975ed7b..52fc75e70 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -27,7 +27,7 @@ Prepared for public release, 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" -#include "actors.h" +#include "zz_actors.h" #include "names_rr.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/gamedef.h b/source/games/duke/src/gamedef.h index 6ed7853e1..e08e37961 100644 --- a/source/games/duke/src/gamedef.h +++ b/source/games/duke/src/gamedef.h @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define gamedef_h_ #include "gamevar.h" -#include "actors.h" +#include "zz_actors.h" #include "build.h" // hashtable_t #include "cheats.h" #include "common.h" // tokenlist diff --git a/source/games/duke/src/interpolate.cpp b/source/games/duke/src/interpolate.cpp new file mode 100644 index 000000000..60e7bff2d --- /dev/null +++ b/source/games/duke/src/interpolate.cpp @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements) + +This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Original Source: 1996 - Todd Replogle +Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms + +EDuke enhancements integrated: 04/13/2003 - Matt Saettler + +Note: EDuke source was in transition. Changes are in-progress in the +source as it is released. + +*/ +//------------------------------------------------------------------------- + + + +void updateinterpolations() //Stick at beginning of domovethings +{ + long i; + + for(i=numinterpolations-1;i>=0;i--) oldipos[i] = *curipos[i]; +} + + +void setinterpolation(long *posptr) +{ + long i; + + if (numinterpolations >= MAXINTERPOLATIONS) return; + for(i=numinterpolations-1;i>=0;i--) + if (curipos[i] == posptr) return; + curipos[numinterpolations] = posptr; + oldipos[numinterpolations] = *posptr; + numinterpolations++; +} + +void stopinterpolation(long *posptr) +{ + long i; + + for(i=numinterpolations-1;i>=startofdynamicinterpolations;i--) + if (curipos[i] == posptr) + { + numinterpolations--; + oldipos[i] = oldipos[numinterpolations]; + bakipos[i] = bakipos[numinterpolations]; + curipos[i] = curipos[numinterpolations]; + } +} + +void dointerpolations(long smoothratio) //Stick at beginning of drawscreen +{ + long i, j, odelta, ndelta; + + ndelta = 0; j = 0; + for(i=numinterpolations-1;i>=0;i--) + { + bakipos[i] = *curipos[i]; + odelta = ndelta; ndelta = (*curipos[i])-oldipos[i]; + if (odelta != ndelta) j = mulscale16(ndelta,smoothratio); + *curipos[i] = oldipos[i]+j; + } +} + +void restoreinterpolations() //Stick at end of drawscreen +{ + long i; + + for(i=numinterpolations-1;i>=0;i--) *curipos[i] = bakipos[i]; +} + + +void setsectinterpolate(short i) +{ + long j, k, startwall,endwall; + + startwall = sector[SECT].wallptr; + endwall = startwall+sector[SECT].wallnum; + + for(j=startwall;j= 0) + { + setinterpolation(&wall[k].x); + setinterpolation(&wall[k].y); + k = wall[k].point2; + setinterpolation(&wall[k].x); + setinterpolation(&wall[k].y); + } + } +} + +void clearsectinterpolate(short i) +{ + short j,startwall,endwall; + + startwall = sector[SECT].wallptr; + endwall = startwall+sector[SECT].wallnum; + for(j=startwall;j= 0) + { + stopinterpolation(&wall[wall[j].nextwall].x); + stopinterpolation(&wall[wall[j].nextwall].y); + } + } +} + diff --git a/source/games/duke/src/sector.h b/source/games/duke/src/sector.h index 8a1862a61..4e0b3a9ff 100644 --- a/source/games/duke/src/sector.h +++ b/source/games/duke/src/sector.h @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef sector_h_ #define sector_h_ -#include "actors.h" // actor_t +#include "zz_actors.h" // actor_t #include "gamedef.h" #include "gamevar.h" #include "macros.h" diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 9d9a4c524..67bcbb579 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -35,7 +35,7 @@ source as it is released. #include #include "ns.h" #include "global.h" -#include "sounds_common.h" +#include "sounds.h" using std::min; using std::max; diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 98f244771..137f22b3b 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -34,7 +34,7 @@ source as it is released. #include "ns.h" #include "global.h" -#include "sounds_common.h" +#include "sounds.h" #include "names.h" // PRIMITIVE diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 7178b9c4c..4675ff944 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -28,7 +28,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" -#include "sounds_common.h" +#include "sounds.h" #include "names_rr.h" // PRIMITIVE diff --git a/source/games/duke/src/sounds.h b/source/games/duke/src/sounds.h index 410fa98f6..4934085b7 100644 --- a/source/games/duke/src/sounds.h +++ b/source/games/duke/src/sounds.h @@ -29,12 +29,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef sounds_public_h_ #define sounds_public_h_ -#include "sounds_common.h" #include "raze_sound.h" #include "raze_music.h" BEGIN_DUKE_NS +// Sound flags +enum { + SF_LOOP = 1, + SF_MSFX = 2, + SF_TALK = 4, + SF_ADULT = 8, + SF_GLOBAL = 16, + SF_ONEINST_INTERNAL = 32, + + SF_DTAG = 128, +}; + // KEEPINSYNC lunatic/con_lang.lua #define MAXSOUNDS 4096 #define LOUDESTVOLUME 111 diff --git a/source/games/duke/src/sounds_common.h b/source/games/duke/src/sounds_common.h deleted file mode 100644 index 5c0dae7ff..000000000 --- a/source/games/duke/src/sounds_common.h +++ /dev/null @@ -1,38 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2013 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef EDUKE32_SOUNDS_COMMON_H -#define EDUKE32_SOUNDS_COMMON_H - -// Sound flags -enum { - SF_LOOP = 1, - SF_MSFX = 2, - SF_TALK = 4, - SF_ADULT = 8, - SF_GLOBAL = 16, - SF_ONEINST_INTERNAL = 32, - - SF_DTAG = 128, -}; - -#endif diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index da96f7a08..79c3e72fd 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -36,7 +36,7 @@ source as it is released. #include "ns.h" #include "global.h" #include "game.h" -#include "sounds_common.h" +#include "sounds.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 2647bf4d0..afbf058c3 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -35,7 +35,7 @@ source as it is released. #include "ns.h" #include "global.h" #include "game.h" -#include "sounds_common.h" +#include "sounds.h" #include "names.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 6e384b76f..9339f165a 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -30,7 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" #include "game.h" -#include "sounds_common.h" +#include "sounds.h" #include "names_rr.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/actors.h b/source/games/duke/src/zz_actors.h similarity index 76% rename from source/games/duke/src/actors.h rename to source/games/duke/src/zz_actors.h index 930833e89..eb769863c 100644 --- a/source/games/duke/src/actors.h +++ b/source/games/duke/src/zz_actors.h @@ -247,13 +247,6 @@ int LocateTheLocator(int const tag, int const sectNum); int A_IncurDamage(int spriteNum); void A_DeleteSprite(int spriteNum); -void movecyclers(void); -void movedummyplayers(void); -void resetlanepics(void); -void moveplayers(); -void doanimations(); -void movefx(); - int G_SetInterpolation(int32_t *posptr); void G_ClearCameraView(DukePlayer_t *ps); void clearcamera(player_struct* ps); @@ -322,90 +315,7 @@ inline int wakeup(int sn, int pn) return G_WakeUp(&sprite[sn], pn); } -// shared functions -void ms(short i); -void movecrane(int i, int crane); -void movefountain(int i, int fountain); -void moveflammable(int i, int tire, int box, int pool); -void detonate(int i, int explosion); -void movemasterswitch(int i, int spectype1, int spectype2); -void movetrash(int i); -void movewaterdrip(int i, int drip); -void movedoorshock(int i); -void movetouchplate(int i, int plate); -void movecanwithsomething(int i); -void bounce(int i); -void movetongue(int i, int tongue, int jaw); -void moveooz(int i, int seenine, int seeninedead, int ooz, int explosion); -void lotsofstuff(spritetype* s, short n, int spawntype); -bool respawnmarker(int i, int yellow, int green); -bool rat(int i, bool makesound); -bool queball(int i, int pocket, int queball, int stripeball); -void forcesphere(int i, int forcesphere); -void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(int i)); -void ooz(int i); -void reactor(int i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT); -void camera(int i); -void forcesphere(int i); -void watersplash2(int i); -void frameeffect1(int i); -bool money(int i, int BLOODPOOL); -bool jibs(int i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2); -bool bloodpool(int i, bool puke, int TIRE); -void shell(int i, bool morecheck); -void glasspieces(int i); -void scrap(int i, int SCRAP1, int SCRAP6); - -void handle_se00(int i, int LASERLINE); -void handle_se01(int i); -void handle_se14(int i, bool checkstat, int RPG, int JIBS6); -void handle_se30(int i, int JIBS6); -void handle_se02(int i); -void handle_se03(int i); -void handle_se04(int i); -void handle_se05(int i, int FIRELASER); -void handle_se08(int i, bool checkhitag1); -void handle_se10(int i, const int *); -void handle_se11(int i); -void handle_se12(int i, int planeonly = 0); -void handle_se13(int i); -void handle_se15(int i); -void handle_se16(int i, int REACTOR, int REACTOR2); -void handle_se17(int i); -void handle_se18(int i, bool morecheck); -void handle_se19(int i, int BIGFORCE); -void handle_se20(int i); -void handle_se21(int i); -void handle_se22(int i); -void handle_se26(int i); -void handle_se27(int i); -void handle_se32(int i); -void handle_se35(int i, int SMALLSMOKE, int EXPLOSION2); -void handle_se128(int i); -void handle_se130(int i, int countmax, int EXPLOSION2); - -void respawn_rrra(int i, int j); - -int dodge(spritetype*); -void alterang(int a, int g_i, int g_p); -void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*)); -void checkavailweapon(struct player_struct* p); - -// tile names which are identical for all games. -enum -{ - SECTOREFFECTOR = 1, - ACTIVATOR = 2, - TOUCHPLATE = 3, - ACTIVATORLOCKED = 4, - MUSICANDSFX = 5, - LOCATORS = 6, - CYCLER = 7, - MASTERSWITCH = 8, - RESPAWN = 9, - GPSPEED = 10, - FOF = 13, -}; +#include "actor.h" #endif diff --git a/source/games/duke/src/zz_anim.cpp b/source/games/duke/src/zz_anim.cpp index d8399cb16..40e8f1ae1 100644 --- a/source/games/duke/src/zz_anim.cpp +++ b/source/games/duke/src/zz_anim.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "../glbackend/glbackend.h" -#include "anim.h" +#include "zz_anim.h" #ifdef USE_LIBVPX # include "animvpx.h" diff --git a/source/games/duke/src/anim.h b/source/games/duke/src/zz_anim.h similarity index 100% rename from source/games/duke/src/anim.h rename to source/games/duke/src/zz_anim.h diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 9ec95b7c6..2d00e3b52 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "net.h" #include "menus.h" #include "savegame.h" -#include "anim.h" +#include "zz_anim.h" #include "demo.h" #include "cheats.h" diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 0d214a7e8..d57421404 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ns.h" // Must come before everything else! #include "duke3d.h" -#include "anim.h" +#include "zz_anim.h" #include "menus.h" #include "demo.h" #include "savegame.h" diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index 9f3509f31..5b660324b 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "screens.h" -#include "anim.h" +#include "zz_anim.h" #include "sbar.h" #include "menus.h" #include "demo.h" diff --git a/source/games/duke/src/text.h b/source/games/duke/src/zz_text.h similarity index 100% rename from source/games/duke/src/text.h rename to source/games/duke/src/zz_text.h