-------
Fixed really poorly done netcode stuff. This should fix the kartstuff desyncing, maybe collision stuff too?
Fixed Megashroom's growth animation lasting too long.
This commit is contained in:
ZTsukei 2017-08-09 18:14:14 -04:00
parent 8d19d18200
commit 80990da828
5 changed files with 16 additions and 16 deletions

View file

@ -518,9 +518,9 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
for (j = 0; j < NUMPOWERS; ++j)
rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]);
for (j = 0; j < NUMKARTSTUFF; ++j)
rsp->kartstuff[j] = (UINT16)SHORT(players[i].kartstuff[j]); // SRB2kart
rsp->kartstuff[j] = (INT32)SHORT(players[i].kartstuff[j]); // SRB2kart
for (j = 0; j < MAXPLAYERS; ++j)
rsp->collide[j] = (UINT16)SHORT(players[i].collide[j]); // SRB2kart
rsp->collide[j] = (UINT8)SHORT(players[i].collide[j]); // SRB2kart
// Score is resynched in the rspfirm resync packet
rsp->health = 0; // resynched with mo health
@ -652,9 +652,9 @@ static void resynch_read_player(resynch_pak *rsp)
for (j = 0; j < NUMPOWERS; ++j)
players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]);
for (j = 0; j < NUMKARTSTUFF; ++j)
players[i].kartstuff[j] = (UINT16)SHORT(rsp->kartstuff[j]); // SRB2kart
players[i].kartstuff[j] = (INT32)SHORT(rsp->kartstuff[j]); // SRB2kart
for (j = 0; j < MAXPLAYERS; ++j)
players[i].collide[j] = (UINT16)SHORT(rsp->collide[j]); // SRB2kart
players[i].collide[j] = (UINT8)SHORT(rsp->collide[j]); // SRB2kart
// Score is resynched in the rspfirm resync packet
players[i].health = rsp->health;

View file

@ -143,16 +143,16 @@ extern FILE *logstream;
#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
#ifdef DEVELOP
#define VERSION 103 // Game version
#define SUBVERSION 17 // more precise version number
#define SUBVERSION 18 // more precise version number
#define VERSIONSTRING "Development EXE"
#define VERSIONSTRINGW "v1.3.17"
#define VERSIONSTRINGW "v1.3.18"
// most interface strings are ignored in development mode.
// we use comprevision and compbranch instead.
#else
#define VERSION 103 // Game version
#define SUBVERSION 17 // more precise version number
#define VERSIONSTRING "DevEXE v1.3.17"
#define VERSIONSTRINGW L"v1.3.17"
#define SUBVERSION 18 // more precise version number
#define VERSIONSTRING "DevEXE v1.3.18"
#define VERSIONSTRINGW L"v1.3.18"
// Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates!
#endif

View file

@ -2303,7 +2303,7 @@ void G_PlayerReborn(INT32 player)
p->pity = pity;
// SRB2kart
p->kartstuff[k_starpostwp] = starpostwp;
p->kartstuff[k_starpostwp] = starpostwp; // TODO: get these out of kartstuff, it causes desync
p->kartstuff[k_offroad] = offroad;
// Don't do anything immediately

View file

@ -1460,7 +1460,7 @@ static fixed_t K_GetKartBoostPower(player_t *player, boolean speed)
boostpower = FixedDiv(boostpower, player->kartstuff[k_offroad] + FRACUNIT);
if (player->kartstuff[k_growshrinktimer] > 1
&& (player->kartstuff[k_growshrinktimer] > (itemtime - 25)
&& (player->kartstuff[k_growshrinktimer] > ((itemtime + TICRATE*2) - 25)
|| player->kartstuff[k_growshrinktimer] <= 26))
{ // Mega Mushroom - Mid-size
if (speed)
@ -1468,7 +1468,7 @@ static fixed_t K_GetKartBoostPower(player_t *player, boolean speed)
boostvalue = max(boostvalue, FRACUNIT/8); // + 12.5%
}
}
if (player->kartstuff[k_growshrinktimer] < (itemtime - 25)
if (player->kartstuff[k_growshrinktimer] < ((itemtime + TICRATE*2) - 25)
&& player->kartstuff[k_growshrinktimer] > 26)
{ // Mega Mushroom
if (speed)
@ -2964,7 +2964,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->kartstuff[k_boosting] = 0;
// Megashroom - Make the player grow!
if (player->kartstuff[k_growshrinktimer] > (itemtime - 25))
if (player->kartstuff[k_growshrinktimer] > ((itemtime + TICRATE*2) - 25))
{
if (leveltime & 2)
player->mo->destscale = FRACUNIT*3/2;
@ -2972,7 +2972,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->mo->destscale = FRACUNIT;
}
else if (player->kartstuff[k_growshrinktimer] > 26
&& player->kartstuff[k_growshrinktimer] <= (itemtime - 25))
&& player->kartstuff[k_growshrinktimer] <= ((itemtime + TICRATE*2) - 25))
player->mo->destscale = FRACUNIT*3/2;
// Megashroom - Back to normal...
else if (player->kartstuff[k_growshrinktimer] > 1

View file

@ -137,7 +137,7 @@ static void P_NetArchivePlayers(void)
for (j = 0; j < NUMPOWERS; j++)
WRITEUINT16(save_p, players[i].powers[j]);
for (j = 0; j < NUMKARTSTUFF; j++)
WRITEUINT16(save_p, players[i].kartstuff[j]);
WRITEINT32(save_p, players[i].kartstuff[j]);
for (j = 0; j < MAXPLAYERS; j++)
WRITEUINT8(save_p, players[i].collide[j]);
@ -320,7 +320,7 @@ static void P_NetUnArchivePlayers(void)
for (j = 0; j < NUMPOWERS; j++)
players[i].powers[j] = READUINT16(save_p);
for (j = 0; j < NUMKARTSTUFF; j++)
players[i].kartstuff[j] = READUINT16(save_p);
players[i].kartstuff[j] = READINT32(save_p);
for (j = 0; j < MAXPLAYERS; j++)
players[i].collide[j] = (boolean)READUINT8(save_p);