[Scummvm-git-logs] scummvm master -> 7d5249f61e347a8347172993b76644e9594c3b14

bluegr noreply at scummvm.org
Fri Mar 18 21:54:54 UTC 2022


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:
7d5249f61e CHEWY: Remove BitClass


Commit: 7d5249f61e347a8347172993b76644e9594c3b14
    https://github.com/scummvm/scummvm/commit/7d5249f61e347a8347172993b76644e9594c3b14
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-03-18T23:54:30+02:00

Commit Message:
CHEWY: Remove BitClass

The places where it's used are self-explanatory, so it's superfluous

Changed paths:
  R engines/chewy/bitclass.h
    engines/chewy/atds.cpp
    engines/chewy/globals.h
    engines/chewy/inits.cpp


diff --git a/engines/chewy/atds.cpp b/engines/chewy/atds.cpp
index 1bddd63ad53..46889450650 100644
--- a/engines/chewy/atds.cpp
+++ b/engines/chewy/atds.cpp
@@ -738,18 +738,17 @@ int16 Atdsys::get_ats_str(int16 txtNr, int16 txtMode, int16 mode) {
 
 int16 Atdsys::getControlBit(int16 txtNr, int16 bitIdx, int16 mode) {
 	set_ats_mem(mode);
-	int16 ret = _G(bit)->is_bit(_ats_sheader[txtNr * MAX_ATS_STATUS], bitIdx);
-	return ret;
+	return (_ats_sheader[txtNr * MAX_ATS_STATUS] & bitIdx) != 0;
 }
 
 void Atdsys::setControlBit(int16 txtNr, int16 bitIdx, int16 mode) {
 	set_ats_mem(mode);
-	_G(bit)->set_bit(&_ats_sheader[txtNr * MAX_ATS_STATUS], bitIdx);
+	_ats_sheader[txtNr * MAX_ATS_STATUS] |= bitIdx;
 }
 
 void Atdsys::delControlBit(int16 txtNr, int16 bitIdx, int16 mode) {
 	set_ats_mem(mode);
-	_G(bit)->del_bit(&_ats_sheader[txtNr * MAX_ATS_STATUS], bitIdx);
+	_ats_sheader[txtNr * MAX_ATS_STATUS] &= ~bitIdx;
 }
 
 char *Atdsys::ats_search_block(int16 txtMode, char *txtAdr) {
@@ -843,11 +842,10 @@ void Atdsys::ats_search_str(int16 *nr, uint8 *status, uint8 controlByte, char **
 				}
 
 				if (tmp_str[1] != ATDS_END) {
-					if (!_G(bit)->is_bit(controlByte, ATS_COUNT_BIT))
+					if (!(controlByte & ATS_COUNT_BIT))
 						++*status;
 				} else {
-
-					if (_G(bit)->is_bit(controlByte, ATS_RESET_BIT))
+					if (controlByte & ATS_RESET_BIT)
 						*status = 0;
 				}
 			}
diff --git a/engines/chewy/bitclass.h b/engines/chewy/bitclass.h
deleted file mode 100644
index e9ad786507b..00000000000
--- a/engines/chewy/bitclass.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef CHEWY_BITCLASS_H
-#define CHEWY_BITCLASS_H
-
-namespace Chewy {
-
-class BitClass {
-public:
-	BitClass() {}
-	~BitClass() {}
-
-	bool is_bit(int16 value, int16 bit) { return (value & bit) != 0; }
-	void set_bit(int16 *value, int16 bit) { *value |= bit; }
-	void del_bit(int16 *value, int16 bit) { *value &= ~bit;}
-
-	bool is_bit(uint8 value, int16 bit) { return (value & bit) != 0; }
-	void set_bit(uint8 *value, int16 bit) { *value |= bit; }
-	void del_bit(uint8 *value, int16 bit) { *value &= ~bit;}
-};
-
-} // namespace Chewy
-
-#endif
diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h
index e00d72c20af..72973f6acec 100644
--- a/engines/chewy/globals.h
+++ b/engines/chewy/globals.h
@@ -30,7 +30,6 @@
 #include "chewy/movclass.h"
 #include "chewy/timer.h"
 #include "chewy/gedclass.h"
-#include "chewy/bitclass.h"
 #include "chewy/text.h"
 #include "chewy/object.h"
 #include "chewy/effect.h"
@@ -191,7 +190,6 @@ public:
 	TafSeqInfo *_howard_taf = nullptr;
 	TafInfo *_chewy = nullptr;
 	int16 *_chewy_kor = nullptr;
-	BitClass *_bit = nullptr;
 	GedClass *_ged = nullptr;
 	Text *_txt = nullptr;
 	Room *_room = nullptr;
diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp
index f8a16f5b8fb..dd88801ccb6 100644
--- a/engines/chewy/inits.cpp
+++ b/engines/chewy/inits.cpp
@@ -35,7 +35,6 @@ void standard_init() {
 	_G(in) = new InputMgr();
 	_G(fx) = new Effect();
 	_G(txt) = new Text();
-	_G(bit) = new BitClass();
 	_G(ged) = new GedClass(&ged_user_func);
 	_G(room) = new Room();
 	_G(obj) = new Object(&_G(spieler));
@@ -269,7 +268,6 @@ void tidy() {
 	delete _G(obj);
 	delete _G(room);
 	delete _G(ged);
-	delete _G(bit);
 	delete _G(txt);
 	delete _G(fx);
 	delete _G(in);
@@ -286,7 +284,6 @@ void tidy() {
 	_G(obj) = nullptr;
 	_G(room) = nullptr;
 	_G(ged) = nullptr;
-	_G(bit) = nullptr;
 	_G(txt) = nullptr;
 	_G(fx) = nullptr;
 	_G(in) = nullptr;




More information about the Scummvm-git-logs mailing list