Commit 754923fd authored by Richard Gobeille's avatar Richard Gobeille
Browse files

Duke3d: first pass at implementing rotatesprite position interpolation for the...

Duke3d: first pass at implementing rotatesprite position interpolation for the weapons and hands and whatnot
parent 81057ad1
......@@ -761,6 +761,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (g_networkMode == NET_DEDICATED_SERVER) return;
totalclocklock = totalclock;
rotatespritesmoothratio = smoothRatio;
if (pub > 0 || videoGetRenderMode() >= REND_POLYMOST) // JBF 20040101: redraw background always
{
......
......@@ -416,7 +416,7 @@ static inline int32_t gameHandleEvents(void)
return handleevents();
}
static inline int32_t calc_smoothratio_demo(ClockTicks const totalclk, ClockTicks const ototalclk)
static inline int32_t calc_smoothratio_demo(ClockTicks const totalclk, ClockTicks const ototalclk, int ticrate = REALGAMETICSPERSEC)
{
int const truncrfreq = Blrintf(floorf(refreshfreq * TICRATE / timerGetClockRate()));
int const clk = (totalclk - ototalclk).toScale16();
......@@ -426,15 +426,15 @@ static inline int32_t calc_smoothratio_demo(ClockTicks const totalclk, ClockTick
int const wholeTics = tabledivide32_noinline(clk * truncrfreq, 65536 * TICRATE);
//POGO: additional debug info for testing purposes
OSD_Printf("Elapsed tics: %d (%g), smoothratio: %d (%d)\n", wholeTics, fracTics,
tabledivide32_noinline(65536 * wholeTics * REALGAMETICSPERSEC, truncrfreq),
tabledivide32_noinline(Blrintf(65536 * fracTics * REALGAMETICSPERSEC), truncrfreq));
tabledivide32_noinline(65536 * wholeTics * ticrate, truncrfreq),
tabledivide32_noinline(Blrintf(65536 * fracTics * ticrate), truncrfreq));
#endif
#if 1
return clamp(tabledivide32_noinline(Blrintf(65536 * fracTics * REALGAMETICSPERSEC), truncrfreq), 0, 65536);
return clamp(tabledivide32_noinline(Blrintf(65536 * fracTics * ticrate), truncrfreq), 0, 65536);
#else
int const wholeTics = tabledivide32_noinline(clk * truncrfreq, 65536 * TICRATE);
return clamp(tabledivide32_noinline(65536 * wholeTics * REALGAMETICSPERSEC, truncrfreq), 0, 65536);
return clamp(tabledivide32_noinline(65536 * wholeTics * ticrate, truncrfreq), 0, 65536);
#endif
}
......
This diff is collapsed.
......@@ -60,6 +60,47 @@ extern int32_t g_mostConcurrentPlayers;
#define WEAPON_POS_RAISE 10
#define WEAPON_POS_START 6
enum weaponuniqhudid_t
{
W_ACCESSCARD,
W_CHAINGUN_BOTTOM,
W_CHAINGUN_HACK,
W_CHAINGUN_TOP,
W_DEVISTATOR_LEFT,
W_DEVISTATOR_RIGHT,
W_DUKENUKEM,
W_FIST,
W_FIST2,
W_FREEZE_BASE,
W_FREEZE_TOP,
W_HANDBOMB,
W_HANDREMOTE,
W_KNEE,
W_KNEE2,
W_KNUCKLES,
W_LOOGIE,
W_LOOGIE_END = W_LOOGIE + 63,
W_PISTOL,
W_PISTOL_CLIP,
W_PISTOL_HAND,
W_PLUTOPAK,
W_RPG,
W_RPG_MUZZLE,
W_SHOTGUN,
W_SHOTGUN_MUZZLE,
W_SHRINKER,
W_SHRINKER_CRYSTAL,
W_THREEDEE,
W_TIP,
W_TRIPBOMB,
W_TRIPBOMB_LEFTHAND,
W_TRIPBOMB_RIGHTHAND,
W_END,
};
EDUKE32_STATIC_ASSERT(W_END < MAXUNIQHUDID);
enum weaponflags_t {
WEAPON_SPAWNTYPE1 = 0x00000000, // just spawn
WEAPON_HOLSTER_CLEARS_CLIP = 0x00000001, // 'holstering' clears the current clip
......
......@@ -961,6 +961,8 @@ void G_DisplayRest(int32_t smoothratio)
#endif
}
rotatespritesmoothratio = smoothratio;
if (g_restorePalette)
{
// reset a normal palette
......@@ -1610,6 +1612,8 @@ void gameDisplayTitleScreen(void)
{
videoClearScreen(0);
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH);
rotatespritesmoothratio = calc_smoothratio_demo(totalclock, ototalclock, TICRATE);
if (logoflags & LOGO_DUKENUKEM)
{
if (totalclock > 120 && totalclock < (120 + 60))
......@@ -1619,10 +1623,10 @@ void gameDisplayTitleScreen(void)
titlesound++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160 << 16, 104 << 16, ((int32_t) totalclock - 120) << 10, 0, DUKENUKEM, 0, 0, 2 + 8);
rotatesprite_fs_id(160 << 16, 104 << 16, ((int32_t) totalclock - 120) << 10, 0, DUKENUKEM, 0, 0, 2 + 8, W_DUKENUKEM);
}
else if (totalclock >= (120 + 60))
rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8);
rotatesprite_fs_id(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8, W_DUKENUKEM);
}
else
titlesound++;
......@@ -1637,11 +1641,12 @@ void gameDisplayTitleScreen(void)
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8);
rotatesprite_fs(160 << 16, (129) << 16, ((int32_t) totalclock - 220) << 11, 0, THREEDEE, 0, 0, 2 + 8);
if (logoflags & LOGO_DUKENUKEM)
rotatesprite_fs_id(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8, W_DUKENUKEM);
rotatesprite_fs_id(160 << 16, (129) << 16, ((int32_t) totalclock - 220) << 11, 0, THREEDEE, 0, 0, 2 + 8, W_THREEDEE);
}
else if (totalclock >= (220 + 30))
rotatesprite_fs(160 << 16, (129) << 16, 30 << 11, 0, THREEDEE, 0, 0, 2 + 8);
rotatesprite_fs_id(160 << 16, (129) << 16, 30 << 11, 0, THREEDEE, 0, 0, 2 + 8, W_THREEDEE);
}
else
titlesound++;
......@@ -1651,8 +1656,8 @@ void gameDisplayTitleScreen(void)
// JBF 20030804
if (totalclock >= 280 && totalclock < 395)
{
rotatesprite_fs(160 << 16, (151) << 16, (410 - (int32_t) totalclock) << 12, 0, PLUTOPAKSPRITE + 1,
(sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0, 2 + 8);
rotatesprite_fs_id(160 << 16, (151) << 16, (410 - (int32_t) totalclock) << 12, 0, PLUTOPAKSPRITE + 1,
(sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0, 2 + 8, W_PLUTOPAK);
if (titlesound == 2)
{
titlesound++;
......@@ -1666,8 +1671,8 @@ void gameDisplayTitleScreen(void)
titlesound++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160 << 16, (151) << 16, 30 << 11, 0, PLUTOPAKSPRITE + 1, (sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0,
2 + 8);
rotatesprite_fs_id(160 << 16, (151) << 16, 30 << 11, 0, PLUTOPAKSPRITE + 1, (sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0,
2 + 8, W_PLUTOPAK);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment