diff --git a/Aquaria/ModDownloader.cpp b/Aquaria/ModDownloader.cpp index 489ca89..947469e 100644 --- a/Aquaria/ModDownloader.cpp +++ b/Aquaria/ModDownloader.cpp @@ -286,7 +286,8 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining) // -- saveAs is optional, and ".aqmod" appended to it //-- optional tag //-- optional tag, pops up confirm dialog - //-- optional tag, if not given, "mod" is assumed. + //-- optional tag, if not given, "mod" is assumed. Can be "mod", "patch", or "weblink". + // if type=="weblink", will be opened with the default web browser. @@ -320,17 +321,18 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining) while(modx) { std::string namestr, descstr, iconurl, pkgurl, confirmStr, localname; - std::string sizestr; - bool isPatch = false; + std::string sizestr, weburl; + ModPackageType pkgtype = MPT_MOD; int serverSize = 0; int serverIconSize = 0; - TiXmlElement *fullname, *desc, *icon, *pkg, *confirm, *props; + TiXmlElement *fullname, *desc, *icon, *pkg, *confirm, *props, *web; fullname = modx->FirstChildElement("Fullname"); desc = modx->FirstChildElement("Description"); icon = modx->FirstChildElement("Icon"); pkg = modx->FirstChildElement("Package"); confirm = modx->FirstChildElement("Confirm"); props = modx->FirstChildElement("Properties"); + web = modx->FirstChildElement("Web"); if(fullname && fullname->Attribute("text")) namestr = fullname->Attribute("text"); @@ -347,7 +349,15 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining) } if(props && props->Attribute("type")) - isPatch = !strcmp(props->Attribute("type"), "patch"); + { + const char *ty = props->Attribute("type"); + if(!strcmp(ty, "patch")) + pkgtype = MPT_PATCH; + else if(!strcmp(ty, "mod")) + pkgtype = MPT_MOD; + else if(!strcmp(ty, "weblink")) + pkgtype = MPT_WEBLINK; + } if(pkg) { @@ -394,7 +404,7 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining) ico->confirmStr = confirmStr; ico->localname = localname; ico->label = "--[ " + namestr + " ]--\n" + descstr; - ico->isPatch = isPatch; + ico->pkgtype = pkgtype; if(serverSize && dsq->modIsKnown(localname)) { diff --git a/Aquaria/ModSelector.cpp b/Aquaria/ModSelector.cpp index 5150475..22f2a88 100644 --- a/Aquaria/ModSelector.cpp +++ b/Aquaria/ModSelector.cpp @@ -273,8 +273,6 @@ void ModSelectorScreen::init() dsq->toggleVersionLabel(false); modsIcon->setFocus(true); - - // TODO: keyboard/gamepad control } void ModSelectorScreen::initModAndPatchPanel() @@ -359,7 +357,6 @@ void ModSelectorScreen::setSubText(const std::string& s) static void _FadeOutAll(RenderObject *r, float t) { - //r->shareAlphaWithChildren = true; r->alpha.interpolateTo(0, t); for(RenderObject::Children::iterator it = r->children.begin(); it != r->children.end(); ++it) _FadeOutAll(*it, t); @@ -369,7 +366,6 @@ void ModSelectorScreen::close() { const float t = 0.5f; _FadeOutAll(this, t); - //panels[currentPanel]->scale.interpolateTo(Vector(0.9f, 0.9f), t); // HMM dsq->user.save(); dsq->toggleVersionLabel(true); } @@ -377,7 +373,6 @@ void ModSelectorScreen::close() JuicyProgressBar::JuicyProgressBar() : Quad(), txt(&dsq->smallFont) { setTexture("modselect/tube"); - //shareAlphaWithChildren = true; followCamera = 1; alpha = 1; @@ -570,8 +565,6 @@ void ModIcon::loadEntry(const ModEntry& entry) if (desc->Attribute("text")) { ds = desc->Attribute("text"); - //if (label.size() > 255) - // label.resize(255); } } TiXmlElement *fullname = top->FirstChildElement("Fullname"); @@ -618,7 +611,7 @@ void ModIcon::updateStatus() ModIconOnline::ModIconOnline() -: SubtitleIcon(), pb(0), extraIcon(0), statusIcon(0), clickable(true), isPatch(false), hasUpdate(false) +: SubtitleIcon(), pb(0), extraIcon(0), statusIcon(0), clickable(true), pkgtype(MPT_MOD), hasUpdate(false) { label = desc; } @@ -660,7 +653,7 @@ bool ModIconOnline::fixIcon() quad->setWidthHeight(MOD_ICON_SIZE, MOD_ICON_SIZE); quad->alpha.interpolateTo(1, 0.5f); - if(!extraIcon && isPatch) + if(!extraIcon && pkgtype == MPT_PATCH) { Vector pos(-MOD_ICON_SIZE/2 + MINI_ICON_SIZE/2, MOD_ICON_SIZE/2 - MINI_ICON_SIZE/2); extraIcon = new Quad("modselect/ico_patch", pos); @@ -721,40 +714,53 @@ void ModIconOnline::onClick() if(clickable && !packageUrl.empty()) { bool proceed = true; - if(dsq->modIsKnown(localname)) + if(pkgtype == MPT_MOD || pkgtype == MPT_PATCH) { - mouseDown = false; // HACK: do this here else stack overflow! - if(hasPkgOnDisk()) + if(dsq->modIsKnown(localname)) { - if(hasUpdate) - proceed = dsq->confirm(dsq->continuity.stringBank.get(2024)); + mouseDown = false; // HACK: do this here else stack overflow! + if(hasPkgOnDisk()) + { + if(hasUpdate) + proceed = dsq->confirm(dsq->continuity.stringBank.get(2024)); + else + proceed = dsq->confirm(dsq->continuity.stringBank.get(2025)); + } else - proceed = dsq->confirm(dsq->continuity.stringBank.get(2025)); + { + dsq->confirm(dsq->continuity.stringBank.get(2026), "", true); + proceed = false; + } + + } + + if(proceed && confirmStr.length()) + { + mouseDown = false; // HACK: do this here else stack overflow! + dsq->sound->playSfx("spirit-beacon"); + proceed = dsq->confirm(confirmStr); + } + + if(proceed) + { + moddl.GetMod(packageUrl, localname); + setDownloadProgress(0); + success = true; + clickable = false; } else + success = true; // we didn't want, anyway + } + else if(pkgtype == MPT_WEBLINK) + { + mouseDown = false; + proceed = dsq->confirm(dsq->continuity.stringBank.get(2034)); + if(proceed) { - dsq->confirm(dsq->continuity.stringBank.get(2026), "", true); - proceed = false; + openURL(packageUrl); + success = true; } - } - - if(proceed && confirmStr.length()) - { - mouseDown = false; // HACK: do this here else stack overflow! - dsq->sound->playSfx("spirit-beacon"); - proceed = dsq->confirm(confirmStr); - } - - if(proceed) - { - moddl.GetMod(packageUrl, localname); - setDownloadProgress(0); - success = true; - clickable = false; - } - else - success = true; // we didn't want, anyway } if(!success) @@ -816,7 +822,7 @@ void MenuIconBar::init() ico = new MenuIcon(0); ico->label = dsq->continuity.stringBank.get(2027); - ico->useQuad("modselect/hdd"); + ico->useQuad("modselect/installed"); y += ico->quad->height; ico->position = Vector(0, y); add(ico); @@ -825,7 +831,7 @@ void MenuIconBar::init() MenuIcon *prev = ico; ico = new MenuIcon(1); ico->label = dsq->continuity.stringBank.get(2028); - ico->useQuad("modselect/patch"); + ico->useQuad("modselect/patches"); y += ico->quad->height; ico->position = Vector(0, y); ico->setDirMove(DIR_UP, prev); @@ -835,7 +841,7 @@ void MenuIconBar::init() prev = ico; ico = new MenuIcon(2); ico->label = dsq->continuity.stringBank.get(2029); - ico->useQuad("modselect/globe"); + ico->useQuad("modselect/download"); y += ico->quad->height; ico->position = Vector(0, y); ico->setDirMove(DIR_UP, prev); @@ -846,7 +852,7 @@ void MenuIconBar::init() prev = ico; ico = new MenuIcon(3); ico->label = dsq->continuity.stringBank.get(2030); - ico->useQuad("gui/wok-drop"); + ico->useQuad("modselect/exit"); ico->repeatTextureToFill(false); y += ico->quad->height; ico->position = Vector(0, y); @@ -863,11 +869,6 @@ void MenuIconBar::add(MenuIcon *ico) addChild(ico, PM_POINTER); } -void MenuArrowBar::init() -{ - // TODO: up/down arrow -} - IconGridPanel::IconGridPanel() : spacing(0), y(0), x(0) { diff --git a/Aquaria/ModSelector.h b/Aquaria/ModSelector.h index 2676a98..46339ad 100644 --- a/Aquaria/ModSelector.h +++ b/Aquaria/ModSelector.h @@ -4,6 +4,13 @@ #include "AquariaMenuItem.h" #include "DSQ.h" +enum ModPackageType +{ + MPT_MOD, + MPT_PATCH, + MPT_WEBLINK, +}; + class JuicyProgressBar : public Quad { public: @@ -90,8 +97,8 @@ public: JuicyProgressBar *pb; // visible if downloading Quad *extraIcon; // installed or update available Quad *statusIcon; + ModPackageType pkgtype; bool clickable; - bool isPatch; bool hasUpdate; protected: @@ -118,13 +125,6 @@ protected: void add(MenuIcon *ico); }; -class MenuArrowBar : public MenuBasicBar -{ -public: - virtual void init(); -}; - - class IconGridPanel : public Quad { public: @@ -168,7 +168,7 @@ public: protected: virtual void onUpdate(float dt); MenuIconBar leftbar; - MenuArrowBar rightbar; + MenuBasicBar rightbar; int currentPanel; BitmapText subtext; Quad subbox; diff --git a/files/data/stringbank.txt b/files/data/stringbank.txt index 55fc6b0..532bc5a 100644 --- a/files/data/stringbank.txt +++ b/files/data/stringbank.txt @@ -207,6 +207,7 @@ 2031 Any 2032 [Achievements] 2033 Retrieving online mod list... +2034 Open URL in web browser? 2100 === for options menu === 2101 Action 2102 Key 1 diff --git a/files/gfx/modselect/bar.png b/files/gfx/modselect/bar.png index a30440c..f417c67 100644 Binary files a/files/gfx/modselect/bar.png and b/files/gfx/modselect/bar.png differ diff --git a/files/gfx/modselect/download.png b/files/gfx/modselect/download.png new file mode 100644 index 0000000..328680d Binary files /dev/null and b/files/gfx/modselect/download.png differ diff --git a/files/gfx/modselect/exit.png b/files/gfx/modselect/exit.png new file mode 100644 index 0000000..c54f835 Binary files /dev/null and b/files/gfx/modselect/exit.png differ diff --git a/files/gfx/modselect/globe.png b/files/gfx/modselect/globe.png deleted file mode 100644 index a65242a..0000000 Binary files a/files/gfx/modselect/globe.png and /dev/null differ diff --git a/files/gfx/modselect/hdd.png b/files/gfx/modselect/hdd.png deleted file mode 100644 index 78d6903..0000000 Binary files a/files/gfx/modselect/hdd.png and /dev/null differ diff --git a/files/gfx/modselect/ico_check.png b/files/gfx/modselect/ico_check.png index b1a4907..b558d5e 100644 Binary files a/files/gfx/modselect/ico_check.png and b/files/gfx/modselect/ico_check.png differ diff --git a/files/gfx/modselect/ico_locked.png b/files/gfx/modselect/ico_locked.png index 5859e2f..a462e2d 100644 Binary files a/files/gfx/modselect/ico_locked.png and b/files/gfx/modselect/ico_locked.png differ diff --git a/files/gfx/modselect/ico_patch.png b/files/gfx/modselect/ico_patch.png index 16dd9ce..20c00a7 100644 Binary files a/files/gfx/modselect/ico_patch.png and b/files/gfx/modselect/ico_patch.png differ diff --git a/files/gfx/modselect/ico_update.png b/files/gfx/modselect/ico_update.png index 77f4b5e..ac0504c 100644 Binary files a/files/gfx/modselect/ico_update.png and b/files/gfx/modselect/ico_update.png differ diff --git a/files/gfx/modselect/installed.png b/files/gfx/modselect/installed.png new file mode 100644 index 0000000..5d5ba74 Binary files /dev/null and b/files/gfx/modselect/installed.png differ diff --git a/files/gfx/modselect/patch.png b/files/gfx/modselect/patch.png deleted file mode 100644 index 75b50fb..0000000 Binary files a/files/gfx/modselect/patch.png and /dev/null differ diff --git a/files/gfx/modselect/patches.png b/files/gfx/modselect/patches.png new file mode 100644 index 0000000..7e07a94 Binary files /dev/null and b/files/gfx/modselect/patches.png differ diff --git a/files/gfx/modselect/references.txt b/files/gfx/modselect/references.txt deleted file mode 100644 index fa18bf9..0000000 --- a/files/gfx/modselect/references.txt +++ /dev/null @@ -1,12 +0,0 @@ -http://www.mricons.com/icon/86682/128/text-patch-icon -http://www.mricons.com/icon/80837/128/drive-harddisk-icon -http://commons.wikimedia.org/wiki/File:Deer_Park_Globe.png - -http://www.iconfinder.com/icondetails/3839/48/alert_arrow_download_exclamation_orange_update_icon -http://www.iconfinder.com/icondetails/52296/48/checkmark_tick_icon - - -http://www.mricons.com/icon/28252/32/patch-icon - -http://www.iconfinder.com/icondetails/21179/32/cancel_dialog_error_gtk_icon - diff --git a/files/gfx/modselect/tube.png b/files/gfx/modselect/tube.png index b3662f4..7a84ea3 100644 Binary files a/files/gfx/modselect/tube.png and b/files/gfx/modselect/tube.png differ