[Scummvm-git-logs] scummvm master -> 6e43e415524e914bff85b2beae4922c8de038b6d
Strangerke
noreply at scummvm.org
Wed Jun 12 21:42:42 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6e43e41552 BAGEL: Pass some parameters as reference instead of value, remove an useless include, move some code from header to cpp
Commit: 6e43e415524e914bff85b2beae4922c8de038b6d
https://github.com/scummvm/scummvm/commit/6e43e415524e914bff85b2beae4922c8de038b6d
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-06-12T22:42:20+01:00
Commit Message:
BAGEL: Pass some parameters as reference instead of value, remove an useless include, move some code from header to cpp file
Changed paths:
engines/bagel/baglib/link_object.h
engines/bagel/baglib/object.cpp
engines/bagel/baglib/object.h
diff --git a/engines/bagel/baglib/link_object.h b/engines/bagel/baglib/link_object.h
index c2d96f3ff31..a5f22501d72 100644
--- a/engines/bagel/baglib/link_object.h
+++ b/engines/bagel/baglib/link_object.h
@@ -65,10 +65,10 @@ public:
void setSize(const CBofSize &size) override {
_size = size;
}
- void setDstLoc(const CBofPoint loc) {
+ void setDstLoc(const CBofPoint &loc) {
_destLocation = loc;
}
- void setSrcLoc(const CBofPoint loc) {
+ void setSrcLoc(const CBofPoint &loc) {
_srcLocation = loc;
}
};
diff --git a/engines/bagel/baglib/object.cpp b/engines/bagel/baglib/object.cpp
index 9d08ebb2954..771b0d90862 100644
--- a/engines/bagel/baglib/object.cpp
+++ b/engines/bagel/baglib/object.cpp
@@ -118,6 +118,34 @@ ErrorCode CBagObject::update(CBofBitmap * /*pBmp*/, CPoint /*pt*/, CRect * /*pSr
return ERR_NONE;
}
+bool CBagObject::onObjInteraction(CBagObject *, CBagStorageDev *) {
+ return false;
+}
+
+void CBagObject::setTimeless(bool b) {
+ setProperty(TIMELESS, b);
+}
+
+bool CBagObject::isForeGround() {
+ return isProperty(FOREGROUND);
+}
+
+void CBagObject::setForeGround(bool b) {
+ setProperty(FOREGROUND, b);
+}
+
+int CBagObject::getProperties() {
+ return _nProperties;
+}
+
+void CBagObject::setProperties(int nProperties) {
+ _nProperties = (uint16)nProperties;
+}
+
+const CBofString *CBagObject::getInitInfo() const {
+ return nullptr;
+}
+
int CBagObject::getProperty(const CBofString &sProp) {
if (!sProp.find("STATE"))
return getState();
@@ -160,6 +188,25 @@ bool CBagObject::runObject() {
return true;
}
+void CBagObject::setRefId(int id) {
+ assert(id >= 0 && id <= 0xFFFF);
+ _nId = (uint16)id;
+}
+
+void CBagObject::setOverCursor(int curs) {
+ _nOverCursor = (byte)curs;
+}
+
+void CBagObject::setState(int state) {
+ assert(ABS(state) < 0x8000);
+ _nState = (int16)state;
+}
+
+void CBagObject::setPosition(const CBofPoint &pos) {
+ _nX = (int16)pos.x;
+ _nY = (int16)pos.y;
+}
+
ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
ParseCodes parseCode = UNKNOWN_TOKEN;
@@ -358,6 +405,38 @@ bool CBagObject::onMouseMove(uint32 /*nFlags*/, CPoint /*xPoint*/, void *) {
return false;
}
+bool CBagObject::onMouseOver(uint32, CBofPoint, void *) {
+ return false;
+}
+
+CBofPoint CBagObject::getPosition() {
+ return CBofPoint(_nX, _nY);
+}
+
+int CBagObject::getRefId() {
+ return _nId;
+}
+
+int CBagObject::getOverCursor() {
+ return _nOverCursor;
+}
+
+int CBagObject::getState() {
+ return _nState;
+}
+
+CBofRect CBagObject::getRect() {
+ return CBofRect(_nX, _nY, _nX - 1, _nY - 1);
+}
+
+const CBofString &CBagObject::getFileName() {
+ return _sFileName;
+}
+
+CBagMenu *CBagObject::getMenuPtr() {
+ return _pMenu;
+}
+
const CBofString &CBagObject::getRefName() {
if (_psName) {
return *_psName;
diff --git a/engines/bagel/baglib/object.h b/engines/bagel/baglib/object.h
index eeb2bed5260..ed94b29a7e4 100644
--- a/engines/bagel/baglib/object.h
+++ b/engines/bagel/baglib/object.h
@@ -23,7 +23,6 @@
#ifndef BAGEL_BAGLIB_OBJECT_H
#define BAGEL_BAGLIB_OBJECT_H
-#include "bagel/boflib/stdinc.h"
#include "bagel/baglib/expression.h"
#include "bagel/baglib/res.h"
#include "bagel/boflib/gfx/bitmap.h"
@@ -257,9 +256,8 @@ public:
bool isTimeless() {
return isProperty(TIMELESS);
}
- void setTimeless(bool b = true) {
- setProperty(TIMELESS, b);
- }
+
+ void setTimeless(bool b = true);
// Does this objects have a set position/or should the sdev provide one when it is attached
bool isFloating() {
return isProperty(FLOATING);
@@ -275,32 +273,21 @@ public:
setProperty(PRELOAD, b);
}
// Does this objects have a set position/or should the sdev provide one when it is attached
- bool isForeGround() {
- return isProperty(FOREGROUND);
- }
- void setForeGround(bool b = true) {
- setProperty(FOREGROUND, b);
- }
-
- int getProperties() {
- return _nProperties;
- }
- void setProperties(int nProperties) {
- _nProperties = (uint16)nProperties;
- }
+ bool isForeGround();
+ void setForeGround(bool b = true);
+ int getProperties();
+ void setProperties(int nProperties);
// Init variables
- virtual const CBofString *getInitInfo() const {
- return nullptr;
- }
+ virtual const CBofString *getInitInfo() const;
virtual void setInitInfo(const CBofString &) {}
-
virtual int getProperty(const CBofString &sProp);
virtual void setProperty(const CBofString &, int nVal);
bool isDirty() {
return _bDirty != 0;
}
+
void setDirty(bool b = true) {
_bDirty = (byte)b;
}
@@ -309,6 +296,7 @@ public:
bool isMsgWaiting() {
return _bMsgWaiting != 0;
}
+
void setMsgWaiting(bool b = true) {
_bMsgWaiting = (byte)b;
}
@@ -316,6 +304,7 @@ public:
bool isAlwaysUpdate() {
return _bAlwaysUpdate != 0;
}
+
void setAlwaysUpdate(bool b = true) {
_bAlwaysUpdate = (byte)b;
}
@@ -323,57 +312,27 @@ public:
bool isNoMenu() {
return _bNoMenu;
}
+
void setNoMenu(bool b = true) {
_bNoMenu = (byte)b;
}
- virtual CBofPoint getPosition() {
- return CBofPoint(_nX, _nY);
- }
- virtual int getRefId() {
- return _nId;
- }
- virtual int getOverCursor() {
- return _nOverCursor;
- }
- virtual int getState() {
- return _nState;
- }
- virtual CBofRect getRect() {
- return CBofRect(_nX, _nY, _nX - 1, _nY - 1);
- }
-
- virtual const CBofString &getFileName() {
- return _sFileName;
- }
- CBagMenu *getMenuPtr() {
- return _pMenu;
- }
+ virtual CBofPoint getPosition();
+ virtual int getRefId();
+ virtual int getOverCursor();
+ virtual int getState();
+ virtual CBofRect getRect();
+ virtual const CBofString &getFileName();
+ CBagMenu *getMenuPtr();
virtual const CBofString &getRefName();
virtual void setRefName(const CBofString &s);
-
- virtual void setFileName(const CBofString &s) {
- _sFileName = s;
- }
+ virtual void setFileName(const CBofString &s);
virtual void setSize(const CBofSize &) {}
- virtual void setRefId(int id) {
- assert(id >= 0 && id <= 0xFFFF);
- _nId = (uint16)id;
- }
- virtual void setOverCursor(int curs) {
- _nOverCursor = (byte)curs;
- }
- virtual void setState(int state) {
- assert(ABS(state) < 0x8000);
- _nState = (int16)state;
- }
- virtual void setMenuPtr(CBagMenu *pm) {
- _pMenu = pm;
- }
- virtual void setPosition(const CBofPoint &pos) {
- _nX = (int16)pos.x;
- _nY = (int16)pos.y;
- }
+ virtual void setRefId(int id);
+ virtual void setOverCursor(int curs);
+ virtual void setState(int state);
+ virtual void setMenuPtr(CBagMenu *pm);
+ virtual void setPosition(const CBofPoint &pos);
/**
* Takes in info and then removes the relative information and returns
@@ -384,19 +343,21 @@ public:
ParseCodes setInfo(CBagIfstream &istr) override;
virtual ErrorCode update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSrcRect = nullptr, int /*nMaskColor*/ = -1);
-
- virtual bool onObjInteraction(CBagObject * /*pObj*/, CBagStorageDev * /*pSDev*/) {
- return false;
- }
-
+ virtual bool onObjInteraction(CBagObject * /*pObj*/, CBagStorageDev * /*pSDev*/);
virtual void onLButtonDown(uint32 /*nFlags*/, CBofPoint * /*xPoint*/, void * = nullptr) {}
virtual void onLButtonUp(uint32 /*nFlags*/, CBofPoint * /*xPoint*/, void * = nullptr); // run menu if available
virtual bool onMouseMove(uint32 /*nFlags*/, CBofPoint /*xPoint*/, void * = nullptr);
- virtual bool onMouseOver(uint32 /*nFlags*/, CBofPoint /*xPoint*/, void * = nullptr) {
- return false;
- }
+ virtual bool onMouseOver(uint32 /*nFlags*/, CBofPoint /*xPoint*/, void * = nullptr);
};
+inline void CBagObject::setFileName(const CBofString &s) {
+ _sFileName = s;
+}
+
+inline void CBagObject::setMenuPtr(CBagMenu *pm) {
+ _pMenu = pm;
+}
+
} // namespace Bagel
#endif
More information about the Scummvm-git-logs
mailing list