Merge branch 'master' into pet-robo

This commit is contained in:
Sally Cochenour 2020-04-18 01:18:22 -04:00
commit 96d69785bf
8 changed files with 107 additions and 95 deletions

View file

@ -1082,7 +1082,10 @@ void D_SRB2Main(void)
// use user specific config file
#ifdef DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home);
#else
snprintf(srb2home, sizeof srb2home, "%s", userhome);
#endif
if (dedicated)
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
else
@ -1090,18 +1093,6 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
#else
snprintf(srb2home, sizeof srb2home, "%s", userhome);
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
if (dedicated)
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome);
else
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, userhome);
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, userhome, PATHSEP);
#endif
}
configfile[sizeof configfile - 1] = '\0';
@ -1115,6 +1106,10 @@ void D_SRB2Main(void)
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
I_mkdir(addonsdir, 0755);
/* and downloads in a subdirectory */
snprintf(downloaddir, sizeof downloaddir, "%s%s%s",
addonsdir, PATHSEP, "downloads");
// rand() needs seeded regardless of password
srand((unsigned int)time(NULL));

View file

@ -797,6 +797,7 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem)
{
if (getitem == KITEM_SPB || getitem == KITEM_SHRINK) // Indirect items
indirectitemcooldown = 20*TICRATE;
if (getitem == KITEM_HYUDORO) // Hyudoro cooldown
hyubgone = 5*TICRATE;
@ -1205,7 +1206,17 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
&& players[i].kartstuff[k_position] == 1)
{
// This player is first! Yay!
pdis = player->distancetofinish - players[i].distancetofinish;
if (player->distancetofinish <= players[i].distancetofinish)
{
// Guess you're in first / tied for first?
pdis = 0;
}
else
{
// Subtract 1st's distance from your distance, to get your distance from 1st!
pdis = player->distancetofinish - players[i].distancetofinish;
}
break;
}
}
@ -1319,7 +1330,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsDisplayPlayer(player))
S_StartSound(NULL, (mashed ? sfx_itrolm : sfx_itrolf));
S_StartSound(NULL, sfx_itrolm);
return;
}
}
@ -1472,7 +1483,7 @@ static void K_DebtStingPlayer(player_t *player, INT32 length)
if (player->mo->state != &states[S_KART_SPIN])
P_SetPlayerMobjState(player->mo, S_KART_SPIN);
K_DropHnextList(player);
K_DropHnextList(player, false);
return;
}
@ -2937,7 +2948,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
if (cv_kartdebughuddrop.value && !modeattacking)
K_DropItems(player);
else
K_DropHnextList(player);
K_DropHnextList(player, false);
return;
}
@ -3082,7 +3093,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
if (cv_kartdebughuddrop.value && !modeattacking)
K_DropItems(player);
else
K_DropHnextList(player);
K_DropHnextList(player, false);
return;
}
@ -3288,7 +3299,7 @@ void K_StealBumper(player_t *player, player_t *victim, boolean force)
if (cv_kartdebughuddrop.value && !modeattacking)
K_DropItems(victim);
else
K_DropHnextList(victim);
K_DropHnextList(victim, false);
return;
}
@ -4751,54 +4762,58 @@ void K_UpdateHnextList(player_t *player, boolean clean)
nextwork = work->hnext;
while ((work = nextwork) && !P_MobjWasRemoved(work))
while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work)))
{
nextwork = work->hnext;
if (!clean && (!work->movedir || work->movedir <= (UINT16)player->kartstuff[k_itemamount]))
{
continue;
}
P_RemoveMobj(work);
}
if (player->mo->hnext == NULL || P_MobjWasRemoved(player->mo->hnext))
{
// Like below, try to clean up the pointer if it's NULL.
// Maybe this was a cause of the shrink/eggbox fails?
P_SetTarget(&player->mo->hnext, NULL);
}
}
// For getting hit!
void K_DropHnextList(player_t *player)
void K_DropHnextList(player_t *player, boolean keepshields)
{
mobj_t *work = player->mo, *nextwork, *dropwork;
INT32 flip;
mobjtype_t type;
boolean orbit, ponground, dropall = true;
INT32 shield = K_GetShieldFromItem(player->kartstuff[k_itemtype]);
if (!work || P_MobjWasRemoved(work))
if (work == NULL || P_MobjWasRemoved(work))
{
return;
}
flip = P_MobjFlip(player->mo);
ponground = P_IsObjectOnGround(player->mo);
if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD)
if (shield != KSHIELD_NONE && !keepshields)
{
K_DoThunderShield(player);
player->kartstuff[k_itemtype] = KITEM_NONE;
player->kartstuff[k_itemamount] = 0;
if (shield == KSHIELD_THUNDER)
{
K_DoThunderShield(player);
}
player->kartstuff[k_curshield] = KSHIELD_NONE;
}
else if (player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD)
{
player->kartstuff[k_itemtype] = KITEM_NONE;
player->kartstuff[k_itemamount] = 0;
player->kartstuff[k_curshield] = KSHIELD_NONE;
}
else if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD)
{
player->kartstuff[k_itemtype] = KITEM_NONE;
player->kartstuff[k_itemamount] = 0;
player->kartstuff[k_curshield] = KSHIELD_NONE;
player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
}
nextwork = work->hnext;
while ((work = nextwork) && !P_MobjWasRemoved(work))
while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work)))
{
nextwork = work->hnext;
@ -4827,20 +4842,20 @@ void K_DropHnextList(player_t *player)
orbit = false;
type = MT_EGGMANITEM;
break;
// intentionally do nothing
case MT_SINK_SHIELD:
case MT_ROCKETSNEAKER:
return;
default:
continue;
}
dropwork = P_SpawnMobj(work->x, work->y, work->z, type);
P_SetTarget(&dropwork->target, player->mo);
P_AddKartItem(dropwork); // needs to be called here so shrink can bust items off players in front of the user.
P_AddKartItem(dropwork); // needs to be called here so shrink can bust items off players in front of the user.
dropwork->angle = work->angle;
dropwork->flags2 = work->flags2;
dropwork->flags |= MF_NOCLIPTHING;
dropwork->flags2 = work->flags2;
dropwork->floorz = work->floorz;
dropwork->ceilingz = work->ceilingz;
@ -4869,19 +4884,29 @@ void K_DropHnextList(player_t *player)
if (orbit) // splay out
{
dropwork->flags2 |= MF2_AMBUSH;
dropwork->z += flip;
dropwork->momx = player->mo->momx>>1;
dropwork->momy = player->mo->momy>>1;
dropwork->momz = 3*flip*mapobjectscale;
if (dropwork->eflags & MFE_UNDERWATER)
dropwork->momz = (117 * dropwork->momz) / 200;
P_Thrust(dropwork, work->angle - ANGLE_90, 6*mapobjectscale);
dropwork->movecount = 2;
dropwork->movedir = work->angle - ANGLE_90;
P_SetMobjState(dropwork, dropwork->info->deathstate);
dropwork->tics = -1;
if (type == MT_JAWZ_DUD)
{
dropwork->z += 20*flip*dropwork->scale;
}
else
{
dropwork->color = work->color;
@ -4897,39 +4922,33 @@ void K_DropHnextList(player_t *player)
P_RemoveMobj(work);
}
// we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic...
P_SetTarget(&player->mo->hnext, NULL);
player->kartstuff[k_bananadrag] = 0;
if (player->kartstuff[k_eggmanheld])
{
// we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic...
P_SetTarget(&player->mo->hnext, NULL);
player->kartstuff[k_bananadrag] = 0;
if (player->kartstuff[k_eggmanheld])
player->kartstuff[k_eggmanheld] = 0;
else if (player->kartstuff[k_itemheld]
&& (dropall || (--player->kartstuff[k_itemamount] <= 0)))
{
player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
player->kartstuff[k_itemtype] = KITEM_NONE;
}
player->kartstuff[k_eggmanheld] = 0;
}
else if (player->kartstuff[k_itemheld]
&& (dropall || (--player->kartstuff[k_itemamount] <= 0)))
{
player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
player->kartstuff[k_itemtype] = KITEM_NONE;
}
}
// For getting EXTRA hit!
void K_DropItems(player_t *player)
{
INT32 shieldhack = 0;
K_DropHnextList(player, true);
if (player->kartstuff[k_curshield])
shieldhack = K_GetShieldFromItem(player->kartstuff[k_itemtype]);
if (shieldhack)
player->kartstuff[k_itemtype] = KITEM_NONE;
K_DropHnextList(player);
if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount])
if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount] > 0)
{
mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM);
P_SetScale(drop, drop->scale>>4);
drop->destscale = (3*drop->destscale)/2;;
drop->destscale = (3*drop->destscale)/2;
drop->angle = player->mo->angle + ANGLE_90;
P_Thrust(drop,
@ -4939,13 +4958,7 @@ void K_DropItems(player_t *player)
if (drop->eflags & MFE_UNDERWATER)
drop->momz = (117 * drop->momz) / 200;
switch (shieldhack)
{
case KSHIELD_THUNDER: drop->threshold = KITEM_THUNDERSHIELD; break;
case KSHIELD_BUBBLE: drop->threshold = KITEM_BUBBLESHIELD; break;
case KSHIELD_FLAME: drop->threshold = KITEM_FLAMESHIELD; break;
default: drop->threshold = player->kartstuff[k_itemtype]; break;
}
drop->threshold = player->kartstuff[k_itemtype];
drop->movecount = player->kartstuff[k_itemamount];
drop->flags |= MF_NOCLIPTHING;

View file

@ -57,7 +57,7 @@ void K_DoSneaker(player_t *player, INT32 type);
void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound);
void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source);
void K_UpdateHnextList(player_t *player, boolean clean);
void K_DropHnextList(player_t *player);
void K_DropHnextList(player_t *player, boolean keepshields);
void K_RepairOrbitChain(mobj_t *orbit);
player_t *K_FindJawzTarget(mobj_t *actor, player_t *source);
INT32 K_GetKartRingPower(player_t *player);

View file

@ -2101,14 +2101,14 @@ static void Nextmap_OnChange(void)
if (currentMenu == &SP_TimeAttackDef)
{
// see also p_setup.c's P_LoadRecordGhosts
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
const size_t glen = strlen(srb2home)+1+strlen("media")+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
char *gpath = malloc(glen);
INT32 i;
if (!gpath)
return;
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
CV_StealthSetValue(&cv_dummystaff, 0);
@ -5142,7 +5142,7 @@ void M_ReplayHut(INT32 choice)
if (!demo.inreplayhut)
{
snprintf(menupath, 1024, "%s"PATHSEP"replay"PATHSEP"online"PATHSEP, srb2home);
snprintf(menupath, 1024, "%s"PATHSEP"media"PATHSEP"replay"PATHSEP"online"PATHSEP, srb2home);
menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath);
}
if (!preparefilemenu(false, true))
@ -7876,20 +7876,21 @@ static boolean M_QuitTimeAttackMenu(void)
static void M_ChooseTimeAttack(INT32 choice)
{
char *gpath;
const size_t glen = strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
const size_t glen = strlen("media")+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
char nameofdemo[256];
(void)choice;
emeralds = 0;
M_ClearMenus(true);
modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_RECORD);
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder), 0755);
gpath = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s",
srb2home, timeattackfolder);
M_MkdirEach(gpath, M_PathParts(gpath) - 3, 0755);
if ((gpath = malloc(glen)) == NULL)
I_Error("Out of memory for replay filepath\n");
sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value));
sprintf(gpath,"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value));
snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, cv_chooseskin.string);
if (!cv_autorecord.value)

View file

@ -1121,8 +1121,8 @@ void M_StartMovie(void)
if (cv_movie_option.value != 3)
{
strcat(pathname, PATHSEP"movies"PATHSEP);
I_mkdir(pathname, 0755);
strcat(pathname, PATHSEP"media"PATHSEP"movies"PATHSEP);
M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
}
if (rendermode == render_none)
@ -1483,8 +1483,8 @@ void M_DoScreenShot(void)
if (cv_screenshot_option.value != 3)
{
strcat(pathname, PATHSEP"screenshots"PATHSEP);
I_mkdir(pathname, 0755);
strcat(pathname, PATHSEP"media"PATHSEP"screenshots"PATHSEP);
M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
}
#ifdef USE_PNG

View file

@ -540,7 +540,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->kartstuff[k_bubbleblowup] > 0)
{
K_DropHnextList(player);
K_DropHnextList(player, false);
special->extravalue1 = 2; // WAIT...
special->extravalue2 = 52; // Slightly over the respawn timer length
return;

View file

@ -2621,14 +2621,14 @@ static void P_ForceCharacter(const char *forcecharskin)
static void P_LoadRecordGhosts(void)
{
// see also m_menu.c's Nextmap_OnChange
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
const size_t glen = strlen(srb2home)+1+strlen("media")+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
char *gpath = malloc(glen);
INT32 i;
if (!gpath)
return;
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
// Best Time ghost
if (cv_ghost_besttime.value)
@ -3203,10 +3203,12 @@ boolean P_SetupLevel(boolean skipprecip)
//@TODO I'd like to fix dedis crashing when recording replays for the future too...
if (!demo.playback && multiplayer && !dedicated) {
static char buf[256];
sprintf(buf, "replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap));
char *path;
sprintf(buf, "media"PATHSEP"replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap));
path = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"online", srb2home);
M_MkdirEach(path, M_PathParts(path) - 4, 0755);
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755);
G_RecordDemo(buf);
}

View file

@ -787,7 +787,7 @@ void Y_Ticker(void)
//
static void Y_UpdateRecordReplays(void)
{
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
const size_t glen = strlen(srb2home)+1+strlen("media")+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
char *gpath;
char lastdemo[256], bestdemo[256];
UINT8 earnedEmblems;
@ -823,13 +823,14 @@ static void Y_UpdateRecordReplays(void)
G_SetDemoTime(players[consoleplayer].realtime, bestlap);
G_CheckDemoStatus();
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder), 0755);
gpath = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s",
srb2home, timeattackfolder);
M_MkdirEach(gpath, M_PathParts(gpath) - 3, 0755);
if ((gpath = malloc(glen)) == NULL)
I_Error("Out of memory for replay filepath\n");
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, cv_chooseskin.string);
if (FIL_FileExists(lastdemo))