summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/CmpCompleteDlg.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-01 21:23:39 +0200
committerAki <please@ignore.pl>2022-04-01 21:23:39 +0200
commit3c487c5cd69c53d6fea948643c0a76df03516605 (patch)
tree72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /StarsEx/CmpCompleteDlg.cpp
parent8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff)
downloadstarshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2
Moved Stars45 to StarsEx
Diffstat (limited to 'StarsEx/CmpCompleteDlg.cpp')
-rw-r--r--StarsEx/CmpCompleteDlg.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/StarsEx/CmpCompleteDlg.cpp b/StarsEx/CmpCompleteDlg.cpp
new file mode 100644
index 0000000..a80e460
--- /dev/null
+++ b/StarsEx/CmpCompleteDlg.cpp
@@ -0,0 +1,106 @@
+/* Starshatter: The Open Source Project
+ Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
+ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
+ Copyright (c) 1997-2006, Destroyer Studios LLC.
+
+ AUTHOR: John DiCamillo
+
+
+ OVERVIEW
+ ========
+*/
+
+#include "CmpCompleteDlg.h"
+#include "CmpnScreen.h"
+#include "Campaign.h"
+#include "CombatEvent.h"
+#include "Starshatter.h"
+
+#include "Game.h"
+#include "DataLoader.h"
+#include "Video.h"
+#include "Keyboard.h"
+#include "Mouse.h"
+#include "ImageBox.h"
+#include "Button.h"
+#include "FormatUtil.h"
+
+// +--------------------------------------------------------------------+
+// DECLARE MAPPING FUNCTIONS:
+
+DEF_MAP_CLIENT(CmpCompleteDlg, OnClose);
+
+// +--------------------------------------------------------------------+
+
+CmpCompleteDlg::CmpCompleteDlg(Screen* s, FormDef& def, CmpnScreen* mgr)
+: FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr),
+lbl_info(0), img_title(0), btn_close(0)
+{
+ Init(def);
+}
+
+CmpCompleteDlg::~CmpCompleteDlg()
+{
+}
+
+void
+CmpCompleteDlg::RegisterControls()
+{
+ img_title = (ImageBox*) FindControl(100);
+ lbl_info = FindControl(101);
+ btn_close = (Button*) FindControl(1);
+
+ REGISTER_CLIENT(EID_CLICK, btn_close, CmpCompleteDlg, OnClose);
+}
+
+void
+CmpCompleteDlg::Show()
+{
+ FormWindow::Show();
+
+ Campaign* c = Campaign::GetCampaign();
+
+ if (img_title && c) {
+ DataLoader* loader = DataLoader::GetLoader();
+ Starshatter* stars = Starshatter::GetInstance();
+ CombatEvent* event = c->GetLastEvent();
+ char img_name[256];
+
+ if (event) {
+ strcpy_s(img_name, event->ImageFile());
+
+ if (!strstr(img_name, ".pcx")) {
+ strcat_s(img_name, ".pcx");
+ }
+
+ if (loader) {
+ loader->SetDataPath(c->Path());
+ loader->LoadBitmap(img_name, banner);
+ loader->SetDataPath(0);
+
+ Rect tgt_rect;
+ tgt_rect.w = img_title->Width();
+ tgt_rect.h = img_title->Height();
+
+ img_title->SetTargetRect(tgt_rect);
+ img_title->SetPicture(banner);
+ }
+ }
+ }
+}
+
+// +--------------------------------------------------------------------+
+
+void
+CmpCompleteDlg::ExecFrame()
+{
+}
+
+// +--------------------------------------------------------------------+
+
+void
+CmpCompleteDlg::OnClose(AWEvent* event)
+{
+ if (manager)
+ manager->ShowCmdDlg();
+}