#pragma once

#include "..\munga_l4\l4app.h"

//##########################################################################
//######################    RP4L4Application    ############################
//##########################################################################

class RPL4Application : public L4Application
{
public:
	RPL4Application(HINSTANCE hInstance, HWND hWnd, ResourceFile *resource_file, ClassID class_ID=L4ApplicationClassID, SharedData &shared_data=DefaultData);
	~RPL4Application();

private:
	Registry* MakeRegistry();

	VideoRenderer* MakeVideoRenderer();

	AudioRenderer* MakeAudioRenderer();

	GaugeRenderer* MakeGaugeRenderer(int *secondaryIndex, int *aux1Index, int *aux2Index);

	ModeManager* MakeModeManager();

	Mission* MakeMission(NotationFile *notation_file, ResourceFile *resources);

	Entity* MakeViewpointEntity(Entity__MakeMessage *);

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// The Winners Circle.
//
// The podium is engine content that only the mission-review build ever
// ran: geometry, the eight ranked dropzones and the presentation code all
// ship, but the sequence lived on RPL4PlaybackApplication behind a spool
// file. This is the same sequence on the path the pods actually race.
//
public:
	enum
	{
		// posted at the buzzer, fires once the race has faded out
		WinnersCircleMessageID = L4Application::NextMessageID,
		NextMessageID
	};

	static const HandlerEntry
		MessageHandlerEntries[];
	static MessageHandlerSet& GetMessageHandlers();
	static Derivation *GetClassDerivations();
	static SharedData DefaultData;

	void
		StopMissionMessageHandler(StopMissionMessage *message);

	// the podium proper, once the screen is already black
	void
		WinnersCircleMessageHandler(Receiver::Message *message);

private:
	// stand the finishers on their ranked spots and frame the shot
	void
		ShowWinnersCircle();
};
