[Scummvm-git-logs] scummvm master -> 8e55f03b6db86ce8f728460177f92a07e17ee972

dreammaster dreammaster at scummvm.org
Fri Jul 9 03:38:26 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
454cc0fff9 AGS: Properly move Lines global into Globals
8e55f03b6d ANDROID: Compilation fix for 64-bit stream change


Commit: 454cc0fff977075c908ec491212c6f1cd37b1cac
    https://github.com/scummvm/scummvm/commit/454cc0fff977075c908ec491212c6f1cd37b1cac
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-08T20:37:51-07:00

Commit Message:
AGS: Properly move Lines global into Globals

Changed paths:
    engines/ags/engine/ac/dialog.cpp
    engines/ags/engine/ac/display.cpp
    engines/ags/engine/ac/drawing_surface.cpp
    engines/ags/engine/ac/global_drawing_surface.cpp
    engines/ags/engine/ac/global_gui.cpp
    engines/ags/engine/gui/my_label.cpp
    engines/ags/globals.cpp
    engines/ags/globals.h
    engines/ags/plugins/ags_plugin.cpp
    engines/ags/shared/font/fonts.cpp
    engines/ags/shared/font/fonts.h
    engines/ags/shared/gui/gui_label.cpp


diff --git a/engines/ags/engine/ac/dialog.cpp b/engines/ags/engine/ac/dialog.cpp
index 5bdeff0554..c3b5a4b3c6 100644
--- a/engines/ags/engine/ac/dialog.cpp
+++ b/engines/ags/engine/ac/dialog.cpp
@@ -331,7 +331,7 @@ int write_dialog_options(Bitmap *ds, bool ds_has_alpha, int dlgxp, int curyp, in
 			else text_color = ds->GetCompatibleColor(utextcol);
 		}
 
-		break_up_text_into_lines(get_translation(dtop->optionnames[(int)disporder[ww]]), Lines, areawid - (2 * padding + 2 + bullet_wid), usingfont);
+		break_up_text_into_lines(get_translation(dtop->optionnames[(int)disporder[ww]]), _GP(Lines), areawid - (2 * padding + 2 + bullet_wid), usingfont);
 		dispyp[ww] = curyp;
 		if (_GP(game).dialog_bullet > 0) {
 			draw_gui_sprite_v330(ds, _GP(game).dialog_bullet, dlgxp, curyp, ds_has_alpha);
@@ -345,8 +345,8 @@ int write_dialog_options(Bitmap *ds, bool ds_has_alpha, int dlgxp, int curyp, in
 			sprintf(tempbfr, "%d.", ww + 1);
 			wouttext_outline(ds, dlgxp + actualpicwid, curyp, usingfont, text_color, tempbfr);
 		}
-		for (size_t cc = 0; cc < Lines.Count(); cc++) {
-			wouttext_outline(ds, dlgxp + ((cc == 0) ? 0 : 9) + bullet_wid, curyp, usingfont, text_color, Lines[cc].GetCStr());
+		for (size_t cc = 0; cc < _GP(Lines).Count(); cc++) {
+			wouttext_outline(ds, dlgxp + ((cc == 0) ? 0 : 9) + bullet_wid, curyp, usingfont, text_color, _GP(Lines)[cc].GetCStr());
 			curyp += linespacing;
 		}
 		if (ww < numdisp - 1)
@@ -360,8 +360,8 @@ int write_dialog_options(Bitmap *ds, bool ds_has_alpha, int dlgxp, int curyp, in
 #define GET_OPTIONS_HEIGHT {\
 		needheight = 0;\
 		for (int i = 0; i < numdisp; ++i) {\
-			break_up_text_into_lines(get_translation(dtop->optionnames[(int)disporder[i]]), Lines, areawid-(2*padding+2+bullet_wid), usingfont);\
-			needheight += getheightoflines(usingfont, Lines.Count()) + data_to_game_coord(_GP(game).options[OPT_DIALOGGAP]);\
+			break_up_text_into_lines(get_translation(dtop->optionnames[(int)disporder[i]]), _GP(Lines), areawid-(2*padding+2+bullet_wid), usingfont);\
+			needheight += getheightoflines(usingfont, _GP(Lines).Count()) + data_to_game_coord(_GP(game).options[OPT_DIALOGGAP]);\
 		}\
 		if (parserInput) needheight += parserInput->Height + data_to_game_coord(_GP(game).options[OPT_DIALOGGAP]);\
 	}
@@ -645,7 +645,7 @@ void DialogOptions::Redraw() {
 		int biggest = 0;
 		padding = _GP(guis)[_GP(game).options[OPT_DIALOGIFACE]].Padding;
 		for (int i = 0; i < numdisp; ++i) {
-			break_up_text_into_lines(get_translation(dtop->optionnames[(int)disporder[i]]), Lines, areawid - ((2 * padding + 2) + bullet_wid), usingfont);
+			break_up_text_into_lines(get_translation(dtop->optionnames[(int)disporder[i]]), _GP(Lines), areawid - ((2 * padding + 2) + bullet_wid), usingfont);
 			if (_G(longestline) > biggest)
 				biggest = _G(longestline);
 		}
diff --git a/engines/ags/engine/ac/display.cpp b/engines/ags/engine/ac/display.cpp
index fa56751716..19928d4fcb 100644
--- a/engines/ags/engine/ac/display.cpp
+++ b/engines/ags/engine/ac/display.cpp
@@ -98,10 +98,10 @@ int _display_main(int xx, int yy, int wii, const char *text, int disp_type, int
 	wii = MIN(wii, 10000);
 
 	ensure_text_valid_for_font(todis, usingfont);
-	break_up_text_into_lines(todis, Lines, wii - 2 * padding, usingfont);
+	break_up_text_into_lines(todis, _GP(Lines), wii - 2 * padding, usingfont);
 	disp.lineheight = getfontheight_outlined(usingfont);
 	disp.linespacing = getfontspacing_outlined(usingfont);
-	disp.fulltxtheight = getheightoflines(usingfont, Lines.Count());
+	disp.fulltxtheight = getheightoflines(usingfont, _GP(Lines).Count());
 
 	// AGS 2.x: If the screen is faded out, fade in again when displaying a message box.
 	if (!asspch && (_G(loaded_game_file_version) <= kGameVersion_272))
@@ -213,7 +213,7 @@ int _display_main(int xx, int yy, int wii, const char *text, int disp_type, int
 		} else if ((ShouldAntiAliasText()) && (_GP(game).GetColorDepth() >= 24))
 			alphaChannel = true;
 
-		for (size_t ee = 0; ee < Lines.Count(); ee++) {
+		for (size_t ee = 0; ee < _GP(Lines).Count(); ee++) {
 			//int ttxp=wii/2 - wgettextwidth_compensate(lines[ee], usingfont)/2;
 			int ttyp = ttxtop + ee * disp.linespacing;
 			// asspch < 0 means that it's inside a text box so don't
@@ -225,11 +225,11 @@ int _display_main(int xx, int yy, int wii, const char *text, int disp_type, int
 				else
 					text_color = text_window_ds->GetCompatibleColor(-asspch);
 
-				wouttext_aligned(text_window_ds, ttxleft, ttyp, oriwid, usingfont, text_color, Lines[ee].GetCStr(), _GP(play).text_align);
+				wouttext_aligned(text_window_ds, ttxleft, ttyp, oriwid, usingfont, text_color, _GP(Lines)[ee].GetCStr(), _GP(play).text_align);
 			} else {
 				text_color = text_window_ds->GetCompatibleColor(asspch);
 				//wouttext_outline(ttxp,ttyp,usingfont,lines[ee]);
-				wouttext_aligned(text_window_ds, ttxleft, ttyp, wii, usingfont, text_color, Lines[ee].GetCStr(), _GP(play).speech_text_align);
+				wouttext_aligned(text_window_ds, ttxleft, ttyp, wii, usingfont, text_color, _GP(Lines)[ee].GetCStr(), _GP(play).speech_text_align);
 			}
 		}
 	} else {
@@ -242,8 +242,8 @@ int _display_main(int xx, int yy, int wii, const char *text, int disp_type, int
 
 		adjust_y_coordinate_for_text(&yoffs, usingfont);
 
-		for (size_t ee = 0; ee < Lines.Count(); ee++)
-			wouttext_aligned(text_window_ds, xoffs, yoffs + ee * disp.linespacing, oriwid, usingfont, text_color, Lines[ee].GetCStr(), _GP(play).text_align);
+		for (size_t ee = 0; ee < _GP(Lines).Count(); ee++)
+			wouttext_aligned(text_window_ds, xoffs, yoffs + ee * disp.linespacing, oriwid, usingfont, text_color, _GP(Lines)[ee].GetCStr(), _GP(play).text_align);
 	}
 
 	int ovrtype = OVER_TEXTMSG;
diff --git a/engines/ags/engine/ac/drawing_surface.cpp b/engines/ags/engine/ac/drawing_surface.cpp
index 69c7fc5f42..f8b74bdc59 100644
--- a/engines/ags/engine/ac/drawing_surface.cpp
+++ b/engines/ags/engine/ac/drawing_surface.cpp
@@ -295,22 +295,22 @@ void DrawingSurface_DrawStringWrapped(ScriptDrawingSurface *sds, int xx, int yy,
 	sds->PointToGameResolution(&xx, &yy);
 	sds->SizeToGameResolution(&wid);
 
-	if (break_up_text_into_lines(msg, Lines, wid, font) == 0)
+	if (break_up_text_into_lines(msg, _GP(Lines), wid, font) == 0)
 		return;
 
 	Bitmap *ds = sds->StartDrawing();
 	color_t text_color = sds->currentColour;
 
-	for (size_t i = 0; i < Lines.Count(); i++) {
+	for (size_t i = 0; i < _GP(Lines).Count(); i++) {
 		int drawAtX = xx;
 
 		if (alignment & kMAlignHCenter) {
-			drawAtX = xx + ((wid / 2) - wgettextwidth(Lines[i].GetCStr(), font) / 2);
+			drawAtX = xx + ((wid / 2) - wgettextwidth(_GP(Lines)[i].GetCStr(), font) / 2);
 		} else if (alignment & kMAlignRight) {
-			drawAtX = (xx + wid) - wgettextwidth(Lines[i].GetCStr(), font);
+			drawAtX = (xx + wid) - wgettextwidth(_GP(Lines)[i].GetCStr(), font);
 		}
 
-		wouttext_outline(ds, drawAtX, yy + linespacing * i, font, text_color, Lines[i].GetCStr());
+		wouttext_outline(ds, drawAtX, yy + linespacing * i, font, text_color, _GP(Lines)[i].GetCStr());
 	}
 
 	sds->FinishedDrawing();
diff --git a/engines/ags/engine/ac/global_drawing_surface.cpp b/engines/ags/engine/ac/global_drawing_surface.cpp
index 511fb0865f..73e3c795f3 100644
--- a/engines/ags/engine/ac/global_drawing_surface.cpp
+++ b/engines/ags/engine/ac/global_drawing_surface.cpp
@@ -156,13 +156,13 @@ void RawPrintMessageWrapped(int xx, int yy, int wid, int font, int msgm) {
 	// it's probably too late but check anyway
 	if (strlen(displbuf) > 2899)
 		quit("!RawPrintMessageWrapped: message too long");
-	if (break_up_text_into_lines(displbuf, Lines, wid, font) == 0)
+	if (break_up_text_into_lines(displbuf, _GP(Lines), wid, font) == 0)
 		return;
 
 	RAW_START();
 	color_t text_color = _GP(play).raw_color;
-	for (size_t i = 0; i < Lines.Count(); i++)
-		wouttext_outline(RAW_SURFACE(), xx, yy + linespacing * i, font, text_color, Lines[i].GetCStr());
+	for (size_t i = 0; i < _GP(Lines).Count(); i++)
+		wouttext_outline(RAW_SURFACE(), xx, yy + linespacing * i, font, text_color, _GP(Lines)[i].GetCStr());
 	invalidate_screen();
 	mark_current_background_dirty();
 	RAW_END();
diff --git a/engines/ags/engine/ac/global_gui.cpp b/engines/ags/engine/ac/global_gui.cpp
index b376e4aaeb..2715b64745 100644
--- a/engines/ags/engine/ac/global_gui.cpp
+++ b/engines/ags/engine/ac/global_gui.cpp
@@ -186,9 +186,9 @@ int GetTextHeight(const char *text, int fontnum, int width) {
 	if ((fontnum < 0) || (fontnum >= _GP(game).numfonts))
 		quit("!GetTextHeight: invalid font number.");
 
-	if (break_up_text_into_lines(text, Lines, data_to_game_coord(width), fontnum) == 0)
+	if (break_up_text_into_lines(text, _GP(Lines), data_to_game_coord(width), fontnum) == 0)
 		return 0;
-	return game_to_data_coord(getheightoflines(fontnum, Lines.Count()));
+	return game_to_data_coord(getheightoflines(fontnum, _GP(Lines).Count()));
 }
 
 int GetFontHeight(int fontnum) {
diff --git a/engines/ags/engine/gui/my_label.cpp b/engines/ags/engine/gui/my_label.cpp
index 2b0d036ba7..2d484519a1 100644
--- a/engines/ags/engine/gui/my_label.cpp
+++ b/engines/ags/engine/gui/my_label.cpp
@@ -47,10 +47,10 @@ void MyLabel::draw(Bitmap *ds) {
 	char *teptr = &text[0];
 	color_t text_color = ds->GetCompatibleColor(0);
 
-	if (break_up_text_into_lines(teptr, Lines, wid, _G(acdialog_font)) == 0)
+	if (break_up_text_into_lines(teptr, _GP(Lines), wid, _G(acdialog_font)) == 0)
 		return;
-	for (size_t ee = 0; ee < Lines.Count(); ee++) {
-		wouttext_outline(ds, x, cyp, _G(acdialog_font), text_color, Lines[ee].GetCStr());
+	for (size_t ee = 0; ee < _GP(Lines).Count(); ee++) {
+		wouttext_outline(ds, x, cyp, _G(acdialog_font), text_color, _GP(Lines)[ee].GetCStr());
 		cyp += TEXT_HT;
 	}
 }
diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp
index a84082fb10..1c2e766950 100644
--- a/engines/ags/globals.cpp
+++ b/engines/ags/globals.cpp
@@ -189,7 +189,7 @@ Globals::Globals() {
 	_fonts = new std::vector<AGS::Shared::Font>();
 	_ttfRenderer = new TTFFontRenderer();
 	_wfnRenderer = new WFNFontRenderer();
-	_fontLines = new SplitLines();
+	_Lines = new SplitLines();
 
 	// game.cpp globals
 	_ccDynamicGUIObject = new CCGUIObject();
@@ -419,6 +419,7 @@ Globals::~Globals() {
 	delete _fonts;
 	delete _ttfRenderer;
 	delete _wfnRenderer;
+	delete _Lines;
 
 	// game.cpp globals
 	delete _ccDynamicGUIObject;
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 802c862578..281778b58e 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -679,7 +679,7 @@ public:
 	std::vector<AGS::Shared::Font> *_fonts;
 	TTFFontRenderer *_ttfRenderer;
 	WFNFontRenderer *_wfnRenderer;
-	SplitLines *_fontLines;
+	SplitLines *_Lines;
 
 	/**@}*/
 
diff --git a/engines/ags/plugins/ags_plugin.cpp b/engines/ags/plugins/ags_plugin.cpp
index c604bc8971..d10e472bbc 100644
--- a/engines/ags/plugins/ags_plugin.cpp
+++ b/engines/ags/plugins/ags_plugin.cpp
@@ -307,7 +307,7 @@ void IAGSEngine::DrawTextWrapped(int32 xx, int32 yy, int32 wid, int32 font, int3
 	// TODO: use generic function from the engine instead of having copy&pasted code here
 	int linespacing = getfontspacing_outlined(font);
 
-	if (break_up_text_into_lines(text, Lines, wid, font) == 0)
+	if (break_up_text_into_lines(text, _GP(Lines), wid, font) == 0)
 		return;
 
 	Bitmap *ds = _G(gfxDriver)->GetStageBackBuffer(true);
@@ -315,8 +315,8 @@ void IAGSEngine::DrawTextWrapped(int32 xx, int32 yy, int32 wid, int32 font, int3
 		return;
 	color_t text_color = ds->GetCompatibleColor(color);
 	data_to_game_coords((int *)&xx, (int *)&yy); // stupid! quick tweak
-	for (size_t i = 0; i < Lines.Count(); i++)
-		draw_and_invalidate_text(ds, xx, yy + linespacing * i, font, text_color, Lines[i].GetCStr());
+	for (size_t i = 0; i < _GP(Lines).Count(); i++)
+		draw_and_invalidate_text(ds, xx, yy + linespacing * i, font, text_color, _GP(Lines)[i].GetCStr());
 }
 
 Bitmap glVirtualScreenWrap;
diff --git a/engines/ags/shared/font/fonts.cpp b/engines/ags/shared/font/fonts.cpp
index 1a32d80736..70fddd9f60 100644
--- a/engines/ags/shared/font/fonts.cpp
+++ b/engines/ags/shared/font/fonts.cpp
@@ -32,8 +32,12 @@
 #include "ags/shared/util/string_utils.h"
 #include "ags/globals.h"
 
+
 namespace AGS3 {
 
+// Project-dependent implementation
+extern int wgettextwidth_compensate(const char *tex, int font);
+
 #define STD_BUFFER_SIZE 3000
 
 using namespace AGS::Shared;
@@ -166,15 +170,6 @@ bool use_default_linespacing(size_t fontNumber) {
 	return _GP(fonts)[fontNumber].Info.LineSpacing == 0;
 }
 
-// Project-dependent implementation
-extern int wgettextwidth_compensate(const char *tex, int font);
-
-namespace AGS {
-namespace Shared {
-SplitLines Lines;
-}
-}
-
 // Replaces AGS-specific linebreak tags with common '\n'
 void unescape_script_string(const char *cstr, std::vector<char> &out) {
 	out.clear();
diff --git a/engines/ags/shared/font/fonts.h b/engines/ags/shared/font/fonts.h
index 92cfc9f4d9..c5ab4c4914 100644
--- a/engines/ags/shared/font/fonts.h
+++ b/engines/ags/shared/font/fonts.h
@@ -139,12 +139,6 @@ private:
 // returns number of lines, or 0 if text cannot be split well to fit in this width
 size_t split_lines(const char *texx, SplitLines &lines, int width, int fontNumber, size_t max_lines = -1);
 
-namespace AGS {
-namespace Shared {
-extern SplitLines Lines;
-} // namespace Shared
-} // namespace AGS
-
 } // namespace AGS3
 
 #endif
diff --git a/engines/ags/shared/gui/gui_label.cpp b/engines/ags/shared/gui/gui_label.cpp
index a7788e358e..6df36ca00b 100644
--- a/engines/ags/shared/gui/gui_label.cpp
+++ b/engines/ags/shared/gui/gui_label.cpp
@@ -55,7 +55,7 @@ void GUILabel::Draw(Shared::Bitmap *ds) {
 	// TODO: need to find a way to cache text prior to drawing;
 	// but that will require to update all gui controls when translation is changed in game
 	PrepareTextToDraw();
-	if (SplitLinesForDrawing(Lines) == 0)
+	if (SplitLinesForDrawing(_GP(Lines)) == 0)
 		return;
 
 	color_t text_color = ds->GetCompatibleColor(TextColor);
@@ -64,9 +64,9 @@ void GUILabel::Draw(Shared::Bitmap *ds) {
 	const bool limit_by_label_frame = _G(loaded_game_file_version) >= kGameVersion_272;
 	int at_y = Y;
 	for (size_t i = 0;
-	        i < Lines.Count() && (!limit_by_label_frame || at_y <= Y + Height);
+	        i < _GP(Lines).Count() && (!limit_by_label_frame || at_y <= Y + Height);
 	        ++i, at_y += linespacing) {
-		GUI::DrawTextAlignedHor(ds, Lines[i].GetCStr(), Font, text_color, X, X + Width - 1, at_y,
+		GUI::DrawTextAlignedHor(ds, _GP(Lines)[i].GetCStr(), Font, text_color, X, X + Width - 1, at_y,
 		                        (FrameAlignment)TextAlignment);
 	}
 }


Commit: 8e55f03b6db86ce8f728460177f92a07e17ee972
    https://github.com/scummvm/scummvm/commit/8e55f03b6db86ce8f728460177f92a07e17ee972
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-08T20:37:51-07:00

Commit Message:
ANDROID: Compilation fix for 64-bit stream change

Changed paths:
    backends/platform/android/asset-archive.cpp


diff --git a/backends/platform/android/asset-archive.cpp b/backends/platform/android/asset-archive.cpp
index 64800fc17c..05cbb524f1 100644
--- a/backends/platform/android/asset-archive.cpp
+++ b/backends/platform/android/asset-archive.cpp
@@ -89,7 +89,7 @@ uint32 AssetInputStream::read(void *dataPtr, uint32 dataSize) {
 	return readlen;
 }
 
-bool AssetInputStream::seek(int32 offset, int whence) {
+bool AssetInputStream::seek(int64 offset, int whence) {
 	int res = AAsset_seek(_asset, offset, whence);
 	if (res == -1) {
 		return false;




More information about the Scummvm-git-logs mailing list