Skip to content

Commit

Permalink
Fixed a bug with list textbox responses
Browse files Browse the repository at this point in the history
Minor responses never get placed in a list at the moment, which should
be sufficient for our purposes.
  • Loading branch information
varkor committed Jan 5, 2016
1 parent 2282f38 commit 86f0da7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions battle/scripts/objects/unique/Textbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,10 @@ Textbox = FunctionObject.new({
dialogue.hover(null, null);
}
var responseOffset = 0, maxResponses = style.maxRows * style.responsesPerRow;
if (responses > maxResponses) {
responseOffset = Math.max(0, Math.ceil(Math.min(responses - maxResponses, Math.floor(Textbox.response - maxResponses / 2)) / style.responsesPerRow) * style.responsesPerRow);
if (majorResponses > maxResponses) {
responseOffset = Math.max(0, Math.ceil(Math.min(majorResponses - maxResponses, Math.floor(Textbox.response - maxResponses / 2)) / style.responsesPerRow) * style.responsesPerRow);
}
for (var response = responseOffset, responsesOfKind, relativeResponse, selected, hovered, isMajor; response - responseOffset < maxResponses && response < responses; ++ response) {
for (var response = responseOffset, responsesOfKind, relativeResponse, selected, hovered, isMajor; (response - responseOffset < maxResponses || response >= majorResponses) && response < responses; ++ response) {
isMajor = response < majorResponses;
responsesOfKind = isMajor ? majorResponses : minorResponses;
relativeResponse = (response - responseOffset) - (isMajor ? 0 : majorResponses);
Expand Down Expand Up @@ -820,7 +820,7 @@ Textbox = FunctionObject.new({
context.lineToHD((metrics.left + metrics.width / 2 - triangleWidth / 2) * Game.zoom, (metrics.top + metrics.height + triangleHeight / 2 + bob) * Game.zoom);
context.fill();
}
if (responseOffset + maxResponses < responses) {
if (responseOffset + maxResponses < majorResponses) {
var responseHeight = Math.ceil(Math.min(majorResponses, style.maxRows * style.responsesPerRow) / style.responsesPerRow) * metrics.response.major.height + Math.ceil(minorResponses / style.responsesPerRow) * metrics.response.minor.height;
context.beginPath();
context.moveToHD((metrics.left + metrics.width / 2) * Game.zoom, (metrics.top + metrics.height + responseHeight + triangleHeight / 2 - bob) * Game.zoom);
Expand Down

0 comments on commit 86f0da7

Please sign in to comment.