Start of post mission screen.

This commit is contained in:
Steve 2018-02-21 08:16:18 +00:00
parent e78c99f5d0
commit f2c8359e59
2 changed files with 101 additions and 8 deletions

View File

@ -23,20 +23,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void logic(void); static void logic(void);
static void draw(void); static void draw(void);
static void updateMissionStatus(void); static void updateMissionStatus(void);
static int status; static int status;
static float missionCompleteY;
static Atlas *background;
static Texture *atlasTexture;
static float oNum;
static int canContinue;
void initPostMission(void) void initPostMission(void)
{ {
startSectionTransition(); startSectionTransition();
atlasTexture = getTexture("gfx/atlas/atlas.png");
background = getImageFromAtlas("gfx/radar/background.png");
updateMissionStatus(); updateMissionStatus();
if (status != MS_INCOMPLETE)
{
app.delegate.logic = logic; app.delegate.logic = logic;
app.delegate.draw = draw; app.delegate.draw = draw;
app.restrictTrophyAlert = 0; app.restrictTrophyAlert = 0;
canContinue = 0;
missionCompleteY = SCREEN_HEIGHT;
playSound(SND_MISSION_COMPLETE, 0);
endSectionTransition(); endSectionTransition();
}
} }
static void updateMissionStatus(void) static void updateMissionStatus(void)
@ -69,11 +87,76 @@ static void updateMissionStatus(void)
static void logic(void) static void logic(void)
{ {
int done;
done = (status == MS_INCOMPLETE);
missionCompleteY = limit(missionCompleteY - 10, 50, SCREEN_HEIGHT);
if (missionCompleteY == 50)
{
oNum += 0.1;
}
if (canContinue && isAcceptControl())
{
done = 1;
clearControls();
}
if (done)
{
destroyWorld(); destroyWorld();
initHub(); initHub();
}
} }
static void draw(void) static void draw(void)
{ {
Objective *o;
SDL_Color c;
char *status;
int x, y, w, i;
blitRectScaled(atlasTexture->texture, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, &background->rect, 0);
drawText(SCREEN_WIDTH / 2, missionCompleteY, 45, TA_CENTER, colors.white, "Mission Complete!");
i = 0;
if (missionCompleteY == 50)
{
w = 800;
x = (SCREEN_WIDTH - w) / 2;
y = 150;
for (o = world.objectiveHead.next ; o != NULL ; o = o->next)
{
c = o->required ? colors.red : colors.white;
status = _("Incomplete");
if (o->currentValue >= o->targetValue)
{
c = colors.green;
status = _("Complete");
}
drawText(x + 20, y, 24, TA_LEFT, c, o->description);
drawText(SCREEN_WIDTH / 2 + 100, y, 24, TA_LEFT, c, "%d / %d", MIN(o->currentValue, o->targetValue), o->targetValue);
drawText(x + w - 20, y, 24, TA_RIGHT, c, status);
y += 55;
if (oNum < ++i)
{
return;
}
}
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 80, 24, TA_CENTER, colors.white, _("Press Fire to Continue"));
canContinue = 1;
}
} }

View File

@ -27,7 +27,17 @@ extern void saveGame(void);
extern void saveWorld(void); extern void saveWorld(void);
extern void destroyWorld(void); extern void destroyWorld(void);
extern int getMissionStatus(void); extern int getMissionStatus(void);
extern Texture *getTexture(const char *filename);
extern Atlas *getImageFromAtlas(char *filename);
extern void blitRectScaled(SDL_Texture *texture, int x, int y, int w, int h, SDL_Rect *srcRect, int center);
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
extern void drawLine(int x1, int y1, int x2, int y2, int r, int g, int b, int a);
extern float limit(float i, float low, float high);
extern void playSound(int snd, int ch);
extern int isAcceptControl(void);
extern void clearControls(void);
extern App app; extern App app;
extern Colors colors;
extern Game game; extern Game game;
extern World world; extern World world;