- separated Duke and RR implementations because the more complex functions would become too messy otherwise.

This commit is contained in:
Christoph Oelckers 2020-05-07 22:30:19 +02:00
parent bda3374f9b
commit 63f45f57d8
10 changed files with 1100 additions and 7064 deletions

File diff suppressed because it is too large Load diff

View file

@ -367,6 +367,43 @@ inline int wakeup(int sn, int pn)
return G_WakeUp(&sprite[sn], pn);
}
// shared functions
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);
void respawn_rrra(int i, int j);
void hitradius(short i, int r, int hp1, int hp2, int hp3, int hp4);
int ifhitbyweapon(int sn);
int movesprite(short spritenum, int xchange, int ychange, int zchange, unsigned int cliptype);
// 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,
};
#endif
END_DUKE_NS

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -353,7 +353,6 @@ int G_WakeUp(spritetype *const pSprite, int const playerNum)
// sleeping monsters, etc
void movefta(void);
// stupid name, but it's what the function does.
int ifhitsectors(int sectnum);
@ -375,12 +374,6 @@ static int P_Submerge(int, int, DukePlayer_t *, int, int);
static int P_Emerge(int, int, DukePlayer_t *, int, int);
static void P_FinishWaterChange(int, DukePlayer_t *, int, int, int);
void moveplayers();
void movefx();
void movefallers();
void movestandables();
void moveweapons();
ACTOR_STATIC void A_DoProjectileBounce(int const spriteNum)
{
spritetype * const pSprite = &sprite[spriteNum];
@ -7534,20 +7527,64 @@ void G_RefreshLights(void)
#endif
}
void G_MoveWorld(void)
void movefta_d(void);
void movefallers_d();
void movestandables_d();
void moveweapons_d();
void movefta_r(void);
void moveplayers();
void movefx();
void movefallers_r();
void movestandables_r();
void moveweapons_r();
void G_MoveWorld_d(void)
{
extern double g_moveActorsTime, g_moveWorldTime;
const double worldTime = timerGetHiTicks();
movefta_d(); //ST 2
moveweapons_d(); //ST 4
G_MoveTransports(); //ST 9
moveplayers(); //ST 10
movefallers_d(); //ST 12
G_MoveMisc(); //ST 5
const double actorsTime = timerGetHiTicks();
G_MoveActors(); //ST 1
g_moveActorsTime = (1-0.033)*g_moveActorsTime + 0.033*(timerGetHiTicks()-actorsTime);
// XXX: Has to be before effectors, in particular movers?
// TODO: lights in moving sectors ought to be interpolated
G_DoEffectorLights();
G_MoveEffectors(); //ST 3
movestandables_d(); //ST 6
G_RefreshLights();
G_DoSectorAnimations();
movefx(); //ST 11
g_moveWorldTime = (1-0.033)*g_moveWorldTime + 0.033*(timerGetHiTicks()-worldTime);
}
void G_MoveWorld_r(void)
{
extern double g_moveActorsTime, g_moveWorldTime;
const double worldTime = timerGetHiTicks();
if (!DEER)
{
movefta(); //ST 2
movefta_r(); //ST 2
G_MoveWeapons(); //ST 4
G_MoveTransports(); //ST 9
}
moveplayers(); //ST 10
movefallers(); //ST 12
movefallers_r(); //ST 12
if (!DEER)
G_MoveMisc(); //ST 5
@ -7555,7 +7592,7 @@ void G_MoveWorld(void)
G_MoveActors(); //ST 1
g_moveActorsTime = (1-0.033)*g_moveActorsTime + 0.033*(timerGetHiTicks()-actorsTime);
g_moveActorsTime = (1 - 0.033) * g_moveActorsTime + 0.033 * (timerGetHiTicks() - actorsTime);
if (DEER)
{
@ -7573,7 +7610,7 @@ void G_MoveWorld(void)
if (!DEER)
{
G_MoveEffectors(); //ST 3
movestandables(); //ST 6
movestandables_r(); //ST 6
}
G_RefreshLights();
@ -7584,8 +7621,14 @@ void G_MoveWorld(void)
if (RR && numplayers < 2 && g_thunderOn)
G_Thunder();
g_moveWorldTime = (1-0.033)*g_moveWorldTime + 0.033*(timerGetHiTicks()-worldTime);
g_moveWorldTime = (1 - 0.033) * g_moveWorldTime + 0.033 * (timerGetHiTicks() - worldTime);
}
void G_MoveWorld(void)
{
if (!isRR()) G_MoveWorld_d();
else G_MoveWorld_r();
}
END_DUKE_NS

View file

@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define EDUKE32_MACROS_H_
#include "mmulti.h"
#include "names.h"
BEGIN_DUKE_NS
@ -64,10 +63,7 @@ static FORCE_INLINE int32_t krand2(void)
inline bool AFLAMABLE(int X)
{
if (!(g_gameType & GAMEFLAG_RRALL))
return (X == BOX || X == TREE1 || X == TREE2 || X == TIRE || X == CONE);
else
return (X == RR_AFLAM1191 || X == RR_AFLAM1193 || X == RR_TIRE || X == RR_AFLAM3062);
return (X == TILE_BOX || X == TILE_TREE1 || X == TILE_TREE2 || X == TILE_TIRE || X == TILE_CONE);
}
#define rnd(X) ((krand2()>>8)>=(255-(X)))

View file

@ -29,17 +29,6 @@ BEGIN_DUKE_NS
enum
{
SECTOREFFECTOR = 1,
ACTIVATOR = 2,
TOUCHPLATE = 3,
ACTIVATORLOCKED = 4,
MUSICANDSFX = 5,
LOCATORS = 6,
CYCLER = 7,
MASTERSWITCH = 8,
RESPAWN = 9,
GPSPEED = 10,
FOF = 13,
ARROW = 20,
FIRSTGUNSPRITE = 21,
CHAINGUNSPRITE = 22,

View file

@ -32,19 +32,8 @@ BEGIN_DUKE_NS
enum
{
SECTOREFFECTOR = 1,
ACTIVATOR = 2,
TOUCHPLATE = 3,
ACTIVATORLOCKED = 4,
MUSICANDSFX = 5,
LOCATORS = 6,
CYCLER = 7,
MASTERSWITCH = 8,
RESPAWN = 9,
GPSPEED = 10,
RRTILE11 = 11,
PLEASEWAIT = 12,
FOF = 13,
//WEATHERWARN = 14,
RPG2SPRITE = 14,
DUKETAG = 15,
@ -306,7 +295,7 @@ enum
PIPE2B = 1126,
BOLT1 = 1127,
PIPE3B = 1132,
CAMERA1 = 1134,
RR_CAMERA1 = 1134,
BRICK = 1139,
VACUUM = 1141,
JURYGUY = 1142,
@ -980,7 +969,7 @@ enum
RRTILE3827 = 3827,
RRTILE3837 = 3837,
APLAYERTOP = 3840,
APLAYER = 3845,
RR_APLAYER = 3845,
PLAYERONWATER = 3860,
DUKELYINGDEAD = 3998,
DUKEGUN = 4041,
@ -1246,7 +1235,7 @@ enum
RRTILE8594 = 8594,
RRTILE8595 = 8595,
RRTILE8596 = 8596,
RRTILE8598 = 8598 = ,
RRTILE8598 = 8598,
RRTILE8605 = 8605,
RRTILE8608 = 8608,
RRTILE8609 = 8609,
@ -1267,15 +1256,12 @@ enum
RRTILE8682 = 8682,
RRTILE8683 = 8683,
RRTILE8704 = 8704,
,
,
// = RR = bad = guys,
BOSS1 = 4477,
BOSS2 = 4557,
BOSS3 = 4607,
BOSS4 = 4221,
,
,
BOULDER = 256,
BOULDER1 = 264,
TORNADO = 1930,
@ -1335,13 +1321,8 @@ enum
SBDIP = 5085,
MINION = 5120,
MINIONSTAYPUT = 5121,
,
#ifdef = RRRA,
# = define = UFO1 = 5260,
#else,
# = define = UFO1 = 5270,
#endif,
,
UFO1_RR = 5260,
UFO1_RRRA = 5270,
UFO2 = 5274,
UFO3 = 5278,
UFO4 = 5282,
@ -1406,4 +1387,8 @@ enum
MAMA = 8705,
MAMAJIBA = 8890,
MAMAJIBB = 8895,
};
};
extern int APLAYER;
extern int CAMERA1;
END_DUKE_NS

View file

@ -2928,8 +2928,9 @@ void G_InitDynamicTiles(void)
{
int32_t i;
APLAYER = (g_gameType & GAMEFLAG_RRALL) ? RR_APLAYER : DUKE_APLAYER;
CAMERA1 = (g_gameType & GAMEFLAG_RRALL) ? RR_CAMERA1 : DUKE_CAMERA1;
// this cannot include the constant headers so it has to use literal numbers
APLAYER = (g_gameType & GAMEFLAG_RRALL) ? 3845 : 1405;
CAMERA1 = (g_gameType & GAMEFLAG_RRALL) ? 1134 : 621;
Bmemset(DynamicTileMap, 0, sizeof(DynamicTileMap));

View file

@ -3612,6 +3612,7 @@ enum redneck_weapon_t
RATE_WEAPON = 15,
CHICKENBOW_WEAPON = 16
};
extern int APLAYER, CAMERA1;
#define DYNAMICWEAPONMAP(Weaponnum) Weaponnum