@@ -14034,21 +14034,21 @@ end
1403414034function dragDialogMessagesY(newY)
1403514035 local x,y,w,hOld = Infinity_GetArea("worldDialogBackground")
1403614036 h = hOld - newY
14037- if h < 100 then
14038- newY = hOld - 100
14039- elseif h > 500 then
14040- newY = hOld - 500
14037+ if h < 210 then
14038+ newY = hOld - 210
14039+ elseif h > 700 then
14040+ newY = hOld - 700
1404114041 end
1404214042
1404314043 adjustItemGroup({"dialogHandleY","worldDialogPortraitArea"},0,newY,0,0)
14044- adjustItemGroup({"worldDialogBackground","worldPlayerDialogChoicesList"},0,newY,0,-newY)
14044+ adjustItemGroup({"worldDialogBackground","worldPlayerDialogChoicesList","worldPlayerDialogFake" },0,newY,0,-newY)
1404514045end
1404614046
1404714047function getDialogEntryText(row)
14048- local text = worldPlayerDialogChoices[row - 2 ].text
14048+ local text = worldPlayerDialogChoices[row].text
1404914049 if (row == worldPlayerDialogSelection) then
1405014050 --Color the text white when selected
14051- text = string.gsub(text, "%^0xff212eff", "^0xFFFFFFFF ")
14051+ text = string.gsub(text, "%^0xff212eff", "^0xffffffff ")
1405214052 end
1405314053 return text
1405414054end
@@ -14088,11 +14088,50 @@ function getDialogText(row)
1408814088 return trim(row == 1 and worldMessageBoxText:sub(1, idx1) or worldMessageBoxText:sub(idx1 + 1))
1408914089end
1409014090
14091+ function B3Split(inputstr, sep)
14092+ sep = sep or "%s"
14093+ local t = {}
14094+ for field, s in string.gmatch(inputstr, "([^"..sep.."]*)("..sep.."?)") do
14095+ table.insert(t, field)
14096+ if s == "" then
14097+ return t
14098+ end
14099+ end
14100+ end
14101+
14102+ B3DialogTable = {}
14103+ B3DialogTextI = -1
14104+ B3DialogResponsesStart = -1
14105+ B3DialogResponsesEnd = -1
14106+
1409114107function makeDialogTable()
14092- if step == 1 then
14093- return makeTable(1)
14108+ B3DialogTable = B3Split(getDialogText(1), "\n")
14109+ B3DialogTextI = #B3DialogTable + 1
14110+ B3DialogResponsesStart = B3DialogTextI + 1
14111+ B3DialogResponsesEnd = B3DialogResponsesStart + #worldPlayerDialogChoices - 1
14112+ if step == 2 then
14113+ table.insert(B3DialogTable, getDialogText(2))
14114+ for _, v in pairs(worldPlayerDialogChoices) do
14115+ table.insert(B3DialogTable, v.text)
14116+ end
14117+ local paddingText = getDialogPaddingText()
14118+ table.insert(B3DialogTable, paddingText)
14119+ end
14120+ return B3DialogTable
14121+ end
14122+
14123+ function getDialogPortrait()
14124+ if worldNPCDialogPortrait == nil or worldNPCDialogPortrait == 'NONE' then
14125+ return 'NOPORTLS'
1409414126 end
14095- return makeTable(#worldPlayerDialogChoices + 3)
14127+ if worldNPCDialogPortrait:sub(-1) == 'S' then
14128+ for _, entry in ipairs(Infinity_GetFilesOfType("BMP")) do
14129+ if entry[1] == worldNPCDialogPortrait:sub(1, -2) .. 'M' then
14130+ return entry[1]
14131+ end
14132+ end
14133+ end
14134+ return worldNPCDialogPortrait
1409614135end
1409714136`
1409814137menu
@@ -14103,6 +14142,7 @@ menu
1410314142 ignoreEsc
1410414143 onOpen
1410514144 "
14145+ step = 1
1410614146 Infinity_PopMenu('ITEM_DESCRIPTION')
1410714147 Infinity_PopMenu('POPUP_DETAILS')
1410814148 Infinity_PushMenu('WORLD_DIALOG_CONFIRM')
@@ -14122,7 +14162,7 @@ menu
1412214162 label
1412314163 {
1412414164 name "worldDialogBackground"
14125- area 0 0 864 250
14165+ area 0 0 864 350
1412614166 rectangle 4
1412714167 }
1412814168 button
@@ -14144,8 +14184,8 @@ menu
1414414184 label
1414514185 {
1414614186 name "worldDialogPortraitArea"
14147- area 24 20 54 84
14148- bitmap lua "worldNPCDialogPortrait "
14187+ area 20 20 110 170
14188+ bitmap lua "getDialogPortrait() "
1414914189 }
1415014190 handle
1415114191 {
@@ -14156,51 +14196,59 @@ menu
1415614196 dragDialogMessagesY(motionY)
1415714197 "
1415814198 }
14199+ text
14200+ {
14201+ name "worldPlayerDialogFake"
14202+ enabled "step == 1"
14203+ area 138 20 702 210
14204+ text lua "getDialogText(2)"
14205+ text style "normal"
14206+ }
1415914207 list
1416014208 {
1416114209 column
1416214210 {
1416314211 width 100
1416414212 text
1416514213 {
14166- enabled "rowNumber == 1 "
14214+ enabled "rowNumber < B3DialogTextI "
1416714215 opacity lua "step == 1 and 0 or 255"
14168- area 0 0 736 -1
14169- text lua "getDialogText(1)"
14216+ area 0 0 -1 -1
14217+ text lua 'B3DialogTable[rowNumber]'
1417014218 text style "normal"
1417114219 }
1417214220 text
1417314221 {
14174- enabled "rowNumber == 2 "
14175- area 0 0 736 -1
14222+ enabled "rowNumber == B3DialogTextI "
14223+ area 0 0 -1 -1
1417614224 pad 0 0 0 12
14177- text lua "getDialogText(2) "
14225+ text lua "B3DialogTable[rowNumber] "
1417814226 text style "normal"
1417914227 }
1418014228 label
1418114229 {
14230+ enabled "rowNumber >= B3DialogResponsesStart and rowNumber <= B3DialogResponsesEnd and dialogEntryGreyed()"
1418214231 area 0 0 -1 -1
14183- enabled "rowNumber > 2 and rowNumber < #worldPlayerDialogChoices + 3 and dialogEntryGreyed()"
1418414232 rectangle 1
1418514233 rectangle opacity 100
1418614234 }
1418714235 text
1418814236 {
14189- enabled "rowNumber > 2 and rowNumber < #worldPlayerDialogChoices + 3 "
14237+ enabled "rowNumber >= B3DialogResponsesStart and rowNumber <= B3DialogResponsesEnd "
1419014238 area 0 0 -1 -1
14191- text lua "getDialogEntryText(rowNumber)"
14239+ text lua "getDialogEntryText(rowNumber - B3DialogResponsesStart + 1 )"
1419214240 text style "normal"
1419314241 }
1419414242 text
1419514243 {
14196- enabled "rowNumber == #worldPlayerDialogChoices + 3 "
14244+ enabled "rowNumber > B3DialogResponsesEnd "
1419714245 area 0 0 -1 -1
14198- text lua "getDialogPaddingText()"
14246+ text lua 'B3DialogTable[rowNumber]'
1419914247 text style "normal"
1420014248 }
1420114249 }
1420214250 name "worldPlayerDialogChoicesList"
14203- area 88 20 752 210
14251+ area 138 20 702 310
1420414252 rowheight dynamic
1420514253 hideHighlight
1420614254 table "makeDialogTable()"
@@ -14210,7 +14258,7 @@ menu
1421014258 actionEnter
1421114259 "
1421214260 if(gameOptions.m_bConfirmDialog == true) then return end
14213- worldPlayerDialogSelection = mouseoverRow
14261+ worldPlayerDialogSelection = mouseoverRow - B3DialogResponsesStart + 1
1421414262 "
1421514263 actionExit
1421614264 "
@@ -14219,10 +14267,10 @@ menu
1421914267 "
1422014268 action
1422114269 "
14270+ worldPlayerDialogSelection = mouseoverRow - B3DialogResponsesStart + 1
1422214271 --In confirm mode, just highlight the choice.
14223- if((gameOptions.m_bConfirmDialog == true) or (worldPlayerDialogSelection <= 0)) then return end
14224- if(worldPlayerDialogChoices[worldPlayerDialogSelection - 2] == nil) then return end
14225- worldScreen:OnDialogReplyClick(worldPlayerDialogChoices[worldPlayerDialogSelection - 2].marker)
14272+ if((gameOptions.m_bConfirmDialog == true) or (worldPlayerDialogSelection <= 0) or (worldPlayerDialogSelection > #worldPlayerDialogChoices)) then return end
14273+ worldScreen:OnDialogReplyClick(worldPlayerDialogChoices[worldPlayerDialogSelection].marker)
1422614274 worldPlayerDialogSelection = 0
1422714275 "
1422814276 }
@@ -14238,7 +14286,7 @@ end
1423814286
1423914287function getDialogButtonClickable()
1424014288 if(gameOptions.m_bConfirmDialog == true) then
14241- return (#worldPlayerDialogChoices == 0) or (worldPlayerDialogSelection and worldPlayerDialogSelection > 2 ) --no choices, or we've selected a choice.
14289+ return (#worldPlayerDialogChoices == 0) or (worldPlayerDialogSelection > 0 and worldPlayerDialogSelection <= #worldPlayerDialogChoices ) --no choices, or we've selected a choice.
1424214290 else
1424314291 return true
1424414292 end
@@ -14260,9 +14308,9 @@ menu
1426014308 text style "button"
1426114309 action
1426214310 "
14263- if(gameOptions.m_bConfirmDialog == true and ( #worldPlayerDialogChoices > 0) ) then
14311+ if(gameOptions.m_bConfirmDialog == true and #worldPlayerDialogChoices > 0) then
1426414312 -- if confirm dialog and choices available.
14265- worldScreen:OnDialogReplyClick(worldPlayerDialogChoices[worldPlayerDialogSelection - 2 ].marker)
14313+ worldScreen:OnDialogReplyClick(worldPlayerDialogChoices[worldPlayerDialogSelection].marker)
1426614314 worldPlayerDialogSelection = 0
1426714315 else
1426814316 -- no choices, just step.
0 commit comments