- a small bit more is gone.

This commit is contained in:
Christoph Oelckers 2020-06-23 21:12:15 +02:00
parent 73e436730d
commit 99067f3bd6
11 changed files with 105 additions and 139 deletions

View file

@ -95,6 +95,8 @@ int connecthead, connectpoint2[MAXMULTIPLAYERS];
int32_t xres = -1, yres = -1, bpp = 0;
auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries.
glcycle_t thinktime, actortime;
MapRecord mapList[512]; // Due to how this gets used it needs to be static. EDuke defines 7 episode plus one spare episode with 64 potential levels each and relies on the static array which is freely accessible by scripts.
MapRecord *currentLevel; // level that is currently played. (The real level, not what script hacks modfifying the current level index can pretend.)

View file

@ -42,6 +42,7 @@ This file is a combination of code from the following sources:
#include "ns.h"
#include "global.h"
#include "namesdyn.h"
#include "stats.h"
BEGIN_DUKE_NS
@ -5050,4 +5051,20 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT
}
}
int LocateTheLocator(int n, int sn)
{
int i;
i = headspritestat[7];
while (i >= 0)
{
if ((sn == -1 || sn == sprite[i].sectnum) && n == sprite[i].lotag)
return i;
i = nextspritestat[i];
}
return -1;
}
END_DUKE_NS

View file

@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "player.h"
# include "namesdyn.h"
#include "stats.h"
extern glcycle_t actortime, thinktime;
BEGIN_DUKE_NS
@ -239,11 +242,7 @@ extern int32_t otherp;
extern int32_t ticrandomseed;
extern int g_canSeePlayer;
int A_FindLocator(int const tag, int const sectNum);
inline int LocateTheLocator(int const tag, int const sectNum)
{
return A_FindLocator(tag, sectNum);
}
int LocateTheLocator(int const tag, int const sectNum);
int A_IncurDamage(int spriteNum);
void A_DeleteSprite(int spriteNum);
@ -251,12 +250,14 @@ 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);
void G_DoInterpolations(int smoothRatio);
void G_MoveWorld(void);
void G_RefreshLights(void);
void G_StopInterpolation(const int32_t *posptr);

View file

@ -4311,4 +4311,36 @@ void checktimetosleep_d(int g_i)
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void think_d(void)
{
thinktime.Reset();
thinktime.Clock();
movefta_d(); //ST 2
moveweapons_d(); //ST 4
movetransports_d(); //ST 9
moveplayers(); //ST 10
movefallers_d(); //ST 12
moveexplosions_d(); //ST 5
actortime.Reset();
actortime.Clock();
moveactors_d(); //ST 1
actortime.Unclock();
moveeffectors_d(); //ST 3
movestandables_d(); //ST 6
doanimations();
movefx(); //ST 11
thinktime.Unclock();
}
END_DUKE_NS

View file

@ -4686,4 +4686,41 @@ void checktimetosleep_r(int g_i)
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void thunder(void);
void think_r(void)
{
thinktime.Reset();
thinktime.Clock();
movefta_r(); //ST 2
moveweapons_r(); //ST 4
movetransports_r(); //ST 9
moveplayers(); //ST 10
movefallers_r(); //ST 12
moveexplosions_r(); //ST 5
actortime.Reset();
actortime.Clock();
moveactors_r(); //ST 1
actortime.Unclock();
moveeffectors_r(); //ST 3
movestandables_r(); //ST 6
doanimations();
movefx(); //ST 11
if (numplayers < 2 && thunderon)
thunder();
thinktime.Unclock();
}
END_DUKE_NS

View file

@ -109,6 +109,8 @@ void displayweapon_d(int snum);
void displayweapon_r(int snum);
void displaymasks_d(int snum);
void displaymasks_r(int snum);
void think_d();
void think_r();
@ -119,6 +121,7 @@ void SetDispatcher()
if (!isRR())
{
fi = {
think_d,
initactorflags_d,
isadoorwall_d,
animatewalls_d,
@ -165,6 +168,7 @@ void SetDispatcher()
else
{
fi = {
think_r,
initactorflags_r,
isadoorwall_r,
animatewalls_r,

View file

@ -486,6 +486,7 @@ void spawneffector(int i);
struct Dispatcher
{
// sectors_?.cpp
void (*think)();
void (*initactorflags)();
bool (*isadoorwall)(int dapic);
void (*animatewalls)();

View file

@ -2637,7 +2637,8 @@ void processinput_d(int snum)
hittype[pi].floorz = fz;
hittype[pi].ceilingz = cz;
#if 0
#pragma message("input stuff begins here")
#if 0 // disabled input
p->oq16horiz = p->q16horiz;
p->oq16horizoff = p->q16horizoff;
#endif

View file

@ -28,11 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS
#if KRANDDEBUG
# define ACTOR_STATIC
#else
# define ACTOR_STATIC static
#endif
#define DELETE_SPRITE_AND_CONTINUE(KX) do { A_DeleteSprite(KX); goto next_sprite; } while (0)
@ -53,11 +48,6 @@ void G_ClearCameraView(DukePlayer_t *ps)
// deletesprite() game wrapper
void A_DeleteSprite(int spriteNum)
{
#ifdef POLYMER
if (actor[spriteNum].lightptr != NULL && videoGetRenderMode() == REND_POLYMER)
A_DeleteLight(spriteNum);
#endif
// AMBIENT_SFX_PLAYING
if (sprite[spriteNum].picnum == MUSICANDSFX && actor[spriteNum].t_data[0] == 1)
S_StopEnvSound(sprite[spriteNum].lotag, spriteNum);
@ -114,126 +104,7 @@ int G_WakeUp(spritetype *const pSprite, int const playerNum)
}
// sleeping monsters, etc
int A_FindLocator(int const tag, int const sectNum)
{
for (bssize_t SPRITES_OF(STAT_LOCATOR, spriteNum))
{
if ((sectNum == -1 || sectNum == SECT(spriteNum)) && tag == SLT(spriteNum))
return spriteNum;
}
return -1;
}
TileInfo tileinfo[MAXTILES];
void movefta_d(void);
void movefallers_d();
void movestandables_d();
void moveweapons_d();
void movetransports_d(void);
void moveactors_d();
void moveexplosions_d();
void moveeffectors_d();
void movefta_r(void);
void moveplayers();
void movefx();
void movefallers_r();
void movestandables_r();
void moveweapons_r();
void movetransports_r(void);
void moveactors_r();
void thunder();
void moveexplosions_r();
void moveeffectors_r();
void doanimations(void);
void G_MoveWorld_d(void)
{
extern double g_moveActorsTime, g_moveWorldTime;
const double worldTime = timerGetHiTicks();
movefta_d(); //ST 2
moveweapons_d(); //ST 4
movetransports_d(); //ST 9
moveplayers(); //ST 10
movefallers_d(); //ST 12
moveexplosions_d(); //ST 5
const double actorsTime = timerGetHiTicks();
moveactors_d(); //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();
moveeffectors_d(); //ST 3
movestandables_d(); //ST 6
//G_RefreshLights();
doanimations();
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_r(); //ST 2
moveweapons_r(); //ST 4
movetransports_r(); //ST 9
}
moveplayers(); //ST 10
movefallers_r(); //ST 12
if (!DEER)
moveexplosions_r(); //ST 5
const double actorsTime = timerGetHiTicks();
moveactors_r(); //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();
if (!DEER)
{
moveeffectors_r(); //ST 3
movestandables_r(); //ST 6
}
//G_RefreshLights();
doanimations();
if (!DEER)
movefx(); //ST 11
if (numplayers < 2 && thunderon)
thunder();
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

@ -2852,7 +2852,7 @@ int G_DoMoveThings(void)
}
if (ud.pause_on == 0)
G_MoveWorld();
fi.think();
Net_CorrectPrediction();

View file

@ -605,8 +605,8 @@ FString GameInterface::statFPS()
output.AppendFormat("Game Update: %2.2f ms + draw: %2.2f ms\n", g_gameUpdateTime, g_gameUpdateAndDrawTime - g_gameUpdateTime);
output.AppendFormat("GU min/max/avg: %5.2f/%5.2f/%5.2f ms\n", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
output.AppendFormat("G_MoveActors(): %.3f ms\n", g_moveActorsTime);
output.AppendFormat("G_MoveWorld(): %.3f ms\n", g_moveWorldTime);
output.AppendFormat("actor think time: %.3f ms\n", actortime.TimeMS());
output.AppendFormat("total think timn: %.3f ms\n", thinktime.TimeMS());
}
}