[Scummvm-git-logs] scummvm master -> db13f1a9906f991544a9622677ea04ee02cee836

Strangerke noreply at scummvm.org
Tue Jan 14 00:37:48 UTC 2025


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

Summary:
ddb14b3cfd GOT: fix an assignment in game_content, courtesy of dreammaster
be1a9e3232 GOT: Remove various unused methods in events
db13f1a990 GOT: Fix out of range access to arrays is script, and 2 other small issues


Commit: ddb14b3cfde3a64260b825ca3418c29e88816b7d
    https://github.com/scummvm/scummvm/commit/ddb14b3cfde3a64260b825ca3418c29e88816b7d
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-14T01:00:42+01:00

Commit Message:
GOT: fix an assignment in game_content, courtesy of dreammaster

Changed paths:
    engines/got/views/game_content.cpp


diff --git a/engines/got/views/game_content.cpp b/engines/got/views/game_content.cpp
index 26eb047ef26..c88c979a98c 100644
--- a/engines/got/views/game_content.cpp
+++ b/engines/got/views/game_content.cpp
@@ -227,7 +227,7 @@ void GameContent::drawBackground(GfxSurface &s) {
 		for (int x = 0; x < TILES_X; x++) {
 			if (_G(scrn).icon[y][x] != 0) {
 				const Common::Point pt(x * TILE_SIZE, y * TILE_SIZE);
-				LEVEL screen = _G(scrn);
+				const LEVEL &screen = _G(scrn);
 				s.simpleBlitFrom(_G(bgPics[screen.bg_color]), pt);
 				s.simpleBlitFrom(_G(bgPics[screen.icon[y][x]]), pt);
 			}


Commit: be1a9e32326e3a41e1b3b4a2e60b4dcfa9c9f285
    https://github.com/scummvm/scummvm/commit/be1a9e32326e3a41e1b3b4a2e60b4dcfa9c9f285
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-14T01:05:45+01:00

Commit Message:
GOT: Remove various unused methods in events

Changed paths:
    engines/got/events.cpp
    engines/got/events.h


diff --git a/engines/got/events.cpp b/engines/got/events.cpp
index 0acff0796c9..c109f0484a9 100644
--- a/engines/got/events.cpp
+++ b/engines/got/events.cpp
@@ -268,7 +268,7 @@ int Events::actionToKeyFlag(int action) const {
 
 void Events::replaceView(UIElement *ui, bool replaceAllViews, bool fadeOutIn) {
 	assert(ui);
-	UIElement *priorView = focusedView();
+	UIElement *oldView = focusedView();
 
 	if (fadeOutIn)
 		Gfx::fade_out();
@@ -277,7 +277,7 @@ void Events::replaceView(UIElement *ui, bool replaceAllViews, bool fadeOutIn) {
 		clearViews();
 
 	} else if (!_views.empty()) {
-		priorView->msgUnfocus(UnfocusMessage());
+		oldView->msgUnfocus(UnfocusMessage());
 		_views.pop();
 	}
 
@@ -291,7 +291,7 @@ void Events::replaceView(UIElement *ui, bool replaceAllViews, bool fadeOutIn) {
 	_views.push(ui);
 
 	ui->redraw();
-	ui->msgFocus(FocusMessage(priorView));
+	ui->msgFocus(FocusMessage(oldView));
 	ui->draw();
 
 	if (fadeOutIn)
@@ -304,14 +304,14 @@ void Events::replaceView(const Common::String &name, bool replaceAllViews, bool
 
 void Events::addView(UIElement *ui) {
 	assert(ui);
-	UIElement *priorView = focusedView();
+	UIElement *oldView = focusedView();
 
 	if (!_views.empty())
-		priorView->msgUnfocus(UnfocusMessage());
+		oldView->msgUnfocus(UnfocusMessage());
 
 	_views.push(ui);
 	ui->redraw();
-	ui->msgFocus(FocusMessage(priorView));
+	ui->msgFocus(FocusMessage(oldView));
 }
 
 void Events::addView(const Common::String &name) {
@@ -319,8 +319,8 @@ void Events::addView(const Common::String &name) {
 }
 
 void Events::popView() {
-	UIElement *priorView = focusedView();
-	priorView->msgUnfocus(UnfocusMessage());
+	UIElement *oldView = focusedView();
+	oldView->msgUnfocus(UnfocusMessage());
 	_views.pop();
 
 	for (uint i = 0; i < _views.size(); ++i) {
@@ -330,19 +330,12 @@ void Events::popView() {
 
 	if (!_views.empty()) {
 		UIElement *view = focusedView();
-		view->msgFocus(FocusMessage(priorView));
+		view->msgFocus(FocusMessage(oldView));
 		view->redraw();
 		view->draw();
 	}
 }
 
-void Events::redrawViews() {
-	for (uint i = 0; i < _views.size(); ++i) {
-		_views[i]->redraw();
-		_views[i]->draw();
-	}
-}
-
 bool Events::isPresent(const Common::String &name) const {
 	for (uint i = 0; i < _views.size(); ++i) {
 		if (_views[i]->_name == name)
@@ -364,15 +357,6 @@ void Events::clearViews() {
 	_views.clear();
 }
 
-void Events::addKeypress(const Common::KeyCode kc) {
-	Common::KeyState ks;
-	ks.keycode = kc;
-	if (kc >= Common::KEYCODE_SPACE && kc <= Common::KEYCODE_TILDE)
-		ks.ascii = kc;
-
-	focusedView()->msgKeypress(KeypressMessage(ks));
-}
-
 /*------------------------------------------------------------------------*/
 
 Bounds::Bounds(Common::Rect &innerBounds) : _bounds(0, 0, 320, 240),
@@ -426,24 +410,11 @@ UIElement *UIElement::findViewGlobally(const Common::String &name) {
 	return g_events->findView(name);
 }
 
-void UIElement::focus() {
-	g_events->replaceView(this);
-}
-
 void UIElement::close() {
 	assert(g_events->focusedView() == this);
 	g_events->popView();
 }
 
-bool UIElement::isFocused() const {
-	return g_events->focusedView() == this;
-}
-
-void UIElement::clearSurface() {
-	GfxSurface s = getSurface();
-	s.fillRect(Common::Rect(s.w, s.h), 0);
-}
-
 void UIElement::draw() {
 	for (size_t i = 0; i < _children.size(); ++i) {
 		_children[i]->draw();
@@ -509,14 +480,6 @@ int UIElement::getRandomNumber(int maxNumber) {
 	return g_engine->getRandomNumber(maxNumber);
 }
 
-void UIElement::delaySeconds(uint seconds) {
-	_timeoutCtr = seconds * FRAME_RATE;
-}
-
-void UIElement::delayFrames(uint frames) {
-	_timeoutCtr = frames;
-}
-
 void UIElement::timeout() {
 	redraw();
 }
diff --git a/engines/got/events.h b/engines/got/events.h
index bc438d37213..996a5f4e088 100644
--- a/engines/got/events.h
+++ b/engines/got/events.h
@@ -89,16 +89,6 @@ protected:
 	Common::String _name;
 
 protected:
-	/**
-     * Set a delay countdown in seconds, after which timeout() is called
-     */
-	void delaySeconds(uint seconds);
-
-	/**
-     * Set a delay countdown in frames, after which timeout() is called
-     */
-	void delayFrames(uint frames);
-
 	/**
      * Returns true if a delay is active
      */
@@ -147,22 +137,12 @@ public:
      */
 	void redraw();
 
-	/**
-     * Focuses the element as the current view
-     */
-	void focus();
-
 	/**
      * Closes the current view. The view must have been added
      * via addView, so there's a remaining view afterwards
      */
 	virtual void close();
 
-	/*
-     * Returns true if the view is focused
-     */
-	bool isFocused() const;
-
 	/**
      * Sets the focus to a new view
      */
@@ -211,11 +191,6 @@ public:
      */
 	Gfx::GfxSurface getSurface(bool innerBounds = false) const;
 
-	/**
-     * Clear the surface
-     */
-	virtual void clearSurface();
-
 	/**
      * Draws the element
      */
@@ -364,13 +339,6 @@ public:
      */
 	void popView();
 
-	/**
-     * Redraws the views in order. This is used in rare cases
-     * where a view draws outside it's defined area, and needs
-     * to restore whether the background was before
-     */
-	void redrawViews();
-
 	/**
      * Returns the currently focused view, if any
      */
@@ -417,11 +385,6 @@ public:
      */
 	void drawElements() override;
 
-	/**
-     * Add a keypress to the event queue
-     */
-	void addKeypress(const Common::KeyCode kc);
-
 	/**
      * Events manager doesn't have any intrinsic drawing
      */


Commit: db13f1a9906f991544a9622677ea04ee02cee836
    https://github.com/scummvm/scummvm/commit/db13f1a9906f991544a9622677ea04ee02cee836
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-14T01:37:33+01:00

Commit Message:
GOT: Fix out of range access to arrays is script, and 2 other small issues

Changed paths:
    engines/got/game/script.cpp


diff --git a/engines/got/game/script.cpp b/engines/got/game/script.cpp
index 63e3af8a723..5d8dab5d315 100644
--- a/engines/got/game/script.cpp
+++ b/engines/got/game/script.cpp
@@ -120,9 +120,9 @@ void Scripts::runScript(bool firstTime) {
 	Common::fill(_gosubStack, _gosubStack + 32, (char *)nullptr);
 	_gosubPtr = 0;
 
-	Common::fill(_forVar, _forVar + 11, 0);
-	Common::fill(_forVal, _forVal + 11, 0);
-	Common::fill(_forStack, _forStack + 11, (char *)nullptr);
+	Common::fill(_forVar, _forVar + 10, 0);
+	Common::fill(_forVal, _forVal + 10, 0);
+	Common::fill(_forStack, _forStack + 10, (char *)nullptr);
 	_forPtr = 0;
 
 	int i = read_script_file();
@@ -480,7 +480,6 @@ int Scripts::get_line(char *src, char *dst) {
 
 	*dst = 0;
 	cnt++;
-	src++;
 
 	return cnt;
 }
@@ -1030,7 +1029,7 @@ void Scripts::scr_func3() {
 	int y = p / 20;
 	int x = p % 20;
 
-	if (y < 0 || x < 0 || y > 11 || x > 19) {
+	if (y < 0 || x < 0 || y > 11) {
 		play_sound(BRAAPP, true);
 		_G(key_flag[key_magic]) = false;
 		return;




More information about the Scummvm-git-logs mailing list