...
 
Commits (6)
......@@ -49,12 +49,10 @@ stop
@mainmenu:
event.clear
tbox.setnumboxes 3
choice.setchoicebox 1
choice.sethighlightbox 2
choice.columns 1
tbox.reset
tbox.setnumboxes 3
tbox.setdiatitlebox 2
tbox.setloc 1 30000,16384 ax:32768 ay:16384
tbox.setparam 1 paddingtop 0
......@@ -66,7 +64,8 @@ tbox.setparam 1 basecolor 0
tbox.setparam 1 basefill 1
tbox.setparam 1 textalign 2
tbox.setparam 1 maxrows 8
tbox.setparam 1 mincols 10
tbox.setparam 1 mincols 11
tbox.setparam 1 columns 1
tbox.setparam 2 basecolor 0xFFF4
tbox.setparam 2 paddingtop 180
......@@ -91,14 +90,14 @@ gfx.transition fade
gfx.clearall
sleep
tbox.reset
tbox.setnumboxes 5
tbox.setdiatitlebox 2
choice.setpartbox 3
choice.setchoicebox 3
choice.sethighlightbox 4
choice.columns 1
tbox.reset
// 1: Game text & choice box
// 1: Game text box
tbox.setparam 1 paddingtop 1160
tbox.setparam 1 paddingbottom 1160
tbox.setparam 1 paddingleft 1800
......@@ -116,7 +115,6 @@ tbox.setparam 1 texbottomedge 36
tbox.setparam 1 bevel 0
// 2: Dialogue title box
tbox.reset 2
tbox.setparam 2 snaptoanchorx 3200
tbox.setparam 2 textcolor 0x204F
tbox.setparam 2 basecolor0 0xDDDF
......@@ -145,7 +143,6 @@ tbox.setparam 3 texbottomedge 39
tbox.setparam 3 bevel 0
// 4: Highlight box
tbox.reset 4
tbox.setparam 4 paddingleft 300
tbox.setparam 4 paddingright 300
tbox.setparam 4 paddingtop 80
......
......@@ -16,17 +16,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// ===== the title screen =====
gfx.show SANSI bkg
......
......@@ -17,6 +17,7 @@ tbox.setdiatitlebox 2
choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
tbox.reset
$defaultlang := "Japanese"
tbox.setlanguage 0 $defaultlang
......@@ -24,11 +25,9 @@ tbox.setlanguage 0 $defaultlang
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 3: Highlight box (default)
tbox.reset 3
// ===== title =====
......
......@@ -17,6 +17,7 @@ tbox.setdiatitlebox 2
choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
tbox.reset
$defaultlang := "Japanese"
tbox.setlanguage 0 $defaultlang
......@@ -24,11 +25,9 @@ tbox.setlanguage 0 $defaultlang
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 3: Highlight box (default)
tbox.reset 3
// ===== title screen =====
......
......@@ -18,17 +18,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// ===== title screen =====
......
......@@ -22,17 +22,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// ===== title screen =====
......
......@@ -22,17 +22,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// Show the Tiare logo before the title screen?
//gfx.show bkg TIARE_S
......
......@@ -24,11 +24,10 @@ sleep
event.clear
gfx.show OP_013A0 anim
tbox.setnumboxes 3
choice.setchoicebox 1
choice.sethighlightbox 2
choice.columns 1
tbox.reset
tbox.setnumboxes 3
tbox.setloc 1 16384,32000 ax:16384 ay:32768
tbox.setparam 1 paddingtop 0
......@@ -41,6 +40,7 @@ tbox.setparam 1 basefill 1
tbox.setparam 1 textalign 1
tbox.setparam 1 maxrows 8
tbox.setparam 1 mincols 13
tbox.setparam 1 columns 1
tbox.setparam 2 basecolor 0xFFF4
tbox.setparam 2 paddingtop 180
......@@ -61,13 +61,12 @@ choice.go
event.clear
gfx.clearall
tbox.reset
tbox.setnumboxes 5
tbox.setdiatitlebox 2
choice.setpartbox 3
choice.setchoicebox 3
choice.sethighlightbox 4
choice.columns 1
tbox.reset
// 1: Game text box
tbox.setparam 1 paddingtop 400
......@@ -84,7 +83,6 @@ tbox.setparam 1 bevel 0
tbox.setparam 1 autowaitkey 1
// 2: Dialogue title box
tbox.reset 2
tbox.setparam 2 textcolor 0xFFFF
tbox.setparam 2 basecolor0 0x000D
tbox.setparam 2 basecolor1 0x220C
......@@ -111,7 +109,6 @@ tbox.setparam 3 texbottomedge 13
tbox.setparam 3 bevel 0
// 4: Highlight box (default)
tbox.reset 4
goto MT_0101.
......
......@@ -17,17 +17,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
gfx.show OP_013 bkg
gfx.transition 4
......
......@@ -45,7 +45,6 @@ event.clear
choice.setchoicebox 1
choice.sethighlightbox 2
choice.columns 1
tbox.reset
tbox.setnumboxes 3
......@@ -61,6 +60,7 @@ tbox.setparam 1 textalign 1
tbox.setparam 1 fontheight 1600
tbox.setparam 1 maxrows 8
tbox.setparam 1 mincols 13
tbox.setparam 1 columns 1
tbox.setparam 2 basecolor 0xFFF4
tbox.setparam 2 paddingtop 180
......@@ -86,15 +86,16 @@ gfx.clearall
sleep
// Textbox setup
tbox.reset
tbox.setnumboxes 4
tbox.setdiatitlebox 2
choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
choice.columns 4
tbox.reset
// 1: Game text & choice box
tbox.setparam 1 autowaitkey 1
tbox.setparam 1 paddingtop 600
tbox.setparam 1 paddingbottom 600
tbox.setparam 1 margintop 280
......@@ -116,14 +117,11 @@ tbox.setparam 1 texbottomedge 20
tbox.setparam 1 bevel 0
tbox.decorate 1 MAINBOXDECORLEFT x 0 y 32768 anchorx 0 anchory 32768
tbox.decorate 1 MAINBOXDECORRIGHT x 32768 y 0 anchorx 32768 anchory 0
tbox.setparam 1 autowaitkey 1
// 2: Dialogue title box
tbox.reset 2
tbox.setparam 2 basecolor 0x7ADC
// 3: Highlight box (default)
tbox.reset 3
goto CS101.
......
......@@ -19,17 +19,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// ===== the title screen =====
......
......@@ -20,17 +20,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// Title screen
......
......@@ -19,17 +19,14 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// ==================================================================
......
// Tenkousei intro
tbox.setnumboxes 5
choice.columns 2
// 3: Choice box
tbox.setloc 3 16384,8800 ax:16384
......@@ -16,6 +15,7 @@ tbox.setparam 3 basefill 1
tbox.setparam 3 textcolor 0xFFFF
tbox.setparam 3 bevel 0
tbox.setlanguage 3 $defaultlang
tbox.setparam 3 columns 2
// 4: Highlight box
tbox.reset 4
......@@ -42,7 +42,7 @@ choice.set ."c2"
call TKEXE.
print ."\n\n\C\?"
call TKEXE.01
print ."\.\?"
print ."\.\t\?"
call TKEXE.02
print ."\."
$v257 := (choice.get noclear=1 noprint=1)
......@@ -52,7 +52,7 @@ tbox.clear
call TKEXE.03
print ."\n\n\C\?"
call TKEXE.04
print ."\.\?"
print ."\.\t\?"
call TKEXE.05
print ."\."
$v258 := (choice.get noclear=1 noprint=1)
......@@ -62,7 +62,7 @@ tbox.clear
call TKEXE.06
print ."\n\n\C\?"
call TKEXE.07
print ."\.\?"
print ."\.\t\?"
call TKEXE.08
print ."\."
$v259 := (choice.get noclear=1 noprint=1)
......@@ -72,7 +72,7 @@ tbox.clear
call TKEXE.09
print ."\n\n\C\?"
call TKEXE.10
print ."\.\?"
print ."\.\t\?"
call TKEXE.11
print ."\."
$v260 := (choice.get noclear=1 noprint=1)
......@@ -82,7 +82,7 @@ tbox.clear
call TKEXE.12
print ."\n\n\C\?"
call TKEXE.13
print ."\.\?"
print ."\.\t\?"
call TKEXE.14
print ."\."
$v261 := (choice.get noclear=1 noprint=1)
......@@ -92,7 +92,7 @@ tbox.clear
call TKEXE.15
print ."\n\n\C\?"
call TKEXE.16
print ."\.\?"
print ."\.\t\?"
call TKEXE.17
print ."\."
$v262 := (choice.get noclear=1 noprint=1)
......@@ -102,7 +102,7 @@ tbox.clear
call TKEXE.18
print ."\n\n\C\?"
call TKEXE.19
print ."\.\?"
print ."\.\t\?"
call TKEXE.20
print ."\."
$v263 := (choice.get noclear=1 noprint=1)
......@@ -112,7 +112,7 @@ tbox.clear
call TKEXE.21
print ."\n\n\C\?"
call TKEXE.22
print ."\.\?"
print ."\.\t\?"
call TKEXE.23
print ."\."
$v264 := (choice.get noclear=1 noprint=1)
......@@ -122,7 +122,7 @@ tbox.clear
call TKEXE.24
print ."\n\n\C\?"
call TKEXE.25
print ."\.\?"
print ."\.\t\?"
call TKEXE.26
print ."\."
$v265 := (choice.get noclear=1 noprint=1)
......@@ -132,7 +132,7 @@ tbox.clear
call TKEXE.27
print ."\n\n\C\?"
call TKEXE.28
print ."\.\?"
print ."\.\t\?"
call TKEXE.29
print ."\."
$v266 := (choice.get noclear=1 noprint=1)
......
......@@ -57,7 +57,6 @@ tbox.setdiatitlebox 2
choice.setpartbox 3
choice.setchoicebox 3
choice.sethighlightbox 4
choice.columns 1
tbox.reset
tbox.setlanguage 1 $defaultlang
......@@ -71,7 +70,6 @@ waitkey
call INTRO.
// ===== More textbox setup =====
choice.columns 1
tbox.reset 3
tbox.reset 4
......
......@@ -16,26 +16,24 @@ choice.setchoicebox 1
choice.setpartbox 2
choice.sethighlightbox 3
$defaultlang := "Japanese"
tbox.reset
tbox.setlanguage 0 $defaultlang
// 1: Game text & choice box
tbox.setlanguage 1 $defaultlang
// 2: Dialogue title box (default)
tbox.reset 2
tbox.setlanguage 2 $defaultlang
// 1: Game text & choice box
// 2: Dialogue title box (default)
// 3: Highlight box (default)
tbox.reset 3
// ===== title screen =====
gfx.show VOP_002 bkg y -32768
// The title graphic comes with a -50% offset.
gfx.transition 4
gfx.show VOP_002 bkg y:65536 ay:32768
sleep
gfx.move VOP_002 0 0 time 3000 style cos
gfx.move VOP_002 ay:16384 time 3000 style cos
sleep
gfx.show V_LOGO2 ofsx 30 ofsy 10
gfx.transition 4
gfx.show V_LOGO2 ofsx 30 ofsy 10
waitkey
gfx.clearall
......
No preview for this file type
......@@ -9,7 +9,6 @@ tbox.setnumboxes 4
choice.setchoicebox 1
choice.setpartbox 1
choice.sethighlightbox 2
choice.columns 1
// 1: Game list box
tbox.setloc 1 16384,32000 ax:16384 ay:32768
......@@ -25,15 +24,12 @@ tbox.setparam 1 paddingbottom 768
tbox.setparam 1 basecolor 0x64E8
tbox.setparam 1 basefill 1
tbox.setparam 1 bevel 0
tbox.setparam 1 columns 1
tbox.setlanguage 1 English
// 2: Highlight box
tbox.setparam 2 paddingleft 320
tbox.setparam 2 paddingright 320
tbox.setparam 2 paddingtop 80
tbox.setparam 2 paddingbottom 80
tbox.reset 2
tbox.setparam 2 bevel 0
tbox.setparam 2 basecolor 0xFFF7
# ===================================================================
# Frontend dat selection screen
......
......@@ -49,7 +49,6 @@ tbox.setdiatitlebox 2
choice.setchoicebox 3
choice.setpartbox 3
choice.sethighlightbox 4
choice.columns 1
// Game text box
// (Default fontheight is 1280, and we want 4 rows in this, which gives 5120
......
......@@ -24,11 +24,7 @@ LOW PRIORITY
might be pretty heavy, particularly if using BunnyScaler...
- Textboxes:
+ Add more bevelling parameters, to allow shaped bevels etc
+ Hard linebreaks inside choices are still wonky if the choice didn't
start from the far left side of the box...
+ Allow setting normal/light hinting as a user preference
+ Box parameter setting should fetch defaults from the same place as
InitTextbox does, or vice versa
- Automated testing stuff:
+ Save every button press and non-move mouse event incl. mouseovers
in an internal buffer that needs to be dumped in a text file in case
......
......@@ -154,14 +154,14 @@ var i : dword;
drawscrollbar := TRUE;
end;
procedure _NewColor(c : RGBAquad; isvisible, force : boolean);
procedure _NewColor(c : RGBAquad; isvisible, force, allowinvert : boolean);
var textpal : byte;
begin
if dword(textcolor) = dword(c) then isvisible := FALSE;
dword(textcolor) := dword(c);
if (isvisible) or (force) then begin
if sakuparam.palettemode = PM_TRUECOLOR then begin
if invertcolors then
if (allowinvert) and (invertcolors) then
write(#27'[48;2;', textcolor.r, ';', textcolor.g, ';', textcolor.b,
'm'#27'[38;2;', style.baseColor[0].r, ';', style.baseColor[0].g, ';', style.baseColor[0].b, 'm')
else
......@@ -170,7 +170,7 @@ var i : dword;
end
else begin
textpal := Rendermatic.palette[textcolor.r shr 4][textcolor.g shr 4][textcolor.b shr 4].flatcolor;
if invertcolors then
if (allowinvert) and (invertcolors) then
SetColor(backpal + textpal shl 4)
else
SetColor(textpal + backpal shl 4);
......@@ -184,14 +184,17 @@ var i : dword;
index := termpos.y - boxLocP_r.y;
SetColor(dword(scrollbar[index].ccolor));
UTF8Write(scrollbar[index].ccode);
_NewColor(textcolor, TRUE, TRUE);
_NewColor(textcolor, TRUE, TRUE, FALSE);
end;
procedure _ProcessContent(maxwidthp : dword; isvisible : boolean);
// Processes the given cell count of text content, or until the next linebreak or end of content.
// Prints the text if isvisible is true, otherwise moves on without printing.
var endindex, totalwidthp, spanwidthp, spanlength : dword;
var endindex, totalwidthp, c, spanwidthp, spanlength : dword;
begin
// Reinforce inverted color if highlighted choice covers more than one line.
if (isvisible) and (invertcolors) then _NewColor(textcolor, TRUE, TRUE, TRUE);
totalwidthp := 0;
with content do begin
repeat
......@@ -212,13 +215,25 @@ var i : dword;
exit;
end;
byte('c'): _NewColor(RGBAquad(escapeList[escindex].escapeData), isvisible, FALSE);
9:
if isvisible then begin
c := columnWidthP + columnPaddingP;
spanwidthp := totalwidthp + c + columnPaddingP - 1;
dec(spanwidthp, spanwidthp mod c + totalwidthp);
if totalwidthp + spanwidthp > maxwidthp then spanwidthp := maxwidthp - totalwidthp;
UTF8Write(space(spanwidthp));
inc(termpos.x, spanwidthp);
inc(contentpos.x, spanwidthp);
inc(totalwidthp, spanwidthp);
end;
byte('c'): _NewColor(RGBAquad(escapeList[escindex].escapeData), isvisible, FALSE, TRUE);
byte('?'):
begin
if choiceindex = Choicematic.highlightIndex then begin
invertcolors := TRUE;
_NewColor(textcolor, isvisible, isvisible);
_NewColor(textcolor, isvisible, isvisible, TRUE);
end;
with Choicematic.showList[choiceindex] do begin
showLocP.left := contentpos.x;
......@@ -230,7 +245,7 @@ var i : dword;
begin
if choiceindex = Choicematic.highlightIndex then begin
invertcolors := FALSE;
_NewColor(textcolor, isvisible, isvisible);
_NewColor(textcolor, isvisible, isvisible, TRUE);
end;
with Choicematic.showList[choiceindex] do begin
showLocP.right := contentpos.x;
......@@ -292,7 +307,7 @@ begin
// Calculate the drawable location and size of the box, and prepare to draw.
backpal := Rendermatic.palette[style.baseColor[0].r shr 4][style.baseColor[0].g shr 4][style.baseColor[0].b shr 4].flatcolor;
_NewColor(style.textColor, TRUE, TRUE);
_NewColor(style.textColor, TRUE, TRUE, FALSE);
inc(distfromedge.left, boxclipping.left);
inc(distfromedge.right, boxclipping.right);
......@@ -372,7 +387,7 @@ begin
j := contentWinScrollOfsP + contentclip.top;
if j > 0 then begin
for i := j - 1 downto 0 do _ProcessContent(high(dword), FALSE);
_NewColor(textcolor, TRUE, TRUE);
_NewColor(textcolor, TRUE, TRUE, FALSE);
end
else begin
// A negative scroll offset is treated as extra padding.
......@@ -415,7 +430,8 @@ begin
_ProcessContent(high(dword), FALSE);
// Print spaces to fill the rest of the row, which includes box padding on the right.
if invertcolors then begin invertcolors := FALSE; _NewColor(textcolor, TRUE, TRUE); end;
//if invertcolors then begin invertcolors := FALSE; _NewColor(textcolor, TRUE, TRUE); end;
_NewColor(textcolor, TRUE, TRUE, FALSE);
write(space(contentdrawrightedge - termpos.x + contentpad.right));
if drawscrollbar then _DrawScrollbar;
......@@ -438,6 +454,9 @@ begin
inc(termpos.y);
dec(boxdrawsize.h);
end;
{with Choicematic do if (boxIndex = choiceBox) and (length(showList) <> 0) then
for i := 0 to high(showList) do log(strcat('showlist %: %', [i, showList[i].showLocP.ToString]));}
end;
function TTextBox.RefreshOverlappingBoxes : boolean;
......
......@@ -81,6 +81,14 @@ type TTextBox = class
// Total box pixel size = content window size + padding + margins.
boxSizeP : TSizeP;
// The content window is split into columnCount columns, with some amount of padding between them. Text output ignores
// columns except on a \t column break, which moves output ahead to the next column's start, mostly used by choicematic.
// Count must be 1 or more, but if it's more, then a reasonable ctWinMaxCols or ctWinMaxSizeP.w must have been defined.
// columnWidthP = (ctWinMaxSizeP.w - colPaddingP * (colCount - 1)) / colCount
// If 32k padding is positive, it's relative to ctWinMaxSizeP.w; if negative, then relative to the box font's exWidthP.
columnCount, columnPadding : longint;
columnWidthP, columnPaddingP : dword;
// If non-zero, this box's anchor location is snapped pixer-perfectly to the snap anchor of the snapToBox. This overrides
// the box's boxLoc.xy temporarily. A box can't snap to itself, and no box can snap to the null box so 0 means no snap.
// The snap edges are specifically the padded box borders, not not counting any additional box margins.
......@@ -147,6 +155,7 @@ type TTextBox = class
// \0 = empty character
// \: = dialogue title terminator
// \n = explicit linebreak
// \t = column break
// \? = begin choice string
// \. = end choice string
// \B \b = enable\disable bold font
......
This diff is collapsed.
......@@ -45,7 +45,7 @@ var txtsurface : PSDL_Surface;
color1, color2 : TSDL_Color;
runcolor, textcoloramul : RGBAquad;
txtofs, txtmark, escindex, choiceindex : dword;
i, rowsizexp, totalsizeyp : dword;
i, j, rowsizexp, totalsizeyp : dword;
destp : pointer;
runalign, luggage : byte;
runchoice : boolean;
......@@ -192,7 +192,7 @@ var txtsurface : PSDL_Surface;
with Choicematic.showList[choiceindex - 1] do begin
if longint(rowsizexp) > showLocP.right then showLocP.right := rowsizexp;
showLocP.bottom := totalsizeyp + lineHeightP - (lineHeightP - font.heightP) shr 1;
//log(strcat('showlist % end: %,%', [choiceindex - 1, rowsizexp, totalsizeyp + lineHeightP]));
//log(strcat('showlist % end: %', [choiceindex - 1, showLocP.ToString]));
end;
end;
......@@ -225,13 +225,13 @@ begin
rowsizexp := 0; totalsizeyp := 0; choiceindex := 0;
runalign := style.textAlign;
destp := buffers.contentFullP;
runchoice := FALSE;
with content do if txtLength <> 0 then begin
// Make sure there's at least one byte of space beyond the end of the content string, for a terminating null byte.
if txtLength >= dword(length(txtContent)) then setlength(txtContent, txtLength + 8);
escindex := 0; txtofs := 0;
runchoice := FALSE;
dword(color1) := $FFFFFFFF;
dword(color2) := 0;
_NewColor(style.textColor);
......@@ -242,7 +242,8 @@ begin
while (escindex < escapeCount) and (escapeList[escindex].escapeOfs = txtofs) do begin
case escapeList[escindex].escapeCode of
1: _DrawCaret;
10, byte('n'): begin
10, byte('n'):
begin
if runchoice then _EndChoiceRun;
_FinaliseRow;
end;
......@@ -254,12 +255,16 @@ begin
byte('R'): runalign := 2;
byte(':'): ;
9: // 't' is converted in FlowContent to 9 or 10 depending on if it was the last column
begin
j := columnWidthP + columnPaddingP;
i := rowsizexp + j + columnPaddingP - 1;
dec(i, i mod j + rowsizexp);
_StashSpace(i);
end;
byte('?'):
begin
// Choice item! Calculate how many pixels to tab ahead.
i := rowsizexp + Choicematic.colWidthP - 1;
dec(i, i mod Choicematic.colWidthP + rowsizexp);
if (i <> 0) and (rowsizexp + i < contentWinSizeP.w) then _StashSpace(i);
// Remember the start coordinate of this choice rect.
if choiceindex < dword(length(Choicematic.showList)) then
with Choicematic.showList[choiceindex] do begin
......@@ -267,7 +272,7 @@ begin
showLocP.right := rowsizexp;
showLocP.top := totalsizeyp + (lineHeightP - font.heightP + 1) shr 1;
showLocP.bottom := totalsizeyp;
//log(strcat('showlist % begin: %,%', [choiceindex, rowsizexp, totalsizeyp]));
//log(strcat('showlist % begin: %', [choiceindex, showLocP.ToString]));
inc(choiceindex);
runchoice := TRUE;
end;
......
......@@ -21,11 +21,6 @@
type TChoicematic = object
public
choiceBox, choicePartBox, highlightBox : dword;
// Choices are printed in this many columns. By default 4; set to 1 to have a simple vertical list. If a choice text is
// wider than a single column, it will simply occupy more than one column, and the following choices are shifted ahead.
// If the total choices take more rows than the box's content window, the box becomes scrollable.
numColumns, colWidthP : dword; {$note todo: Add column padding, 32k of box width between cols}
{$note todo: box columns should be a feature of boxes, applied only on \t; choicematic then uses \t\?}
// This starts empty, then gets the user's choice appended to it. This string can be displayed as the choice parent, if
// you replace the intermediate colons with spaces.
choiceParent : array of UTF8string;
......
......@@ -23,8 +23,6 @@ begin
choiceBox := 1;
choicePartBox := 1;
highlightBox := 2;
numColumns := 4;
colWidthP := 0;
setlength(choiceParent, 0);
setlength(choiceParent, length(languageList));
setlength(choiceList, 0);
......@@ -326,13 +324,10 @@ begin
BoxHub.textbox[choicePartBox].Print('\B' + copy(choiceParent[lang], 1, length(choiceParent[lang]) - 1) + '\b\n');
// Print the showList in the choiceBox.
for i := 0 to showCount - 1 do begin
{$ifdef sakucon}
if (i <> 0) and (i mod numColumns = 0) then
BoxHub.textbox[choiceBox].Print('\n');
{$endif}
BoxHub.textbox[choiceBox].Print('\?' + showList[i].showtxt[lang] + '\.');
end;
for i := 0 to showCount - 1 do
BoxHub.textbox[choiceBox].Print('\?' + showList[i].showtxt[lang] + '\.\t');
// Remove the last extra column break.
dec(BoxHub.textbox[choiceBox].content.escapeCount);
end;
procedure TChoicematic.SelectChoice(selnum : dword);
......
......@@ -414,7 +414,7 @@ var i : longint;
fullcoslength : dword;
begin
// Cancel the previous displacement.
GobHub.gob[fxGob].SetLocationDelta(-displacement.x, -displacement.y);
GobHub.gob[fxGob].SetLocationDelta(-displacement.x, -displacement.y, FALSE);
// Scale to double the coscos table's length.
fullcoslength := high(coscos) shl 1;
......@@ -453,7 +453,7 @@ begin
end;
// Place shaken gob at its new displaced location.
GobHub.gob[fxGob].SetLocationDelta(displacement.x, displacement.y);
GobHub.gob[fxGob].SetLocationDelta(displacement.x, displacement.y, FALSE);
//log(strcat('bash displacement (%, %) at age %/%, amp %', [displacement.x, displacement.y, age, ageLimit, i]));
end;
......@@ -461,7 +461,7 @@ destructor TEffectGobBash.Destroy;
begin
// Cancel the latest applied displacement.
if fxGob < GobHub.numGobs then
GobHub.gob[fxGob].SetLocationDelta(-displacement.x, -displacement.y);
GobHub.gob[fxGob].SetLocationDelta(-displacement.x, -displacement.y, FALSE);
inherited;
end;
......
......@@ -74,15 +74,6 @@ begin
Choicematic.Deactivate(TRUE);
end;
procedure Invoke_CHOICE_COLUMNS; inline;
begin
numvalue := 0;
FetchParam(WOPP_VALUE);
if numvalue <= 0 then numvalue := 4;
Choicematic.numColumns := numvalue;
Choicematic.colWidthP := 0;
end;
procedure Invoke_CHOICE_GET; inline;
begin
numvalue := 0;
......@@ -684,7 +675,7 @@ end;
procedure Invoke_GFX_MOVE; inline;
var gobnum : dword;
time : longint;
newloc : TCoord32k;
newloc, newanchor : TCoord32k;
movestyle : EMoveType;
begin
if FetchParam(WOPP_GOB) = FALSE then begin
......@@ -703,6 +694,9 @@ begin
newloc.y := gob[gobnum].gobLoc.y;
if FetchParam(WOPP_LOCX) then newloc.x := numvalue;
if FetchParam(WOPP_LOCY) then newloc.y := numvalue;
newanchor := gob[gobnum].gobAnchor;
if FetchParam(WOPP_ANCHORX) then newanchor.x := numvalue;
if FetchParam(WOPP_ANCHORY) then newanchor.y := numvalue;
numvalue := 0; FetchParam(WOPP_TIME); time := numvalue;
strvalue[0] := ''; FetchParam(WOPP_STYLE);
case lowercase(strvalue[0]) of
......@@ -711,7 +705,7 @@ begin
'halfcos': movestyle := MT_HALFCOS;
else movestyle := MT_INSTANT;
end;
TEffectGobMove.Create(GetCurrentId, time, gobnum, newloc.x, newloc.y, movestyle);
TEffectGobMove.Create(GetCurrentId, time, gobnum, newloc.x, newloc.y, newanchor.x, newanchor.y, movestyle);
end;
end;
......@@ -825,7 +819,7 @@ end;
procedure Invoke_GFX_SHOW;
var gfxname, gobname : UTF8string;
x, y, z, frame, vp : longint;
x, y, z, frame, vp, ax, ay : longint;
gobtype : TGobType;
begin
if FetchParam(WOPP_GOB) = FALSE then begin
......@@ -852,8 +846,10 @@ begin
numvalue := -1; FetchParam(WOPP_FRAME); frame := numvalue;
numvalue := -1; FetchParam(WOPP_VIEWPORT); vp := numvalue;
numvalue := 0; FetchParam(WOPP_ZLEVEL); z := numvalue;
numvalue := 0; FetchParam(WOPP_ANCHORX); ax := numvalue;
numvalue := 0; FetchParam(WOPP_ANCHORY); ay := numvalue;
TGob.Create(gfxname, gobname, strvalue[0], gobtype, vp, x, y, z, frame);
TGob.Create(gfxname, gobname, strvalue[0], gobtype, vp, x, y, z, ax, ay, frame);
end;
procedure Invoke_GFX_TRANSITION; inline;
......@@ -1579,7 +1575,6 @@ begin
WOP_CHOICE_CALL: Invoke_CHOICE_CALL;
WOP_CHOICE_CANCEL: Invoke_CHOICE_CANCEL;
WOP_CHOICE_COLUMNS: Invoke_CHOICE_COLUMNS;
WOP_CHOICE_GET: Invoke_CHOICE_GET;
WOP_CHOICE_GETHIGHLIGHT: Invoke_CHOICE_GETHIGHLIGHT;
WOP_CHOICE_GOTO: Invoke_CHOICE_GOTO;
......
......@@ -68,13 +68,13 @@ type TGob = class
procedure AutoAdopt;
procedure UpdateLocP;
procedure UpdateSizeP;
procedure SetLocationDelta(deltax, deltay : longint);
procedure SetLocationDelta(deltax, deltay : longint; force : boolean);
procedure SetLocation(x, y, anchorx, anchory : longint);
procedure SetSolidBlit(blitcolor : dword);
function ToString : UTF8string; override;
constructor Create(gfxlistname, _gobname, parentname : UTF8string; _gobtype : TGobType;
inviewport, atx, aty, atz, frame : longint);
inviewport, locx, locy, zlevel, anchorx, anchory, frame : longint);
destructor Destroy; override;
end;
......
......@@ -138,8 +138,14 @@ begin
// Apply anchoring displacement. This must be in pixels to align to things pixel-perfectly.
if (gobAnchor.x or gobAnchor.y) <> 0 then begin
inc(gobLoc.xp, gobSizeP.w * gobAnchor.x div 32768);
inc(gobLoc.yp, gobSizeP.h * gobAnchor.y div 32768);
if gobAnchor.x >= 0 then
dec(gobLoc.xp, (gobSizeP.w * gobAnchor.x + 16384) shr 15)
else
inc(gobLoc.xp, (gobSizeP.w * -gobAnchor.x + 16384) shr 15);
if gobAnchor.y >= 0 then
dec(gobLoc.yp, (gobSizeP.h * gobAnchor.y + 16384) shr 15)
else
inc(gobLoc.yp, (gobSizeP.h * -gobAnchor.y + 16384) shr 15);
end;
// Gob location as pixel value is relative to game window, not to parent viewport.
......@@ -180,12 +186,12 @@ begin
UpdateLocP;
end;
procedure TGob.SetLocationDelta(deltax, deltay : longint);
procedure TGob.SetLocationDelta(deltax, deltay : longint; force : boolean);
// Call this to move an existing gob relative to its current 32k coordinates. This also makes sure the gob's children are moved
// along. The current and changed coordinates may be outside the containing viewport. Refreshes the screen appropriately.
var i, thisindex : dword;
begin
if (deltax or deltay) = 0 then exit;
if (force = FALSE) and (deltax or deltay = 0) then exit;
inc(gobLoc.x, deltax);
inc(gobLoc.y, deltay);
......@@ -194,15 +200,17 @@ begin
// Move all children by the same amount.
thisindex := GetCurrentIndex;
for i := thisindex + 1 to GobHub.numGobs - 1 do
if GobHub.gob[i].gobParent = thisindex then GobHub.gob[i].SetLocationDelta(deltax, deltay);
if GobHub.gob[i].gobParent = thisindex then GobHub.gob[i].SetLocationDelta(deltax, deltay, FALSE);
end;
procedure TGob.SetLocation(x, y, anchorx, anchory : longint);
// Call this to set an existing gob's 32k screen position. This also makes sure the gob's children are moved along.
// The position may be outside the containing viewport. Refreshes the screen appropriately.
var force : boolean;
begin
force := (anchorx <> gobAnchor.x) or (anchory <> gobAnchor.y);
gobAnchor.x := anchorx; gobAnchor.y := anchory;
SetLocationDelta(x - gobLoc.x, y - gobLoc.y);
SetLocationDelta(x - gobLoc.x, y - gobLoc.y, force);
end;
procedure TGob.SetSolidBlit(blitcolor : dword);
......@@ -221,13 +229,13 @@ function TGob.ToString : UTF8string;
var t : string;
begin
WriteStr(t, gobType);
result := strcat('Gob %:% % gfx=% parent=% vp=% loc=%,% locp=%,% sizep=% frame=% z=%',
result := strcat('Gob %:% % gfx=% parent=% vp=% loc=%,% locp=%,% anchor=% sizep=% frame=% z=%',
[longint(GetCurrentIndex), gobName, t, gobGfxListName, longint(gobParent), gobInViewport, gobLoc.x, gobLoc.y,
gobLoc.xp, gobLoc.yp, gobSizeP.ToString, longint(gobDrawFrame), gobZLevel]);
gobLoc.xp, gobLoc.yp, gobAnchor.ToString, gobSizeP.ToString, longint(gobDrawFrame), gobZLevel]);
end;
constructor TGob.Create(gfxlistname, _gobname, parentname : UTF8string; _gobtype : TGobType;
inviewport, atx, aty, atz, frame : longint);
inviewport, locx, locy, zlevel, anchorx, anchory, frame : longint);
// Creates a gob, set to be drawn immediately on the next Renderer pass.
// The gfxlistname must be an available graphic resource. The gobname is used to refer to the gob in script code; it may be
// empty, in which case the gfxlistname is used as the gobname. If an existing gob has the same name, z-level, viewport,
......@@ -253,11 +261,11 @@ begin
gobType := _gobtype;
gobParent := high(dword);
gobAnchor.x := 0;
gobAnchor.y := 0;
gobLoc.x := atx;
gobLoc.y := aty;
gobZLevel := atz;
gobAnchor.x := anchorx;
gobAnchor.y := anchory;
gobLoc.x := locx;
gobLoc.y := locy;
gobZLevel := zlevel;
gobRenderNow := TRUE;
gobSizeMultiplier := 32768;
animTimer := $FFFFFFFF; // non-animating
......@@ -280,9 +288,9 @@ begin
if gobType = GT_BACKGROUND then with GobHub do begin
gobindex := viewport[inviewport].GetBackgroundGobIndex;
if gobindex < numGobs then begin
if (atz = gob[gobindex].gobZLevel)
or ((atz < gob[gobindex].gobZLevel) and ((gobindex = 0) or (gob[gobindex - 1].gobZLevel < atz)))
or ((atz > gob[gobindex].gobZLevel) and ((gobindex = numGobs - 1) or (gob[gobindex + 1].gobZLevel >= atz)))
if (zlevel = gob[gobindex].gobZLevel)
or ((zlevel < gob[gobindex].gobZLevel) and ((gobindex = 0) or (gob[gobindex - 1].gobZLevel < zlevel)))
or ((zlevel > gob[gobindex].gobZLevel) and ((gobindex = numGobs - 1) or (gob[gobindex + 1].gobZLevel >= zlevel)))
then
OverwriteIndex(gobindex, self, frame < 0)
else begin
......@@ -311,8 +319,8 @@ begin
gobindex := numGobs;
while gobindex <> 0 do begin
dec(gobindex);
if gob[gobindex].gobZLevel <= atz then
if (gobType <> GT_BACKGROUND) or (gob[gobindex].gobZLevel < atz) then begin
if gob[gobindex].gobZLevel <= zlevel then
if (gobType <> GT_BACKGROUND) or (gob[gobindex].gobZLevel < zlevel) then begin
inc(gobindex);
break;
end;
......
......@@ -867,7 +867,7 @@ begin
{$ifdef sakucon}
sysvar.keysdown := sysvar.keysdown or KEYVAL_LEFT;
{$endif}
if (Choicematic.isActive) and (Choicematic.numColumns > 1) then begin
if (Choicematic.isActive) and (BoxHub.textbox[Choicematic.choiceBox].columnCount > 1) then begin
Choicematic.MoveHighlightLeft;
exit;
end;
......@@ -898,7 +898,7 @@ begin
{$ifdef sakucon}
sysvar.keysdown := sysvar.keysdown or KEYVAL_RIGHT;
{$endif}
if (Choicematic.isActive) and (Choicematic.numColumns > 1) then begin
if (Choicematic.isActive) and (BoxHub.textbox[Choicematic.choiceBox].columnCount > 1) then begin
Choicematic.MoveHighlightRight;
exit;
end;
......
......@@ -131,7 +131,6 @@ const
WOP_CHOICE_CALL = 40;
WOP_CHOICE_CANCEL = 41;
WOP_CHOICE_COLUMNS = 42;
WOP_CHOICE_ENDTYPING = 43;
WOP_CHOICE_GET = 44;
WOP_CHOICE_GETHIGHLIGHT = 45;
......@@ -259,7 +258,6 @@ var ss_rwoplist : array[0..159] of record
(namu : 'choice.call'; code : WOP_CHOICE_CALL),
(namu : 'choice.cancel'; code : WOP_CHOICE_CANCEL),
(namu : 'choice.clear'; code : WOP_CHOICE_RESET),
(namu : 'choice.columns'; code : WOP_CHOICE_COLUMNS),
(namu : 'choice.disable'; code : WOP_CHOICE_OFF),
(namu : 'choice.enable'; code : WOP_CHOICE_ON),
(namu : 'choice.endtyping'; code : WOP_CHOICE_ENDTYPING),
......@@ -327,6 +325,7 @@ var ss_rwoplist : array[0..159] of record
(namu : 'gfx.removekids'; code : WOP_GFX_CLEARKIDS),
(namu : 'gfx.setalpha'; code : WOP_GFX_SETALPHA),
(namu : 'gfx.setframe'; code : WOP_GFX_SETFRAME),
(namu : 'gfx.setloc'; code : WOP_GFX_MOVE),
(namu : 'gfx.setparent'; code : WOP_GFX_ADOPT),
(namu : 'gfx.setsequence'; code : WOP_GFX_SETSEQUENCE),
(namu : 'gfx.setsolidblit'; code : WOP_GFX_SETSOLIDBLIT),
......@@ -629,8 +628,6 @@ begin
ss_rwopparams[WOP_CHOICE_OFF][WOPP_TEXT] := ss_rwoppargtype[WOPP_TEXT];
ss_rwopparams[WOP_CHOICE_ON][WOPP_TEXT] := ss_rwoppargtype[WOPP_TEXT];
ss_rwopparams[WOP_CHOICE_REMOVE][WOPP_TEXT] := ss_rwoppargtype[WOPP_TEXT];
// default: 4 columns
ss_rwopparams[WOP_CHOICE_COLUMNS][WOPP_VALUE] := ss_rwoppargtype[WOPP_VALUE];
// default: empty label, no trigger on highlight change
ss_rwopparams[WOP_CHOICE_ONHIGHLIGHT][WOPP_LABEL] := ss_rwoppargtype[WOPP_LABEL];
// default: 0, disabled
......@@ -749,6 +746,9 @@ begin
// default: current location
ss_rwopparams[WOP_GFX_MOVE][WOPP_LOCX] := ss_rwoppargtype[WOPP_LOCX];
ss_rwopparams[WOP_GFX_MOVE][WOPP_LOCY] := ss_rwoppargtype[WOPP_LOCY];
// default: current anchor or 0,0
ss_rwopparams[WOP_GFX_MOVE][WOPP_ANCHORX] := ss_rwoppargtype[WOPP_ANCHORX];
ss_rwopparams[WOP_GFX_MOVE][WOPP_ANCHORY] := ss_rwoppargtype[WOPP_ANCHORY];
// default: 0 msec
ss_rwopparams[WOP_GFX_MOVE][WOPP_TIME] := ss_rwoppargtype[WOPP_TIME];
......@@ -789,6 +789,9 @@ begin
ss_rwopparams[WOP_GFX_SHOW][WOPP_FRAME] := ss_rwoppargtype[WOPP_FRAME];
// default: 0
ss_rwopparams[WOP_GFX_SHOW][WOPP_ZLEVEL] := ss_rwoppargtype[WOPP_ZLEVEL];
// default: 0,0
ss_rwopparams[WOP_GFX_SHOW][WOPP_ANCHORX] := ss_rwoppargtype[WOPP_ANCHORX];
ss_rwopparams[WOP_GFX_SHOW][WOPP_ANCHORY] := ss_rwoppargtype[WOPP_ANCHORY];
// default: "thumb"
ss_rwopparams[WOP_GFX_STASHTHUMBNAIL][WOPP_NAME] := ss_rwoppargtype[WOPP_NAME];
......
......@@ -454,9 +454,9 @@ var i : dword;
// row/column.
// This same calculation is done again in LoadGFX.
ofsxp := (PNGlist[i].origofsxp * longint(listsizex)) div PNGlist[i].origsizexp;
if PNGlist[i].origofsxp < 0 then dec(ofsxp);
//if PNGlist[i].origofsxp < 0 then dec(ofsxp);
ofsyp := (PNGlist[i].origofsyp * longint(listsizey)) div PNGlist[i].origframeheightp;
if PNGlist[i].origofsyp < 0 then dec(ofsyp);
//if PNGlist[i].origofsyp < 0 then dec(ofsyp); // <-- causes off by one in Vanish title screen
sizexp := listsizex;
frameheightp := listsizey;
......