Skip to content

Loading…

Quest Menu Changes #120

Merged
merged 1 commit into from

2 participants

@IkarusDowned

as per #97, a couple remaining quest menu changes

Features:

  • Added location and sub location image / description support
  • Added Completion Descriptions. This is a summary description that shows up when you complete the quest (in aqua! oooooOOooo....). note that in order to support this the description text box has been changed from 400px height to 200px height.

Bug Fix:

  • Quest List had some problems with the pointer and "completed" quests. This should now be fixed
  • An edge case where a completed quest that had not been read yet was causing graphical inconsistencies. This is now fixed
@IkarusDowned IkarusDowned Quest Menu Changes
as per #97, a couple remaining quest menu changes

Features:
+ Added location and sub location image / description support
+ Added Completion Descriptions. This is a summary description that shows
up when you complete the quest (in aqua! oooooOOooo....). note that in
order to support this the description text box has been changed from 400px
height to 200px height.

Bug Fix:
- Quest List had some problems with the pointer and "completed" quests. This should now be fixed
- An edge case where a completed quest that had not been read yet was
  causing graphical inconsistencies. This is now fixed
d217eaf
@Bertram25
Valyria Tear member

Code wise, the patch looks perfectly fine.

I'll play with it a bit and merge. Thanks!!!

yep, let me know any changes you want made

@Bertram25
Valyria Tear member

Working fine, thanks!!

Merging now. I'll add actual content in another commit.

@Bertram25 Bertram25 merged commit d60b2e1 into ValyriaTear:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 22, 2013
  1. @IkarusDowned

    Quest Menu Changes

    IkarusDowned committed
    as per #97, a couple remaining quest menu changes
    
    Features:
    + Added location and sub location image / description support
    + Added Completion Descriptions. This is a summary description that shows
    up when you complete the quest (in aqua! oooooOOooo....). note that in
    order to support this the description text box has been changed from 400px
    height to 200px height.
    
    Bug Fix:
    - Quest List had some problems with the pointer and "completed" quests. This should now be fixed
    - An edge case where a completed quest that had not been read yet was
      causing graphical inconsistencies. This is now fixed
This page is out of date. Refresh to see the latest.
Showing with 135 additions and 34 deletions.
  1. +23 −6 dat/config/quests.lua
  2. +5 −3 src/common/global/global.cpp
  3. +31 −2 src/common/global/global.h
  4. +68 −21 src/modes/menu/menu_views.cpp
  5. +8 −2 src/modes/menu/menu_views.h
View
29 dat/config/quests.lua
@@ -1,7 +1,8 @@
-- this is a flat list of all the quest descriptions and their titles.
--- format should be as follows: ["unique_string_id"] = {"title", "description", completion_event_group, completion_event_name, location_name, location_banner_filename},
+-- format should be as follows: ["unique_string_id"] =
+-- {"title", "description", completion_description, completion_event_group, completion_event_name, location_name, location_banner_filename, location_subname, location_subimage},
-- When the event value of the completion_event_name in the completion_event_group is equal to 1, the quest is considered complete.
--- location_name and location_banner_filename are optional fields, and they are used to display the quest start location and associated banner image
+-- location_name, location_subname, location_subimage and location_banner_filename are optional fields, and they are used to display the quest start location and associated banner image
-- All fields can be empty but are required.
-- Use the 'GlobalManager:AddQuestLog("string_id");' luabind script command to add a quest entry in the player's quest log.
@@ -13,10 +14,14 @@ quests = {
hoa_system.Translate("Get Some Barley Meal"),
-- Description
hoa_system.Translate("Mom needs some for dinner!\n \nFlora might have some in her shop. I should go and have a look there first."),
+ -- Completion Description
+ hoa_system.Translate("This quest is completed. Here's how i did it:\nblah blah blah..."),
-- Group and event for the quest to be complete.
"story", "quest1_barley_meal_done",
-- Location name and banner image filename
- hoa_system.Translate("Village of Layna\n \nBronann's home"), "img/menus/locations/mountain_village.png"
+ hoa_system.Translate("Village of Layna"), "img/menus/locations/mountain_village.png",
+ -- Location sub-name and image filename
+ hoa_system.Translate("Bronann's home"), "img/menus/locations/mountain_village.png",
},
-- Quest id
@@ -25,10 +30,14 @@ quests = {
hoa_system.Translate("Find Georges' pen"),
-- Description
hoa_system.Translate("In order to know whom Georges gave the rest of barley meal to, I need to get back his lost pen.\n \nHe spoke about losing it near a tree but also told me people in the village might know more..."),
+ -- Completion Description
+ hoa_system.Translate("This quest is completed. Here's how i did it:\nblah blah blah..."),
-- Group and event for the quest to be complete.
"layna_center", "quest1_pen_given_done",
-- Location name and banner image filename
- hoa_system.Translate("Village of Layna\n \nVillage center"), "img/menus/locations/mountain_village.png"
+ hoa_system.Translate("Village of Layna"), "img/menus/locations/mountain_village.png",
+ -- Location sub-name and image filename
+ hoa_system.Translate("Village center"), "img/menus/locations/mountain_village.png",
},
-- Quest id
@@ -37,10 +46,14 @@ quests = {
hoa_system.Translate("Let's go in the woods..."),
-- Description
hoa_system.Translate("It's been weeks since I could go outside the village.\n \nThe entrance has been shut with stones, and now they won't even let me go and breath in the only place I could still go before?!?\n \nWhatever, I need a sword just in case and I'll get there alone!"),
+ -- Completion Description
+ hoa_system.Translate("This quest is completed. Here's how i did it:\nblah blah blah..."),
-- Group and event for the quest to be complete.
"story", "kalya_has_joined",
-- Location name and banner image filename
- hoa_system.Translate("Village of Layna\n \nBronann's home"), "img/menus/locations/mountain_village.png"
+ hoa_system.Translate("Village of Layna"), "img/menus/locations/mountain_village.png",
+ -- Location sub-name and image filename
+ hoa_system.Translate("Bronann's home"), "img/menus/locations/mountain_village.png",
},
-- Quest id
@@ -49,9 +62,13 @@ quests = {
hoa_system.Translate("Orlinn might be in danger!"),
-- Description
hoa_system.Translate("After seeing that strange light, Orlinn just ran away into the woods. He's just a kid, even if a quick one!\n \nMy own father asked me to go there with Kalya and get him back safe and sound.\n \nI can't let them down!"),
+ -- Completion Description
+ hoa_system.Translate("This quest is completed. Here's how i did it:\nblah blah blah..."),
-- Group and event for the quest to be complete.
"none", "none",
-- Location name and banner image filename
- hoa_system.Translate("Village of Layna\n \nVillage center"), "img/menus/locations/mountain_village.png"
+ hoa_system.Translate("Village of Layna"), "img/menus/locations/mountain_village.png",
+ -- Location sub-name and image filename
+ hoa_system.Translate("Village center"), "img/menus/locations/mountain_village.png",
}
}
View
8 src/common/global/global.cpp
@@ -1680,12 +1680,14 @@ bool GameGlobal::_LoadQuestsScript(const std::string& quests_script_filename)
}
//check whether all fields are there.
- if(quest_info.size() == 6)
+ if(quest_info.size() == 9)
{
QuestLogInfo info = QuestLogInfo(MakeUnicodeString(quest_info[0]),
MakeUnicodeString(quest_info[1]),
- quest_info[2], quest_info[3],
- MakeUnicodeString(quest_info[4]), quest_info[5]);
+ MakeUnicodeString(quest_info[2]),
+ quest_info[3], quest_info[4],
+ MakeUnicodeString(quest_info[5]), quest_info[6],
+ MakeUnicodeString(quest_info[7]), quest_info[8]);
_quest_log_info[quest_id] = info;
}
//malformed quest log
View
33 src/common/global/global.h
@@ -197,18 +197,43 @@ struct QuestLogEntry
struct QuestLogInfo {
QuestLogInfo(const hoa_utils::ustring &title,
const hoa_utils::ustring &description,
+ const hoa_utils::ustring &completion_description,
const std::string &completion_event_group,
const std::string &completion_event_name,
const hoa_utils::ustring &location_name,
- const std::string &location_banner_filename) :
+ const std::string &location_banner_filename,
+ const hoa_utils::ustring &location_subname,
+ const std::string &location_subimage_filename) :
_title(title),
_description(description),
+ _completion_description(completion_description),
_completion_event_group(completion_event_group),
_completion_event_name(completion_event_name),
- _location_name(location_name)
+ _location_name(location_name),
+ _location_subname(location_subname)
{
if(!_location_image.Load(location_banner_filename))
+ {
PRINT_ERROR << "image: " << location_banner_filename << " not able to load" << std::endl;
+ return;
+ }
+ //rescale such that the height is no bigger than 90 pixels. we give ourselves a bit of wiggle room
+ //by actually setting it to 90px, 5 pixel buffer top and bottom, so that we can utilize a potential 100px
+ if(_location_image.GetHeight() > 90.0f)
+ _location_image.SetHeightKeepRatio(90.0f);
+
+ if(!_location_subimage.Load(location_subimage_filename))
+ {
+ PRINT_ERROR << "image: " << location_subimage_filename << " not able to load" << std::endl;
+ return;
+ }
+ //rescale such that the height is no bigger than 90 pixels. we give ourselves a bit of wiggle room
+ //by actually setting it to 90px, 5 pixel buffer top and bottom, so that we can utilize a potential 100px
+ if(_location_subimage.GetHeight() > 90.0f)
+ _location_subimage.SetHeightKeepRatio(90.0f);
+
+
+
}
QuestLogInfo()
@@ -217,6 +242,8 @@ struct QuestLogInfo {
// User info about the quest log
hoa_utils::ustring _title;
hoa_utils::ustring _description;
+ // Completion description gets added to the quest description when the quest is considered completed
+ hoa_utils::ustring _completion_description;
// Internal quest info used to know whether the quest is complete.
std::string _completion_event_group;
@@ -224,7 +251,9 @@ struct QuestLogInfo {
// location information
hoa_video::StillImage _location_image;
+ hoa_video::StillImage _location_subimage;
hoa_utils::ustring _location_name;
+ hoa_utils::ustring _location_subname;
};
/** *****************************************************************************
View
89 src/modes/menu/menu_views.cpp
@@ -1699,13 +1699,21 @@ void QuestListWindow::_UpdateQuestList()
QuestLogEntry *entry = _quest_entries[selection];
const std::string& quest_id = entry->GetQuestId();
-
- if (!entry->IsRead()) {
- ustring title = GlobalManager->GetQuestInfo(quest_id)._title;
+ ustring title = GlobalManager->GetQuestInfo(quest_id)._title;
+ if(GlobalManager->IsQuestCompleted(quest_id))
+ {
+ _quests_list.SetOptionText(selection, check_file + title);
+ _quests_list.SetCursorOffset(-55.0f, -15.0f);
+ _quests_list.EnableOption(selection, false);
+ }
+ else
+ {
+ _quests_list.SetCursorOffset(-75.0f, -15.0f);
_quests_list.SetOptionText(selection, spacing + title);
- entry->SetRead();
}
+ entry->SetRead();
+
// Update the list box
_quests_list.Update(SystemManager->GetUpdateTime());
@@ -1746,16 +1754,16 @@ void QuestListWindow::_SetupQuestsList() {
const std::string& quest_id = entry->GetQuestId();
ustring title = GlobalManager->GetQuestInfo(quest_id)._title;
- if(entry->IsRead())
- _quests_list.AddOption(spacing + title);
- else
- _quests_list.AddOption(exclamation_file + title);
-
- // Check if this is a completed quest, and set the option text state
+ //completed quest check.
if(GlobalManager->IsQuestCompleted(quest_id)) {
- _quests_list.SetOptionText(i, check_file + title);
+ _quests_list.AddOption(check_file + title);
_quests_list.EnableOption(i, false);
}
+ //if incomplete, then we check the read status
+ else if(entry->IsRead())
+ _quests_list.AddOption(spacing + title);
+ else
+ _quests_list.AddOption(exclamation_file + title);
}
}
@@ -1764,21 +1772,37 @@ void QuestListWindow::_SetupQuestsList() {
////////////////////////////////////////////////////////////////////////////////
QuestWindow::QuestWindow():
- _location_image(NULL)
+ _location_image(NULL),
+ _location_subimage(NULL)
{
- //_quest_description.SetOwner(this);
_quest_description.SetPosition(445, 130);
- _quest_description.SetDimensions(455, 400);
- _quest_description.SetDisplaySpeed(30);
+ _quest_description.SetDimensions(455, 200);
_quest_description.SetDisplayMode(VIDEO_TEXT_INSTANT);
_quest_description.SetTextStyle(TextStyle("text20"));
_quest_description.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
+ // preferably, we want the completion description to show underneath the description text
+ // last line. Unfortunatly, it seems CalculateTextHeight() doesn't work right
+ // so we fix the position for now
+ _quest_completion_description.SetPosition(445, 350);
+ _quest_completion_description.SetDimensions(455, 200);
+ _quest_completion_description.SetDisplayMode(VIDEO_TEXT_INSTANT);
+ _quest_completion_description.SetTextStyle(TextStyle("text20", Color::aqua));
+ _quest_completion_description.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
+
_location_name.SetPosition(102, 556);
_location_name.SetDimensions(500.0f, 150.0f);
_location_name.SetTextStyle(TextStyle("text22"));
- _location_name.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER);
- _location_name.SetDisplayText(GlobalManager->GetMapHudName());
+ _location_name.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
+ _location_name.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
+
+ _location_subname.SetPosition(500, 556);
+ _location_subname.SetDimensions(500.0f, 150.0f);
+ _location_subname.SetTextStyle(TextStyle("text22"));
+ _location_subname.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
+ _location_subname.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
+
+
}
void QuestWindow::Draw()
@@ -1786,22 +1810,35 @@ void QuestWindow::Draw()
MenuWindow::Draw();
Update();
if(MenuMode::CurrentInstance()->_quest_list_window.IsActive())
+ {
_quest_description.Draw();
+ _quest_completion_description.Draw();
+ }
+
}
void QuestWindow::DrawBottom()
{
- VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_BOTTOM, 0);
- VideoManager->Move(150, 580);
- // Display Location
+ // Display Location name information
_location_name.Draw();
+ _location_subname.Draw();
+
+ //check location image and draw
if(_location_image != NULL && _location_image->GetFilename().empty() == false) {
VideoManager->SetDrawFlags(VIDEO_X_RIGHT, VIDEO_Y_BOTTOM, 0);
VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_BOTTOM, 0);
- VideoManager->Move(390, 685);
+ VideoManager->Move(102, 685);
_location_image->Draw();
}
+
+ //check location subimage and draw
+ if(_location_subimage != NULL && _location_subimage->GetFilename().empty() == false) {
+ VideoManager->SetDrawFlags(VIDEO_X_RIGHT, VIDEO_Y_BOTTOM, 0);
+ VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_BOTTOM, 0);
+ VideoManager->Move(500, 685);
+ _location_subimage->Draw();
+ }
}
void QuestWindow::Update()
@@ -1812,7 +1849,9 @@ void QuestWindow::Update()
if(_viewing_quest_id.empty()) {
_quest_description.ClearText();
_location_name.ClearText();
+ _location_subname.ClearText();
_location_image = NULL;
+ _location_subimage = NULL;
return;
}
@@ -1823,7 +1862,15 @@ void QuestWindow::Update()
{
_quest_description.SetDisplayText(info._description);
_location_name.SetDisplayText(info._location_name);
+ _location_subname.SetDisplayText(info._location_subname);
_location_image = &info._location_image;
+ _location_subimage = &info._location_subimage;
+
+ //set the completion description only if the quest is completed
+ if(GlobalManager->IsQuestCompleted(_viewing_quest_id))
+ _quest_completion_description.SetDisplayText(info._completion_description);
+ else
+ _quest_completion_description.ClearText();
}
}
View
10 src/modes/menu/menu_views.h
@@ -580,7 +580,9 @@ class QuestWindow : public hoa_gui::MenuWindow {
void ClearBottom()
{
_location_name.ClearText();
+ _location_subname.ClearText();
_location_image = NULL;
+ _location_subimage = NULL;
}
/*!
@@ -603,12 +605,16 @@ class QuestWindow : public hoa_gui::MenuWindow {
//! \brief sets the display text to be rendered, based on their quest key that is set
hoa_gui::TextBox _quest_description;
+ //! \brief sets the display text to be rendered when the quest is completed. this is additional info
+ hoa_gui::TextBox _quest_completion_description;
- //! \brief the display text to be rendered for the location name that the quest key is set to
+ //! \brief the display text to be rendered for the location name and subname that the quest key is set to
hoa_gui::TextBox _location_name;
+ hoa_gui::TextBox _location_subname;
- //! \brief the currently viewing location image
+ //! \brief the currently viewing location image and location subimage
hoa_video::StillImage *_location_image;
+ hoa_video::StillImage *_location_subimage;
};
Something went wrong with that request. Please try again.