Skip to content

Commit

Permalink
gamepad fix with the dialogue menu that would skip
Browse files Browse the repository at this point in the history
  • Loading branch information
Aelto committed Apr 16, 2021
1 parent c9c2dca commit def6e15
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/bounty/bounty_master/states/dialog_choice.ws
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ state DialogChoice in RER_BountyMasterManager {

choices.PushBack(SSceneChoice(
GetLocStringByKey("rer_dialog_start_bounty"),
!has_completed_a_bounty,
false,
true,
has_completed_a_bounty,
false,
DialogAction_MONSTERCONTRACT,
'StartBounty'
Expand Down Expand Up @@ -68,6 +68,10 @@ state DialogChoice in RER_BountyMasterManager {
latent function displayDialogChoices(choices: array<SSceneChoice>) {
var response: SSceneChoice;

// while on gamepad, the interact input is directly sent in the dialog choice
// it is safer to wait a bit before capturing the input.
Sleep(0.25);

while (true) {
response = SU_setDialogChoicesAndWaitForResponse(choices);
SU_closeDialogChoiceInterface();
Expand Down Expand Up @@ -100,10 +104,22 @@ state DialogChoice in RER_BountyMasterManager {
.play();

this.convertTrophiesIntoCrowns();
this.removeTrophyChoiceFromList(choices);
}

}

function removeTrophyChoiceFromList(out choices: array<SSceneChoice>) {
var i: int;

for (i = 0; i < choices.Size(); i += 1) {
if (choices[i].playGoChunk == 'SellTrophies') {
choices.Erase(i);
return;
}
}
}

// returns the amount of crowns the player received from the trophies
function convertTrophiesIntoCrowns(optional ignore_item_transaction: bool): int {
var trophy_guids: array<SItemUniqueId>;
Expand Down Expand Up @@ -140,7 +156,7 @@ state DialogChoice in RER_BountyMasterManager {
output += price;
}

if (output > 0) {
if (output > 0 && !ignore_item_transaction) {
NDEBUG(
StrReplace(
GetLocStringByKey("rer_bounty_master_trophies_bought_notification"),
Expand Down

0 comments on commit def6e15

Please sign in to comment.