LASTEXPRESS: Add missing casts, fix warnings and correct typos

svn-id: r53694
This commit is contained in:
Julien Templier 2010-10-22 01:30:18 +00:00
parent 06d9de0a9b
commit fed894aeee
11 changed files with 90 additions and 58 deletions

View File

@ -851,7 +851,8 @@ bool Debugger::cmdBeetle(int argc, const char **argv) {
// 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);

View File

@ -1374,7 +1374,7 @@ label_callback_3:
case 4:
getData()->location = kLocationOutsideCompartment;
setCallback((byte)(getCallback() + 1));
setCallback(getCallback() + 1);
setup_updatePosition("124C", kCarRestaurant, 52);
break;

View File

@ -1230,13 +1230,13 @@ IMPLEMENT_FUNCTION(29, Anna, function29)
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 @@ IMPLEMENT_FUNCTION(69, Anna, function69)
case kAction100969180:
getEntities()->clearSequences(kEntityAnna);
params->param1 = 1;
break;
case kAction122288808:
getEntities()->drawSequenceLeft(kEntityAnna, "127E");

View File

@ -2856,7 +2856,7 @@ label_callback_19:
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 @@ label_callback_6:
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;

View File

@ -251,6 +251,33 @@ public:
}
};
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 @@ public:
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

View File

@ -127,7 +127,7 @@ IMPLEMENT_FUNCTION_II(8, Francois, updateEntity, CarIndex, EntityPosition)
&& getInventory()->get(kItemBeetle)->location == kObjectLocation1
&& !getEvent(kEventFrancoisShowBeetle)
&& !getEvent(kEventFrancoisShowBeetleD))
getData()->inventoryItem = kItemMatchBox;
getData()->inventoryItem = kItemMatchBox;
} else {
getData()->inventoryItem = kItemFirebird;
}

View File

@ -111,6 +111,9 @@ IMPLEMENT_FUNCTION_II(8, Gendarmes, arrestUpdateEntity, CarIndex, EntityPosition
//////////////////////////////////////////////////////////////////////////
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 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition)
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 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition)
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 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition)
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,17 +230,17 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition)
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;
}
}
}
//////////////////////////////////////////////////////////////////////////

View File

@ -250,7 +250,7 @@ IMPLEMENT_FUNCTION(14, Hadija, chapter2Handler)
break;
case kActionNone:
if (getState()->time > kTime1782000 && !params->param1) { \
if (getState()->time > kTime1782000 && !params->param1) {
params->param1 = 1;
getData()->entityPosition = kPosition_2740;
}

View File

@ -487,13 +487,13 @@ IMPLEMENT_FUNCTION(20, Kronos, function20)
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);

View File

@ -1761,7 +1761,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
return kCursorNormal;
if ((!getInventory()->getSelectedItem() || getInventory()->getSelectedEntry()->manualSelect)
&& (object != kObject21 || getProgress().eventCorpseMovedFromFloor == true))
&& (object != kObject21 || getProgress().eventCorpseMovedFromFloor))
return kCursorHand;
else
return kCursorNormal;

View File

@ -218,7 +218,7 @@ EntityData::EntityCallData *Entities::getData(EntityIndex entity) const {
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)