LASTEXPRESS: Replace UPDATE_PARAM_PROC and UPDATE_PARAM_PROC_TIME macros

This commit is contained in:
Julien 2012-07-23 01:15:20 -04:00
parent e13290a028
commit 8de4cb6547
23 changed files with 145 additions and 147 deletions

View File

@ -1650,12 +1650,12 @@ IMPLEMENT_FUNCTION(48, Abbot, function48)
if (ENTITY_PARAM(0, 1))
getData()->inventoryItem = kItemInvalid;
UPDATE_PARAM_PROC(params->param1, getState()->time, 1800)
if (Entity::updateParameter(params->param1, getState()->time, 1800)) {
getData()->inventoryItem = kItemNone;
setCallback(4);
setup_updatePosition("126C", kCarRedSleeping, 52);
UPDATE_PARAM_PROC_END
}
TIME_CHECK_CALLBACK_INVENTORY(kTime2533500, params->param2, 5, setup_callbackActionRestaurantOrSalon);
break;

View File

@ -751,7 +751,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22)
break;
case kActionNone:
UPDATE_PARAM_PROC(params->param2, getState()->time, params->param2)
if (Entity::updateParameter(params->param2, getState()->time, params->param2)) {
if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
getData()->location = kLocationOutsideCompartment;
getData()->inventoryItem = kItemNone;
@ -760,7 +760,7 @@ IMPLEMENT_FUNCTION(22, Alexei, function22)
setup_updatePosition("103D", kCarRestaurant, 52);
break;
}
UPDATE_PARAM_PROC_END
}
if (params->param3 == kTimeInvalid || getState()->time <= kTime1111500)
break;
@ -1333,22 +1333,22 @@ IMPLEMENT_FUNCTION(35, Alexei, function35)
case kActionNone:
if (getEntities()->isInSalon(kEntityPlayer)) {
UPDATE_PARAM_PROC(params->param2, getState()->time, 2700)
if (Entity::updateParameter(params->param2, getState()->time, 2700)) {
setCallback(1);
setup_callbackActionRestaurantOrSalon();
break;
UPDATE_PARAM_PROC_END
}
} else {
params->param2 = 0;
}
UPDATE_PARAM_PROC(params->param3, getState()->time, params->param1)
if (Entity::updateParameter(params->param3, getState()->time, params->param1)) {
if (getEntities()->isSomebodyInsideRestaurantOrSalon()) {
setCallback(3);
setup_function15();
break;
}
UPDATE_PARAM_PROC_END
}
label_callback_3:
if (!Entity::updateParameter(params->param4, getState()->time, 9000))

View File

@ -198,12 +198,12 @@ IMPLEMENT_FUNCTION(12, Anna, function12)
params->param2 = 1;
if (params->param6) {
UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, 75)
if (Entity::updateParameter(params->param7, getState()->timeTicks, 75)) {
getSavePoints()->push(kEntityAnna, kEntityAnna, kActionEndSound);
params->param6 = 0;
params->param7 = 0;
UPDATE_PARAM_PROC_END
}
}
if (params->param4) {
@ -669,11 +669,11 @@ IMPLEMENT_FUNCTION_I(18, Anna, function18, TimeValue)
}
if (params->param5 && !params->param4) {
UPDATE_PARAM_PROC(params->param6, getState()->time, 900)
if (Entity::updateParameter(params->param6, getState()->time, 900)) {
params->param2 |= kItemScarf;
params->param5 = 0;
params->param6 = 0;
UPDATE_PARAM_PROC_END
}
}
if (params->param3) {
@ -1152,11 +1152,11 @@ IMPLEMENT_FUNCTION(29, Anna, function29)
case kActionNone:
if (params->param2) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 900)
if (Entity::updateParameter(params->param3, getState()->time, 900)) {
getData()->inventoryItem = (InventoryItem)(getData()->inventoryItem | kItemScarf);
params->param2 = 0;
params->param3 = 0;
UPDATE_PARAM_PROC_END
}
}
if (params->param1) {
@ -1415,11 +1415,11 @@ IMPLEMENT_FUNCTION(34, Anna, function34)
case kActionNone:
if (!params->param1 && getEntities()->isPlayerPosition(kCarRedSleeping, 60)) {
UPDATE_PARAM_PROC(params->param2, getState()->time, 150)
if (Entity::updateParameter(params->param2, getState()->time, 150)) {
setCallback(1);
setup_draw("419B");
break;
UPDATE_PARAM_PROC_END
}
}
label_callback_1:
@ -2098,11 +2098,11 @@ IMPLEMENT_FUNCTION(48, Anna, function48)
break;
if (params->param3 != kTimeInvalid && getState()->time > kTime1969200) {
UPDATE_PARAM_PROC_TIME(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150)
if (Entity::updateParameterTime(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150)) {
setCallback(3);
setup_playSound("Aug3007A");
break;
UPDATE_PARAM_PROC_END
}
}
label_callback_4:
@ -2392,18 +2392,18 @@ IMPLEMENT_FUNCTION(53, Anna, function53)
case kActionNone:
if (getProgress().field_48 && params->param5 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150)
if (Entity::updateParameterTime(kTime2065500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param5, 150)) {
setup_function54();
break;
UPDATE_PARAM_PROC_END
}
}
if (params->param3) {
UPDATE_PARAM_PROC(params->param6, getState()->time, 9000)
if (Entity::updateParameter(params->param6, getState()->time, 9000)) {
params->param4 = !params->param4;
getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A");
params->param6 = 0;
UPDATE_PARAM_PROC_END
}
}
if (params->param1) {
@ -2546,11 +2546,11 @@ IMPLEMENT_FUNCTION(54, Anna, function54)
if (params->param3) {
TIME_CHECK(kTime2079000, params->param5, setup_function55);
UPDATE_PARAM_PROC(params->param6, getState()->time, 9000)
if (Entity::updateParameter(params->param6, getState()->time, 9000)) {
params->param4 = !params->param4;
getEntities()->drawSequenceLeft(kEntityAnna, params->param4 ? "417B" : "417A");
params->param6 = 0;
UPDATE_PARAM_PROC_END
}
}
if (params->param1) {

View File

@ -538,10 +538,10 @@ label_continue:
break;
if (params->param6) {
UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 6300)
if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 6300)) {
params->param6 = 0;
CURRENT_PARAM(1, 1) = 0;
UPDATE_PARAM_PROC_END
}
}
if (!params->param4
@ -804,7 +804,7 @@ IMPLEMENT_FUNCTION_I(23, August, function23, TimeValue)
}
label_callback_8:
UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)
if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->timeTicks, 75)) {
getEntities()->exitCompartment(kEntityAugust, kObjectCompartment1, true);
if (getProgress().eventCorpseMovedFromFloor) {
@ -820,7 +820,7 @@ label_callback_8:
setup_savegame(kSavegameTypeEvent, kEventAugustFindCorpse);
}
break;
UPDATE_PARAM_PROC_END
}
label_callback_9:
if (params->param3 && params->param1 < getState()->time && !CURRENT_PARAM(1, 5)) {
@ -1634,9 +1634,9 @@ IMPLEMENT_FUNCTION(32, August, function32)
break;
case kActionNone:
UPDATE_PARAM_PROC_TIME(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0);
if (Entity::updateParameterTime(kTime1179000, (!getEntities()->isInSalon(kEntityAnna) || getEntities()->isInSalon(kEntityPlayer)), params->param6, 0)) {
getSavePoints()->push(kEntityAugust, kEntityAnna, kAction123712592);
UPDATE_PARAM_PROC_END
}
if (params->param1 && getEntities()->isSomebodyInsideRestaurantOrSalon()) {
if (!params->param4) {
@ -1645,13 +1645,13 @@ IMPLEMENT_FUNCTION(32, August, function32)
}
if (params->param7 != kTimeInvalid && params->param4 < getState()->time) {
UPDATE_PARAM_PROC_TIME(params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0);
if (Entity::updateParameterTime((TimeValue)params->param5, getEntities()->isInSalon(kEntityPlayer), params->param7, 0)) {
getData()->location = kLocationOutsideCompartment;
setCallback(5);
setup_updatePosition("109D", kCarRestaurant, 56);
break;
UPDATE_PARAM_PROC_END
}
}
}
@ -3224,9 +3224,9 @@ IMPLEMENT_FUNCTION(63, August, function63)
break;
case kActionNone:
UPDATE_PARAM_PROC(params->param3, getState()->time, 1800)
if (Entity::updateParameter(params->param3, getState()->time, 1800)) {
getData()->inventoryItem = kItemInvalid;
UPDATE_PARAM_PROC_END
}
if (getState()->time > kTime2488500 && !params->param4) {
params->param4 = 1;

View File

@ -646,11 +646,11 @@ IMPLEMENT_FUNCTION(20, Boutarel, function20)
break;
if (!params->param2) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 4500)
if (Entity::updateParameter(params->param3, getState()->time, 4500)) {
setCallback(3);
setup_playSound("MRB1078A");
break;
UPDATE_PARAM_PROC_END
}
}
TIME_CHECK_CALLBACK_1(kTime1138500, params->param4, 4, setup_function14, false);
@ -936,9 +936,9 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29)
break;
case kActionNone:
UPDATE_PARAM_PROC(params->param2, getState()->time, 450)
if (Entity::updateParameter(params->param2, getState()->time, 450)) {
getSavePoints()->push(kEntityBoutarel, kEntityServers1, kAction256200848);
UPDATE_PARAM_PROC_END
}
if (!params->param1)
break;

View File

@ -393,13 +393,13 @@ IMPLEMENT_FUNCTION(8, Chapters, chapter1Handler)
if (!getProgress().isTrainRunning || getState()->time >= kTime1458000)
goto label_processStations;
UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param2)
if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param2)) {
// Play sound FX
getSound()->playLocomotiveSound();
params->param2 = 225 * (4 * rnd(5) + 20);
params->param6 = 0;
UPDATE_PARAM_PROC_END
}
label_processStations:
// Process stations
@ -896,15 +896,15 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
case kActionNone:
if (getProgress().isTrainRunning) {
UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, params->param1)
if (Entity::updateParameter(params->param4, getState()->timeTicks, params->param1)) {
getSound()->playLocomotiveSound();
params->param1 = 225 * (4 * rnd(5) + 20);
params->param4 = 0;
UPDATE_PARAM_PROC_END
}
}
UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, params->param2)
if (Entity::updateParameter(params->param5, getState()->timeTicks, params->param2)) {
switch (rnd(2)) {
default:
break;
@ -920,7 +920,7 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler)
params->param2 = 225 * (4 * rnd(6) + 8);
params->param5 = 0;
UPDATE_PARAM_PROC_END
}
TIME_CHECK_CALLBACK_2(kTimeEnterSalzbourg, params->param6, 1, setup_enterStation, "Salzburg", kCitySalzbourg);
@ -1195,15 +1195,15 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
case kActionNone:
if (getProgress().isTrainRunning) {
UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, params->param4);
if (Entity::updateParameter(params->param6, getState()->timeTicks, params->param4)) {
getSound()->playLocomotiveSound();
params->param4 = 225 * (4 * rnd(5) + 20);
params->param6 = 0;
UPDATE_PARAM_PROC_END
}
}
UPDATE_PARAM_PROC(params->param7, getState()->timeTicks, params->param5)
if (Entity::updateParameter(params->param7, getState()->timeTicks, params->param5)) {
switch (rnd(2)) {
default:
break;
@ -1219,7 +1219,7 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler)
params->param5 = 225 * (4 * rnd(6) + 8);
params->param7 = 0;
UPDATE_PARAM_PROC_END
}
TIME_CHECK_CALLBACK_2(kTimeEnterPoszony, params->param8, 1, setup_enterStation, "Pozsony", kCityPoszony);

View File

@ -434,12 +434,12 @@ IMPLEMENT_FUNCTION(11, Cooks, chapter3Handler)
break;
case kActionNone:
UPDATE_PARAM_PROC(params->param4, getState()->time, params->param2)
if (Entity::updateParameter(params->param4, getState()->time, params->param2)) {
// Broken plate sound
getSound()->playSound(kEntityPlayer, "LIB122", getSound()->getSoundFlag(kEntityCooks));
params->param2 = 225 * (4 * rnd(30) + 120);
params->param4 = 0;
UPDATE_PARAM_PROC_END
}
if (getState()->time > kTime2079000 && !params->param5) {
params->param1 = 0;

View File

@ -908,9 +908,9 @@ IMPLEMENT_FUNCTION_II(20, Coudert, function20, ObjectIndex, ObjectIndex)
break;
case kActionNone:
UPDATE_PARAM_PROC(CURRENT_PARAM(1, 3), getState()->time, 300)
if (Entity::updateParameter(CURRENT_PARAM(1, 3), getState()->time, 300)) {
getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityCoudert));
UPDATE_PARAM_PROC_END
}
if (!Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 900))
break;
@ -2281,14 +2281,14 @@ label_callback_9:
label_callback_10:
if (getState()->time > kTime1189800 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 2700);
if (Entity::updateParameter(params->param3, getState()->time, 2700)) {
ENTITY_PARAM(0, 2) = 1;
ENTITY_PARAM(0, 1) = 1;
getEntities()->drawSequenceLeft(kEntityCoudert, "697F");
params->param3 = 0;
UPDATE_PARAM_PROC_END
}
}
if (!ENTITY_PARAM(0, 2))
@ -3539,11 +3539,11 @@ label_callback_1:
params->param2 = (uint)(getState()->time + 4500);
if (params->param3 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)
if (Entity::updateParameterTime((TimeValue)params->param2, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param3, 0)) {
setCallback(2);
setup_function55();
break;
UPDATE_PARAM_PROC_END
}
}
}

View File

@ -601,11 +601,11 @@ void Entity::callbackAction() {
// Helper functions
//////////////////////////////////////////////////////////////////////////
bool Entity::updateParameter(uint &parameter, uint timeValue, uint delta) {
bool Entity::updateParameter(uint &parameter, uint timeType, uint delta) {
if (!parameter)
parameter = (uint)(timeValue + delta);
parameter = (uint)(timeType + delta);
if (parameter >= timeValue)
if (parameter >= timeType)
return false;
parameter = kTimeInvalid;
@ -613,12 +613,26 @@ bool Entity::updateParameter(uint &parameter, uint timeValue, uint delta) {
return true;
}
bool Entity::updateParameterCheck(uint &parameter, uint timeValue, uint delta) {
if (parameter && parameter >= timeValue)
bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta) {
if (getState()->time <= timeValue) {
if (check || !parameter)
parameter = (uint)(getState()->time + delta);
}
if (parameter >= getState()->time && getState()->time <= timeValue)
return false;
parameter = kTimeInvalid;
return true;
}
bool Entity::updateParameterCheck(uint &parameter, uint timeType, uint delta) {
if (parameter && parameter >= timeType)
return false;
if (!parameter)
parameter = (uint)(timeValue + delta);
parameter = (uint)(timeType + delta);
return true;
}

View File

@ -870,8 +870,9 @@ protected:
// Helper functions
//////////////////////////////////////////////////////////////////////////
bool updateParameter(uint &parameter, uint time, uint delta);
bool updateParameterCheck(uint &parameter, uint time, uint delta);
bool updateParameter(uint &parameter, uint timeType, uint delta);
bool updateParameterCheck(uint &parameter, uint timeType, uint delta);
bool updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta);
void timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action);
void timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex index, ObjectLocation location);

View File

@ -371,23 +371,6 @@ void class::setup_##name() { \
parameter = kTimeInvalid; \
}
// Updating parameter with code inside the check
#define UPDATE_PARAM_PROC(parameter, type, value) \
if (!parameter) \
parameter = (uint)(type + value); \
if (parameter < type) { \
parameter = kTimeInvalid;
#define UPDATE_PARAM_PROC_TIME(timeValue, test, parameter, value) \
if (getState()->time <= timeValue) { \
if (test || !parameter) \
parameter = (uint)(getState()->time + value); \
} \
if (parameter < getState()->time || getState()->time > timeValue) { \
parameter = kTimeInvalid;
#define UPDATE_PARAM_PROC_END }
} // End of namespace LastExpress
#endif // LASTEXPRESS_ENTITY_INTERN_H

View File

@ -278,7 +278,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue)
case kActionNone:
if (!getSoundQueue()->isBuffered(kEntityFrancois)) {
UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6)
if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6)) {
switch (rnd(7)) {
default:
break;
@ -311,7 +311,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue)
params->param6 = 15 * rnd(7);
CURRENT_PARAM(1, 1) = 0;
UPDATE_PARAM_PROC_END
}
}
if (!getEntities()->hasValidFrame(kEntityFrancois) || !getEntities()->isWalkingOppositeToPlayer(kEntityFrancois))
@ -998,11 +998,11 @@ label_callback_5:
}
if (params->param5 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75);
if (Entity::updateParameterTime(kTimeEnd, !getEntities()->isDistanceBetweenEntities(kEntityFrancois, kEntityPlayer, 2000), params->param5, 75)) {
setCallback(6);
setup_playSound("Fra2010");
break;
UPDATE_PARAM_PROC_END
}
}
label_callback_6:

View File

@ -394,10 +394,10 @@ IMPLEMENT_FUNCTION(15, Kahina, function15)
case kActionNone:
if (params->param2 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0)
if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param2, 0)) {
setCallback(9);
setup_updateEntity(kCarRedSleeping, kPosition_4070);
UPDATE_PARAM_PROC_END
}
}
break;
@ -580,18 +580,18 @@ IMPLEMENT_FUNCTION(17, Kahina, chapter2Handler)
case kActionNone:
if (params->param1) {
UPDATE_PARAM_PROC(params->param2, getState()->time, 9000)
if (Entity::updateParameter(params->param2, getState()->time, 9000)) {
params->param1 = 1;
params->param2 = 0;
UPDATE_PARAM_PROC_END
}
}
if (getEvent(kEventKahinaAskSpeakFirebird) && getEvent(kEventKronosConversationFirebird) && getEntities()->isInsideTrainCar(kEntityPlayer, kCarKronos)) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 900)
if (Entity::updateParameter(params->param3, getState()->time, 900)) {
setCallback(1);
setup_savegame(kSavegameTypeEvent, kEventKronosConversationFirebird);
break;
UPDATE_PARAM_PROC_END
}
}
label_callback_3:
@ -785,10 +785,10 @@ label_callback_2:
}
if (!params->param1) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 9000)
if (Entity::updateParameter(params->param3, getState()->time, 9000)) {
params->param1 = 1;
params->param3 = 0;
UPDATE_PARAM_PROC_END
}
}
if (getEvent(kEventKahinaAskSpeakFirebird)
@ -927,11 +927,11 @@ IMPLEMENT_FUNCTION(21, Kahina, function21)
params->param3 = (uint)getState()->time + 4500;
if (params->param6 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0)
if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param5, 0)) {
setCallback(2);
setup_function23();
break;
UPDATE_PARAM_PROC_END
}
}
}
@ -942,14 +942,14 @@ label_callback_2:
params->param4 = (uint)getState()->time + 4500;
if (params->param6 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0)
if (Entity::updateParameterTime((TimeValue)params->param3, (getEntities()->isPlayerPosition(kCarKronos, 80) || getEntities()->isPlayerPosition(kCarKronos, 88)), params->param6, 0)) {
getSound()->playSound(kEntityPlayer, "LIB014", getSound()->getSoundFlag(kEntityKahina));
getSound()->playSound(kEntityPlayer, "LIB015", getSound()->getSoundFlag(kEntityKahina));
getEntities()->drawSequenceLeft(kEntityKahina, "202a");
params->param2 = 0;
UPDATE_PARAM_PROC_END
}
}
}

View File

@ -293,10 +293,10 @@ IMPLEMENT_FUNCTION(15, Kronos, function15)
case kActionNone:
if (params->param1 && !getEntities()->isInSalon(kEntityBoutarel)) {
UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 75)
if (Entity::updateParameter(params->param2, getState()->timeTicks, 75)) {
setup_function16();
break;
UPDATE_PARAM_PROC_END
}
}
if (params->param3 != kTimeInvalid && getState()->time > kTime2002500) {
@ -526,9 +526,9 @@ IMPLEMENT_FUNCTION(20, Kronos, function20)
}
if (CURRENT_PARAM(1, 2) != kTimeInvalid && params->param7 < getState()->time) {
UPDATE_PARAM_PROC_TIME(params->param8, !params->param1, CURRENT_PARAM(1, 2), 450)
if (Entity::updateParameterTime((TimeValue)params->param8, !params->param1, CURRENT_PARAM(1, 2), 450)) {
getSavePoints()->push(kEntityKronos, kEntityKahina, kAction237555748);
UPDATE_PARAM_PROC_END
}
}
if (!params->param1)

View File

@ -534,20 +534,20 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool)
Entity::savegameBloodJacket();
if (!params->param2 && !params->param3) {
UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 75)
if (Entity::updateParameter(params->param4, getState()->timeTicks, 75)) {
getData()->inventoryItem = kItemNone;
setCallback(5);
setup_function18();
break;
UPDATE_PARAM_PROC_END
}
}
UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 225)
if (Entity::updateParameter(params->param5, getState()->timeTicks, 225)) {
getData()->inventoryItem = kItemNone;
setCallback(6);
setup_function18();
break;
UPDATE_PARAM_PROC_END
}
getData()->inventoryItem = (getProgress().chapter == kChapter1
&& !ENTITY_PARAM(2, 1)
@ -1059,9 +1059,9 @@ IMPLEMENT_FUNCTION_II(21, Mertens, function21, ObjectIndex, ObjectIndex)
break;
case kActionNone:
UPDATE_PARAM_PROC(CURRENT_PARAM(1, 4), getState()->time, 300)
if (Entity::updateParameter(CURRENT_PARAM(1, 4), getState()->time, 300)) {
getSound()->playSound(kEntityPlayer, "ZFX1004", getSound()->getSoundFlag(kEntityMertens));
UPDATE_PARAM_PROC_END
}
if (!Entity::updateParameter(CURRENT_PARAM(1, 5), getState()->time, 900))
break;
@ -1616,13 +1616,13 @@ IMPLEMENT_FUNCTION_I(27, Mertens, tylerCompartment, MertensActionType)
break;
}
UPDATE_PARAM_PROC(params->param2, getState()->timeTicks, 150)
if (Entity::updateParameter(params->param2, getState()->timeTicks, 150)) {
getObjects()->update(kObjectCompartment1, kEntityPlayer, getObjects()->get(kObjectCompartment1).location, kCursorNormal, kCursorNormal);
setCallback(10);
setup_playSound16("CON1018A");
break;
UPDATE_PARAM_PROC_END
}
label_callback10:
if (!params->param3)
@ -3025,11 +3025,11 @@ IMPLEMENT_FUNCTION(42, Mertens, function42)
label_callback_8:
if (getState()->time > kTime1215000 && !ENTITY_PARAM(0, 1) && !ENTITY_PARAM(2, 1)) {
UPDATE_PARAM_PROC(params->param5, getState()->time, 2700)
if (Entity::updateParameter(params->param5, getState()->time, 2700)) {
getEntities()->drawSequenceLeft(kEntityMertens, "601E");
ENTITY_PARAM(0, 1) = 1;
params->param5 = 0;
UPDATE_PARAM_PROC_END
}
}
if (ENTITY_PARAM(0, 8)) {

View File

@ -176,11 +176,11 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue)
}
if (params->param2) {
UPDATE_PARAM_PROC(params->param8, getState()->timeTicks, 75)
if (Entity::updateParameter(params->param8, getState()->timeTicks, 75)) {
params->param2 = 0;
params->param3 = 1;
getObjects()->update(kObjectCompartmentG, kEntityMilos, kObjectLocation1, kCursorNormal, kCursorNormal);
UPDATE_PARAM_PROC_END
}
}
params->param8 = 0;
@ -189,10 +189,10 @@ IMPLEMENT_FUNCTION_I(11, Milos, function11, TimeValue)
break;
if (params->param6) {
UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->time, 4500)
if (Entity::updateParameter(CURRENT_PARAM(1, 1), getState()->time, 4500)) {
params->param6 = 0;
CURRENT_PARAM(1, 1) = 0;
UPDATE_PARAM_PROC_END
}
}
if (!getProgress().field_CC) {
@ -730,11 +730,11 @@ IMPLEMENT_FUNCTION(15, Milos, chapter1Handler)
}
if (getEntities()->isPlayerPosition(kCarRestaurant, 61) && !params->param1) {
UPDATE_PARAM_PROC(params->param4, getState()->timeTicks, 45)
if (Entity::updateParameter(params->param4, getState()->timeTicks, 45)) {
setCallback(1);
setup_draw("009C");
break;
UPDATE_PARAM_PROC_END
}
}
if (getEntities()->isPlayerPosition(kCarRestaurant, 70) && !params->param2) {
@ -1287,10 +1287,10 @@ IMPLEMENT_FUNCTION(25, Milos, function25)
case kActionNone:
if (!getEvent(kEventMilosCompartmentVisitTyler) && !getProgress().field_54 && !ENTITY_PARAM(0, 4)) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 13500)
if (Entity::updateParameter(params->param3, getState()->time, 13500)) {
getSavePoints()->push(kEntityMilos, kEntityVesna, kAction155913424);
params->param3 = 0;
UPDATE_PARAM_PROC_END
}
}
if (params->param1) {

View File

@ -400,7 +400,7 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13)
case kActionNone:
if (!getSoundQueue()->isBuffered(kEntityMmeBoutarel) && params->param6 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0)
if (Entity::updateParameterTime((TimeValue)params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0)) {
getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
getObjects()->update(kObject51, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal);
@ -412,16 +412,16 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13)
setCallback(1);
setup_playSound("MME1037");
break;
UPDATE_PARAM_PROC_END
}
}
label_callback_1:
if (getProgress().field_24 && params->param7 != kTimeInvalid) {
UPDATE_PARAM_PROC_TIME(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0)
if (Entity::updateParameterTime(kTime1093500, (!params->param5 || !getEntities()->isPlayerInCar(kCarRedSleeping)), params->param7, 0)) {
setCallback(2);
setup_function11();
break;
UPDATE_PARAM_PROC_END
}
}
TIME_CHECK(kTime1094400, params->param8, setup_function14);

View File

@ -1115,13 +1115,13 @@ IMPLEMENT_FUNCTION(33, Pascale, function33)
case kActionNone:
if (params->param4) {
UPDATE_PARAM_PROC(params->param5, getState()->time, 4500)
if (Entity::updateParameter(params->param5, getState()->time, 4500)) {
getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal);
setCallback(1);
setup_playSound("Wat5010");
break;
UPDATE_PARAM_PROC_END
}
}
label_callback1:

View File

@ -498,14 +498,14 @@ IMPLEMENT_FUNCTION_I(20, Rebecca, function20, TimeValue)
if (!params->param2) {
params->param6 = 0;
} else {
UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75)
if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) {
params->param2 = 0;
params->param3 = 1;
getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
params->param6 = 0;
UPDATE_PARAM_PROC_END
}
}
if (getProgress().chapter == kChapter1 && !ENTITY_PARAM(0, 3)) {

View File

@ -312,17 +312,17 @@ IMPLEMENT_FUNCTION(20, Servers0, chapter1Handler)
case kActionNone:
if (params->param2) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 2700);
if (Entity::updateParameter(params->param3, getState()->time, 2700)) {
ENTITY_PARAM(0, 4) = 1;
params->param2 = 0;
UPDATE_PARAM_PROC_END
}
}
if (params->param1) {
UPDATE_PARAM_PROC(params->param4, getState()->time, 4500)
if (Entity::updateParameter(params->param4, getState()->time, 4500)) {
ENTITY_PARAM(0, 5) = 1;
params->param1 = 0;
UPDATE_PARAM_PROC_END
}
}
if (!getEntities()->isInKitchen(kEntityServers0) && !getEntities()->isSomebodyInsideRestaurantOrSalon())
@ -733,10 +733,10 @@ IMPLEMENT_FUNCTION(32, Servers0, chapter4Handler)
break;
case kActionNone:
UPDATE_PARAM_PROC(params->param2, getState()->time, 3600)
if (Entity::updateParameter(params->param2, getState()->time, 3600)) {
ENTITY_PARAM(1, 8) = 1;
params->param1 = 0;
UPDATE_PARAM_PROC_END
}
if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon())
break;

View File

@ -563,10 +563,10 @@ IMPLEMENT_FUNCTION(26, Servers1, chapter4Handler)
case kActionNone:
if (params->param2) {
UPDATE_PARAM_PROC(params->param2, getState()->time, 900)
if (Entity::updateParameter(params->param2, getState()->time, 900)) {
ENTITY_PARAM(1, 5) = 1;
params->param1 = 0;
UPDATE_PARAM_PROC_END
}
}
if (!getEntities()->isInKitchen(kEntityServers1) || !getEntities()->isSomebodyInsideRestaurantOrSalon())

View File

@ -374,10 +374,10 @@ IMPLEMENT_FUNCTION(18, Tatiana, function18)
}
if (!params->param1) {
UPDATE_PARAM_PROC(params->param3, getState()->time, 4500)
if (Entity::updateParameter(params->param3, getState()->time, 4500)) {
getEntities()->drawSequenceRight(kEntityTatiana, "806DS");
params->param1 = 1;
UPDATE_PARAM_PROC_END
}
}
}
@ -424,20 +424,20 @@ IMPLEMENT_FUNCTION(19, Tatiana, chapter1Handler)
if (getSoundQueue()->isBuffered(kEntityTatiana) || !params->param4 || params->param3 == 2 || getSoundQueue()->isBuffered("TAT1066"))
goto label_tatiana_chapter1_2;
UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 450)
if (Entity::updateParameter(params->param5, getState()->timeTicks, 450)) {
getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A");
getProgress().field_64 = 1;
params->param3++;
params->param5 = 0;
UPDATE_PARAM_PROC_END
}
if (getEntities()->isPlayerPosition(kCarRestaurant, 71)) {
UPDATE_PARAM_PROC(params->param6, getState()->timeTicks, 75)
if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) {
getSound()->playSound(kEntityTatiana, params->param3 ? "TAT1069B" : "TAT1069A");
getProgress().field_64 = 1;
params->param3++;
params->param6 = 0;
UPDATE_PARAM_PROC_END
}
}
label_tatiana_chapter1_2:
@ -615,7 +615,7 @@ IMPLEMENT_FUNCTION(22, Tatiana, function22)
if (params->param1 == kTimeInvalid || getState()->time <= kTime1179000)
goto label_update;
UPDATE_PARAM_PROC_TIME(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)
if (Entity::updateParameterTime(kTime1233000, ((!getEvent(kEventTatianaAskMatchSpeakRussian) && !getEvent(kEventTatianaAskMatch)) || getEntities()->isInGreenCarEntrance(kEntityPlayer)), params->param1, 0)) {
label_update:
if (!getEvent(kEventTatianaAskMatchSpeakRussian)
&& !getEvent(kEventTatianaAskMatch)
@ -624,7 +624,7 @@ label_update:
getObjects()->update(kObject25, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward);
getObjects()->update(kObjectTrainTimeTable, kEntityTatiana, kObjectLocation1, kCursorNormal, kCursorForward);
}
UPDATE_PARAM_PROC_END
}
params->param1 = kTimeInvalid;
@ -1284,13 +1284,13 @@ IMPLEMENT_FUNCTION(37, Tatiana, function37)
params->param3 = (uint)getState()->time + 900;
if (params->param4 != kTimeInvalid && params->param3 < getState()->time) {
UPDATE_PARAM_PROC_TIME(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450)
if (Entity::updateParameterTime(kTime2227500, !getEntities()->isPlayerInCar(kCarRedSleeping), params->param4, 450)) {
getProgress().field_5C = 1;
if (getEntities()->isInsideCompartment(kEntityAnna, kCarRedSleeping, kPosition_4070)) {
setup_function38();
break;
}
UPDATE_PARAM_PROC_END
}
}
}

View File

@ -1082,10 +1082,10 @@ IMPLEMENT_FUNCTION(30, Vesna, function30)
case kActionNone:
if (!params->param1) {
UPDATE_PARAM_PROC(params->param3, getState()->timeTicks, 120)
if (Entity::updateParameter(params->param3, getState()->timeTicks, 120)) {
getSound()->playSound(kEntityVesna, "Ves50001", kFlagDefault);
params->param1 = 1;
UPDATE_PARAM_PROC_END
}
}
if (!Entity::updateParameter(params->param4, getState()->timeTicks, 180))