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

sev- sev at scummvm.org
Wed Sep 7 18:56:39 CEST 2016


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:
5dddde199f FULLPIPE: Further work on the hangers in scene09
a021b4c7e8 FULLPIPE: Added and using StaticANIObject::isPixelHitAtPos()
8f8e94bde6 FULLPIPE: Fix memory leak in scene09
3e34c4408a FULLPIPE: First round of getting rid of BallChain in scene27
2e643276df FULLPIPE: Fix bat minigame in scene27


Commit: 5dddde199fef11650f635c666dd797df011fcdb3
    https://github.com/scummvm/scummvm/commit/5dddde199fef11650f635c666dd797df011fcdb3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-09-07T10:36:51+02:00

Commit Message:
FULLPIPE: Further work on the hangers in scene09

Changed paths:
    engines/fullpipe/gfx.cpp
    engines/fullpipe/scenes/scene09.cpp
    engines/fullpipe/statics.cpp
    engines/fullpipe/statics.h



diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 547b6cf..de0faf0 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -749,6 +749,9 @@ int Picture::getPixelAtPosEx(int x, int y) {
 	if (x < 0 || y < 0)
 		return 0;
 
+	warning("STUB: Picture::getPixelAtPosEx(%d, %d)", x, y);
+
+	// It looks like this doesn't really work. TODO. FIXME
 	if (x < (g_fp->_pictureScale + _width - 1) / g_fp->_pictureScale &&
 			y < (g_fp->_pictureScale + _height - 1) / g_fp->_pictureScale &&
 			_memoryObject2 != 0 && _memoryObject2->_rows != 0)
diff --git a/engines/fullpipe/scenes/scene09.cpp b/engines/fullpipe/scenes/scene09.cpp
index f9cf58d..aaa430d 100644
--- a/engines/fullpipe/scenes/scene09.cpp
+++ b/engines/fullpipe/scenes/scene09.cpp
@@ -365,19 +365,19 @@ void sceneHandler09_checkHangerCollide() {
 		}
 
 	LABEL_11:
-		int pixel;
+		bool hit;
 
 		for (int i = 0; i < g_vars->scene09_numMovingHangers; i++) {
 			for (int j = 0; j < 4; j++) {
-				g_vars->scene09_hangers[i]->ani->getPixelAtPos(newx + g_vars->scene09_hangerOffsets[j].x, ball->_oy + g_vars->scene09_hangerOffsets[j].y, &pixel);
+				hit = g_vars->scene09_hangers[i]->ani->getPixelAtPos(newx + g_vars->scene09_hangerOffsets[j].x, ball->_oy + g_vars->scene09_hangerOffsets[j].y, 0, true);
 
-				if (pixel) {
+				if (hit) {
 					sceneHandler09_ballExplode(b);
 					break;
 				}
 			}
 
-			if (pixel)
+			if (hit)
 				break;
 		}
 	}
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 1d88b3b..a1f91bc 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -458,7 +458,7 @@ Movement *StaticANIObject::getMovementByName(char *name) {
 	return 0;
 }
 
-bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel) {
+bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel, bool hitOnly) {
 	bool res = false;
 	Picture *pic;
 
@@ -504,6 +504,10 @@ bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel) {
 	y = pic->_y;
 	pic->_x = 0;
 	pic->_y = 0;
+
+	if (hitOnly)
+		return pic->isPixelHitAtPos(xtarget, ytarget);
+
 	if (pic->isPixelHitAtPos(xtarget, ytarget)) {
 		*pixel = pic->getPixelAtPos(xtarget, ytarget);
 
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index c7baac7..5082d50 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -257,7 +257,7 @@ public:
 	MessageQueue *changeStatics1(int msgNum);
 	void changeStatics2(int objId);
 
-	bool getPixelAtPos(int x, int y, int *pixel);
+	bool getPixelAtPos(int x, int y, int *pixel, bool hitOnly = false);
 };
 
 struct MovTable {


Commit: a021b4c7e8c811f56c522e69f1723d29d7c36cc7
    https://github.com/scummvm/scummvm/commit/a021b4c7e8c811f56c522e69f1723d29d7c36cc7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-09-07T12:12:31+02:00

Commit Message:
FULLPIPE: Added and using StaticANIObject::isPixelHitAtPos()

Changed paths:
    engines/fullpipe/scene.cpp
    engines/fullpipe/scenes/scene09.cpp
    engines/fullpipe/statics.cpp
    engines/fullpipe/statics.h



diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 71990f7..1d693fc 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -601,10 +601,9 @@ StaticANIObject *Scene::getStaticANIObjectAtPos(int x, int y) {
 
 	for (uint i = 0; i < _staticANIObjectList1.size(); i++) {
 		StaticANIObject *p = _staticANIObjectList1[i];
-		int pixel;
 
 		if ((p->_field_8 & 0x100) && (p->_flags & 4) &&
-				p->getPixelAtPos(x, y, &pixel) &&
+				p->isPixelHitAtPos(x, y) &&
 				(!res || res->_priority > p->_priority))
 			res = p;
 	}
diff --git a/engines/fullpipe/scenes/scene09.cpp b/engines/fullpipe/scenes/scene09.cpp
index aaa430d..fe9051e 100644
--- a/engines/fullpipe/scenes/scene09.cpp
+++ b/engines/fullpipe/scenes/scene09.cpp
@@ -369,7 +369,7 @@ void sceneHandler09_checkHangerCollide() {
 
 		for (int i = 0; i < g_vars->scene09_numMovingHangers; i++) {
 			for (int j = 0; j < 4; j++) {
-				hit = g_vars->scene09_hangers[i]->ani->getPixelAtPos(newx + g_vars->scene09_hangerOffsets[j].x, ball->_oy + g_vars->scene09_hangerOffsets[j].y, 0, true);
+				hit = g_vars->scene09_hangers[i]->ani->isPixelHitAtPos(newx + g_vars->scene09_hangerOffsets[j].x, ball->_oy + g_vars->scene09_hangerOffsets[j].y);
 
 				if (hit) {
 					sceneHandler09_ballExplode(b);
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index a1f91bc..fe1f1e2 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -458,6 +458,10 @@ Movement *StaticANIObject::getMovementByName(char *name) {
 	return 0;
 }
 
+bool StaticANIObject::isPixelHitAtPos(int x, int y) {
+	return getPixelAtPos(x, y, 0, true);
+}
+
 bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel, bool hitOnly) {
 	bool res = false;
 	Picture *pic;
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 5082d50..6206fef 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -258,6 +258,7 @@ public:
 	void changeStatics2(int objId);
 
 	bool getPixelAtPos(int x, int y, int *pixel, bool hitOnly = false);
+	bool isPixelHitAtPos(int x, int y);
 };
 
 struct MovTable {


Commit: 8f8e94bde650c71fdbc5a642c048b02c246a9f28
    https://github.com/scummvm/scummvm/commit/8f8e94bde650c71fdbc5a642c048b02c246a9f28
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-09-07T18:29:23+02:00

Commit Message:
FULLPIPE: Fix memory leak in scene09

Changed paths:
    engines/fullpipe/scenes/scene09.cpp



diff --git a/engines/fullpipe/scenes/scene09.cpp b/engines/fullpipe/scenes/scene09.cpp
index fe9051e..209cf18 100644
--- a/engines/fullpipe/scenes/scene09.cpp
+++ b/engines/fullpipe/scenes/scene09.cpp
@@ -71,7 +71,11 @@ void scene09_initScene(Scene *sc) {
 
 	g_vars->scene09_flyingBalls.clear();
 
+	for (uint i = 0; i < g_vars->scene09_hangers.size(); i++)
+		delete g_vars->scene09_hangers[i];
+
 	g_vars->scene09_hangers.clear();
+
 	g_vars->scene09_numMovingHangers = 4;
 
 	StaticANIObject *hanger = sc->getStaticANIObject1ById(ANI_VISUNCHIK, -1);
@@ -102,6 +106,9 @@ void scene09_initScene(Scene *sc) {
 		g_vars->scene09_hangers.push_back(hng);
 	}
 
+	for (uint i = 0; i < g_vars->scene09_sceneBalls.size(); i++)
+		delete g_vars->scene09_sceneBalls[i];
+
 	g_vars->scene09_sceneBalls.clear();
 
 	StaticANIObject *newball = new StaticANIObject(sc->getStaticANIObject1ById(ANI_BALL9, -1));


Commit: 3e34c4408a2158b6dbe103ef2508b7fca9dc8d59
    https://github.com/scummvm/scummvm/commit/3e34c4408a2158b6dbe103ef2508b7fca9dc8d59
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-09-07T18:38:38+02:00

Commit Message:
FULLPIPE: First round of getting rid of BallChain in scene27

Changed paths:
    engines/fullpipe/scenes.h
    engines/fullpipe/scenes/scene27.cpp



diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 10c089a..db0546b 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -581,7 +581,7 @@ public:
 	int scene27_aimStartX;
 	int scene27_aimStartY;
 	int scene27_launchPhase;
-	BallChain scene27_balls;
+	Common::Array<StaticANIObject *> scene27_balls;
 	Common::Array<Bat *> scene27_bats;
 	Common::Array<Bat *> scene27_var07;
 
diff --git a/engines/fullpipe/scenes/scene27.cpp b/engines/fullpipe/scenes/scene27.cpp
index 93ff53f..bc52580 100644
--- a/engines/fullpipe/scenes/scene27.cpp
+++ b/engines/fullpipe/scenes/scene27.cpp
@@ -54,15 +54,10 @@ void scene27_initScene(Scene *sc) {
 	g_vars->scene27_maid = sc->getStaticANIObject1ById(ANI_MAID, -1);
 	g_vars->scene27_batHandler = sc->getStaticANIObject1ById(ANI_BITAHANDLER, -1);
 
-	g_vars->scene27_balls.numBalls = 0;
-	g_vars->scene27_balls.pTail = 0;
-	g_vars->scene27_balls.field_8 = 0;
-	g_vars->scene27_balls.pHead = 0;
-	g_vars->scene27_balls.cPlexLen = 10;
-
-	free(g_vars->scene27_balls.cPlex);
-	g_vars->scene27_balls.cPlex = 0;
+	for (uint i = 0; i < g_vars->scene27_balls.size(); i++)
+		delete g_vars->scene27_balls[i];
 
+	g_vars->scene27_balls.clear();
 	g_vars->scene27_bats.clear();
 	g_vars->scene27_var07.clear();
 
@@ -72,43 +67,6 @@ void scene27_initScene(Scene *sc) {
 	for (int i = 0; i < 4; i++) {
 		StaticANIObject *newbat = new StaticANIObject(g_vars->scene27_bat);
 
-		Ball *runPtr = g_vars->scene27_balls.pTail;
-		Ball *lastP = g_vars->scene27_balls.field_8;
-
-		if (!g_vars->scene27_balls.pTail) {
-			g_vars->scene27_balls.cPlex = (byte *)calloc(g_vars->scene27_balls.cPlexLen, sizeof(Ball));
-
-			byte *p1 = g_vars->scene27_balls.cPlex + (g_vars->scene27_balls.cPlexLen - 1) * sizeof(Ball);
-
-			if (g_vars->scene27_balls.cPlexLen - 1 < 0) {
-				runPtr = g_vars->scene27_balls.pTail;
-			} else {
-				runPtr = g_vars->scene27_balls.pTail;
-
-				for (int j = 0; j < g_vars->scene27_balls.cPlexLen; j++) {
-					((Ball *)p1)->p1 = runPtr;
-					runPtr = (Ball *)p1;
-
-					p1 -= sizeof(Ball);
-				}
-
-				g_vars->scene27_balls.pTail = runPtr;
-			}
-		}
-
-		g_vars->scene27_balls.pTail = runPtr->p0;
-		runPtr->p1 = lastP;
-		runPtr->p0 = 0;
-		runPtr->ani = newbat;
-
-		g_vars->scene27_balls.numBalls++;
-
-		if (g_vars->scene27_balls.field_8)
-			g_vars->scene27_balls.field_8->p0 = runPtr;
-		else
-			g_vars->scene27_balls.pHead = runPtr;
-
-		g_vars->scene27_balls.field_8 = runPtr;
 
 		sc->addStaticANIObject(newbat, 1);
 	}
@@ -463,17 +421,11 @@ void sceneHandler27_maidSwitchback() {
 }
 
 void sceneHandler27_batLogic() {
-	if (g_vars->scene27_balls.numBalls) {
-		g_vars->scene27_bat = g_vars->scene27_balls.pHead->ani;
+	if (g_vars->scene27_balls.size()) {
+		g_vars->scene27_bat = g_vars->scene27_balls[0];
 
-		g_vars->scene27_balls.pHead = g_vars->scene27_balls.pHead->p0;
-
-		if (g_vars->scene27_balls.pHead)
-			g_vars->scene27_balls.pHead->p0->p1 = 0;
-		else
-			g_vars->scene27_balls.field_8 = 0;
-
-		g_vars->scene27_balls.init(&g_vars->scene27_balls.pHead->p0);
+		g_vars->scene27_balls.remove_at(0);
+		g_vars->scene27_balls.push_back(g_vars->scene27_bat);
 
 		int mv;
 
@@ -545,7 +497,7 @@ void sceneHandler27_calcWinArcade() {
 			}
 		}
 
-		if (!g_vars->scene27_balls.numBalls) {
+		if (!g_vars->scene27_balls.size()) {
 			sceneHandler27_driverPushButton();
 			sceneHandler27_maidSwitchback();
 			return;
@@ -563,44 +515,9 @@ void sceneHandler27_regenBats() {
 	for (uint i = 0; i < g_vars->scene27_var07.size(); i++) {
 		g_vars->scene27_var07[i]->ani->hide();
 
-		Ball *runPtr = g_vars->scene27_balls.pTail;
-		Ball *lastP = g_vars->scene27_balls.field_8;
 		StaticANIObject *newbat = g_vars->scene27_var07[i]->ani;
 
-		if (!g_vars->scene27_balls.pTail) {
-			g_vars->scene27_balls.cPlex = (byte *)calloc(g_vars->scene27_balls.cPlexLen, sizeof(Ball));
-
-			byte *p1 = g_vars->scene27_balls.cPlex + (g_vars->scene27_balls.cPlexLen - 1) * sizeof(Ball);
-
-			if (g_vars->scene27_balls.cPlexLen - 1 < 0) {
-				runPtr = g_vars->scene27_balls.pTail;
-			} else {
-				runPtr = g_vars->scene27_balls.pTail;
-
-				for (int j = 0; j < g_vars->scene27_balls.cPlexLen; j++) {
-					((Ball *)p1)->p1 = runPtr;
-					runPtr = (Ball *)p1;
-
-					p1 -= sizeof(Ball);
-				}
-
-				g_vars->scene27_balls.pTail = runPtr;
-			}
-		}
-
-		g_vars->scene27_balls.pTail = runPtr->p0;
-		runPtr->p1 = lastP;
-		runPtr->p0 = 0;
-		runPtr->ani = newbat;
-
-		g_vars->scene27_balls.numBalls++;
-
-		if (g_vars->scene27_balls.field_8)
-			g_vars->scene27_balls.field_8->p0 = runPtr;
-		else
-			g_vars->scene27_balls.pHead = runPtr;
-
-		g_vars->scene27_balls.field_8 = runPtr;
+		g_vars->scene27_balls.push_back(newbat);
 	}
 
 	g_vars->scene27_var07.clear();


Commit: 2e643276df90339f76a34897d4f9aeaf549ffb8d
    https://github.com/scummvm/scummvm/commit/2e643276df90339f76a34897d4f9aeaf549ffb8d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-09-07T18:44:17+02:00

Commit Message:
FULLPIPE: Fix bat minigame in scene27

Changed paths:
    engines/fullpipe/scenes/scene27.cpp



diff --git a/engines/fullpipe/scenes/scene27.cpp b/engines/fullpipe/scenes/scene27.cpp
index bc52580..9524464 100644
--- a/engines/fullpipe/scenes/scene27.cpp
+++ b/engines/fullpipe/scenes/scene27.cpp
@@ -67,6 +67,7 @@ void scene27_initScene(Scene *sc) {
 	for (int i = 0; i < 4; i++) {
 		StaticANIObject *newbat = new StaticANIObject(g_vars->scene27_bat);
 
+		g_vars->scene27_balls.push_back(newbat);
 
 		sc->addStaticANIObject(newbat, 1);
 	}





More information about the Scummvm-git-logs mailing list