Laserlicht 1 年之前
父節點
當前提交
9c2a5f6baa

+ 5 - 1
client/NetPacksLobbyClient.cpp

@@ -35,6 +35,7 @@
 #include "../lib/CConfigHandler.h"
 #include "../lib/texts/CGeneralTextHandler.h"
 #include "../lib/serializer/Connection.h"
+#include "../lib/campaign/CampaignState.h"
 
 void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientConnected(LobbyClientConnected & pack)
 {
@@ -203,7 +204,10 @@ void ApplyOnLobbyScreenNetPackVisitor::visitLobbyUpdateState(LobbyUpdateState &
 	if(!lobby->bonusSel && handler.si->campState && handler.getState() == EClientState::LOBBY_CAMPAIGN)
 	{
 		lobby->bonusSel = std::make_shared<CBonusSelection>();
-		GH.windows().pushWindow(lobby->bonusSel);
+		if(!handler.si->campState->conqueredScenarios().size())
+			GH.windows().createAndPushWindow<CampaignIntroVideo>(VideoPath::builtin("Hc1_Intro"), ImagePath::builtin("INTRORIM"), lobby->bonusSel);
+		else
+			GH.windows().pushWindow(lobby->bonusSel);
 	}
 
 	if(lobby->bonusSel)

+ 15 - 0
client/lobby/CBonusSelection.cpp

@@ -28,6 +28,7 @@
 #include "../widgets/MiscWidgets.h"
 #include "../widgets/ObjectLists.h"
 #include "../widgets/TextControls.h"
+#include "../widgets/VideoWidget.h"
 #include "../windows/GUIClasses.h"
 #include "../windows/InfoWindows.h"
 #include "../render/IImage.h"
@@ -58,6 +59,20 @@
 #include "../../lib/mapObjects/CGHeroInstance.h"
 
 
+CampaignIntroVideo::CampaignIntroVideo(VideoPath video, ImagePath rim, std::shared_ptr<CBonusSelection> bonusSel)
+	: CWindowObject(BORDERED), bonusSel(bonusSel)
+{
+	OBJECT_CONSTRUCTION;
+	videoPlayer = std::make_shared<VideoWidgetOnce>(Point(0, 0), video, true, [this](){ exit(); });
+	setBackground(rim);
+}
+
+void CampaignIntroVideo::exit()
+{
+	close();
+	GH.windows().pushWindow(bonusSel);
+}
+
 std::shared_ptr<CampaignState> CBonusSelection::getCampaign()
 {
 	return CSH->si->campState;

+ 14 - 0
client/lobby/CBonusSelection.h

@@ -12,6 +12,7 @@
 #include "../windows/CWindowObject.h"
 
 #include "../lib/campaign/CampaignConstants.h"
+#include "../lib/filesystem/ResourcePath.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 
@@ -28,6 +29,19 @@ class CLabel;
 class CFlagBox;
 class ISelectionScreenInfo;
 class ExtraOptionsTab;
+class VideoWidgetOnce;
+class CBonusSelection;
+
+
+class CampaignIntroVideo : public CWindowObject
+{
+	std::shared_ptr<VideoWidgetOnce> videoPlayer;
+	std::shared_ptr<CBonusSelection> bonusSel;
+
+	void exit();
+public:
+	CampaignIntroVideo(VideoPath video, ImagePath rim, std::shared_ptr<CBonusSelection> bonusSel);
+};
 
 /// Campaign screen where you can choose one out of three starting bonuses
 class CBonusSelection : public CWindowObject

+ 1 - 0
launcher/modManager/chroniclesextractor.cpp

@@ -234,6 +234,7 @@ void ChroniclesExtractor::extractFiles(int no)
 	tmpDir.cdUp();
 	QDir tmpDirData = tmpDir.filePath(tmpDir.entryList({"data"}, QDir::Filter::Dirs).front());
 	extract(tmpDirData, outDirData, "bitmap.lod", std::vector<std::string>{"HPL003sh", "HPL102br", "HPL139", "HPS006kn", "HPS137", "HPS141", "HPL004sh", "hpl112bs", "HPL140", "hps007sh", "HPS138", "HPS142", "HPL006kn", "HPL137", "HPS003sh", "HPS102br", "HPS139", "HPS143", "hpl007sh", "HPL138", "HPS004sh", "hps112bs", "HPS140"});
+	extract(tmpDirData, outDirData, "lbitmap.lod", std::vector<std::string>{"INTRORIM"});
 
 	rename(outDirData);
 	rename(outDirSprites);