[Scummvm-cvs-logs] SF.net SVN: scummvm:[53694] scummvm/trunk/engines/lastexpress

littleboy at users.sourceforge.net littleboy at users.sourceforge.net
Fri Oct 22 03:30:18 CEST 2010


Revision: 53694
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53694&view=rev
Author:   littleboy
Date:     2010-10-22 01:30:18 +0000 (Fri, 22 Oct 2010)

Log Message:
-----------
LASTEXPRESS: Add missing casts, fix warnings and correct typos

Modified Paths:
--------------
    scummvm/trunk/engines/lastexpress/debug.cpp
    scummvm/trunk/engines/lastexpress/entities/alexei.cpp
    scummvm/trunk/engines/lastexpress/entities/anna.cpp
    scummvm/trunk/engines/lastexpress/entities/coudert.cpp
    scummvm/trunk/engines/lastexpress/entities/entity.h
    scummvm/trunk/engines/lastexpress/entities/francois.cpp
    scummvm/trunk/engines/lastexpress/entities/gendarmes.cpp
    scummvm/trunk/engines/lastexpress/entities/hadija.cpp
    scummvm/trunk/engines/lastexpress/entities/kronos.cpp
    scummvm/trunk/engines/lastexpress/game/action.cpp
    scummvm/trunk/engines/lastexpress/game/entities.cpp

Modified: scummvm/trunk/engines/lastexpress/debug.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/debug.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/debug.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -851,7 +851,8 @@
 			// Cleanup
 			beetle->unload();
 			delete beetle;
-			SAFE_DELETE(action);
+			if (action)
+				delete action;
 
 			// Pause for a second to be able to see the final scene
 			_engine->_system->delayMillis(1000);

Modified: scummvm/trunk/engines/lastexpress/entities/alexei.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/alexei.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/alexei.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -1374,7 +1374,7 @@
 		case 4:
 			getData()->location = kLocationOutsideCompartment;
 
-			setCallback((byte)(getCallback() + 1));
+			setCallback(getCallback() + 1);
 			setup_updatePosition("124C", kCarRestaurant, 52);
 			break;
 

Modified: scummvm/trunk/engines/lastexpress/entities/anna.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/anna.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/anna.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -1230,13 +1230,13 @@
 
 			getScenes()->loadSceneFromPosition(kCarRestaurant, 51);
 			break;
-
-		case kAction123712592:
-			getData()->inventoryItem = kItemNone;
-			setup_function30();
-			break;
 		}
 		break;
+
+	case kAction123712592:
+		getData()->inventoryItem = kItemNone;
+		setup_function30();
+		break;
 	}
 }
 
@@ -3479,6 +3479,7 @@
 	case kAction100969180:
 		getEntities()->clearSequences(kEntityAnna);
 		params->param1 = 1;
+		break;
 
 	case kAction122288808:
 		getEntities()->drawSequenceLeft(kEntityAnna, "127E");

Modified: scummvm/trunk/engines/lastexpress/entities/coudert.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/coudert.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/coudert.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -2856,7 +2856,7 @@
 	case kAction11:
 		if (!ENTITY_PARAM(2, 1)) {
 			setCallback(20);
-			setup_function13(savepoint.param.intValue, savepoint.entity2);
+			setup_function13((bool)savepoint.param.intValue, savepoint.entity2);
 		}
 		break;
 
@@ -3584,7 +3584,7 @@
 	case kAction11:
 		if (!ENTITY_PARAM(2, 1) && !ENTITY_PARAM(0, 1)) {
 			setCallback(7);
-			setup_function13(savepoint.param.intValue, savepoint.entity2);
+			setup_function13((bool)savepoint.param.intValue, savepoint.entity2);
 		}
 		break;
 

Modified: scummvm/trunk/engines/lastexpress/entities/entity.h
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/entity.h	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/entity.h	2010-10-22 01:30:18 UTC (rev 53694)
@@ -251,6 +251,33 @@
 		}
 	};
 
+	struct EntityParametersSSSI : EntityParameters {
+		char seq1[12];
+		char seq2[12];
+		char seq3[12];
+		uint param10;
+
+		EntityParametersSSSI() {
+			memset(&seq1, 0, 12);
+			memset(&seq2, 0, 12);
+			memset(&seq3, 0, 12);
+			param10 = 0;
+		}
+
+		Common::String toString() {
+			return Common::String::printf("SSSI: %s %s %s %d\n", seq1, seq2, seq3, param10);
+		}
+
+		void update(uint32 index) {
+			switch (index) {
+			default:
+				error("EntityParametersSSSI::update: invalid index (was: %d)", index);
+
+			case 9: param10 = 1; break;			
+			}
+		}
+	};
+
 	struct EntityParametersIISS : EntityParameters {
 		uint param1;
 		uint param2;
@@ -525,7 +552,7 @@
 	EntityData::EntityCallData *getData() { return _data->getCallData(); }
 
 	// Callbacks
-	int getCallback() { return _data->getCallback(_data->getCallData()->currentCall + 8); }
+	byte getCallback() { return _data->getCallback(_data->getCallData()->currentCall + 8); }
 	void setCallback(byte index) { _data->setCallback(_data->getCallData()->currentCall + 8, index); getData()->currentCall++; }
 
 	// Setup

Modified: scummvm/trunk/engines/lastexpress/entities/francois.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/francois.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/francois.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -127,7 +127,7 @@
 				 && getInventory()->get(kItemBeetle)->location == kObjectLocation1
 				 && !getEvent(kEventFrancoisShowBeetle)
 				 && !getEvent(kEventFrancoisShowBeetleD))
-				getData()->inventoryItem = kItemMatchBox;
+					getData()->inventoryItem = kItemMatchBox;
 			} else {
 				getData()->inventoryItem = kItemFirebird;
 			}

Modified: scummvm/trunk/engines/lastexpress/entities/gendarmes.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/gendarmes.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/gendarmes.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -111,6 +111,9 @@
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition)
+	EntityData::EntityParametersSSSI *parameters1 = (EntityData::EntityParametersSSSI*)_data->getCurrentParameters(1);
+	EntityData::EntityParametersISII *parameters2 = (EntityData::EntityParametersISII*)_data->getCurrentParameters(2);
+
 	switch (savepoint.action) {
 	default:
 		break;
@@ -119,73 +122,73 @@
 		if (params->param2 <= kPosition_3050) {
 			if (params->param2 != kPosition_3050) {
 				if (params->param2 == kPosition_2740)
-					CURRENT_PARAM(2, 5) = kObjectCompartment8;
+					parameters2->param5 = kObjectCompartment8;
 			} else {
-				CURRENT_PARAM(2, 5) = kObjectCompartment7;
-				CURRENT_PARAM(2, 6) = true;
+				parameters2->param5 = kObjectCompartment7;
+				parameters2->param6 = true;
 			}
 		} else if (params->param2 <= kPosition_4840) {
 			if (params->param2 != kPosition_4840) {
 				if (params->param2 == kPosition_4070) {
-					CURRENT_PARAM(2, 5) = kObjectCompartment6;
-					CURRENT_PARAM(2, 7) = kPosition_4455;
+					parameters2->param5 = kObjectCompartment6;
+					parameters2->param7 = kPosition_4455;
 				}
 			} else {
-				CURRENT_PARAM(2, 5) = kObjectCompartment5;
-				CURRENT_PARAM(2, 6) = true;
-				CURRENT_PARAM(2, 7) = kPosition_4455;
+				parameters2->param5 = kObjectCompartment5;
+				parameters2->param6 = true;
+				parameters2->param7 = kPosition_4455;
 			}
 		} else if (params->param2 <= kPosition_6470) {
 			if (params->param2 != kPosition_6470) {
 				if (params->param2 == kPosition_5790) {
-					CURRENT_PARAM(2, 5) = kObjectCompartment4;
-					CURRENT_PARAM(2, 7) = kPosition_6130;
+					parameters2->param5 = kObjectCompartment4;
+					parameters2->param7 = kPosition_6130;
 				}
 			} else {
-				CURRENT_PARAM(2, 5) = kObjectCompartment3;
-				CURRENT_PARAM(2, 6) = true;
-				CURRENT_PARAM(2, 7) = kPosition_6130;
+				parameters2->param5 = kObjectCompartment3;
+				parameters2->param6 = true;
+				parameters2->param7 = kPosition_6130;
 			}
 		} else if (params->param2 != kPosition_7500) {
 			if (params->param2 == kPosition_8200) {
-				CURRENT_PARAM(2, 5) = kObjectCompartment1;
-				CURRENT_PARAM(2, 6) = true;
-				CURRENT_PARAM(2, 7) = kPosition_7850;
+				parameters2->param5 = kObjectCompartment1;
+				parameters2->param6 = true;
+				parameters2->param7 = kPosition_7850;
 			}
 		} else {
-			CURRENT_PARAM(2, 5) = kObjectCompartment2;
-			CURRENT_PARAM(2, 7) = kPosition_7850;
+			parameters2->param5 = kObjectCompartment2;
+			parameters2->param7 = kPosition_7850;
 		}
 
 		if (params->param1 == kCarBaggageRear)
-			CURRENT_PARAM(2, 5) += 31; // Switch to next compartment car
+			parameters2->param5 += 31; // Switch to next compartment car
 
-		if (CURRENT_PARAM(2, 6)) {
-			strcpy((char *)&CURRENT_PARAM(1, 1), "632A");
-			strcpy((char *)&CURRENT_PARAM(1, 4), "632B");
-			strcpy((char *)&CURRENT_PARAM(1, 7), "632C");
+		if (parameters2->param6) {
+			strcpy((char *)&parameters1->seq1, "632A");
+			strcpy((char *)&parameters1->seq2, "632B");
+			strcpy((char *)&parameters1->seq3, "632C");
 		} else {
-			strcpy((char *)&CURRENT_PARAM(1, 1), "632D");
-			strcpy((char *)&CURRENT_PARAM(1, 4), "632E");
-			strcpy((char *)&CURRENT_PARAM(1, 7), "632F");
+			strcpy((char *)&parameters1->seq1, "632D");
+			strcpy((char *)&parameters1->seq2, "632E");
+			strcpy((char *)&parameters1->seq3, "632F");
 		}
 
-		strcat((char *)&CURRENT_PARAM(1, 1), (char *)&params->seq1);
-		strcat((char *)&CURRENT_PARAM(1, 4), (char *)&params->seq1);
-		strcat((char *)&CURRENT_PARAM(1, 7), (char *)&params->seq1);
+		strcat((char *)&parameters1->seq1, (char *)&params->seq1);
+		strcat((char *)&parameters1->seq2, (char *)&params->seq1);
+		strcat((char *)&parameters1->seq3, (char *)&params->seq1);
 
 		if ((getEntities()->isInsideCompartment(kEntityPlayer, (CarIndex)params->param1, (EntityPosition)params->param2)
-		  || getEntities()->isInsideCompartment(kEntityPlayer, (CarIndex)params->param1, (EntityPosition)CURRENT_PARAM(2, 7))
+		  || getEntities()->isInsideCompartment(kEntityPlayer, (CarIndex)params->param1, (EntityPosition)parameters2->param7)
 		  || (params->param1 == kCarGreenSleeping && params->param2 == kPosition_8200 && getEntities()->isOutsideAlexeiWindow()))
 		 && !getEntities()->isInsideCompartment(kEntityPlayer, kCarRedSleeping, kPosition_7850)) {
 			setCallback(1);
-			setup_function10((CarIndex)params->param1, (EntityPosition)params->param2, (ObjectIndex)CURRENT_PARAM(2, 5));
+			setup_function10((CarIndex)params->param1, (EntityPosition)params->param2, (ObjectIndex)parameters2->param5);
 		} else {
-			getEntities()->drawSequenceLeft(kEntityGendarmes, (char *)&CURRENT_PARAM(1, 1));
+			getEntities()->drawSequenceLeft(kEntityGendarmes, (char *)&parameters1->seq1);
 			getEntities()->enterCompartment(kEntityGendarmes, (ObjectIndex)CURRENT_PARAM(2, 5));
 
-			setCallback(CURRENT_PARAM(2, 6) ? 2 : 3);
-			setup_arrestPlaysound(CURRENT_PARAM(2, 6) ? "POL1044A" : "POL1044B");
+			setCallback(parameters2->param6 ? 2 : 3);
+			setup_arrestPlaysound(parameters2->param6 ? "POL1044A" : "POL1044B");
 		}
 		break;
 
@@ -200,12 +203,12 @@
 
 		case 2:
 		case 3:
-			getEntities()->drawSequenceLeft(kEntityGendarmes, (char *)&CURRENT_PARAM(1, 4));
+			getEntities()->drawSequenceLeft(kEntityGendarmes, (char *)&parameters1->seq2);
 			if (getEntities()->isNobodyInCompartment((CarIndex)params->param1, (EntityPosition)params->param2) || !strcmp(params->seq2, "NODIALOG")) {
 				setCallback(4);
 				setup_arrestCallback(150);
 			} else {
-				char *arrestSound = (char *)&CURRENT_PARAM(2, 2);
+				char *arrestSound = (char *)&parameters2->seq;
 				strcpy(arrestSound, "POL1045");
 				strcat(arrestSound, (char *)&params->seq2);
 
@@ -217,7 +220,7 @@
 		case 4:
 		case 5:
 			if (!getEntities()->isNobodyInCompartment((CarIndex)params->param1, (EntityPosition)params->param2) && strcmp(params->seq2, "NODIALOG")) {
-				char *arrestSound = (char *)&CURRENT_PARAM(2, 2);
+				char *arrestSound = (char *)&parameters2->seq;
 				strcpy(arrestSound, "POL1043");
 				strcat(arrestSound, (char *)&params->seq2);
 
@@ -227,18 +230,18 @@
 			getData()->location = kLocationInsideCompartment;
 
 			setCallback(6);
-			setup_arrestDraw((char *)&CURRENT_PARAM(1, 7));
+			setup_arrestDraw((char *)&parameters1->seq3);
 			break;
 
 		case 6:
 			getData()->location = kLocationOutsideCompartment;
-			getEntities()->exitCompartment(kEntityGendarmes, (ObjectIndex)CURRENT_PARAM(2, 5));
+			getEntities()->exitCompartment(kEntityGendarmes, (ObjectIndex)parameters2->param5);
 			CALLBACK_ACTION();
 			break;
 		}
 		break;
+	}
 }
-}
 
 //////////////////////////////////////////////////////////////////////////
 IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, ObjectIndex)

Modified: scummvm/trunk/engines/lastexpress/entities/hadija.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/hadija.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/hadija.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -250,7 +250,7 @@
 		break;
 
 	case kActionNone:
-		if (getState()->time > kTime1782000 && !params->param1) { \
+		if (getState()->time > kTime1782000 && !params->param1) {
 			params->param1 = 1;
 			getData()->entityPosition = kPosition_2740;
 		}

Modified: scummvm/trunk/engines/lastexpress/entities/kronos.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/entities/kronos.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/entities/kronos.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -487,13 +487,13 @@
 
 		if (params->param6 < ARRAYSIZE(concertData) && params->param5 > concertData[params->param6].time) {
 
-			getEntities()->drawSequenceLeft(kEntityKronos, (char *)&concertData[params->param6].sequence);
+			getEntities()->drawSequenceLeft(kEntityKronos, concertData[params->param6].sequence);
 
-			if (scumm_stricmp((char *)&concertData[params->param6].sequence, "201e")) {
+			if (scumm_stricmp(concertData[params->param6].sequence, "201e")) {
 
-				if (scumm_stricmp((char *)&concertData[params->param6].sequence, "201c")) {
+				if (scumm_stricmp(concertData[params->param6].sequence, "201c")) {
 
-					if (!scumm_stricmp((char *)&concertData[params->param6].sequence, "201d")) {
+					if (!scumm_stricmp(concertData[params->param6].sequence, "201d")) {
 						if (getEntities()->isPlayerPosition(kCarKronos, 86))
 							getScenes()->loadSceneFromPosition(kCarKronos, 83);
 

Modified: scummvm/trunk/engines/lastexpress/game/action.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/game/action.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/game/action.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -1761,7 +1761,7 @@
 			return kCursorNormal;
 
 		if ((!getInventory()->getSelectedItem() || getInventory()->getSelectedEntry()->manualSelect)
-		 && (object != kObject21 || getProgress().eventCorpseMovedFromFloor == true))
+		 && (object != kObject21 || getProgress().eventCorpseMovedFromFloor))
 			return kCursorHand;
 		else
 			return kCursorNormal;

Modified: scummvm/trunk/engines/lastexpress/game/entities.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/game/entities.cpp	2010-10-22 00:35:37 UTC (rev 53693)
+++ scummvm/trunk/engines/lastexpress/game/entities.cpp	2010-10-22 01:30:18 UTC (rev 53694)
@@ -218,7 +218,7 @@
 int Entities::getPosition(CarIndex car, Position position) {
 	int index = 100 * car + position;
 
-	if (car < 0 || car > 10)
+	if (car > 10)
 		error("Entities::getPosition: trying to access an invalid car (was: %d, valid:0-9)", car);
 
 	if (position > 100)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list