[Scummvm-git-logs] scummvm master -> 59eac075504d8c0844fd3fa9b046cdf209395c35

bluegr noreply at scummvm.org
Sat May 21 14:13:24 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:
59eac07550 CHEWY: Simplify the barrier (GED) code


Commit: 59eac075504d8c0844fd3fa9b046cdf209395c35
    https://github.com/scummvm/scummvm/commit/59eac075504d8c0844fd3fa9b046cdf209395c35
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-05-21T17:12:53+03:00

Commit Message:
CHEWY: Simplify the barrier (GED) code

Changed paths:
    engines/chewy/gedclass.cpp
    engines/chewy/gedclass.h
    engines/chewy/globals.h
    engines/chewy/inits.cpp
    engines/chewy/main.cpp
    engines/chewy/movclass.cpp
    engines/chewy/ngstypes.cpp
    engines/chewy/ngstypes.h
    engines/chewy/r_event.cpp
    engines/chewy/room.cpp
    engines/chewy/room.h
    engines/chewy/rooms/room00.cpp
    engines/chewy/rooms/room02.cpp
    engines/chewy/rooms/room52.cpp
    engines/chewy/rooms/room63.cpp
    engines/chewy/sprite.cpp


diff --git a/engines/chewy/gedclass.cpp b/engines/chewy/gedclass.cpp
index da602089a1e..c67768c92ca 100644
--- a/engines/chewy/gedclass.cpp
+++ b/engines/chewy/gedclass.cpp
@@ -26,60 +26,161 @@
 
 namespace Chewy {
 
-void GedClass::load_ged_pool(const char *fname, GedChunkHeader *Gh, int16 ch_nr, byte *speicher) {
+void GedClass::load_ged_pool(GedChunkHeader *Gh, int16 ch_nr, byte *speicher) {
 	Common::File f;
-	if (f.open(fname)) {
-		load_ged_pool(&f, Gh, ch_nr, speicher);
-	} else {
+	if (!f.open(EPISODE1_GEP))
 		error("load_ged_pool error");
-	}
-}
 
-void GedClass::load_ged_pool(Common::SeekableReadStream *stream, GedChunkHeader *Gh, int16 ch_nr, byte *speicher) {
-	if (stream) {
-		stream->seek(0, SEEK_SET);
-		if (_gedPoolHeader.load(stream)) {
-			load_ged_chunk(Gh, stream, ch_nr, speicher);
-		}
-	} else {
-		error("load_ged_pool error");
-	}
-}
+	f.seek(6, SEEK_SET); // skip header (4 bytes ID + 2 bytes number)
 
-void GedClass::load_ged_chunk(GedChunkHeader *Gh, Common::SeekableReadStream *stream, int16 nr, byte *speicher) {
-	if (stream) {
-		// Scan for the correct index entry
-		int i = 0;
-		do {
-			Gh->load(stream);
-			if (i != nr) {
-				// Skip over the entry's data
-				stream->seek(Gh->Len, SEEK_CUR);
-			}
-		} while (++i <= nr);
-
-		if (stream->read(speicher, Gh->Len) != Gh->Len) {
-			error("load_ged_chunk error");
+	// Scan for the correct index entry
+	int i = 0;
+	do {
+		Gh->load(&f);
+		if (i != ch_nr) {
+			// Skip over the entry's data
+			f.seek(Gh->Len, SEEK_CUR);
 		}
-	} else {
+	} while (++i <= ch_nr);
+
+	if (f.read(speicher, Gh->Len) != Gh->Len) {
 		error("load_ged_chunk error");
 	}
 }
 
-int16 GedClass::ged_idx(int16 x, int16 y, int16 x_anz, byte *speicher) {
-	int16 result = 0;
-	if (_gedUserFunc)
-		result = _gedUserFunc(speicher[((y / 8) * x_anz) + (x / 8)]);
-
-	return result;
+int16 GedClass::getBarrierId(int16 x, int16 y, int16 x_anz, byte *speicher) {
+	return getBarrierId(((y / 8) * x_anz) + (x / 8), speicher);
 }
 
-int16 GedClass::ged_idx(int16 g_idx, int16 x_anz, byte *speicher) {
-	int16 result = 0;
-	if (_gedUserFunc)
-		result = _gedUserFunc(speicher[g_idx]);
+int16 GedClass::getBarrierId(int16 g_idx, byte *speicher) {
+	int16 idx_nr = speicher[g_idx];
+
+	switch (idx_nr) {
+	case 40:
+		switch (_G(gameState)._personRoomNr[P_CHEWY]) {
+		case 8:
+			if (_G(gameState).R8GTuer)
+				idx_nr = 0;
+			break;
+
+		case 9:
+			if (!_G(gameState).R9Gitter)
+				idx_nr = 0;
+			break;
+
+		case 16:
+			if (!_G(gameState).R16F5Exit)
+				idx_nr = 0;
+			break;
+
+		case 17:
+			if (_G(gameState).R17Location != 1)
+				idx_nr = 0;
+			break;
+
+		case 21:
+			if (!_G(gameState).R21Laser2Weg)
+				idx_nr = 0;
+			break;
+
+		case 31:
+			if (!_G(gameState).R31KlappeZu)
+				idx_nr = 0;
+			break;
+
+		case 41:
+			if (!_G(gameState).R41LolaOk)
+				idx_nr = 0;
+			break;
+
+		case 52:
+			if (!_G(gameState).R52LichtAn)
+				idx_nr = 2;
+			else
+				idx_nr = 4;
+			break;
+
+		case 71:
+			idx_nr = _G(gameState).R71LeopardVined ? 1 : 0;
+			break;
+
+		case 76:
+			idx_nr = _G(gameState).flags29_4 ? 4 : 0;
+			break;
+
+		case 84:
+			if (!_G(gameState).R88UsedMonkey)
+				_G(gameState).R84GoonsPresent = true;
+			break;
+
+		case 86:
+			if (!_G(gameState).flags32_2)
+				idx_nr = 0;
+			break;
+
+		case 94:
+			if (!_G(gameState).flags35_10)
+				idx_nr = 0;
+			break;
+
+		case 97:
+			if (_G(gameState).flags35_80)
+				idx_nr = 0;
+			break;
+
+		default:
+			break;
+		}
+		break;
+
+	case 41:
+		switch (_G(gameState)._personRoomNr[P_CHEWY]) {
+		case 17:
+			if (_G(gameState).R17Location != 2)
+				idx_nr = 0;
+			break;
+
+		case 21:
+			if (!_G(gameState).R21Laser1Weg) {
+				idx_nr = 0;
+			} else
+				idx_nr = 3;
+			break;
+
+		case 37:
+			if (!_G(gameState).R37Kloppe)
+				idx_nr = 0;
+			break;
+
+		case 52:
+			if (!_G(gameState).R52TuerAuf)
+				idx_nr = 2;
+			else
+				idx_nr = 4;
+			break;
+
+		case 97:
+			if (_G(gameState).flags36_20)
+				idx_nr = 0;
+			break;
+
+		default:
+			break;
+		}
+		break;
+
+	case 42:
+		if (_G(gameState)._personRoomNr[P_CHEWY] == 97) {
+			if (!_G(gameState).flags37_1)
+				idx_nr = 0;
+		}
+		break;
+
+	default:
+		break;
+	}
 
-	return result;
+	return idx_nr;
 }
 
 } // namespace Chewy
diff --git a/engines/chewy/gedclass.h b/engines/chewy/gedclass.h
index 9b29682a242..8e9b0cebc8e 100644
--- a/engines/chewy/gedclass.h
+++ b/engines/chewy/gedclass.h
@@ -26,24 +26,14 @@
 
 namespace Chewy {
 
-typedef int16(*GedUserFunc)(int16 idx_nr);
-
 class GedClass {
 public:
-	GedClass(GedUserFunc func) : _gedUserFunc(func) {
-	}
-
-	void load_ged_pool(const char *fname, GedChunkHeader *Gh, int16 ch_nr, byte *speicher);
-
-	void load_ged_pool(Common::SeekableReadStream *stream, GedChunkHeader *Gh, int16 ch_nr, byte *speicher);
-	int16 ged_idx(int16 x, int16 y, int16 x_anz, byte *speicher);
-	int16 ged_idx(int16 g_idx, int16 x_anz, byte *speicher);
+	GedClass() {}
 
-private:
-	void load_ged_chunk(GedChunkHeader *Gh, Common::SeekableReadStream *stream, int16 nr, byte *speicher);
+	void load_ged_pool(GedChunkHeader *Gh, int16 ch_nr, byte *speicher);
 
-	GedPoolHeader _gedPoolHeader;
-	GedUserFunc _gedUserFunc;
+	int16 getBarrierId(int16 x, int16 y, int16 x_anz, byte *speicher);
+	int16 getBarrierId(int16 g_idx, byte *speicher);
 };
 
 } // namespace Chewy
diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h
index 008875161a8..60a47fce881 100644
--- a/engines/chewy/globals.h
+++ b/engines/chewy/globals.h
@@ -305,7 +305,7 @@ void delInventory(int16 nr);
 
 bool isCurInventory(int16 nr);
 
-void check_shad(int16 palIdx, int16 mode);
+void checkShadow(int16 palIdx, int16 mode);
 
 void get_scroll_off(int16 x, int16 y, int16 pic_x, int16 pic_y,
                     int16 *sc_x, int16 *sc_y);
@@ -389,8 +389,6 @@ void timer_action(int16 t_nr);
 
 void check_ged_action(int16 index);
 
-int16 ged_user_func(int16 idx_nr);
-
 void enter_room(int16 eib_nr);
 
 void exit_room(int16 eib_nr);
diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp
index ddb128b3816..f035b6c676c 100644
--- a/engines/chewy/inits.cpp
+++ b/engines/chewy/inits.cpp
@@ -38,7 +38,7 @@ void standard_init() {
 	_G(in) = new InputMgr();
 	_G(fx) = new Effect();
 	_G(txt) = new Text();
-	_G(ged) = new GedClass(&ged_user_func);
+	_G(ged) = new GedClass();
 	_G(room) = new Room();
 	_G(obj) = new Object(&_G(gameState));
 	_G(uhr) = new Timer(MAX_TIMER_OBJ, _G(ani_timer));
@@ -158,8 +158,6 @@ void init_room() {
 	_G(room_blk).Rsi = _G(gameState).room_s_obj;
 	_G(room_blk).AadLoad = true;
 	_G(room_blk).AtsLoad = true;
-
-	_G(room)->open_handle(EPISODE1_GEP, R_GEP_DATA);
 }
 
 void new_game() {
diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index dabd5f548df..71878fc7c4e 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -423,11 +423,11 @@ static void showWalkAreas() {
 
 	for (int y = 0, yp = ys; y < 200 / 8; ++y, yp += 8) {
 		for (int x = 0, xp = xs; x < 320 / 8; ++x, xp += 8) {
-			int idx = _G(ged)->ged_idx(xp, yp,
+			const int paletteId = _G(ged)->getBarrierId(xp, yp,
 				_G(room)->_gedXNr[_G(room_blk).AkAblage],
 				_G(ged_mem)[_G(room_blk).AkAblage]);
 
-			if (idx) {
+			if (paletteId) {
 				Common::Rect r(xp, yp, xp + 8, yp + 8);
 				r.translate(-_G(gameState).scrollx, -_G(gameState).scrolly);
 				r.clip(Common::Rect(0, 0, 320, 200));
@@ -526,12 +526,12 @@ void setupScreen(SetupScreenMode mode) {
 		calc_auto_go();
 
 		if (_G(fx_blend)) {
-			int16 idx = _G(ged)->ged_idx(
+			const int16 paletteId = _G(ged)->getBarrierId(
 				_G(spieler_vector)[P_CHEWY].Xypos[0] + _G(spieler_mi)[P_CHEWY].HotX,
 				_G(spieler_vector)[P_CHEWY].Xypos[1] + _G(spieler_mi)[P_CHEWY].HotY,
 				_G(room)->_gedXNr[_G(room_blk).AkAblage],
 				_G(ged_mem)[_G(room_blk).AkAblage]);
-			check_shad(idx, 0);
+			checkShadow(paletteId, 0);
 		} else {
 			for (i = 0; i < MAX_PERSON; i++) {
 				mov_objekt(&_G(spieler_vector)[i], &_G(spieler_mi)[i]);
@@ -1034,7 +1034,7 @@ void palcopy(byte *destPal, const byte *srcPal, int16 destStartIndex, int16 srcS
 	}
 }
 
-void check_shad(int16 palIdx, int16 mode) {
+void checkShadow(int16 palIdx, int16 mode) {
 	static const uint8 PAL_0[] = {
 		0, 0, 0,
 		39, 0, 26,
@@ -1708,11 +1708,11 @@ void calc_ausgang(int16 x, int16 y) {
 				               ScrXy[0], ScrXy[1],
 				               &_G(gameState).scrollx, &_G(gameState).scrolly);
 
-				int16 u_idx = _G(ged)->ged_idx(_G(spieler_vector)[P_CHEWY].Xypos[0] + _G(spieler_mi)[P_CHEWY].HotX,
+				const int16 paletteId = _G(ged)->getBarrierId(_G(spieler_vector)[P_CHEWY].Xypos[0] + _G(spieler_mi)[P_CHEWY].HotX,
 				                               _G(spieler_vector)[P_CHEWY].Xypos[1] + _G(spieler_mi)[P_CHEWY].HotY,
 				                               _G(room)->_gedXNr[_G(room_blk).AkAblage],
 				                               _G(ged_mem)[_G(room_blk).AkAblage]);
-				check_shad(u_idx, 0);
+				checkShadow(paletteId, 0);
 				setPersonSpr(_G(Rdi)->AutoMov[_G(gameState).room_e_obj[nr].ExitMov]._sprNr, P_CHEWY);
 				_G(spieler_vector)[P_CHEWY]._delayCount = 0;
 				_G(fx_blend) = BLEND1;
diff --git a/engines/chewy/movclass.cpp b/engines/chewy/movclass.cpp
index c5b08707ed4..8642142b84a 100644
--- a/engines/chewy/movclass.cpp
+++ b/engines/chewy/movclass.cpp
@@ -207,7 +207,7 @@ void MovClass::calc_xy() {
 	int16 xvector = 0;
 	int16 yvector = 0;
 
-	if (!_G(ged)->ged_idx(_gpkt->Dx, _gpkt->Dy, _gpkt->Breite, _gpkt->Mem)) {
+	if (!_G(ged)->getBarrierId(_gpkt->Dx, _gpkt->Dy, _gpkt->Breite, _gpkt->Mem)) {
 		int16 ende = 0;
 		int16 count = 0;
 		int16 min_x = -1;
@@ -249,7 +249,7 @@ void MovClass::calc_xy() {
 				for (int16 i = 0; i < anz; i++) {
 					if (x >= 0 && x < _gpkt->Breite * 8 &&
 					        y >= 0 && y < _gpkt->Hoehe * 8) {
-						if (_G(ged)->ged_idx(x, y, _gpkt->Breite, _gpkt->Mem)) {
+						if (_G(ged)->getBarrierId(x, y, _gpkt->Breite, _gpkt->Mem)) {
 							int16 aksteps = abs(_gpkt->Dx - x);
 							aksteps += abs(_gpkt->Dy - y);
 							if (aksteps < min_steps) {
@@ -328,15 +328,15 @@ short MovClass::calc_go(int16 src_feld, int16 *dst_feld) {
 			}
 
 			tmpz = 0;
-			if (!_G(ged)->ged_idx(om.Xypos[0] + tmpx + tmpz,
+			if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
 			                  om.Xypos[1] + tmpy + tmpz,
 			                  _gpkt->Breite, _gpkt->Mem)) {
 
-				if (!_G(ged)->ged_idx(om.Xypos[0] + tmpx + tmpz,
+				if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
 				                  om.Xypos[1] + tmpz,
 				                  _gpkt->Breite, _gpkt->Mem)) {
 
-					if (!_G(ged)->ged_idx(om.Xypos[0] + tmpz,
+					if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpz,
 					                  om.Xypos[1] + tmpy + tmpz,
 					                  _gpkt->Breite, _gpkt->Mem)) {
 
@@ -426,12 +426,12 @@ void MovClass::get_mov_line() {
 		while (!ende) {
 
 			int16 tmp_feld = start_feld + count * count_vect;
-			if (_G(ged)->ged_idx(tmp_feld, _gpkt->Breite, _gpkt->Mem)) {
+			if (_G(ged)->getBarrierId(tmp_feld, _gpkt->Mem)) {
 				int16 abbruch = 0;
 				int16 vector = 0;
 				while ((tmp_feld % _gpkt->Breite) < (_gpkt->Breite - 1) && !abbruch)
 				{
-					if (_G(ged)->ged_idx(tmp_feld + vector, _gpkt->Breite, _gpkt->Mem)) {
+					if (_G(ged)->getBarrierId(tmp_feld + vector, _gpkt->Mem)) {
 						tmp_feld += vector;
 						if (speicher[tmp_feld] == MOV_LINE_IDX) {
 							ak_steps = abs((tmp_feld % _gpkt->Breite) - (start_feld % _gpkt->Breite));
@@ -452,7 +452,7 @@ void MovClass::get_mov_line() {
 				vector = LEFT_VECT;
 				abbruch = 0;
 				while ((tmp_feld % _gpkt->Breite) > 0 && !abbruch) {
-					if (_G(ged)->ged_idx(tmp_feld + vector, _gpkt->Breite, _gpkt->Mem)) {
+					if (_G(ged)->getBarrierId(tmp_feld + vector, _gpkt->Mem)) {
 						tmp_feld += vector;
 						if (speicher[tmp_feld] == MOV_LINE_IDX) {
 							ak_steps = abs((tmp_feld % _gpkt->Breite) - (start_feld % _gpkt->Breite));
diff --git a/engines/chewy/ngstypes.cpp b/engines/chewy/ngstypes.cpp
index 0681a0f2aa1..d55497c5739 100644
--- a/engines/chewy/ngstypes.cpp
+++ b/engines/chewy/ngstypes.cpp
@@ -32,13 +32,6 @@ bool NewPhead::load(Common::SeekableReadStream *src) {
 	return true;
 }
 
-bool GedPoolHeader::load(Common::SeekableReadStream *src) {
-	src->read(_id, 4);
-	_nr = src->readUint16LE();
-
-	return true;
-}
-
 bool GedChunkHeader::load(Common::SeekableReadStream *src) {
 	Len = src->readUint32LE();
 	X = src->readSint16LE();
diff --git a/engines/chewy/ngstypes.h b/engines/chewy/ngstypes.h
index af2edd72dbe..f6c17a82592 100644
--- a/engines/chewy/ngstypes.h
+++ b/engines/chewy/ngstypes.h
@@ -60,13 +60,6 @@ struct musik_info {
 	char *cur_pattern = nullptr;
 };
 
-struct GedPoolHeader {
-	char _id[4] = { 0 };
-	int16 _nr = 0;
-
-	bool load(Common::SeekableReadStream *src);
-};
-
 struct GedChunkHeader {
 	uint32 Len = 0;
 	int16 X = 0;
diff --git a/engines/chewy/r_event.cpp b/engines/chewy/r_event.cpp
index d64b415c29a..09692698524 100644
--- a/engines/chewy/r_event.cpp
+++ b/engines/chewy/r_event.cpp
@@ -172,135 +172,6 @@ void check_ged_action(int16 index) {
 	g_events->_kbInfo._scanCode = Common::KEYCODE_INVALID;
 }
 
-int16 ged_user_func(int16 idx_nr) {
-	switch (idx_nr) {
-	case 40:
-		switch (_G(gameState)._personRoomNr[P_CHEWY]) {
-		case 8:
-			if (_G(gameState).R8GTuer)
-				idx_nr = 0;
-			break;
-
-		case 9:
-			if (!_G(gameState).R9Gitter)
-				idx_nr = 0;
-			break;
-
-		case 16:
-			if (!_G(gameState).R16F5Exit)
-				idx_nr = 0;
-			break;
-
-		case 17:
-			if (_G(gameState).R17Location != 1)
-				idx_nr = 0;
-			break;
-
-		case 21:
-			if (!_G(gameState).R21Laser2Weg)
-				idx_nr = 0;
-			break;
-
-		case 31:
-			if (!_G(gameState).R31KlappeZu)
-				idx_nr = 0;
-			break;
-
-		case 41:
-			if (!_G(gameState).R41LolaOk)
-				idx_nr = 0;
-			break;
-
-		case 52:
-			if (!_G(gameState).R52LichtAn)
-				idx_nr = 2;
-			else
-				idx_nr = 4;
-			break;
-
-		case 71:
-			idx_nr = _G(gameState).R71LeopardVined ? 1 : 0;
-			break;
-
-		case 76:
-			idx_nr = _G(gameState).flags29_4 ? 4 : 0;
-			break;
-
-		case 84:
-			if (!_G(gameState).R88UsedMonkey)
-				_G(gameState).R84GoonsPresent = true;
-			break;
-
-		case 86:
-			if (!_G(gameState).flags32_2)
-				idx_nr = 0;
-			break;
-
-		case 94:
-			if (!_G(gameState).flags35_10)
-				idx_nr = 0;
-			break;
-
-		case 97:
-			if (_G(gameState).flags35_80)
-				idx_nr = 0;
-			break;
-
-		default:
-			break;
-		}
-		break;
-
-	case 41:
-		switch (_G(gameState)._personRoomNr[P_CHEWY]) {
-		case 17:
-			if (_G(gameState).R17Location != 2)
-				idx_nr = 0;
-			break;
-
-		case 21:
-			if (!_G(gameState).R21Laser1Weg) {
-				idx_nr = 0;
-			} else
-				idx_nr = 3;
-			break;
-
-		case 37:
-			if (!_G(gameState).R37Kloppe)
-				idx_nr = 0;
-			break;
-
-		case 52:
-			if (!_G(gameState).R52TuerAuf)
-				idx_nr = 2;
-			else
-				idx_nr = 4;
-			break;
-
-		case 97:
-			if (_G(gameState).flags36_20)
-				idx_nr = 0;
-			break;
-
-		default:
-			break;
-		}
-		break;
-
-	case 42:
-		if (_G(gameState)._personRoomNr[P_CHEWY] == 97) {
-			if (!_G(gameState).flags37_1)
-				idx_nr = 0;
-		}
-		break;
-
-	default:
-		break;
-	}
-
-	return idx_nr;
-}
-
 void enter_room(int16 eib_nr) {
 	load_room_music(_G(gameState)._personRoomNr[P_CHEWY]);
 	load_chewy_taf(_G(gameState).ChewyAni);
@@ -1243,7 +1114,7 @@ int16 sib_event_no_inv(int16 sib_nr) {
 	case SIB_LAMPE_R52:
 		_G(atds)->delControlBit(338, ATS_ACTIVE_BIT);
 		_G(gameState).R52LichtAn ^= 1;
-		check_shad(2 * (_G(gameState).R52LichtAn + 1), 1);
+		checkShadow(2 * (_G(gameState).R52LichtAn + 1), 1);
 		break;
 
 	case SIB_KAUTABAK_R56:
diff --git a/engines/chewy/room.cpp b/engines/chewy/room.cpp
index 171ff81b275..fe0f3467198 100644
--- a/engines/chewy/room.cpp
+++ b/engines/chewy/room.cpp
@@ -150,36 +150,13 @@ Room::Room() {
 	_roomTimer._timerMaxNr = 0;
 	_roomTimer._timerStart = 0;
 	init_ablage();
-	for (int16 i = 0; i < MAX_ROOM_HANDLE; i++)
-		_roomHandle[i] = nullptr;
 	_roomInfo = nullptr;
 }
 
 Room::~Room() {
-	for (int16 i = 0; i < MAX_ROOM_HANDLE; i++) {
-		if (_roomHandle[i])
-			delete _roomHandle[i];
-	}
-
 	free_ablage();
 }
 
-Common::Stream *Room::open_handle(const char *fname1, int16 mode) {
-	assert(mode == R_GEP_DATA || mode == R_VOC_DATA);
-
-	Common::File *f = new Common::File();
-	f->open(fname1);
-	if (f->isOpen()) {
-		if (_roomHandle[mode])
-			delete _roomHandle[mode];
-		_roomHandle[mode] = f;
-	} else {
-		error("open_handle error");
-	}
-
-	return _roomHandle[mode];
-}
-
 void Room::loadRoom(RaumBlk *Rb, int16 room_nr, GameState *player) {
 	clear_prog_ani();
 	_G(det)->load_rdi(Rb->DetFile, room_nr);
@@ -334,10 +311,7 @@ int16 Room::load_tgp(int16 nr, RaumBlk *Rb, int16 tgp_idx, int16 mode, const cha
 		set_ablage_info(Rb->AkAblage, nr + (1000 * tgp_idx), img->size);
 
 		if (mode == GED_LOAD) {
-			Common::SeekableReadStream *gstream = dynamic_cast<Common::SeekableReadStream *>(
-				_roomHandle[R_GEP_DATA]);
-			_G(ged)->load_ged_pool(gstream, &_gedInfo[Rb->AkAblage],
-						        nr, _gedMem[Rb->AkAblage]);
+			_G(ged)->load_ged_pool(&_gedInfo[Rb->AkAblage], nr, _gedMem[Rb->AkAblage]);
 			_gedXNr[Rb->AkAblage] = img->width / _gedInfo[Rb->AkAblage].X;
 			_gedYNr[Rb->AkAblage] = img->height / _gedInfo[Rb->AkAblage].Y;
 		}
diff --git a/engines/chewy/room.h b/engines/chewy/room.h
index afe7f907021..76ceeb1d19b 100644
--- a/engines/chewy/room.h
+++ b/engines/chewy/room.h
@@ -38,13 +38,8 @@ extern const int16 SURIMY_TAF19_PHASES[4][2];
 
 #define ABLAGE_BLOCK_SIZE 64000l
 #define GED_BLOCK_SIZE 3000l
-#define MAX_ROOM_HANDLE 2
 #define GED_LOAD 1
 
-#define R_VOC_DATA 0
-#define R_GEP_DATA 1
-
-
 class JungleRoom {
 protected:
 	static void topEntry();
@@ -84,7 +79,6 @@ public:
 	Room();
 	~Room();
 
-	Common::Stream *open_handle(const char *fname, int16 mode);
 	void loadRoom(RaumBlk *Rb, int16 room_nr, GameState *player);
 	int16 load_tgp(int16 nr, RaumBlk *Rb, int16 tgp_idx, int16 mode, const char *fileName);
 	byte *get_ablage(int16 nr);
@@ -113,7 +107,6 @@ private:
 	int16 get_ablage_g1(int16 ablage_bedarf, int16 ak_pos);
 	void set_ablage_info(int16 ablagenr, int16 bildnr, uint32 pic_size);
 
-	GedPoolHeader _gedPoolHeader;
 	int16 _akAblage;
 	int16 _lastAblageSave;
 
@@ -122,7 +115,6 @@ private:
 	int16 _ablageInfo[MAX_ABLAGE][2];
 
 	byte *_gedMem[MAX_ABLAGE];
-	Common::Stream *_roomHandle[MAX_ROOM_HANDLE];
 };
 
 void load_chewy_taf(int16 taf_nr);
diff --git a/engines/chewy/rooms/room00.cpp b/engines/chewy/rooms/room00.cpp
index 1873e61090e..a85509f76bb 100644
--- a/engines/chewy/rooms/room00.cpp
+++ b/engines/chewy/rooms/room00.cpp
@@ -752,7 +752,7 @@ void Room0::feederAni() {
 			               _G(Rdi)->AutoMov[4]._y - CH_HOT_MOV_Y, P_CHEWY, P_RIGHT);
 			_G(spieler_vector)[P_CHEWY]._delayCount = 0;
 
-			check_shad(4, 0);
+			checkShadow(4, 0);
 			_G(fx_blend) = BLEND1;
 			setupScreen(DO_SETUP);
 		} else {
diff --git a/engines/chewy/rooms/room02.cpp b/engines/chewy/rooms/room02.cpp
index d98ce782881..b88e275b1f9 100644
--- a/engines/chewy/rooms/room02.cpp
+++ b/engines/chewy/rooms/room02.cpp
@@ -51,7 +51,7 @@ void Room2::jump_out_r1(int16 nr) {
 	_G(gameState)._personHide[P_CHEWY] = false;
 	clear_prog_ani();
 	switchRoom(1);
-	check_shad(2, 1);
+	checkShadow(2, 1);
 }
 
 void Room2::electrifyWalkway1() {
diff --git a/engines/chewy/rooms/room52.cpp b/engines/chewy/rooms/room52.cpp
index 047364ae971..58c49584f2e 100644
--- a/engines/chewy/rooms/room52.cpp
+++ b/engines/chewy/rooms/room52.cpp
@@ -52,7 +52,7 @@ void Room52::entry() {
 		autoMove(2, P_CHEWY);
 		_G(gameState).R52TuerAuf = false;
 		_G(det)->hideStaticSpr(4);
-		check_shad(2, 1);
+		checkShadow(2, 1);
 	}
 }
 
diff --git a/engines/chewy/rooms/room63.cpp b/engines/chewy/rooms/room63.cpp
index 0c15e0a50af..c5a9e5773e0 100644
--- a/engines/chewy/rooms/room63.cpp
+++ b/engines/chewy/rooms/room63.cpp
@@ -136,7 +136,7 @@ void Room63::bork_platt() {
 	flic_cut(FCUT_081);
 	flic_cut(FCUT_082);
 	_G(gameState)._personHide[P_CHEWY] = false;
-	check_shad(4, 1);
+	checkShadow(4, 1);
 	_G(spieler_mi)[P_CHEWY].Mode = true;
 	autoMove(6, P_CHEWY);
 	_G(spieler_mi)[P_CHEWY].Mode = false;
diff --git a/engines/chewy/sprite.cpp b/engines/chewy/sprite.cpp
index 9ce4e7f2bba..5ff7ad9959c 100644
--- a/engines/chewy/sprite.cpp
+++ b/engines/chewy/sprite.cpp
@@ -323,10 +323,10 @@ void setPersonPos(int16 x, int16 y, int16 personNr, int16 direction) {
 	int16 y1 = _G(spieler_vector)[personNr].Xypos[1] - _G(gameState).scrolly;
 	_G(atds)->set_split_win(tmpNr, x1, y1);
 	if (!_G(flags).ExitMov && personNr == P_CHEWY) {
-		int16 u_index = _G(ged)->ged_idx(x + _G(spieler_mi)[personNr].HotX, y + _G(spieler_mi)[personNr].HotY,
+		const int16 paletteId = _G(ged)->getBarrierId(x + _G(spieler_mi)[personNr].HotX, y + _G(spieler_mi)[personNr].HotY,
 		                                 _G(room)->_gedXNr[_G(room_blk).AkAblage],
 		                                 _G(ged_mem)[_G(room_blk).AkAblage]);
-		check_shad(u_index, 1);
+		checkShadow(paletteId, 1);
 	}
 }
 
@@ -774,17 +774,17 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 			}
 
 			if (!mi->Mode) {
-				if (!(u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX + tmpx,
+				if (!(u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX + tmpx,
 				                              om->Xypos[1] + mi->HotY + tmpy,
 				                              _G(room)->_gedXNr[_G(room_blk).AkAblage],
 				                              _G(ged_mem)[_G(room_blk).AkAblage]))) {
 
-					if (!(u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX + tmpx,
+					if (!(u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX + tmpx,
 					                              om->Xypos[1] + mi->HotY,
 					                              _G(room)->_gedXNr[_G(room_blk).AkAblage],
 					                              _G(ged_mem)[_G(room_blk).AkAblage]))) {
 
-						if (!(u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX,
+						if (!(u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX,
 						                              om->Xypos[1] + mi->HotY + tmpy,
 						                              _G(room)->_gedXNr[_G(room_blk).AkAblage],
 						                              _G(ged_mem)[_G(room_blk).AkAblage]))) {
@@ -797,7 +797,7 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 									tmpy = 1;
 							}
 							if (mi->Id == CHEWY_OBJ)
-								check_shad(u_index, 1);
+								checkShadow(u_index, 1);
 
 							if (abs(om->Xypos[1] - mi->XyzEnd[1]) <= abs(tmpy)) {
 								om->Count = 0;
@@ -834,7 +834,7 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 								tmpx = 1;
 						}
 						if (mi->Id == CHEWY_OBJ)
-							check_shad(u_index, 1);
+							checkShadow(u_index, 1);
 
 						if (abs(om->Xypos[0] - mi->XyzEnd[0]) <= abs(tmpx)) {
 							om->Count = 0;
@@ -866,7 +866,7 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 					}
 				} else {
 					if (mi->Id == CHEWY_OBJ)
-						check_shad(u_index, 1);
+						checkShadow(u_index, 1);
 					om->Xypos[0] += tmpx;
 					om->Xypos[1] += tmpy;
 					om->Xypos[2] += tmpz;
@@ -889,11 +889,11 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 				om->Xypos[1] += tmpy;
 				om->Xypos[2] += tmpz;
 				if (mi->Id == CHEWY_OBJ) {
-					u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX,
+					u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX,
 					                        om->Xypos[1] + mi->HotY,
 					                        _G(room)->_gedXNr[_G(room_blk).AkAblage],
 					                        _G(ged_mem)[_G(room_blk).AkAblage]);
-					check_shad(u_index, 1);
+					checkShadow(u_index, 1);
 				}
 			}
 			if (mi->Id == CHEWY_OBJ) {




More information about the Scummvm-git-logs mailing list