Skip to content

Commit

Permalink
Only show high scores at very end #151
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Feb 2, 2025
1 parent 2c249e4 commit 47fccc6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
24 changes: 13 additions & 11 deletions src/briefing_screens.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013-2023 Cong Xu
Copyright (c) 2013-2023, 2025 Cong Xu
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -37,7 +37,6 @@

#include "animated_counter.h"
#include "autosave.h"
#include "hiscores.h"
#include "loading_screens.h"
#include "menu_utils.h"
#include "password.h"
Expand Down Expand Up @@ -144,7 +143,14 @@ static void CampaignIntroDraw(GameLoopData *data)
// Display title + author
char *buf;
CMALLOC(buf, strlen(sData->c->Title) + strlen(sData->c->Author) + 16);
sprintf(buf, "%s by %s", sData->c->Title, sData->c->Author);
if (strlen(sData->c->Author))
{
sprintf(buf, "%s by %s", sData->c->Title, sData->c->Author);
}
else
{
strcpy(buf, sData->c->Title);
}
FontOpts opts = FontOptsNew();
opts.HAlign = ALIGN_CENTER;
opts.Area = gGraphicsDevice.cachedConfig.Res;
Expand Down Expand Up @@ -493,7 +499,7 @@ static void MissionSummaryOnEnter(GameLoopData *data)
p->Totals.TimeTicks += mData->m->time;
CA_FOREACH_END()
}

if (mData->completed && CanLevelSelect(mData->c->Entry.Mode))
{
AutosaveAdd(
Expand Down Expand Up @@ -634,11 +640,6 @@ static GameLoopResult MissionSummaryUpdate(GameLoopData *data, LoopRunner *l)
gCampaign.IsQuit = mData->ms.current->u.returnCode == 1;
LoopRunnerPop(l);
}
else
{
LoopRunnerChange(
l, HighScoresScreen(&gCampaign, &gGraphicsDevice));
}
}
return result;
}
Expand Down Expand Up @@ -937,8 +938,9 @@ static void DrawObjectiveInfo(const Objective *o, const struct vec2i pos)
struct vec2i picOffset;
const Pic *p = MapObjectGetPic(*mo, &picOffset);
PicRender(
p, gGraphicsDevice.gameWindow.renderer, svec2i_add(drawPos, picOffset),
colorWhite, 0, svec2_one(), SDL_FLIP_NONE, Rect2iZero());
p, gGraphicsDevice.gameWindow.renderer,
svec2i_add(drawPos, picOffset), colorWhite, 0, svec2_one(),
SDL_FLIP_NONE, Rect2iZero());
drawPos = svec2i_add(drawPos, svec2i(4, 2));
CA_FOREACH_END()
}
Expand Down
5 changes: 0 additions & 5 deletions src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
#include <cdogs/pickup.h>

#include "briefing_screens.h"
#include "hiscores.h"
#include "loading_screens.h"
#include "prep.h"
#include "screens_end.h"
Expand Down Expand Up @@ -569,10 +568,6 @@ static void NextLoop(RunGameData *rData, LoopRunner *l)
break;
}
}
else
{
nextScreen = HighScoresScreen(rData->co, &gGraphicsDevice);
}
LoopRunnerPush(l, ScreenLoading("Debriefing...", true, nextScreen, true));
if (!HasRounds(rData->co->Entry.Mode) && !rData->co->IsComplete)
{
Expand Down
12 changes: 2 additions & 10 deletions src/screens_end.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,17 +438,9 @@ static GameLoopResult DogfightScoresUpdate(GameLoopData *data, LoopRunner *l)
PlayerList *pl = data->Data;

const GameLoopResult result = MenuUpdate(&pl->ms);
if (result == UPDATE_RESULT_OK)
if (result == UPDATE_RESULT_OK && gCampaign.IsComplete)
{
if (gCampaign.IsComplete)
{
LoopRunnerChange(l, ScreenDogfightFinalScores());
}
else
{
LoopRunnerChange(
l, HighScoresScreen(&gCampaign, &gGraphicsDevice));
}
LoopRunnerChange(l, ScreenDogfightFinalScores());
}
return result;
}
Expand Down

0 comments on commit 47fccc6

Please sign in to comment.