[Scummvm-git-logs] scummvm master -> 2f00e8d279af5bca5700e0b5f287c4f8ea5d300d

bluegr noreply at scummvm.org
Sun May 22 14:30:31 UTC 2022


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

Summary:
356592417e CHEWY: Cleanup defines
58cc03fac0 CHEWY: Remove _cursorMoveFl
f367a2b42b CHEWY: Rename Debugger to Console
5209a028cf CHEWY: Refactor the room barrier (GED) code
2f00e8d279 CHEWY: Rename ged to barriers


Commit: 356592417e2ed24cd5e0621011da4b23c74f9069
    https://github.com/scummvm/scummvm/commit/356592417e2ed24cd5e0621011da4b23c74f9069
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-05-22T17:29:56+03:00

Commit Message:
CHEWY: Cleanup defines

Changed paths:
  R engines/chewy/ngsdefs.h
    engines/chewy/atds.cpp
    engines/chewy/detail.cpp
    engines/chewy/dialogs/files.cpp
    engines/chewy/events.cpp
    engines/chewy/events.h
    engines/chewy/mouse.cpp
    engines/chewy/mouse.h


diff --git a/engines/chewy/atds.cpp b/engines/chewy/atds.cpp
index f9ede8a85a5..157ce75c4c7 100644
--- a/engines/chewy/atds.cpp
+++ b/engines/chewy/atds.cpp
@@ -27,7 +27,6 @@
 #include "chewy/main.h"
 #include "chewy/mcga_graphics.h"
 #include "chewy/mouse.h"
-#include "chewy/ngsdefs.h"
 #include "chewy/sound.h"
 #include "chewy/text.h"
 
diff --git a/engines/chewy/detail.cpp b/engines/chewy/detail.cpp
index 7304cacb761..57c9410562c 100644
--- a/engines/chewy/detail.cpp
+++ b/engines/chewy/detail.cpp
@@ -23,12 +23,14 @@
 #include "chewy/globals.h"
 #include "chewy/mcga_graphics.h"
 #include "chewy/memory.h"
-#include "chewy/ngsdefs.h"
 #include "chewy/sound.h"
 #include "chewy/resource.h"
 
 namespace Chewy {
 
+#define ON 1
+#define OFF 0
+
 bool RoomInfo::load(Common::SeekableReadStream *src) {
 	_roomNr = src->readByte();
 	_imageNr = src->readByte();
diff --git a/engines/chewy/dialogs/files.cpp b/engines/chewy/dialogs/files.cpp
index b919627d4cf..446185bd9cb 100644
--- a/engines/chewy/dialogs/files.cpp
+++ b/engines/chewy/dialogs/files.cpp
@@ -27,7 +27,6 @@
 #include "chewy/globals.h"
 #include "chewy/mcga_graphics.h"
 #include "chewy/memory.h"
-#include "chewy/ngsdefs.h"
 
 namespace Chewy {
 namespace Dialogs {
diff --git a/engines/chewy/events.cpp b/engines/chewy/events.cpp
index 1c7c42e6ea8..f77d3c5e95f 100644
--- a/engines/chewy/events.cpp
+++ b/engines/chewy/events.cpp
@@ -23,7 +23,6 @@
 #include "chewy/events.h"
 #include "chewy/globals.h"
 #include "chewy/mouse.h"
-#include "chewy/ngsdefs.h"
 
 namespace Chewy {
 
diff --git a/engines/chewy/events.h b/engines/chewy/events.h
index caf315880fd..6ca333e5c97 100644
--- a/engines/chewy/events.h
+++ b/engines/chewy/events.h
@@ -157,6 +157,7 @@ extern char getch();
 
 #define EVENTS_UPDATE g_events->update()
 #define EVENTS_CLEAR g_events->clearEvents()
+#define ALT 0x1000
 
 } // namespace Chewy
 
diff --git a/engines/chewy/mouse.cpp b/engines/chewy/mouse.cpp
index 3b621b618e0..d3ce932eebf 100644
--- a/engines/chewy/mouse.cpp
+++ b/engines/chewy/mouse.cpp
@@ -23,7 +23,6 @@
 #include "chewy/mouse.h"
 #include "chewy/events.h"
 #include "chewy/globals.h"
-#include "chewy/ngsdefs.h"
 
 namespace Chewy {
 
diff --git a/engines/chewy/mouse.h b/engines/chewy/mouse.h
index d233289e77c..b87a2b53b15 100644
--- a/engines/chewy/mouse.h
+++ b/engines/chewy/mouse.h
@@ -29,6 +29,9 @@ namespace Chewy {
 
 extern bool _cursorMoveFl;
 
+#define MOUSE_LEFT 255
+#define MOUSE_CENTER 254
+
 class InputMgr {
 public:
 	InputMgr();
diff --git a/engines/chewy/ngsdefs.h b/engines/chewy/ngsdefs.h
deleted file mode 100644
index 0d937674010..00000000000
--- a/engines/chewy/ngsdefs.h
+++ /dev/null
@@ -1,71 +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_NGSDEFS_H
-#define CHEWY_NGSDEFS_H
-
-#include "common/events.h"
-
-namespace Chewy {
-
-#define MAXSPRITE 620
-#define NOSPEICHER 0
-#define MAXFONTBREITE 32
-#define MAXFONTHOEHE 32
-
-#define CHECK 0x00
-#define WRITE 0x04
-#define READ 0x08
-
-#define MCGA_SPEICHER 64000L
-#define SETZEN 0
-#define UND 1
-#define ODER 2
-#define XODER 3
-
-#define COPY_PAGE _G(out)->screen2screen
-
-#define END_POOL 32767
-
-#define MAXDIRS 50
-#define MAXFNAMEN 50
-#define MOD15 10
-#define TYPE_ANZ 27
-#define TMFDATA 6
-#define SCREENSAVE 0
-#define SPRITESAVE 1
-
-#define ALT 0x1000
-
-#define MOUSE_LEFT 255
-#define MOUSE_RIGHT 1
-#define MOUSE_CENTER 254
-
-#define SOUND 5
-#define BASE 0x220
-#define JA 1
-#define NEIN 0
-#define ON 1
-#define OFF 0
-
-} // namespace Chewy
-
-#endif


Commit: 58cc03fac0f1e59115194388bdbcad2c6d087da7
    https://github.com/scummvm/scummvm/commit/58cc03fac0f1e59115194388bdbcad2c6d087da7
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-05-22T17:29:56+03:00

Commit Message:
CHEWY: Remove _cursorMoveFl

It's really not necessary in our current code base

Changed paths:
    engines/chewy/cursor.cpp
    engines/chewy/events.cpp
    engines/chewy/main.cpp
    engines/chewy/mouse.cpp
    engines/chewy/mouse.h


diff --git a/engines/chewy/cursor.cpp b/engines/chewy/cursor.cpp
index 5b8b01e4408..b5bb8170c9a 100644
--- a/engines/chewy/cursor.cpp
+++ b/engines/chewy/cursor.cpp
@@ -38,8 +38,6 @@ Cursor::~Cursor() {
 
 void Cursor::plot_cur() {
 	if (CursorMan.isVisible()) {
-		_cursorMoveFl = false;
-
 		--_curAniCountdown;
 		if (_curAniCountdown <= 0) {
 			_curAniCountdown = _animDelay;
@@ -56,7 +54,6 @@ void Cursor::plot_cur() {
 
 void Cursor::show_cur() {
 	CursorMan.showMouse(true);
-	_cursorMoveFl = true;
 	plot_cur();
 }
 
@@ -74,7 +71,6 @@ void Cursor::setAnimation(uint8 start, uint8 end, int16 delay) {
 
 void Cursor::move(int16 x, int16 y) {
 	g_events->warpMouse(Common::Point(x, y));
-	_cursorMoveFl = CursorMan.isVisible();
 }
 
 } // namespace Chewy
diff --git a/engines/chewy/events.cpp b/engines/chewy/events.cpp
index f77d3c5e95f..b758a775922 100644
--- a/engines/chewy/events.cpp
+++ b/engines/chewy/events.cpp
@@ -129,11 +129,8 @@ void EventsManager::handleMouseEvent(const Common::Event &event) {
 	}
 
 	// Set mouse position
-	if (!_cursorMoveFl) {
-		_cursorMoveFl = true;
-		g_events->_mousePos.x = event.mouse.x;
-		g_events->_mousePos.y = event.mouse.y;
-	}
+	g_events->_mousePos.x = event.mouse.x;
+	g_events->_mousePos.y = event.mouse.y;
 }
 
 void EventsManager::handleKbdEvent(const Common::Event &event) {
diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index 5f20523ce4e..e1e59eb78e5 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -169,7 +169,6 @@ void cursorChoice(int16 nr) {
 	}
 
 	if (ok) {
-		_cursorMoveFl = true;
 		_G(gameState)._curWidth = READ_LE_INT16(_G(curblk).sprite[_G(cur)->getAnimStart()]);
 		_G(gameState)._curHeight = READ_LE_INT16(_G(curblk).sprite[_G(cur)->getAnimStart()] + 2);
 	}
diff --git a/engines/chewy/mouse.cpp b/engines/chewy/mouse.cpp
index d3ce932eebf..2d2de152d5b 100644
--- a/engines/chewy/mouse.cpp
+++ b/engines/chewy/mouse.cpp
@@ -26,8 +26,6 @@
 
 namespace Chewy {
 
-bool _cursorMoveFl;
-
 InputMgr::InputMgr() {
 }
 
diff --git a/engines/chewy/mouse.h b/engines/chewy/mouse.h
index b87a2b53b15..6477447403c 100644
--- a/engines/chewy/mouse.h
+++ b/engines/chewy/mouse.h
@@ -27,8 +27,6 @@
 
 namespace Chewy {
 
-extern bool _cursorMoveFl;
-
 #define MOUSE_LEFT 255
 #define MOUSE_CENTER 254
 


Commit: f367a2b42b621ca6fca74e35239d0a9ded68edad
    https://github.com/scummvm/scummvm/commit/f367a2b42b621ca6fca74e35239d0a9ded68edad
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-05-22T17:29:57+03:00

Commit Message:
CHEWY: Rename Debugger to Console

This aligns its name with how most engines have it named

Changed paths:
  A engines/chewy/console.cpp
  A engines/chewy/console.h
  R engines/chewy/debugger.cpp
  R engines/chewy/debugger.h
    engines/chewy/chewy.cpp
    engines/chewy/module.mk


diff --git a/engines/chewy/chewy.cpp b/engines/chewy/chewy.cpp
index 17ed69e6d80..97267c3bea9 100644
--- a/engines/chewy/chewy.cpp
+++ b/engines/chewy/chewy.cpp
@@ -25,7 +25,7 @@
 #include "engines/util.h"
 #include "graphics/palette.h"
 #include "chewy/chewy.h"
-#include "chewy/debugger.h"
+#include "chewy/console.h"
 #include "chewy/events.h"
 #include "chewy/globals.h"
 #include "chewy/main.h"
@@ -73,7 +73,7 @@ void ChewyEngine::initialize() {
 	_sound = new Sound(_mixer);
 	_video = new VideoPlayer();
 
-	setDebugger(new Debugger());
+	setDebugger(new Console());
 }
 
 Common::Error ChewyEngine::run() {
diff --git a/engines/chewy/debugger.cpp b/engines/chewy/console.cpp
similarity index 78%
rename from engines/chewy/debugger.cpp
rename to engines/chewy/console.cpp
index 9cbc6ca5519..cd53c144817 100644
--- a/engines/chewy/debugger.cpp
+++ b/engines/chewy/console.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "common/file.h"
-#include "chewy/debugger.h"
+#include "chewy/console.h"
 #include "chewy/globals.h"
 #include "chewy/chewy.h"
 #include "chewy/video/video_player.h"
@@ -43,18 +43,18 @@ static int strToInt(const char *s) {
 	return (int)tmp;
 }
 
-Debugger::Debugger() : GUI::Debugger() {
-	registerCmd("room", WRAP_METHOD(Debugger, Cmd_GotoRoom));
-	registerCmd("item", WRAP_METHOD(Debugger, Cmd_Item));
-	registerCmd("video", WRAP_METHOD(Debugger, Cmd_PlayVideo));
-	registerCmd("walk", WRAP_METHOD(Debugger, Cmd_WalkAreas));
-	registerCmd("text", WRAP_METHOD(Debugger, Cmd_Text));
+Console::Console() : GUI::Debugger() {
+	registerCmd("room", WRAP_METHOD(Console, Cmd_GotoRoom));
+	registerCmd("item", WRAP_METHOD(Console, Cmd_Item));
+	registerCmd("video", WRAP_METHOD(Console, Cmd_PlayVideo));
+	registerCmd("walk", WRAP_METHOD(Console, Cmd_WalkAreas));
+	registerCmd("text", WRAP_METHOD(Console, Cmd_Text));
 }
 
-Debugger::~Debugger() {
+Console::~Console() {
 }
 
-bool Debugger::Cmd_GotoRoom(int argc, const char **argv) {
+bool Console::Cmd_GotoRoom(int argc, const char **argv) {
 	if (argc == 1) {
 		debugPrintf("%s <roomNum>\n", argv[0]);
 		return true;
@@ -70,7 +70,7 @@ bool Debugger::Cmd_GotoRoom(int argc, const char **argv) {
 	}
 }
 
-bool Debugger::Cmd_Item(int argc, const char **argv) {
+bool Console::Cmd_Item(int argc, const char **argv) {
 	if (argc == 1) {
 		debugPrintf("%s <itemNum>\n", argv[0]);
 	} else {
@@ -82,7 +82,7 @@ bool Debugger::Cmd_Item(int argc, const char **argv) {
 	return true;
 }
 
-bool Debugger::Cmd_PlayVideo(int argc, const char **argv) {
+bool Console::Cmd_PlayVideo(int argc, const char **argv) {
 	if (argc < 2) {
 		debugPrintf("Usage: play_video <number>\n");
 		return true;
@@ -94,12 +94,12 @@ bool Debugger::Cmd_PlayVideo(int argc, const char **argv) {
 	return false;
 }
 
-bool Debugger::Cmd_WalkAreas(int argc, const char **argv) {
+bool Console::Cmd_WalkAreas(int argc, const char **argv) {
 	g_engine->_showWalkAreas = (argc == 2) && !strcmp(argv[1], "on");
 	return false;
 }
 
-bool Debugger::Cmd_Text(int argc, const char **argv) {
+bool Console::Cmd_Text(int argc, const char **argv) {
 	if (argc < 4) {
 		debugPrintf("Usage: text <chunk> <entry> <type>\n");
 		return true;
diff --git a/engines/chewy/debugger.h b/engines/chewy/console.h
similarity index 90%
rename from engines/chewy/debugger.h
rename to engines/chewy/console.h
index bb16d7d5565..41263119396 100644
--- a/engines/chewy/debugger.h
+++ b/engines/chewy/console.h
@@ -19,14 +19,14 @@
  *
  */
 
-#ifndef CHEWY_DEBUGGER_H
-#define CHEWY_DEBUGGER_H
+#ifndef CHEWY_CONSOLE_H
+#define CHEWY_CONSOLE_H
 
 #include "gui/debugger.h"
 
 namespace Chewy {
 
-class Debugger : public GUI::Debugger {
+class Console : public GUI::Debugger {
 protected:
 	bool Cmd_GotoRoom(int argc, const char **argv);
 	bool Cmd_Item(int argc, const char **argv);
@@ -35,8 +35,8 @@ protected:
 	bool Cmd_Text(int argc, const char **argv);
 
 public:
-	Debugger();
-	~Debugger() override;
+	Console();
+	~Console() override;
 };
 
 } // End of namespace Chewy
diff --git a/engines/chewy/module.mk b/engines/chewy/module.mk
index 2d64e382f42..12f37213eda 100644
--- a/engines/chewy/module.mk
+++ b/engines/chewy/module.mk
@@ -4,7 +4,7 @@ MODULE_OBJS = \
 	atds.o \
 	chewy.o \
 	cursor.o \
-	debugger.o \
+	console.o \
 	detail.o \
 	effect.o \
 	events.o \


Commit: 5209a028cf05ca538fc66ef0844998104758a4c4
    https://github.com/scummvm/scummvm/commit/5209a028cf05ca538fc66ef0844998104758a4c4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-05-22T17:29:57+03:00

Commit Message:
CHEWY: Refactor the room 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/movclass.h
    engines/chewy/ngstypes.h
    engines/chewy/resource.cpp
    engines/chewy/resource.h
    engines/chewy/room.cpp
    engines/chewy/room.h
    engines/chewy/sprite.cpp


diff --git a/engines/chewy/gedclass.cpp b/engines/chewy/gedclass.cpp
index f6183c1e9a1..a059cf57019 100644
--- a/engines/chewy/gedclass.cpp
+++ b/engines/chewy/gedclass.cpp
@@ -26,41 +26,16 @@
 
 namespace Chewy {
 
-void GedClass::load_ged_pool(GedChunkInfo *Gh, int16 ch_nr, byte *speicher) {
-	Common::File f;
-	if (!f.open(EPISODE1_GEP))
-		error("load_ged_pool error");
-
-	f.seek(6, SEEK_SET); // skip header (4 bytes ID + 2 bytes number)
-
-	// Scan for the correct index entry
-	int i = 0;
-	uint32 length = 0;
-
-	do {
-		length = f.readUint32LE();
-
-		Gh->pos.x = f.readSint16LE();
-		Gh->pos.y = f.readSint16LE();
-		Gh->level = f.readSint16LE();
-
-		if (i != ch_nr) {
-			// Skip over the entry's data
-			f.seek(length, SEEK_CUR);
-		}
-	} while (++i <= ch_nr);
-
-	if (f.read(speicher, length) != length) {
-		error("load_ged_chunk error");
-	}
-}
-
-int16 GedClass::getBarrierId(int16 x, int16 y, int16 x_anz, byte *speicher) {
-	return getBarrierId(((y / 8) * x_anz) + (x / 8), speicher);
+int16 GedClass::getBarrierId(int16 x, int16 y) {
+	const int16 width = _G(room)->_barriers->getWidth();
+	const byte *data = _G(room)->_barriers->getData();
+	const int16 result = getBarrierId(((y / 8) * width) + (x / 8), data + 6);
+	delete[] data;
+	return result;
 }
 
-int16 GedClass::getBarrierId(int16 g_idx, byte *speicher) {
-	int16 idx_nr = speicher[g_idx];
+int16 GedClass::getBarrierId(int16 g_idx, const byte *buffer) {
+	int16 idx_nr = buffer[g_idx];
 
 	switch (idx_nr) {
 	case 40:
diff --git a/engines/chewy/gedclass.h b/engines/chewy/gedclass.h
index c8d4919dca2..8e1bef96915 100644
--- a/engines/chewy/gedclass.h
+++ b/engines/chewy/gedclass.h
@@ -30,10 +30,8 @@ class GedClass {
 public:
 	GedClass() {}
 
-	void load_ged_pool(GedChunkInfo *Gh, int16 ch_nr, byte *speicher);
-
-	int16 getBarrierId(int16 x, int16 y, int16 x_anz, byte *speicher);
-	int16 getBarrierId(int16 g_idx, byte *speicher);
+	int16 getBarrierId(int16 x, int16 y);
+	int16 getBarrierId(int16 g_idx, const byte *buffer);
 };
 
 } // namespace Chewy
diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h
index 60a47fce881..2bce3a3307f 100644
--- a/engines/chewy/globals.h
+++ b/engines/chewy/globals.h
@@ -129,7 +129,6 @@ public:
 	byte **_ablage = nullptr;
 	byte *_workpage = nullptr;
 	byte *_workptr = nullptr;
-	byte **_ged_mem = nullptr;
 	byte *_spblende = nullptr;
 	char **_ads_item_ptr = nullptr;
 
diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp
index 5a7dc8f8d90..a408664f863 100644
--- a/engines/chewy/inits.cpp
+++ b/engines/chewy/inits.cpp
@@ -72,7 +72,6 @@ void standard_init() {
 
 	var_init();
 	_G(ablage) = _G(room)->get_ablage();
-	_G(ged_mem) = _G(room)->get_ged_mem();
 
 	_G(zoom_horizont) = 140;
 	_G(pal)[765] = 63;
diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index e1e59eb78e5..9421c3b5ac9 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -422,9 +422,7 @@ 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) {
-			const int barrierId = _G(ged)->getBarrierId(xp, yp,
-				_G(room)->_gedXNr[_G(room_blk).AkAblage],
-				_G(ged_mem)[_G(room_blk).AkAblage]);
+			const int barrierId = _G(ged)->getBarrierId(xp, yp);
 
 			if (barrierId) {
 				Common::Rect r(xp, yp, xp + 8, yp + 8);
@@ -503,10 +501,6 @@ void setupScreen(SetupScreenMode mode) {
 						          _G(spieler_mi)[P_CHEWY].HotX;
 						_G(gpkt).Sy = _G(spieler_vector)[P_CHEWY].Xypos[1] +
 						          _G(spieler_mi)[P_CHEWY].HotY;
-						_G(gpkt).Breite = _G(room)->_gedXNr[_G(room_blk).AkAblage];
-						_G(gpkt).Hoehe = _G(room)->_gedYNr[_G(room_blk).AkAblage];
-						_G(gpkt).Mem = _G(ged_mem)[_G(room_blk).AkAblage];
-						_G(gpkt).Ebenen = _G(room)->_gedInfo[_G(room_blk).AkAblage].level;
 						_G(gpkt).AkMovEbene = 1;
 						_G(mov)->goto_xy(&_G(gpkt));
 						_G(spieler_mi)[P_CHEWY].XyzStart[0] = _G(spieler_vector)[P_CHEWY].Xypos[0];
@@ -527,9 +521,7 @@ void setupScreen(SetupScreenMode mode) {
 		if (_G(fx_blend)) {
 			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]);
+				_G(spieler_vector)[P_CHEWY].Xypos[1] + _G(spieler_mi)[P_CHEWY].HotY);
 			checkShadow(paletteId, 0);
 		} else {
 			for (i = 0; i < MAX_PERSON; i++) {
@@ -1148,10 +1140,6 @@ bool autoMove(int16 movNr, int16 playerNum) {
 						  _G(spieler_mi)[playerNum].HotMovY + _G(spieler_mi)[playerNum].HotY;
 			_G(gpkt).Sx = _G(spieler_vector)[playerNum].Xypos[0] + _G(spieler_mi)[playerNum].HotX;
 			_G(gpkt).Sy = _G(spieler_vector)[playerNum].Xypos[1] + _G(spieler_mi)[playerNum].HotY;
-			_G(gpkt).Breite = _G(room)->_gedXNr[_G(room_blk).AkAblage];
-			_G(gpkt).Hoehe = _G(room)->_gedYNr[_G(room_blk).AkAblage];
-			_G(gpkt).Mem = _G(ged_mem)[_G(room_blk).AkAblage];
-			_G(gpkt).Ebenen = _G(room)->_gedInfo[_G(room_blk).AkAblage].level;
 			_G(gpkt).AkMovEbene = 1;
 			_G(mov)->goto_xy(&_G(gpkt));
 
@@ -1708,9 +1696,7 @@ void calc_ausgang(int16 x, int16 y) {
 				               &_G(gameState).scrollx, &_G(gameState).scrolly);
 
 				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]);
+				                                              _G(spieler_vector)[P_CHEWY].Xypos[1] + _G(spieler_mi)[P_CHEWY].HotY);
 				checkShadow(paletteId, 0);
 				setPersonSpr(_G(Rdi)->AutoMov[_G(gameState).room_e_obj[nr].ExitMov]._sprNr, P_CHEWY);
 				_G(spieler_vector)[P_CHEWY]._delayCount = 0;
diff --git a/engines/chewy/movclass.cpp b/engines/chewy/movclass.cpp
index 8642142b84a..64fd54a2806 100644
--- a/engines/chewy/movclass.cpp
+++ b/engines/chewy/movclass.cpp
@@ -27,8 +27,6 @@ namespace Chewy {
 
 #define LEFT_VECT -1
 #define RIGHT_VECT 1
-#define UP_VECT -_gpkt->Breite
-#define DOWN_VECT _gpkt->Breite
 #define MOV_START 0
 #define MOV_FOUND 1
 #define MOV_UNPASSABLE 2
@@ -59,11 +57,12 @@ MovClass::~MovClass() {
 }
 
 void MovClass::goto_xy(GotoPkt *gp) {
+	const int16 width = _G(room)->_barriers->getWidth();
 	_gpkt = gp;
 	_agv.AutoGo = false;
 	_agv.Continue = false;
-	_vecTbl[0] = -_gpkt->Breite;
-	_vecTbl[2] = _gpkt->Breite;
+	_vecTbl[0] = -width;
+	_vecTbl[2] = width;
 	_plotDelay = 20;
 	calc_xy();
 	_plotDelay = 0;
@@ -98,9 +97,12 @@ void MovClass::goto_xy(GotoPkt *gp) {
 int16 MovClass::calc_auto_go(int16 x, int16 y, int16 *auto_x, int16 *auto_y) {
 	int16 ret = -1;
 
+	const int16 width = _G(room)->_barriers->getWidth();
+	const int16 height = _G(room)->_barriers->getHeight();
 	if (_agv.AutoGo == true) {
-		byte *speicher = _gpkt->Mem;
-		speicher += (_gpkt->Breite * _gpkt->Hoehe) * _gpkt->AkMovEbene;
+		const byte *data = _G(room)->_barriers->getData();
+		const byte *buffer = data + 6;
+		buffer += (width * height) * _gpkt->AkMovEbene;
 		if (!_agv.Start) {
 			_agv.Start = _agv.PktAnz;
 			if (_agv.PktAnz == 1) {
@@ -126,7 +128,7 @@ int16 MovClass::calc_auto_go(int16 x, int16 y, int16 *auto_x, int16 *auto_y) {
 					if (_agv.LastFeld == -1) {
 						_agv.LastFeld = _gml.MLineFeld;
 						_agv.AkFeld = _gml.MLineFeld + _mle.Direction;
-						if (speicher[_agv.AkFeld] == MOV_LINE_KNOTEN) {
+						if (buffer[_agv.AkFeld] == MOV_LINE_KNOTEN) {
 							_feld1knoten = true;
 						} else
 							_feld1knoten = false;
@@ -151,13 +153,13 @@ int16 MovClass::calc_auto_go(int16 x, int16 y, int16 *auto_x, int16 *auto_y) {
 									ok = 1;
 							} else {
 								for (int16 i = 0; i < 4 && !ok; i++) {
-									if (speicher[_agv.AkFeld + _vecTbl[i]] == MOV_LINE_IDX) {
+									if (buffer[_agv.AkFeld + _vecTbl[i]] == MOV_LINE_IDX) {
 										if (_agv.AkFeld + _vecTbl[i] != _agv.LastFeld) {
 											_agv.LastFeld = _agv.AkFeld;
 											_agv.AkFeld += _vecTbl[i];
 											ok = 1;
 										}
-									} else if (speicher[_agv.AkFeld + _vecTbl[i]] == MOV_LINE_KNOTEN) {
+									} else if (buffer[_agv.AkFeld + _vecTbl[i]] == MOV_LINE_KNOTEN) {
 										if (_agv.AkFeld + _vecTbl[i] != _agv.LastFeld) {
 											_agv.LastFeld = _agv.AkFeld + _vecTbl[i];
 											_agv.AkFeld = _mle.KnPkt[_agv.AkKnoten];
@@ -185,6 +187,8 @@ int16 MovClass::calc_auto_go(int16 x, int16 y, int16 *auto_x, int16 *auto_y) {
 				}
 			}
 		}
+
+		delete[] data;
 	}
 
 	return ret;
@@ -207,11 +211,13 @@ void MovClass::calc_xy() {
 	int16 xvector = 0;
 	int16 yvector = 0;
 
-	if (!_G(ged)->getBarrierId(_gpkt->Dx, _gpkt->Dy, _gpkt->Breite, _gpkt->Mem)) {
+	if (!_G(ged)->getBarrierId(_gpkt->Dx, _gpkt->Dy)) {
 		int16 ende = 0;
 		int16 count = 0;
 		int16 min_x = -1;
 		int16 min_y = -1;
+		const int16 width = _G(room)->_barriers->getWidth();
+		const int16 height = _G(room)->_barriers->getHeight();
 
 		while (!ende) {
 			int16 min_steps = 30000;
@@ -247,9 +253,9 @@ 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)->getBarrierId(x, y, _gpkt->Breite, _gpkt->Mem)) {
+					if (x >= 0 && x < width * 8 &&
+					        y >= 0 && y < height * 8) {
+						if (_G(ged)->getBarrierId(x, y)) {
 							int16 aksteps = abs(_gpkt->Dx - x);
 							aksteps += abs(_gpkt->Dy - y);
 							if (aksteps < min_steps) {
@@ -329,16 +335,13 @@ short MovClass::calc_go(int16 src_feld, int16 *dst_feld) {
 
 			tmpz = 0;
 			if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
-			                  om.Xypos[1] + tmpy + tmpz,
-			                  _gpkt->Breite, _gpkt->Mem)) {
+			                           om.Xypos[1] + tmpy + tmpz)) {
 
 				if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
-				                  om.Xypos[1] + tmpz,
-				                  _gpkt->Breite, _gpkt->Mem)) {
+				                           om.Xypos[1] + tmpz)) {
 
 					if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpz,
-					                  om.Xypos[1] + tmpy + tmpz,
-					                  _gpkt->Breite, _gpkt->Mem)) {
+					                           om.Xypos[1] + tmpy + tmpz)) {
 
 						abbruch = MOV_UNPASSABLE;
 					} else {
@@ -409,33 +412,37 @@ short MovClass::calc_go(int16 src_feld, int16 *dst_feld) {
 }
 
 void MovClass::get_mov_line() {
+	const int16 width = _G(room)->_barriers->getWidth();
+	const int16 height = _G(room)->_barriers->getHeight();
+	const int16 level = _G(room)->_barriers->getLevel();
+	const byte *data = _G(room)->_barriers->getData();
+	const byte *buffer = data + 6;
 	int16 ak_steps;
+
 	_gml.GotoFeld = -1;
 	_gml.MLineFeld = -1;
-	if (_gpkt->Ebenen > 1) {
-		byte *speicher = _gpkt->Mem;
-
-		speicher += (_gpkt->Breite * _gpkt->Hoehe) * _gpkt->AkMovEbene;
 
+	if (level > 1) {
+		buffer += (width * height) * _gpkt->AkMovEbene;
 		int16 start_feld = get_feld_nr(_gpkt->Sx, _gpkt->Sy);
 		int16 ende = 0;
 		int16 count = 0;
 		int16 min_steps = 30000;
-		int16 count_vect = DOWN_VECT;
+		int16 count_vect = width;
 		int16 y_richtung = Y_DOWN;
 		while (!ende) {
 
 			int16 tmp_feld = start_feld + count * count_vect;
-			if (_G(ged)->getBarrierId(tmp_feld, _gpkt->Mem)) {
+			if (_G(ged)->getBarrierId(tmp_feld, data + 6)) {
 				int16 abbruch = 0;
 				int16 vector = 0;
-				while ((tmp_feld % _gpkt->Breite) < (_gpkt->Breite - 1) && !abbruch)
+				while ((tmp_feld % width) < (width - 1) && !abbruch)
 				{
-					if (_G(ged)->getBarrierId(tmp_feld + vector, _gpkt->Mem)) {
+					if (_G(ged)->getBarrierId(tmp_feld + vector, data + 6)) {
 						tmp_feld += vector;
-						if (speicher[tmp_feld] == MOV_LINE_IDX) {
-							ak_steps = abs((tmp_feld % _gpkt->Breite) - (start_feld % _gpkt->Breite));
-							ak_steps += abs((tmp_feld / _gpkt->Breite) - (start_feld / _gpkt->Breite));
+						if (buffer[tmp_feld] == MOV_LINE_IDX) {
+							ak_steps = abs((tmp_feld % width) - (start_feld % width));
+							ak_steps += abs((tmp_feld / width) - (start_feld / width));
 							if (ak_steps < min_steps) {
 								min_steps = ak_steps;
 								_gml.GotoFeld = start_feld + count * count_vect;
@@ -451,12 +458,12 @@ void MovClass::get_mov_line() {
 				tmp_feld = start_feld + count * count_vect;
 				vector = LEFT_VECT;
 				abbruch = 0;
-				while ((tmp_feld % _gpkt->Breite) > 0 && !abbruch) {
-					if (_G(ged)->getBarrierId(tmp_feld + vector, _gpkt->Mem)) {
+				while ((tmp_feld % width) > 0 && !abbruch) {
+					if (_G(ged)->getBarrierId(tmp_feld + vector, data + 6)) {
 						tmp_feld += vector;
-						if (speicher[tmp_feld] == MOV_LINE_IDX) {
-							ak_steps = abs((tmp_feld % _gpkt->Breite) - (start_feld % _gpkt->Breite));
-							ak_steps += abs((tmp_feld / _gpkt->Breite) - (start_feld / _gpkt->Breite));
+						if (buffer[tmp_feld] == MOV_LINE_IDX) {
+							ak_steps = abs((tmp_feld % width) - (start_feld % width));
+							ak_steps += abs((tmp_feld / width) - (start_feld / width));
 							if (ak_steps < min_steps) {
 								min_steps = ak_steps;
 								_gml.GotoFeld = start_feld + count * count_vect;
@@ -473,21 +480,26 @@ void MovClass::get_mov_line() {
 
 					y_richtung = Y_UP;
 					count = 1;
-					count_vect = UP_VECT;
+					count_vect = -_G(room)->_barriers->getWidth();
 				} else
 					ende = 1;
 			}
 		}
 	}
+
+	delete[] data;
 }
 
 void MovClass::calc_mov_line_xit(int16 start_feld) {
+	const int16 width = _G(room)->_barriers->getWidth();
+	const int16 height = _G(room)->_barriers->getHeight();
+	const int16 level = _G(room)->_barriers->getLevel();
+	const byte *data = _G(room)->_barriers->getData();
 	int16 tmp_feld;
 	int16 i;
 	int16 dest_steps;
 
 	int16 k;
-	//int16 found_min;
 	int16 TmpKnPkt[MAX_KNOTEN_PKT];
 	int16 dir_unerreicht = 0;
 	int16 KnPkt_unrreicht[MAX_KNOTEN_PKT];
@@ -496,10 +508,10 @@ void MovClass::calc_mov_line_xit(int16 start_feld) {
 
 	for (i = 0; i < MAX_KNOTEN_PKT; i++)
 		TmpKnPkt[i] = -1;
-	if (_gpkt->Ebenen > 1) {
-		memset((char *)knoten_felder, -1, MAX_KNOTEN_PKT * 6);
-		byte *speicher = _gpkt->Mem;
-		speicher += (_gpkt->Breite * _gpkt->Hoehe) * _gpkt->AkMovEbene;
+	if (level > 1) {
+		memset(knoten_felder, -1, MAX_KNOTEN_PKT * 6);
+		const byte *buffer = data + 6;
+		buffer += (width * height) * _gpkt->AkMovEbene;
 		_mle.Steps = 30000;
 		int16 min_step_unerreicht = 30000;
 		_mle.FNr = -1;
@@ -519,8 +531,8 @@ void MovClass::calc_mov_line_xit(int16 start_feld) {
 			tmp_feld = ziel_feld;
 			calc_go(calc_feld, &tmp_feld);
 			if (tmp_feld == ziel_feld) {
-				dest_steps = abs((ziel_feld % _gpkt->Breite) - (calc_feld % _gpkt->Breite));
-				dest_steps += abs((ziel_feld / _gpkt->Breite) - (calc_feld / _gpkt->Breite));
+				dest_steps = abs((ziel_feld % width) - (calc_feld % width));
+				dest_steps += abs((ziel_feld / width) - (calc_feld / width));
 				if (dest_steps < _mle.Steps) {
 					_mle.Steps = dest_steps;
 					_mle.FNr = calc_feld;
@@ -532,8 +544,8 @@ void MovClass::calc_mov_line_xit(int16 start_feld) {
 						_mle.KnPkt[i] = TmpKnPkt[i];
 				}
 			} else {
-				dest_steps = abs((ziel_feld % _gpkt->Breite) - (tmp_feld % _gpkt->Breite));
-				dest_steps += abs((ziel_feld / _gpkt->Breite) - (tmp_feld / _gpkt->Breite));
+				dest_steps = abs((ziel_feld % width) - (tmp_feld % width));
+				dest_steps += abs((ziel_feld / width) - (tmp_feld / width));
 				if (dest_steps < min_step_unerreicht) {
 					min_step_unerreicht = dest_steps;
 					feld_unerreicht = tmp_feld;
@@ -547,7 +559,7 @@ void MovClass::calc_mov_line_xit(int16 start_feld) {
 			}
 			int16 ok = 0;
 			for (i = 0; i < 4 && !ok; i++) {
-				if (speicher[calc_feld + _vecTbl[tbl_ptr + i * tbl_dir]] == MOV_LINE_IDX)
+				if (buffer[calc_feld + _vecTbl[tbl_ptr + i * tbl_dir]] == MOV_LINE_IDX)
 				{
 					if (calc_feld + _vecTbl[tbl_ptr + i * tbl_dir] != last_feld)
 					{
@@ -564,7 +576,7 @@ void MovClass::calc_mov_line_xit(int16 start_feld) {
 							knoten_flag = false;
 						}
 					}
-				} else if (speicher[calc_feld + _vecTbl[tbl_ptr + i * tbl_dir]] == MOV_LINE_KNOTEN) {
+				} else if (buffer[calc_feld + _vecTbl[tbl_ptr + i * tbl_dir]] == MOV_LINE_KNOTEN) {
 					if (calc_feld + _vecTbl[tbl_ptr + i * tbl_dir] != last_feld) {
 						if (dir == 30000) {
 							dir = _vecTbl[tbl_ptr + i * tbl_dir];
@@ -605,7 +617,7 @@ void MovClass::calc_mov_line_xit(int16 start_feld) {
 					for (i = 0; i < 4 && !ok; i++) {
 						if (knoten_felder[ak_knoten][tbl_ptr + i * tbl_dir] == -1) {
 							tmp_feld = knoten_felder[ak_knoten][4];
-							if (speicher[tmp_feld + _vecTbl[tbl_ptr + i * tbl_dir]] == MOV_LINE_IDX)
+							if (buffer[tmp_feld + _vecTbl[tbl_ptr + i * tbl_dir]] == MOV_LINE_IDX)
 							{
 								last_feld = knoten_felder[ak_knoten][4];
 								calc_feld = tmp_feld + _vecTbl[tbl_ptr + i * tbl_dir];
@@ -644,18 +656,22 @@ void MovClass::calc_mov_line_xit(int16 start_feld) {
 			}
 		}
 	}
+
+	delete[] data;
 }
 
 int16 MovClass::get_feld_nr(int16 x, int16 y) {
+	const int16 width = _G(room)->_barriers->getWidth();
 	x >>= 3;
 	y >>= 3;
 
-	return x + (y * _gpkt->Breite);
+	return x + (y * width);
 }
 
 void MovClass::get_feld_xy(int16 fnr, int16 *x, int16 *y) {
-	*x = (fnr % _gpkt->Breite);
-	*y = (fnr / _gpkt->Breite);
+	const int16 width = _G(room)->_barriers->getWidth();
+	*x = (fnr % width);
+	*y = (fnr / width);
 	*x <<= 3;
 	*y <<= 3;
 }
diff --git a/engines/chewy/movclass.h b/engines/chewy/movclass.h
index 0542d2e5b5a..a85c4d141c1 100644
--- a/engines/chewy/movclass.h
+++ b/engines/chewy/movclass.h
@@ -73,10 +73,6 @@ struct GotoPkt {
 	int16 Sy = 0;
 	int16 Dx = 0;
 	int16 Dy = 0;
-	byte *Mem = nullptr;
-	int16 Breite = 0;
-	int16 Hoehe = 0;
-	int16 Ebenen = 0;
 	int16 AkMovEbene = 0;
 	int16 Vorschub = 0;
 };
diff --git a/engines/chewy/ngstypes.h b/engines/chewy/ngstypes.h
index ef7db2c61a8..d067be2bd57 100644
--- a/engines/chewy/ngstypes.h
+++ b/engines/chewy/ngstypes.h
@@ -52,11 +52,6 @@ struct MusicInfo {
 	char *cur_pattern = nullptr;
 };
 
-struct GedChunkInfo {
-	Common::Point pos = Common::Point(0, 0);
-	int16 level = 0;
-};
-
 struct CurBlk {
 	byte **sprite = nullptr;
 };
diff --git a/engines/chewy/resource.cpp b/engines/chewy/resource.cpp
index 1f918523bf6..71d42e9b160 100644
--- a/engines/chewy/resource.cpp
+++ b/engines/chewy/resource.cpp
@@ -36,16 +36,18 @@ Resource::Resource(Common::String filename) {
 	const uint32 headerTxtDec  = MKTAG('T', 'C', 'F', '\0');
 	const uint32 headerTxtEnc  = MKTAG('T', 'C', 'F', '\1');
 	const uint32 headerSprite  = MKTAG('T', 'A', 'F', '\0');
+	const uint32 headerBarrier = MKTAG('G', 'E', 'P', '\0');
 
 	filename.toLowercase();
 	_stream.open(filename);
 
-	uint32 header = _stream.readUint32BE();
-	bool isText = (header == headerTxtDec || header == headerTxtEnc);
-	bool isSprite = (header == headerSprite);
-	bool isSpeech = filename.contains("speech.tvp");
+	const uint32 header = _stream.readUint32BE();
+	const bool isText = (header == headerTxtDec || header == headerTxtEnc);
+	const bool isSprite = (header == headerSprite);
+	const bool isSpeech = filename.contains("speech.tvp");
+	const bool isBarrier = (header == headerBarrier);
 
-	if (header != headerGeneric && !isSprite && !isText)
+	if (header != headerGeneric && !isSprite && !isText && !isBarrier)
 		error("Invalid resource - %s", filename.c_str());
 
 	if (isText) {
@@ -54,6 +56,9 @@ Resource::Resource(Common::String filename) {
 	} else if (isSprite) {
 		initSprite(filename);
 		return;
+	} else if (isBarrier) {
+		_resType = kResourceGEP;
+		_encrypted = false;
 	} else {
 		_resType = (ResourceType)_stream.readUint16LE();
 		_encrypted = false;
@@ -69,12 +74,16 @@ Resource::Resource(Common::String filename) {
 		Chunk cur;
 		cur.size = _stream.readUint32LE();
 
-		if (!isText) {
-			cur.type = (ResourceType)_stream.readUint16LE();
-			cur.num = 0;
-		} else {
+		if (isText) {
 			cur.type = kResourceUnknown;
 			cur.num = _stream.readUint16LE();
+		} else if (isBarrier) {
+			cur.type = kResourceUnknown;
+			cur.num = i;
+			cur.size += 6;
+		} else {
+			cur.type = (ResourceType)_stream.readUint16LE();
+			cur.num = 0;
 		}	
 
 		cur.pos = _stream.pos();
@@ -430,4 +439,17 @@ void DialogResource::saveStream(Common::WriteStream* s) {
 	s->writeStream(_dialogStream, _stream.size());
 }
 
+void BarrierResource::init(int16 room, int16 bgWidth, int16 bgHeight) {
+	assert(room < _chunkList.size());
+
+	Chunk *chunk = &_chunkList[room];
+	_stream.seek(chunk->pos, SEEK_SET);
+	_x = _stream.readSint16LE();
+	_y = _stream.readSint16LE();
+	_level = _stream.readSint16LE();
+	_w = bgWidth / _x;
+	_h = bgHeight / _y;
+	_room = room;
+}
+
 }
diff --git a/engines/chewy/resource.h b/engines/chewy/resource.h
index 4dbea93900a..51cae9b405a 100644
--- a/engines/chewy/resource.h
+++ b/engines/chewy/resource.h
@@ -24,14 +24,9 @@
 
 #include "common/scummsys.h"
 #include "common/file.h"
-#include "common/util.h"
 #include "common/str.h"
-#include "common/hashmap.h"
-#include "common/hash-str.h"
 #include "common/memstream.h"
-#include "common/random.h"
-#include "common/stream.h"
-#include "graphics/surface.h"
+#include "common/rect.h"
 
 namespace Chewy {
 
@@ -63,7 +58,8 @@ enum ResourceType {
 	kResourceTTP = 23,		// unused
 	kResourceTAP = 24,		// container for sound effects, music and cutscenes, used in sound/details.tap and cut/cut.tap
 	kResourceCFO = 25,		// unused
-	kResourceTCF = 26		// error messages, used in err/err_e.tcf (English) and err/err_d.tcf (German)
+	kResourceTCF = 26,		// error messages, used in err/err_e.tcf (English) and err/err_d.tcf (German)
+	kResourceGEP = 27		// barriers / walkable areas
 };
 
 // Generic chunk header
@@ -230,6 +226,24 @@ private:
 	byte *_dialogBuffer;
 };
 
+class BarrierResource : public Resource {
+public:
+	BarrierResource(Common::String filename) : Resource(filename) {}
+	virtual ~BarrierResource() {}
+
+	void init(int16 room, int16 bgWidth, int16 bgHeight);
+
+	int16 getX() const { return _x; }
+	int16 getY() const { return _y; }
+	int16 getLevel() const { return _level; }
+	int16 getWidth() const { return _w; }
+	int16 getHeight() const { return _h; }
+	uint8 *getData() { return getChunkData(_room); }
+
+private:
+	int16 _x = 0, _y = 0, _level = 0, _w = 0, _h = 0, _room = 0;
+};
+
 } // namespace Chewy
 
 #endif
diff --git a/engines/chewy/room.cpp b/engines/chewy/room.cpp
index cd6fc4c96d3..1f020f37045 100644
--- a/engines/chewy/room.cpp
+++ b/engines/chewy/room.cpp
@@ -151,9 +151,11 @@ Room::Room() {
 	_roomTimer._timerStart = 0;
 	init_ablage();
 	_roomInfo = nullptr;
+	_barriers = new BarrierResource(EPISODE1_GEP);
 }
 
 Room::~Room() {
+	delete _barriers;
 	free_ablage();
 }
 
@@ -311,9 +313,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) {
-			_G(ged)->load_ged_pool(&_gedInfo[Rb->AkAblage], nr, _gedMem[Rb->AkAblage]);
-			_gedXNr[Rb->AkAblage] = img->width / _gedInfo[Rb->AkAblage].pos.x;
-			_gedYNr[Rb->AkAblage] = img->height / _gedInfo[Rb->AkAblage].pos.y;
+			_barriers->init(nr, img->width, img->height);
 		}
 	}
 
@@ -327,19 +327,16 @@ void Room::init_ablage() {
 	_lastAblageSave = 0;
 	_ablage[0] = (byte *)MALLOC(MAX_ABLAGE * (ABLAGE_BLOCK_SIZE + 4l));
 	_ablagePal[0] = (byte *)MALLOC(MAX_ABLAGE * 768l);
-	_gedMem[0] = (byte *)MALLOC(MAX_ABLAGE * GED_BLOCK_SIZE);
 	_akAblage = 0;
 	for (int16 i = 0; i < MAX_ABLAGE; i++) {
 		_ablage[i] = _ablage[0] + (ABLAGE_BLOCK_SIZE + 4l) * i;
 		_ablageInfo[i][0] = -1;
 		_ablageInfo[i][1] = -1;
 		_ablagePal[i] = _ablagePal[0] + 768l * i;
-		_gedMem[i] = _gedMem[0] + (GED_BLOCK_SIZE * i);
 	}
 }
 
 void Room::free_ablage() {
-	free(_gedMem[0]);
 	free(_ablagePal[0]);
 	free(_ablage[0]);
 	_akAblage = -1;
@@ -363,15 +360,6 @@ byte **Room::get_ablage() {
 	return ret;
 }
 
-byte **Room::get_ged_mem() {
-	byte **ret = nullptr;
-
-	if (_akAblage != -1) {
-		ret = &_gedMem[0];
-	}
-	return ret;
-}
-
 int16 Room::get_ablage(int16 pic_nr, uint32 pic_size) {
 	int16 ret = -1;
 	uint32 ablage_bedarf = pic_size / ABLAGE_BLOCK_SIZE;
diff --git a/engines/chewy/room.h b/engines/chewy/room.h
index a5a9e3625c5..12918a64239 100644
--- a/engines/chewy/room.h
+++ b/engines/chewy/room.h
@@ -37,7 +37,6 @@ extern const int16 SURIMY_TAF19_PHASES[4][2];
 #define MAX_ABLAGE 4
 
 #define ABLAGE_BLOCK_SIZE 64000l
-#define GED_BLOCK_SIZE 3000l
 #define GED_LOAD 1
 
 class JungleRoom {
@@ -83,7 +82,6 @@ public:
 	int16 load_tgp(int16 nr, RaumBlk *Rb, int16 tgp_idx, int16 mode, const char *fileName);
 	byte *get_ablage(int16 nr);
 	byte **get_ablage();
-	byte **get_ged_mem();
 	void set_timer_start(int16 timer_start);
 	void add_timer_new_room();
 	void del_timer_old_room();
@@ -96,9 +94,7 @@ public:
 
 	RaumTimer _roomTimer;
 	RoomInfo *_roomInfo;
-	GedChunkInfo _gedInfo[MAX_ABLAGE];
-	int16 _gedXNr[MAX_ABLAGE];
-	int16 _gedYNr[MAX_ABLAGE];
+	BarrierResource *_barriers;
 
 private:
 	void init_ablage();
@@ -113,8 +109,6 @@ private:
 	byte *_ablage[MAX_ABLAGE];
 	byte *_ablagePal[MAX_ABLAGE];
 	int16 _ablageInfo[MAX_ABLAGE][2];
-
-	byte *_gedMem[MAX_ABLAGE];
 };
 
 void load_chewy_taf(int16 taf_nr);
diff --git a/engines/chewy/sprite.cpp b/engines/chewy/sprite.cpp
index de2b4f24fe9..51feb15a006 100644
--- a/engines/chewy/sprite.cpp
+++ b/engines/chewy/sprite.cpp
@@ -323,9 +323,7 @@ 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) {
-		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]);
+		const int16 paletteId = _G(ged)->getBarrierId(x + _G(spieler_mi)[personNr].HotX, y + _G(spieler_mi)[personNr].HotY);
 		checkShadow(paletteId, 1);
 	}
 }
@@ -775,19 +773,13 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 
 			if (!mi->Mode) {
 				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]))) {
+				                                      om->Xypos[1] + mi->HotY + tmpy))) {
 
 					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]))) {
+					                                      om->Xypos[1] + mi->HotY))) {
 
 						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]))) {
+						                                      om->Xypos[1] + mi->HotY + tmpy))) {
 							om->Count = 0;
 						} else {
 							if (!tmpy) {
@@ -890,9 +882,7 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 				om->Xypos[2] += tmpz;
 				if (mi->Id == CHEWY_OBJ) {
 					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]);
+					                                om->Xypos[1] + mi->HotY);
 					checkShadow(u_index, 1);
 				}
 			}


Commit: 2f00e8d279af5bca5700e0b5f287c4f8ea5d300d
    https://github.com/scummvm/scummvm/commit/2f00e8d279af5bca5700e0b5f287c4f8ea5d300d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-05-22T17:29:57+03:00

Commit Message:
CHEWY: Rename ged to barriers

Makes it a bit clearer to understand its purpose

Changed paths:
  A engines/chewy/barriers.cpp
  A engines/chewy/barriers.h
  R engines/chewy/gedclass.cpp
  R engines/chewy/gedclass.h
    engines/chewy/globals.h
    engines/chewy/inits.cpp
    engines/chewy/main.cpp
    engines/chewy/module.mk
    engines/chewy/movclass.cpp
    engines/chewy/sprite.cpp


diff --git a/engines/chewy/gedclass.cpp b/engines/chewy/barriers.cpp
similarity index 95%
rename from engines/chewy/gedclass.cpp
rename to engines/chewy/barriers.cpp
index a059cf57019..3c46b269067 100644
--- a/engines/chewy/gedclass.cpp
+++ b/engines/chewy/barriers.cpp
@@ -22,11 +22,11 @@
 #include "common/file.h"
 #include "chewy/chewy.h"
 #include "chewy/globals.h"
-#include "chewy/gedclass.h"
+#include "chewy/barriers.h"
 
 namespace Chewy {
 
-int16 GedClass::getBarrierId(int16 x, int16 y) {
+int16 Barriers::getBarrierId(int16 x, int16 y) {
 	const int16 width = _G(room)->_barriers->getWidth();
 	const byte *data = _G(room)->_barriers->getData();
 	const int16 result = getBarrierId(((y / 8) * width) + (x / 8), data + 6);
@@ -34,7 +34,7 @@ int16 GedClass::getBarrierId(int16 x, int16 y) {
 	return result;
 }
 
-int16 GedClass::getBarrierId(int16 g_idx, const byte *buffer) {
+int16 Barriers::getBarrierId(int16 g_idx, const byte *buffer) {
 	int16 idx_nr = buffer[g_idx];
 
 	switch (idx_nr) {
diff --git a/engines/chewy/gedclass.h b/engines/chewy/barriers.h
similarity index 90%
rename from engines/chewy/gedclass.h
rename to engines/chewy/barriers.h
index 8e1bef96915..cc5632991a7 100644
--- a/engines/chewy/gedclass.h
+++ b/engines/chewy/barriers.h
@@ -19,16 +19,14 @@
  *
  */
 
-#ifndef CHEWY_GEDCLASS_H
-#define CHEWY_GEDCLASS_H
-
-#include "chewy/ngstypes.h"
+#ifndef CHEWY_BARRIERS_H
+#define CHEWY_BARRIERS_H
 
 namespace Chewy {
 
-class GedClass {
+class Barriers {
 public:
-	GedClass() {}
+	Barriers() {}
 
 	int16 getBarrierId(int16 x, int16 y);
 	int16 getBarrierId(int16 g_idx, const byte *buffer);
diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h
index 2bce3a3307f..320d2ce4068 100644
--- a/engines/chewy/globals.h
+++ b/engines/chewy/globals.h
@@ -29,7 +29,7 @@
 #include "chewy/room.h"
 #include "chewy/movclass.h"
 #include "chewy/timer.h"
-#include "chewy/gedclass.h"
+#include "chewy/barriers.h"
 #include "chewy/text.h"
 #include "chewy/object.h"
 #include "chewy/effect.h"
@@ -183,7 +183,7 @@ public:
 	TafSeqInfo *_howard_taf = nullptr;
 	TafInfo *_chewy = nullptr;
 	int16 *_chewy_kor = nullptr;
-	GedClass *_ged = nullptr;
+	Barriers *_barriers = nullptr;
 	Text *_txt = nullptr;
 	Room *_room = nullptr;
 	Object *_obj = nullptr;
diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp
index a408664f863..e2bff35d1c5 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();
+	_G(barriers) = new Barriers();
 	_G(room) = new Room();
 	_G(obj) = new Object(&_G(gameState));
 	_G(uhr) = new Timer(MAX_TIMER_OBJ, _G(ani_timer));
@@ -230,7 +230,7 @@ void tidy() {
 	delete _G(uhr);
 	delete _G(obj);
 	delete _G(room);
-	delete _G(ged);
+	delete _G(barriers);
 	delete _G(txt);
 	delete _G(fx);
 	delete _G(in);
@@ -244,7 +244,7 @@ void tidy() {
 	_G(uhr) = nullptr;
 	_G(obj) = nullptr;
 	_G(room) = nullptr;
-	_G(ged) = nullptr;
+	_G(barriers) = nullptr;
 	_G(txt) = nullptr;
 	_G(fx) = nullptr;
 	_G(in) = nullptr;
diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index 9421c3b5ac9..bfb21355d2c 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -422,7 +422,7 @@ 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) {
-			const int barrierId = _G(ged)->getBarrierId(xp, yp);
+			const int barrierId = _G(barriers)->getBarrierId(xp, yp);
 
 			if (barrierId) {
 				Common::Rect r(xp, yp, xp + 8, yp + 8);
@@ -519,7 +519,7 @@ void setupScreen(SetupScreenMode mode) {
 		calc_auto_go();
 
 		if (_G(fx_blend)) {
-			const int16 paletteId = _G(ged)->getBarrierId(
+			const int16 paletteId = _G(barriers)->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);
 			checkShadow(paletteId, 0);
@@ -1695,7 +1695,7 @@ void calc_ausgang(int16 x, int16 y) {
 				               ScrXy[0], ScrXy[1],
 				               &_G(gameState).scrollx, &_G(gameState).scrolly);
 
-				const int16 paletteId = _G(ged)->getBarrierId(_G(spieler_vector)[P_CHEWY].Xypos[0] + _G(spieler_mi)[P_CHEWY].HotX,
+				const int16 paletteId = _G(barriers)->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);
 				checkShadow(paletteId, 0);
 				setPersonSpr(_G(Rdi)->AutoMov[_G(gameState).room_e_obj[nr].ExitMov]._sprNr, P_CHEWY);
diff --git a/engines/chewy/module.mk b/engines/chewy/module.mk
index 12f37213eda..6f92959647f 100644
--- a/engines/chewy/module.mk
+++ b/engines/chewy/module.mk
@@ -2,13 +2,13 @@ MODULE := engines/chewy
 
 MODULE_OBJS = \
 	atds.o \
+	barriers.o \
 	chewy.o \
 	cursor.o \
 	console.o \
 	detail.o \
 	effect.o \
 	events.o \
-	gedclass.o \
 	globals.o \
 	inits.o \
 	m_event.o \
diff --git a/engines/chewy/movclass.cpp b/engines/chewy/movclass.cpp
index 64fd54a2806..5d5bea7e20c 100644
--- a/engines/chewy/movclass.cpp
+++ b/engines/chewy/movclass.cpp
@@ -211,7 +211,7 @@ void MovClass::calc_xy() {
 	int16 xvector = 0;
 	int16 yvector = 0;
 
-	if (!_G(ged)->getBarrierId(_gpkt->Dx, _gpkt->Dy)) {
+	if (!_G(barriers)->getBarrierId(_gpkt->Dx, _gpkt->Dy)) {
 		int16 ende = 0;
 		int16 count = 0;
 		int16 min_x = -1;
@@ -255,7 +255,7 @@ void MovClass::calc_xy() {
 				for (int16 i = 0; i < anz; i++) {
 					if (x >= 0 && x < width * 8 &&
 					        y >= 0 && y < height * 8) {
-						if (_G(ged)->getBarrierId(x, y)) {
+						if (_G(barriers)->getBarrierId(x, y)) {
 							int16 aksteps = abs(_gpkt->Dx - x);
 							aksteps += abs(_gpkt->Dy - y);
 							if (aksteps < min_steps) {
@@ -334,13 +334,13 @@ short MovClass::calc_go(int16 src_feld, int16 *dst_feld) {
 			}
 
 			tmpz = 0;
-			if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
+			if (!_G(barriers)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
 			                           om.Xypos[1] + tmpy + tmpz)) {
 
-				if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
+				if (!_G(barriers)->getBarrierId(om.Xypos[0] + tmpx + tmpz,
 				                           om.Xypos[1] + tmpz)) {
 
-					if (!_G(ged)->getBarrierId(om.Xypos[0] + tmpz,
+					if (!_G(barriers)->getBarrierId(om.Xypos[0] + tmpz,
 					                           om.Xypos[1] + tmpy + tmpz)) {
 
 						abbruch = MOV_UNPASSABLE;
@@ -433,12 +433,12 @@ void MovClass::get_mov_line() {
 		while (!ende) {
 
 			int16 tmp_feld = start_feld + count * count_vect;
-			if (_G(ged)->getBarrierId(tmp_feld, data + 6)) {
+			if (_G(barriers)->getBarrierId(tmp_feld, data + 6)) {
 				int16 abbruch = 0;
 				int16 vector = 0;
 				while ((tmp_feld % width) < (width - 1) && !abbruch)
 				{
-					if (_G(ged)->getBarrierId(tmp_feld + vector, data + 6)) {
+					if (_G(barriers)->getBarrierId(tmp_feld + vector, data + 6)) {
 						tmp_feld += vector;
 						if (buffer[tmp_feld] == MOV_LINE_IDX) {
 							ak_steps = abs((tmp_feld % width) - (start_feld % width));
@@ -459,7 +459,7 @@ void MovClass::get_mov_line() {
 				vector = LEFT_VECT;
 				abbruch = 0;
 				while ((tmp_feld % width) > 0 && !abbruch) {
-					if (_G(ged)->getBarrierId(tmp_feld + vector, data + 6)) {
+					if (_G(barriers)->getBarrierId(tmp_feld + vector, data + 6)) {
 						tmp_feld += vector;
 						if (buffer[tmp_feld] == MOV_LINE_IDX) {
 							ak_steps = abs((tmp_feld % width) - (start_feld % width));
diff --git a/engines/chewy/sprite.cpp b/engines/chewy/sprite.cpp
index 51feb15a006..cb2cedfa38b 100644
--- a/engines/chewy/sprite.cpp
+++ b/engines/chewy/sprite.cpp
@@ -323,7 +323,7 @@ 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) {
-		const int16 paletteId = _G(ged)->getBarrierId(x + _G(spieler_mi)[personNr].HotX, y + _G(spieler_mi)[personNr].HotY);
+		const int16 paletteId = _G(barriers)->getBarrierId(x + _G(spieler_mi)[personNr].HotX, y + _G(spieler_mi)[personNr].HotY);
 		checkShadow(paletteId, 1);
 	}
 }
@@ -772,13 +772,13 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 			}
 
 			if (!mi->Mode) {
-				if (!(u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX + tmpx,
+				if (!(u_index = _G(barriers)->getBarrierId(om->Xypos[0] + mi->HotX + tmpx,
 				                                      om->Xypos[1] + mi->HotY + tmpy))) {
 
-					if (!(u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX + tmpx,
+					if (!(u_index = _G(barriers)->getBarrierId(om->Xypos[0] + mi->HotX + tmpx,
 					                                      om->Xypos[1] + mi->HotY))) {
 
-						if (!(u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX,
+						if (!(u_index = _G(barriers)->getBarrierId(om->Xypos[0] + mi->HotX,
 						                                      om->Xypos[1] + mi->HotY + tmpy))) {
 							om->Count = 0;
 						} else {
@@ -881,7 +881,7 @@ void mov_objekt(ObjMov *om, MovInfo *mi) {
 				om->Xypos[1] += tmpy;
 				om->Xypos[2] += tmpz;
 				if (mi->Id == CHEWY_OBJ) {
-					u_index = _G(ged)->getBarrierId(om->Xypos[0] + mi->HotX,
+					u_index = _G(barriers)->getBarrierId(om->Xypos[0] + mi->HotX,
 					                                om->Xypos[1] + mi->HotY);
 					checkShadow(u_index, 1);
 				}




More information about the Scummvm-git-logs mailing list