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 // use user specific config file
#ifdef DEFAULTDIR #ifdef DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); 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) if (dedicated)
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
else else
@ -1090,18 +1093,6 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename // can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP); 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'; configfile[sizeof configfile - 1] = '\0';
@ -1115,6 +1106,10 @@ void D_SRB2Main(void)
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons"); snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
I_mkdir(addonsdir, 0755); 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 // rand() needs seeded regardless of password
srand((unsigned int)time(NULL)); 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 if (getitem == KITEM_SPB || getitem == KITEM_SHRINK) // Indirect items
indirectitemcooldown = 20*TICRATE; indirectitemcooldown = 20*TICRATE;
if (getitem == KITEM_HYUDORO) // Hyudoro cooldown if (getitem == KITEM_HYUDORO) // Hyudoro cooldown
hyubgone = 5*TICRATE; hyubgone = 5*TICRATE;
@ -1205,7 +1206,17 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
&& players[i].kartstuff[k_position] == 1) && players[i].kartstuff[k_position] == 1)
{ {
// This player is first! Yay! // 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; break;
} }
} }
@ -1319,7 +1330,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
player->kartstuff[k_itemroulette] = 0; player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0; player->kartstuff[k_roulettetype] = 0;
if (P_IsDisplayPlayer(player)) if (P_IsDisplayPlayer(player))
S_StartSound(NULL, (mashed ? sfx_itrolm : sfx_itrolf)); S_StartSound(NULL, sfx_itrolm);
return; return;
} }
} }
@ -1472,7 +1483,7 @@ static void K_DebtStingPlayer(player_t *player, INT32 length)
if (player->mo->state != &states[S_KART_SPIN]) if (player->mo->state != &states[S_KART_SPIN])
P_SetPlayerMobjState(player->mo, S_KART_SPIN); P_SetPlayerMobjState(player->mo, S_KART_SPIN);
K_DropHnextList(player); K_DropHnextList(player, false);
return; return;
} }
@ -2937,7 +2948,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
if (cv_kartdebughuddrop.value && !modeattacking) if (cv_kartdebughuddrop.value && !modeattacking)
K_DropItems(player); K_DropItems(player);
else else
K_DropHnextList(player); K_DropHnextList(player, false);
return; return;
} }
@ -3082,7 +3093,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
if (cv_kartdebughuddrop.value && !modeattacking) if (cv_kartdebughuddrop.value && !modeattacking)
K_DropItems(player); K_DropItems(player);
else else
K_DropHnextList(player); K_DropHnextList(player, false);
return; return;
} }
@ -3288,7 +3299,7 @@ void K_StealBumper(player_t *player, player_t *victim, boolean force)
if (cv_kartdebughuddrop.value && !modeattacking) if (cv_kartdebughuddrop.value && !modeattacking)
K_DropItems(victim); K_DropItems(victim);
else else
K_DropHnextList(victim); K_DropHnextList(victim, false);
return; return;
} }
@ -4751,54 +4762,58 @@ void K_UpdateHnextList(player_t *player, boolean clean)
nextwork = work->hnext; nextwork = work->hnext;
while ((work = nextwork) && !P_MobjWasRemoved(work)) while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work)))
{ {
nextwork = work->hnext; nextwork = work->hnext;
if (!clean && (!work->movedir || work->movedir <= (UINT16)player->kartstuff[k_itemamount])) if (!clean && (!work->movedir || work->movedir <= (UINT16)player->kartstuff[k_itemamount]))
{
continue; continue;
}
P_RemoveMobj(work); 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! // For getting hit!
void K_DropHnextList(player_t *player) void K_DropHnextList(player_t *player, boolean keepshields)
{ {
mobj_t *work = player->mo, *nextwork, *dropwork; mobj_t *work = player->mo, *nextwork, *dropwork;
INT32 flip; INT32 flip;
mobjtype_t type; mobjtype_t type;
boolean orbit, ponground, dropall = true; 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; return;
}
flip = P_MobjFlip(player->mo); flip = P_MobjFlip(player->mo);
ponground = P_IsObjectOnGround(player->mo); ponground = P_IsObjectOnGround(player->mo);
if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) if (shield != KSHIELD_NONE && !keepshields)
{ {
K_DoThunderShield(player); if (shield == KSHIELD_THUNDER)
player->kartstuff[k_itemtype] = KITEM_NONE; {
player->kartstuff[k_itemamount] = 0; K_DoThunderShield(player);
}
player->kartstuff[k_curshield] = KSHIELD_NONE; player->kartstuff[k_curshield] = KSHIELD_NONE;
}
else if (player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD)
{
player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemtype] = KITEM_NONE;
player->kartstuff[k_itemamount] = 0; player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 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;
} }
nextwork = work->hnext; nextwork = work->hnext;
while ((work = nextwork) && !P_MobjWasRemoved(work)) while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work)))
{ {
nextwork = work->hnext; nextwork = work->hnext;
@ -4827,20 +4842,20 @@ void K_DropHnextList(player_t *player)
orbit = false; orbit = false;
type = MT_EGGMANITEM; type = MT_EGGMANITEM;
break; break;
// intentionally do nothing
case MT_SINK_SHIELD:
case MT_ROCKETSNEAKER:
return;
default: default:
continue; continue;
} }
dropwork = P_SpawnMobj(work->x, work->y, work->z, type); dropwork = P_SpawnMobj(work->x, work->y, work->z, type);
P_SetTarget(&dropwork->target, player->mo); 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->angle = work->angle;
dropwork->flags2 = work->flags2;
dropwork->flags |= MF_NOCLIPTHING; dropwork->flags |= MF_NOCLIPTHING;
dropwork->flags2 = work->flags2;
dropwork->floorz = work->floorz; dropwork->floorz = work->floorz;
dropwork->ceilingz = work->ceilingz; dropwork->ceilingz = work->ceilingz;
@ -4869,19 +4884,29 @@ void K_DropHnextList(player_t *player)
if (orbit) // splay out if (orbit) // splay out
{ {
dropwork->flags2 |= MF2_AMBUSH; dropwork->flags2 |= MF2_AMBUSH;
dropwork->z += flip; dropwork->z += flip;
dropwork->momx = player->mo->momx>>1; dropwork->momx = player->mo->momx>>1;
dropwork->momy = player->mo->momy>>1; dropwork->momy = player->mo->momy>>1;
dropwork->momz = 3*flip*mapobjectscale; dropwork->momz = 3*flip*mapobjectscale;
if (dropwork->eflags & MFE_UNDERWATER) if (dropwork->eflags & MFE_UNDERWATER)
dropwork->momz = (117 * dropwork->momz) / 200; dropwork->momz = (117 * dropwork->momz) / 200;
P_Thrust(dropwork, work->angle - ANGLE_90, 6*mapobjectscale); P_Thrust(dropwork, work->angle - ANGLE_90, 6*mapobjectscale);
dropwork->movecount = 2; dropwork->movecount = 2;
dropwork->movedir = work->angle - ANGLE_90; dropwork->movedir = work->angle - ANGLE_90;
P_SetMobjState(dropwork, dropwork->info->deathstate); P_SetMobjState(dropwork, dropwork->info->deathstate);
dropwork->tics = -1; dropwork->tics = -1;
if (type == MT_JAWZ_DUD) if (type == MT_JAWZ_DUD)
{
dropwork->z += 20*flip*dropwork->scale; dropwork->z += 20*flip*dropwork->scale;
}
else else
{ {
dropwork->color = work->color; dropwork->color = work->color;
@ -4897,39 +4922,33 @@ void K_DropHnextList(player_t *player)
P_RemoveMobj(work); 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... player->kartstuff[k_eggmanheld] = 0;
P_SetTarget(&player->mo->hnext, NULL); }
player->kartstuff[k_bananadrag] = 0; else if (player->kartstuff[k_itemheld]
if (player->kartstuff[k_eggmanheld]) && (dropall || (--player->kartstuff[k_itemamount] <= 0)))
player->kartstuff[k_eggmanheld] = 0; {
else if (player->kartstuff[k_itemheld] player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
&& (dropall || (--player->kartstuff[k_itemamount] <= 0))) player->kartstuff[k_itemtype] = KITEM_NONE;
{
player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
player->kartstuff[k_itemtype] = KITEM_NONE;
}
} }
} }
// For getting EXTRA hit! // For getting EXTRA hit!
void K_DropItems(player_t *player) void K_DropItems(player_t *player)
{ {
INT32 shieldhack = 0; K_DropHnextList(player, true);
if (player->kartstuff[k_curshield]) if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount] > 0)
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])
{ {
mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM); 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); 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; drop->angle = player->mo->angle + ANGLE_90;
P_Thrust(drop, P_Thrust(drop,
@ -4939,13 +4958,7 @@ void K_DropItems(player_t *player)
if (drop->eflags & MFE_UNDERWATER) if (drop->eflags & MFE_UNDERWATER)
drop->momz = (117 * drop->momz) / 200; drop->momz = (117 * drop->momz) / 200;
switch (shieldhack) drop->threshold = player->kartstuff[k_itemtype];
{
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->movecount = player->kartstuff[k_itemamount]; drop->movecount = player->kartstuff[k_itemamount];
drop->flags |= MF_NOCLIPTHING; 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_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound);
void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source); void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source);
void K_UpdateHnextList(player_t *player, boolean clean); 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); void K_RepairOrbitChain(mobj_t *orbit);
player_t *K_FindJawzTarget(mobj_t *actor, player_t *source); player_t *K_FindJawzTarget(mobj_t *actor, player_t *source);
INT32 K_GetKartRingPower(player_t *player); INT32 K_GetKartRingPower(player_t *player);

View file

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

View file

@ -1121,8 +1121,8 @@ void M_StartMovie(void)
if (cv_movie_option.value != 3) if (cv_movie_option.value != 3)
{ {
strcat(pathname, PATHSEP"movies"PATHSEP); strcat(pathname, PATHSEP"media"PATHSEP"movies"PATHSEP);
I_mkdir(pathname, 0755); M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
} }
if (rendermode == render_none) if (rendermode == render_none)
@ -1483,8 +1483,8 @@ void M_DoScreenShot(void)
if (cv_screenshot_option.value != 3) if (cv_screenshot_option.value != 3)
{ {
strcat(pathname, PATHSEP"screenshots"PATHSEP); strcat(pathname, PATHSEP"media"PATHSEP"screenshots"PATHSEP);
I_mkdir(pathname, 0755); M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
} }
#ifdef USE_PNG #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) if (player->kartstuff[k_bubbleblowup] > 0)
{ {
K_DropHnextList(player); K_DropHnextList(player, false);
special->extravalue1 = 2; // WAIT... special->extravalue1 = 2; // WAIT...
special->extravalue2 = 52; // Slightly over the respawn timer length special->extravalue2 = 52; // Slightly over the respawn timer length
return; return;

View file

@ -2621,14 +2621,14 @@ static void P_ForceCharacter(const char *forcecharskin)
static void P_LoadRecordGhosts(void) static void P_LoadRecordGhosts(void)
{ {
// see also m_menu.c's Nextmap_OnChange // 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); char *gpath = malloc(glen);
INT32 i; INT32 i;
if (!gpath) if (!gpath)
return; 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 // Best Time ghost
if (cv_ghost_besttime.value) 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... //@TODO I'd like to fix dedis crashing when recording replays for the future too...
if (!demo.playback && multiplayer && !dedicated) { if (!demo.playback && multiplayer && !dedicated) {
static char buf[256]; 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); G_RecordDemo(buf);
} }

View file

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