Rewrite shops system to be more general

- Shops can now contain more than one type of item (for example, both mage and priest spells)
- Shops can now specify any talking portrait
- Healing options in a shop now have an info button giving a brief explanation (partly because it was easier than maintaining the exception)
- Additional healing option (not present in default healing shops): cure acid
- Acid is also no longer removed when you leave town or end combat (unless it's about to wear off)
- Always start shop mode with the scrollbar scrolled to the top
- Fix crash when entering an outdoor shop (and outdoor dialogue for that matter)
- Treasure generation system can now return junk items (treasure type 0), but only if explicitly requested; this is possible in shops but not with monsters since 0 means no loot

Dialog Engine:
- When setting a scrollbar's maximum, it now ensures the current position doesn't end up greater than the maximum
This commit is contained in:
2015-02-03 10:22:28 -05:00
parent 559663dd35
commit 008248a947
20 changed files with 435 additions and 238 deletions

View File

@@ -13,6 +13,7 @@ location which_party_sec;
extern short which_combat_type,current_pc;
extern eGameMode overall_mode;
extern eGameMode store_pre_shop_mode, store_pre_talk_mode;
extern location center;
extern cUniverse univ;
@@ -41,13 +42,33 @@ void take_explored(short i,short j) {
bool is_out() {
if((overall_mode == MODE_OUTDOORS) || (overall_mode == MODE_LOOK_OUTDOORS))
return true;
else return false;
else if(overall_mode == MODE_SHOPPING) {
std::swap(overall_mode, store_pre_shop_mode);
bool ret = is_out();
std::swap(overall_mode, store_pre_shop_mode);
return ret;
} else if(overall_mode == MODE_TALKING) {
std::swap(overall_mode, store_pre_talk_mode);
bool ret = is_out();
std::swap(overall_mode, store_pre_talk_mode);
return ret;
} else return false;
}
bool is_town() {
if(((overall_mode > MODE_OUTDOORS) && (overall_mode < MODE_COMBAT)) || (overall_mode == MODE_LOOK_TOWN))
return true;
else return false;
else if(overall_mode == MODE_SHOPPING) {
std::swap(overall_mode, store_pre_shop_mode);
bool ret = is_town();
std::swap(overall_mode, store_pre_shop_mode);
return ret;
} else if(overall_mode == MODE_TALKING) {
std::swap(overall_mode, store_pre_talk_mode);
bool ret = is_town();
std::swap(overall_mode, store_pre_talk_mode);
return ret;
} else return false;
}
bool is_combat() {