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

mgerhardy noreply at scummvm.org
Thu Jul 16 08:44:47 UTC 2026


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

Summary:
7f47c5adc7 MACS2: removed todo comments
e4a17ef902 MACS2: removed unused code


Commit: 7f47c5adc75d2337dc831f90d8b23c737d7900f8
    https://github.com/scummvm/scummvm/commit/7f47c5adc75d2337dc831f90d8b23c737d7900f8
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T10:35:18+02:00

Commit Message:
MACS2: removed todo comments

Changed paths:
    engines/macs2/view1.h


diff --git a/engines/macs2/view1.h b/engines/macs2/view1.h
index 8941aad3339..1950f57e986 100644
--- a/engines/macs2/view1.h
+++ b/engines/macs2/view1.h
@@ -118,7 +118,6 @@ public:
 
 	uint16 getVerticalOffset() const;
 
-	// TODO: Handle properly
 	uint8 _animationIndex = 1;
 	uint16 _motionTargetVerticalOffset = 0;
 	uint16 _motionVerticalOffsetDelta = 0;
@@ -135,7 +134,6 @@ public:
 	bool isAnimationMirrored() const;
 	uint8 getMirroredAnimation(uint8 original) const;
 
-	// TODO: Will need time handling
 	// advanceMode matches drawAnimFrame/advanceAnimFrame (1010:16e7): 0=current frame,
 	// 2=advance sequence after returning current frame. Hit testing uses 0; drawing uses 2.
 	bool fillCurrentAnimationFrame(uint16 advanceMode, Macs2::AnimFrame &out);


Commit: e4a17ef9025ff9f90fe3744e3888fae3351b2ec5
    https://github.com/scummvm/scummvm/commit/e4a17ef9025ff9f90fe3744e3888fae3351b2ec5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T10:40:30+02:00

Commit Message:
MACS2: removed unused code

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


diff --git a/engines/macs2/events.cpp b/engines/macs2/events.cpp
index 61169253c2d..ca4b0f759da 100644
--- a/engines/macs2/events.cpp
+++ b/engines/macs2/events.cpp
@@ -150,27 +150,6 @@ void Events::processEvent(Common::Event &ev) {
 	}
 }
 
-void Events::replaceView(UIElement *ui, bool replaceAllViews) {
-	assert(ui);
-	UIElement *priorView = focusedView();
-
-	if (replaceAllViews) {
-		clearViews();
-
-	} else if (!_views.empty()) {
-		priorView->msgUnfocus(UnfocusMessage());
-		_views.pop();
-	}
-
-	_views.push(ui);
-	ui->redraw();
-	ui->msgFocus(FocusMessage(priorView));
-}
-
-void Events::replaceView(const Common::String &name, bool replaceAllViews) {
-	replaceView(findView(name));
-}
-
 void Events::addView(UIElement *ui) {
 	assert(ui);
 	UIElement *priorView = focusedView();
@@ -183,91 +162,27 @@ void Events::addView(UIElement *ui) {
 	ui->msgFocus(FocusMessage(priorView));
 }
 
-void Events::addView(const Common::String &name) {
-	addView(findView(name));
-}
-
-void Events::popView() {
-	UIElement *priorView = focusedView();
-	priorView->msgUnfocus(UnfocusMessage());
-	_views.pop();
-
-	for (int i = 0; i < (int)_views.size() - 1; ++i) {
-		_views[i]->redraw();
-		_views[i]->draw();
-	}
-
-	if (!_views.empty()) {
-		UIElement *view = focusedView();
-		view->msgFocus(FocusMessage(priorView));
-		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)
-			return true;
-	}
-
-	return false;
-}
-
-void Events::clearViews() {
-	if (!_views.empty())
-		focusedView()->msgUnfocus(UnfocusMessage());
-
-	_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, kScreenWidth, kGameHeight),
-											_innerBounds(innerBounds),
-											left(_bounds.left), top(_bounds.top),
-											right(_bounds.right), bottom(_bounds.bottom) {
+											_innerBounds(innerBounds) {
 }
 
 Bounds &Bounds::operator=(const Common::Rect &r) {
 	_bounds = r;
 	_innerBounds = r;
-	_innerBounds.grow(-_borderSize);
 	return *this;
 }
 
-void Bounds::setBorderSize(size_t borderSize) {
-	_borderSize = borderSize;
-	_innerBounds = *this;
-	_innerBounds.grow(-_borderSize);
-}
-
 /*------------------------------------------------------------------------*/
 
-UIElement::UIElement(const Common::String &name) : _name(name), _parent(g_engine), _bounds(_innerBounds) {
+UIElement::UIElement(const Common::String &name) : _name(name), _bounds(_innerBounds) {
 	g_engine->_children.push_back(this);
 }
 
-UIElement::UIElement(const Common::String &name, UIElement *uiParent) : _name(name), _parent(uiParent),
-																		_bounds(_innerBounds) {
-	if (_parent)
-		_parent->_children.push_back(this);
+UIElement::UIElement(const Common::String &name, UIElement *uiParent) : _name(name), _bounds(_innerBounds) {
+	if (uiParent)
+		uiParent->_children.push_back(this);
 }
 
 void UIElement::redraw() {
@@ -287,28 +202,6 @@ void UIElement::drawElements() {
 		_children[i]->drawElements();
 }
 
-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() {
-	Graphics::ManagedSurface 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();
@@ -316,10 +209,6 @@ void UIElement::draw() {
 }
 
 bool UIElement::tick() {
-	if (_timeoutCtr && --_timeoutCtr == 0) {
-		timeout();
-	}
-
 	for (size_t i = 0; i < _children.size(); ++i) {
 		if (_children[i]->tick())
 			return true;
@@ -341,40 +230,8 @@ UIElement *UIElement::findView(const Common::String &name) {
 	return nullptr;
 }
 
-void UIElement::replaceView(UIElement *ui, bool replaceAllViews) {
-	g_events->replaceView(ui, replaceAllViews);
-}
-
-void UIElement::replaceView(const Common::String &name, bool replaceAllViews) {
-	g_events->replaceView(name, replaceAllViews);
-}
-
-void UIElement::addView(UIElement *ui) {
-	g_events->addView(ui);
-}
-
-void UIElement::addView(const Common::String &name) {
-	g_events->addView(name);
-}
-
-void UIElement::addView() {
-	g_events->addView(this);
-}
-
 Graphics::ManagedSurface UIElement::getSurface() const {
 	return Graphics::ManagedSurface(*g_events->getScreen(), _bounds);
 }
 
-void UIElement::delaySeconds(uint seconds) {
-	_timeoutCtr = seconds * (1000 / FRAME_DELAY);
-}
-
-void UIElement::delayFrames(uint frames) {
-	_timeoutCtr = frames;
-}
-
-void UIElement::timeout() {
-	redraw();
-}
-
 } // namespace Macs2
diff --git a/engines/macs2/events.h b/engines/macs2/events.h
index c7fab2c4b38..c8dbdf3b3f1 100644
--- a/engines/macs2/events.h
+++ b/engines/macs2/events.h
@@ -29,12 +29,6 @@
 
 namespace Macs2 {
 
-// Timer ISR fires at ~21.6 Hz (PIT divisor 0xd7b0 = 55216, 1193182/55216).
-// Main loop processes a game frame when tick counter > 1 (every ~2 ticks).
-// Effective game frame rate: ~20 fps (confirmed by previous testing).
-#define FRAME_RATE 70
-#define FRAME_DELAY (1000 / 20)
-
 class Events;
 
 /**
@@ -46,21 +40,11 @@ struct Bounds {
 private:
 	Common::Rect _bounds;
 	Common::Rect &_innerBounds;
-	int _borderSize = 0;
-
-public:
-	const int16 &left;
-	const int16 ⊤
-	const int16 &right;
-	const int16 ⊥
 
 public:
 	Bounds(Common::Rect &innerBounds);
 	operator const Common::Rect &() const { return _bounds; }
 	Bounds &operator=(const Common::Rect &r);
-	void setBorderSize(size_t borderSize);
-	size_t borderSize() const { return _borderSize; }
-	int16 width() const { return _bounds.width(); }
 	int16 height() const { return _bounds.height(); }
 };
 
@@ -70,128 +54,34 @@ public:
 class UIElement {
 	friend class Events;
 
-private:
-	int _timeoutCtr = 0;
-
 protected:
-	UIElement *_parent;
 	Common::Array<UIElement *> _children;
 	Common::Rect _innerBounds;
 	Bounds _bounds;
 	bool _needsRedraw = true;
 	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
-	 */
-	bool isDelayActive() const {
-		return _timeoutCtr != 0;
-	}
-
-	/**
-	 * Cancels any active delay
-	 */
-	void cancelDelay() {
-		_timeoutCtr = 0;
-	}
-
-	/**
-	 * Called when an active timeout countdown expired
-	 */
-	virtual void timeout();
-
 private:
 	/**
 	 * Outer method for doing drawing
-	 *
 	 */
 	void drawElements();
 
-	/**
-	 * Finds a view globally
-	 */
-	static UIElement *findViewGlobally(const Common::String &name);
-
 public:
 	UIElement(const Common::String &name, UIElement *uiParent);
 	UIElement(const Common::String &name);
 	virtual ~UIElement() {}
 
-	/**
-	 * Returns true if the elements needs to be redrawn
-	 */
-	bool needsRedraw() const { return _needsRedraw; }
-
 	/**
 	 * Sets that the element needs to be redrawn
 	 */
 	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
-	 */
-	void replaceView(UIElement *ui, bool replaceAllViews = false);
-	void replaceView(const Common::String &name, bool replaceAllViews = false);
-
-	/**
-	 * Adds a focused view to the view stack without replacing current one
-	 */
-	void addView(UIElement *ui);
-	void addView(const Common::String &name);
-	void addView();
-	void open() { addView(); }
-
-	/**
-	 * Sets the element's bounds
-	 */
-	virtual void setBounds(const Common::Rect &r) {
-		_bounds = r;
-	}
-
-	/**
-	 * Gets the element's bounds
-	 */
-	Common::Rect getBounds() const {
-		return _bounds;
-	}
-
 	/**
 	 * Returns a surface for drawing the element
 	 */
 	Graphics::ManagedSurface getSurface() const;
 
-	/**
-	 * Clear the surface
-	 */
-	virtual void clearSurface();
-
 	/**
 	 * Draws the element
 	 */
@@ -219,16 +109,6 @@ protected:                                                                \
 				return true;                                              \
 		}                                                                 \
 		return false;                                                     \
-	}                                                                     \
-                                                                          \
-public:                                                                   \
-	bool send(const Common::String &viewName, const NAME##Message &msg) { \
-		UIElement *view = UIElement::findViewGlobally(viewName);          \
-		assert(view);                                                     \
-		return view->msg##NAME(msg);                                      \
-	}                                                                     \
-	bool send(const NAME##Message &msg) {                                 \
-		return send("Root", msg);                                         \
 	}
 
 	MESSAGE(Focus);
@@ -245,8 +125,8 @@ public:                                                                   \
  * Main events and view manager. This is kept separate from the engine
  * class because the engine may add a lot of globals and bring in other
  * classes. So to save on compilation time, classes that only need to
- * access basic view management methods like addView or replaceView
- * only need to include events.h rather than the whole engine.
+ * access basic view management methods like addView only need to
+ * include events.h rather than the whole engine.
  */
 class Events : public UIElement {
 private:
@@ -290,34 +170,10 @@ public:
 	 */
 	void runGame();
 
-	/**
-	 * Sets the focus to a new view
-	 */
-	void replaceView(UIElement *ui, bool replaceAllViews = false);
-	void replaceView(const Common::String &name, bool replaceAllViews = false);
-
 	/**
 	 * Adds a focused view to the view stack without replacing current one
 	 */
 	void addView(UIElement *ui);
-	void addView(const Common::String &name);
-
-	/**
-	 * Clears the view list
-	 */
-	void clearViews();
-
-	/**
-	 * Pops a view from the view stack
-	 */
-	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
@@ -326,26 +182,6 @@ public:
 		return _views.empty() ? nullptr : _views.top();
 	}
 
-	/**
-	 * Returns the view prior to the current view, if any
-	 */
-	UIElement *priorView() const {
-		return _views.size() < 2 ? nullptr : _views[_views.size() - 2];
-	}
-
-	/**
-	 * Returns true if a view of a given name is present
-	 * at all in the visible view stack
-	 */
-	bool isPresent(const Common::String &name) const;
-
-	/**
-	 * Returns true if combat is active
-	 */
-	bool isInCombat() const {
-		return isPresent("Combat");
-	}
-
 	/**
 	 * Returns the underlying screen
 	 */
@@ -361,11 +197,6 @@ public:
 			focusedView()->drawElements();
 	}
 
-	/**
-	 * Add a keypress to the event queue
-	 */
-	void addKeypress(const Common::KeyCode kc);
-
 	/**
 	 * Events manager doesn't have any intrinsic drawing
 	 */
@@ -377,13 +208,6 @@ public:
 	bool tick() override {
 		return !_views.empty() ? focusedView()->tick() : false;
 	}
-
-	/**
-	 * Calling the close method for g_events closes the active view
-	 */
-	void close() override {
-		focusedView()->close();
-	}
 };
 
 extern Events *g_events;




More information about the Scummvm-git-logs mailing list