summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-08 20:40:38 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-08 20:40:38 +0200
commit47d885a50b7a2c63267b4bb08360a40ee9b877f7 (patch)
tree358d92e9331b85a73cdf01f445bff0ca6eb00b02 /src
parentfd520c9cabdea03dbaa9edba4b8fdedd99ca75b3 (diff)
parente45cefb6b073447c10145b65b59f30af440ce77c (diff)
downloadmv-47d885a50b7a2c63267b4bb08360a40ee9b877f7.tar.gz
mv-47d885a50b7a2c63267b4bb08360a40ee9b877f7.tar.bz2
mv-47d885a50b7a2c63267b4bb08360a40ee9b877f7.tar.xz
mv-47d885a50b7a2c63267b4bb08360a40ee9b877f7.zip
Merge branch 'minimaps'
Diffstat (limited to 'src')
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/minimap.cpp48
-rw-r--r--src/gui/setup_other.cpp19
-rw-r--r--src/gui/setup_other.h3
4 files changed, 62 insertions, 9 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index b6f72887a..dddded0a8 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -193,6 +193,7 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "usePersistentIP", false);
AddDEF(configData, "showJobExp", true);
AddDEF(configData, "showBeingPopup", true);
+ AddDEF(configData, "showExtMinimaps", false);
return configData;
}
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 798318c99..1dd9ba54e 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -96,16 +96,50 @@ void Minimap::setMap(Map *map)
if (map)
{
- std::string tempname =
- "graphics/minimaps/" + map->getFilename() + ".png";
- ResourceManager *resman = ResourceManager::getInstance();
+ if (config.getBoolValue("showExtMinimaps"))
+ {
+ SDL_Surface* surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ map->getWidth(), map->getHeight(), 32,
+ 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000);
+ if (!surface)
+ {
+ if (!isSticky())
+ setVisible(false);
+ return;
+ }
+
+ // I'm not sure if the locks are necessary since it's a SWSURFACE
+ SDL_LockSurface(surface);
+ int* data = (int*)surface->pixels;
+ if (!data)
+ {
+ if (!isSticky())
+ setVisible(false);
+ return;
+ }
+ for (int y = 0; y < surface->h; y ++)
+ {
+ for (int x = 0; x < surface->w; x ++)
+ *(data ++) = -map->getWalk(x,y);
+ }
+ SDL_UnlockSurface(surface);
+
+ mMapImage = Image::load(surface);
+ SDL_FreeSurface(surface);
+ }
+ else
+ {
+ std::string tempname =
+ "graphics/minimaps/" + map->getFilename() + ".png";
+ ResourceManager *resman = ResourceManager::getInstance();
- minimapName = map->getProperty("minimap");
+ minimapName = map->getProperty("minimap");
- if (minimapName.empty() && resman->exists(tempname))
- minimapName = tempname;
+ if (minimapName.empty() && resman->exists(tempname))
+ minimapName = tempname;
- mMapImage = resman->getImage(minimapName);
+ mMapImage = resman->getImage(minimapName);
+ }
}
if (mMapImage && map)
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 5e7895c23..be5f31665 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -65,6 +65,7 @@
#define ACTION_SHOW_OWN_HP "show own hp"
#define ACTION_SHOW_JOB_EXP "show job exp"
#define ACTION_SHOW_BEING_POPUP "show being popup"
+#define ACTION_SHOW_EXTENDED_MINIMAPS "show extended minimaps"
Setup_Other::Setup_Other():
mShowMonstersTakedDamage(config.getBoolValue("showMonstersTakedDamage")),
@@ -92,6 +93,7 @@ Setup_Other::Setup_Other():
mShowOwnHP(config.getBoolValue("showOwnHP")),
mShowJobExp(config.getBoolValue("showJobExp")),
mShowBeingPopup(config.getBoolValue("showBeingPopup")),
+ mShowExtMinimaps(config.getBoolValue("showExtMinimaps")),
mEditDialog(0)
{
setName(_("Misc"));
@@ -192,8 +194,12 @@ Setup_Other::Setup_Other():
this, ACTION_SHOW_JOB_EXP);
mShowBeingPopupCheckBox = new CheckBox(_("Show players popups"),
- mShowBeingPopup,
- this, ACTION_SHOW_BEING_POPUP);
+ mShowBeingPopup,
+ this, ACTION_SHOW_BEING_POPUP);
+
+ mShowExtMinimapsCheckBox = new CheckBox(_("Show extended minimaps"),
+ mShowExtMinimaps,
+ this, ACTION_SHOW_EXTENDED_MINIMAPS);
// Do the layout
LayoutHelper h(this);
@@ -212,6 +218,7 @@ Setup_Other::Setup_Other():
place(12, 7, mShowOwnHPCheckBox, 10);
place(12, 8, mShowJobExpCheckBox, 10);
place(12, 9, mShowBeingPopupCheckBox, 10);
+ place(12, 10, mShowExtMinimapsCheckBox, 10);
place(0, 3, mFloorItemsHighlightCheckBox, 12);
place(0, 4, mHighlightAttackRangeCheckBox, 12);
place(0, 5, mHighlightMonsterAttackRangeCheckBox, 12);
@@ -352,6 +359,10 @@ void Setup_Other::action(const gcn::ActionEvent &event)
{
mShowBeingPopup = mShowBeingPopupCheckBox->isSelected();
}
+ else if (event.getId() == ACTION_SHOW_EXTENDED_MINIMAPS)
+ {
+ mShowExtMinimaps = mShowExtMinimapsCheckBox->isSelected();
+ }
}
void Setup_Other::cancel()
@@ -430,6 +441,9 @@ void Setup_Other::cancel()
mShowBeingPopup = config.getBoolValue("showBeingPopup");
mShowBeingPopupCheckBox->setSelected(mShowBeingPopup);
+
+ mShowExtMinimaps = config.getBoolValue("showExtMinimaps");
+ mShowExtMinimapsCheckBox->setSelected(mShowExtMinimaps);
}
void Setup_Other::apply()
@@ -459,6 +473,7 @@ void Setup_Other::apply()
config.setValue("showOwnHP", mShowOwnHP);
config.setValue("showJobExp", mShowJobExp);
config.setValue("showBeingPopup", mShowBeingPopup);
+ config.setValue("showExtMinimaps", mShowExtMinimaps);
logger->setDebugLog(mDebugLog);
}
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index 041aad9f3..44daa1237 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -119,6 +119,9 @@ class Setup_Other : public SetupTab, public gcn::ActionListener
gcn::CheckBox *mShowBeingPopupCheckBox;
bool mShowBeingPopup;
+ gcn::CheckBox *mShowExtMinimapsCheckBox;
+ bool mShowExtMinimaps;
+
EditDialog *mEditDialog;
};