Merge remote-tracking branch 'public/next'

This commit is contained in:
Sally Coolatta 2020-08-12 18:50:41 -04:00
commit f8d1e75025
11 changed files with 119 additions and 57 deletions

View file

@ -1314,7 +1314,7 @@ static boolean CL_AskFileList(INT32 firstfile)
netbuffer->packettype = PT_TELLFILESNEEDED; netbuffer->packettype = PT_TELLFILESNEEDED;
netbuffer->u.filesneedednum = firstfile; netbuffer->u.filesneedednum = firstfile;
return HSendPacket(servernode, true, 0, sizeof (INT32)); return HSendPacket(servernode, false, 0, sizeof (INT32));
} }
/** Sends a special packet to declare how many players in local /** Sends a special packet to declare how many players in local
@ -1989,11 +1989,11 @@ static boolean CL_FinishedFileList(void)
CL_Reset(); CL_Reset();
D_StartTitle(); D_StartTitle();
M_StartMessage(M_GetText( M_StartMessage(M_GetText(
"You have WAD files loaded or have\n" "You have the wrong addons loaded.\n\n"
"modified the game in some way, and\n" "To play on this server, restart\n"
"your file list does not match\n" "the game and don't load any addons.\n"
"the server's file list.\n" "SRB2Kart will automatically add\n"
"Please restart SRB2Kart before connecting.\n\n" "everything you need when you join.\n\n"
"Press ESC\n" "Press ESC\n"
), NULL, MM_NOTHING); ), NULL, MM_NOTHING);
return false; return false;
@ -2014,11 +2014,12 @@ static boolean CL_FinishedFileList(void)
CL_Reset(); CL_Reset();
D_StartTitle(); D_StartTitle();
M_StartMessage(M_GetText( M_StartMessage(M_GetText(
"You cannot connect to this server\n" "An error occured when trying to\n"
"because you cannot download the files\n" "download missing addons.\n"
"that you are missing from the server.\n\n" "(This is almost always a problem\n"
"See the console or log file for\n" "with the server, not your game.)\n\n"
"more details.\n\n" "See the console or log file\n"
"for additional details.\n\n"
"Press ESC\n" "Press ESC\n"
), NULL, MM_NOTHING); ), NULL, MM_NOTHING);
return false; return false;

View file

@ -1084,7 +1084,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
// Only allow HTTP and HTTPS // Only allow HTTP and HTTPS
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents. curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
// Follow a redirect request, if sent by the server. // Follow a redirect request, if sent by the server.
curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L);

View file

@ -6344,7 +6344,9 @@ void G_BeginRecording(void)
demoflags |= DF_ENCORE; demoflags |= DF_ENCORE;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
demoflags |= DF_LUAVARS; if (!modeattacking) // Ghosts don't read luavars, and you shouldn't ever need to save Lua in replays, you doof!
// SERIOUSLY THOUGH WHY WOULD YOU LOAD HOSTMOD AND RECORD A GHOST WITH IT !????
demoflags |= DF_LUAVARS;
#endif #endif
// Setup header. // Setup header.
@ -6477,8 +6479,9 @@ void G_BeginRecording(void)
WRITEUINT8(demo_p, 0xFF); // Denote the end of the player listing WRITEUINT8(demo_p, 0xFF); // Denote the end of the player listing
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
// player lua vars, always saved even if empty // player lua vars, always saved even if empty... Unless it's record attack.
LUA_ArchiveDemo(); if (!modeattacking)
LUA_ArchiveDemo();
#endif #endif
memset(&oldcmd,0,sizeof(oldcmd)); memset(&oldcmd,0,sizeof(oldcmd));
@ -7431,6 +7434,7 @@ void G_DoPlayDemo(char *defdemoname)
if (!gL) // No Lua state! ...I guess we'll just start one... if (!gL) // No Lua state! ...I guess we'll just start one...
LUA_ClearState(); LUA_ClearState();
// No modeattacking check, DF_LUAVARS won't be present here.
LUA_UnArchiveDemo(); LUA_UnArchiveDemo();
} }
#endif #endif

View file

@ -3944,7 +3944,8 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter)
if (!thismine || P_MobjWasRemoved(thismine)) if (!thismine || P_MobjWasRemoved(thismine))
return; return;
if (thismine->type == MT_SSMINE_SHIELD) // Create a new mine //This guarantees you hit a mine being dragged
if (thismine->type == MT_SSMINE_SHIELD) // Create a new mine, and clean up the old one
{ {
mine = P_SpawnMobj(thismine->x, thismine->y, thismine->z, MT_SSMINE); mine = P_SpawnMobj(thismine->x, thismine->y, thismine->z, MT_SSMINE);
P_SetTarget(&mine->target, thismine->target); P_SetTarget(&mine->target, thismine->target);
@ -3952,7 +3953,19 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter)
mine->flags2 = thismine->flags2; mine->flags2 = thismine->flags2;
mine->floorz = thismine->floorz; mine->floorz = thismine->floorz;
mine->ceilingz = thismine->ceilingz; mine->ceilingz = thismine->ceilingz;
//Since we aren't using P_KillMobj, we need to clean up the hnext reference
{
P_SetTarget(&thismine->target->hnext, NULL); //target is the player who owns the mine
thismine->target->player->kartstuff[k_bananadrag] = 0;
thismine->target->player->kartstuff[k_itemheld] = 0;
if (--thismine->target->player->kartstuff[k_itemamount] <= 0)
thismine->target->player->kartstuff[k_itemtype] = KITEM_NONE;
}
P_RemoveMobj(thismine); P_RemoveMobj(thismine);
} }
else else
mine = thismine; mine = thismine;
@ -4574,6 +4587,62 @@ void K_DropItems(player_t *player)
K_StripItems(player); K_StripItems(player);
} }
void K_DropRocketSneaker(player_t *player)
{
mobj_t *shoe = player->mo;
fixed_t flingangle;
boolean leftshoe = true; //left shoe is first
if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext)))
return;
while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe))
{
if (shoe->type != MT_ROCKETSNEAKER)
return; //woah, not a rocketsneaker, bail! safeguard in case this gets used when you're holding non-rocketsneakers
shoe->flags2 &= ~MF2_DONTDRAW;
shoe->flags &= ~MF_NOGRAVITY;
shoe->angle += ANGLE_45;
if (shoe->eflags & MFE_VERTICALFLIP)
shoe->z -= shoe->height;
else
shoe->z += shoe->height;
//left shoe goes off tot eh left, right shoe off to the right
if (leftshoe)
flingangle = -(ANG60);
else
flingangle = ANG60;
S_StartSound(shoe, shoe->info->deathsound);
P_SetObjectMomZ(shoe, 8*FRACUNIT, false);
P_InstaThrust(shoe, R_PointToAngle2(shoe->target->x, shoe->target->y, shoe->x, shoe->y)+flingangle, 16*FRACUNIT);
shoe->momx += shoe->target->momx;
shoe->momy += shoe->target->momy;
shoe->momz += shoe->target->momz;
shoe->extravalue2 = 1;
leftshoe = false;
}
P_SetTarget(&player->mo->hnext, NULL);
player->kartstuff[k_rocketsneakertimer] = 0;
}
void K_DropKitchenSink(player_t *player)
{
if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext)))
return;
if (player->mo->hnext->type != MT_SINK_SHIELD)
return; //so we can just call this function regardless of what is being held
P_KillMobj(player->mo->hnext, NULL, NULL);
P_SetTarget(&player->mo->hnext, NULL);
}
// When an item in the hnext chain dies. // When an item in the hnext chain dies.
void K_RepairOrbitChain(mobj_t *orbit) void K_RepairOrbitChain(mobj_t *orbit)
{ {
@ -6864,12 +6933,12 @@ void K_KartUpdatePosition(player_t *player)
// //
void K_StripItems(player_t *player) void K_StripItems(player_t *player)
{ {
K_DropRocketSneaker(player);
K_DropKitchenSink(player);
player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemtype] = KITEM_NONE;
player->kartstuff[k_itemamount] = 0; player->kartstuff[k_itemamount] = 0;
player->kartstuff[k_itemheld] = 0; player->kartstuff[k_itemheld] = 0;
player->kartstuff[k_rocketsneakertimer] = 0;
if (!player->kartstuff[k_itemroulette] || player->kartstuff[k_roulettetype] != 2) if (!player->kartstuff[k_itemroulette] || player->kartstuff[k_roulettetype] != 2)
{ {
player->kartstuff[k_itemroulette] = 0; player->kartstuff[k_itemroulette] = 0;

View file

@ -68,6 +68,7 @@ INT32 K_GetKartDriftSparkValue(player_t *player);
void K_SpawnDriftBoostExplosion(player_t *player, int stage); void K_SpawnDriftBoostExplosion(player_t *player, int stage);
void K_KartUpdatePosition(player_t *player); void K_KartUpdatePosition(player_t *player);
void K_DropItems(player_t *player); void K_DropItems(player_t *player);
void K_DropRocketSneaker(player_t *player);
void K_StripItems(player_t *player); void K_StripItems(player_t *player);
void K_StripOther(player_t *player); void K_StripOther(player_t *player);
void K_MomentumToFacing(player_t *player); void K_MomentumToFacing(player_t *player);

View file

@ -119,7 +119,7 @@ static int lib_iterateDisplayplayers(lua_State *L)
for (i++; i < MAXSPLITSCREENPLAYERS; i++) for (i++; i < MAXSPLITSCREENPLAYERS; i++)
{ {
if (!playeringame[displayplayers[i]] || i > splitscreen) if (i > splitscreen || !playeringame[displayplayers[i]])
return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers. return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers.
if (!players[displayplayers[i]].mo) if (!players[displayplayers[i]].mo)
@ -140,6 +140,8 @@ static int lib_getDisplayplayers(lua_State *L)
lua_Integer i = luaL_checkinteger(L, 2); lua_Integer i = luaL_checkinteger(L, 2);
if (i < 0 || i >= MAXSPLITSCREENPLAYERS) if (i < 0 || i >= MAXSPLITSCREENPLAYERS)
return luaL_error(L, "displayplayers[] index %d out of range (0 - %d)", i, MAXSPLITSCREENPLAYERS-1); return luaL_error(L, "displayplayers[] index %d out of range (0 - %d)", i, MAXSPLITSCREENPLAYERS-1);
if (i > splitscreen)
return 0;
if (!playeringame[displayplayers[i]]) if (!playeringame[displayplayers[i]])
return 0; return 0;
if (!players[displayplayers[i]].mo) if (!players[displayplayers[i]].mo)

View file

@ -4857,7 +4857,7 @@ static boolean M_AddonsRefresh(void)
else if (majormods && !prevmajormods) else if (majormods && !prevmajormods)
{ {
S_StartSound(NULL, sfx_s221); S_StartSound(NULL, sfx_s221);
message = va("%c%s\x80\nGameplay has now been modified.\nIf you wish to play Record Attack mode, restart the game to clear existing addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
prevmajormods = majormods; prevmajormods = majormods;
} }
@ -8685,7 +8685,7 @@ static void M_ConnectMenuModChecks(INT32 choice)
if (modifiedgame) if (modifiedgame)
{ {
M_StartMessage(M_GetText("Addons are currently loaded.\n\nYou will only be able to join a server if\nit has the same ones loaded in the same order, which may be unlikely.\n\nIf you wish to play on other servers,\nrestart the game to clear existing addons.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER); M_StartMessage(M_GetText("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER);
return; return;
} }

View file

@ -8861,18 +8861,7 @@ void P_MobjThinker(mobj_t *mobj)
if (!mobj->extravalue2) if (!mobj->extravalue2)
{ {
if (mobj->eflags & MFE_VERTICALFLIP) K_DropRocketSneaker(mobj->target->player);
mobj->z -= mobj->height;
else
mobj->z += mobj->height;
S_StartSound(mobj, mobj->info->deathsound);
P_SetObjectMomZ(mobj, 8*FRACUNIT, false);
P_InstaThrust(mobj, R_PointToAngle2(mobj->target->x, mobj->target->y, mobj->x, mobj->y)+ANGLE_90, 16*FRACUNIT);
mobj->momx += mobj->target->momx;
mobj->momy += mobj->target->momy;
mobj->momz += mobj->target->momz;
mobj->extravalue2 = 1;
} }
else if (P_IsObjectOnGround(mobj)) else if (P_IsObjectOnGround(mobj))
{ {

View file

@ -1450,7 +1450,7 @@ static void P_LoadRawSideDefs2(void *data)
UINT16 i; UINT16 i;
INT32 num; INT32 num;
size_t j; size_t j;
UINT32 cr, cg, cb; RGBA_t color;
for (i = 0; i < numsides; i++) for (i = 0; i < numsides; i++)
{ {
@ -1532,23 +1532,21 @@ static void P_LoadRawSideDefs2(void *data)
// encore mode colormaps! // encore mode colormaps!
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code. // do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
// do this for both the start and fade colormaps. // do this for both the start and fade colormaps.
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0); color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
#ifdef GLENCORE #ifdef GLENCORE
if (encoremap) if (encoremap)
{ {
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
cr = pLocalPalette[j].s.red; color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below
cg = pLocalPalette[j].s.green;
cb = pLocalPalette[j].s.blue;
} }
#endif #endif
color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly
sec->extra_colormap->rgba = cr + cg + cb; sec->extra_colormap->rgba = color.rgba;
// alpha // alpha
if (msd->toptexture[7]) if (msd->toptexture[7])
@ -1575,23 +1573,21 @@ static void P_LoadRawSideDefs2(void *data)
col = msd->bottomtexture; col = msd->bottomtexture;
// do the exact same thing as above here. // do the exact same thing as above here.
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0); color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
#ifdef GLENCORE #ifdef GLENCORE
if (encoremap) if (encoremap)
{ {
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
cr = pLocalPalette[j].s.red; color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below
cg = pLocalPalette[j].s.green;
cb = pLocalPalette[j].s.blue;
} }
#endif #endif
color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly
sec->extra_colormap->fadergba = cr + cg + cb; sec->extra_colormap->fadergba = color.rgba;
// alpha // alpha
if (msd->bottomtexture[7]) if (msd->bottomtexture[7])

View file

@ -711,9 +711,9 @@ void P_Ticker(boolean run)
if (exitcountdown > 1) if (exitcountdown > 1)
exitcountdown--; exitcountdown--;
if (indirectitemcooldown > 1) if (indirectitemcooldown > 0)
indirectitemcooldown--; indirectitemcooldown--;
if (hyubgone > 1) if (hyubgone > 0)
hyubgone--; hyubgone--;
if (G_BattleGametype()) if (G_BattleGametype())

View file

@ -1319,8 +1319,8 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
{ {
size = 0; size = 0;
zerr(zErr); zerr(zErr);
(void)inflateEnd(&strm);
} }
(void)inflateEnd(&strm);
} }
else else
{ {