From 42c9b405f1d7a6e4e3a117579a126f290c6d895a Mon Sep 17 00:00:00 2001 From: Littleboy Date: Fri, 27 Jul 2012 23:23:17 -0400 Subject: LASTEXPRESS: Untemplatize setup functions --- engines/lastexpress/entities/entity.cpp | 190 ++++++++++++++++++++++++- engines/lastexpress/entities/entity.h | 242 +++++--------------------------- 2 files changed, 217 insertions(+), 215 deletions(-) (limited to 'engines/lastexpress') diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index aff9445326..4b1fda9c12 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -598,7 +598,49 @@ void Entity::setup(const char *name, uint index) { _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersIIII); + _data->resetCurrentParameters(); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupI(const char *name, uint index, uint param1) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u)", name, param1); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); + params->param1 = (unsigned int)param1; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupII(const char *name, uint index, uint param1, uint param2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u)", name, param1, param2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIII(const char *name, uint index, uint param1, uint param2, uint param3) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %u)", name, param1, param2, param3); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + params->param3 = param3; _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); } @@ -608,10 +650,10 @@ void Entity::setupS(const char *name, uint index, const char *seq1) { _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersSIIS); + _data->resetCurrentParameters(); EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS*)_data->getCurrentParameters(); - strncpy((char *)¶ms->seq1, seq1, 12); + strncpy(params->seq1, seq1, 12); _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); } @@ -621,11 +663,147 @@ void Entity::setupSS(const char *name, uint index, const char *seq1, const char _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersSSII); + _data->resetCurrentParameters(); EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII*)_data->getCurrentParameters(); - strncpy((char *)¶ms->seq1, seq1, 12); - strncpy((char *)¶ms->seq2, seq2, 12); + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSI(const char *name, uint index, const char *seq1, uint param4) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u)", name, seq1, param4); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + params->param4 = param4; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSII(const char *name, uint index, const char *seq1, uint param4, uint param5) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u)", name, seq1, param4, param5); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + params->param4 = param4; + params->param5 = param5; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSIII(const char *name, uint index, const char *seq, uint param4, uint param5, uint param6) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u, %u)", name, seq, param4, param5, param6); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII *)_data->getCurrentParameters(); + strncpy(params->seq, seq, 12); + params->param4 = param4; + params->param5 = param5; + params->param6 = param6; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSIIS(const char *name, uint index, const char *seq1, uint param4, uint param5, const char *seq2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %u, %u, %s)", name, seq1, param4, param5, seq2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + params->param4 = param4; + params->param5 = param5; + strncpy(params->seq2, seq2, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupSSI(const char *name, uint index, const char *seq1, const char *seq2, uint param7) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s, %u)", name, seq1, seq2, param7); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII *)_data->getCurrentParameters(); + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); + params->param7 = param7; + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIS(const char *name, uint index, uint param1, const char *seq) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %s)", name, param1, seq); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII *)_data->getCurrentParameters(); + params->param1 = (unsigned int)param1; + strncpy(params->seq, seq, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupISS(const char *name, uint index, uint param1, const char *seq1, const char *seq2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %s, %s)", name, param1, seq1, seq2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI *)_data->getCurrentParameters(); + params->param1 = param1; + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIIS(const char *name, uint index, uint param1, uint param2, const char *seq) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %s)", name, param1, param2, seq); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + strncpy(params->seq, seq, 12); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); +} + +void Entity::setupIISS(const char *name, uint index, uint param1, uint param2, const char *seq1, const char *seq2) { + debugC(6, kLastExpressDebugLogic, "Entity: %s(%u, %u, %s, %s)", name, param1, param2, seq1, seq2); + + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); + _data->setCurrentCallback(index); + _data->resetCurrentParameters(); + + EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS *)_data->getCurrentParameters(); + params->param1 = param1; + params->param2 = param2; + strncpy(params->seq1, seq1, 12); + strncpy(params->seq2, seq2, 12); _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); } diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index 0b1db137a6..3601f34f6f 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -122,13 +122,6 @@ struct SavePoint; if (!params) \ error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \ -#define RESET_PARAMS(data, type) do { \ - EntityData::EntityCallParameters *callParameters = data->getCurrentCallParameters(); \ - callParameters->clear(); \ - for (int i = 0; i < 4; i++) \ - callParameters->parameters[i] = new type(); \ -} while (false) - // function signature without setup (we keep the index for consistency but never use it) #define IMPLEMENT_FUNCTION_NOSETUP(index, class, name) \ void class::name(const SavePoint &savepoint) { \ @@ -154,7 +147,7 @@ struct SavePoint; // setup with one uint parameter #define IMPLEMENT_FUNCTION_I(index, class, name, paramType) \ void class::setup_##name(paramType param1) { \ - Entity::setupI(#class "::setup_" #name, index, param1); \ + Entity::setupI(#class "::setup_" #name, index, param1); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ @@ -163,7 +156,7 @@ struct SavePoint; // setup with two uint parameters #define IMPLEMENT_FUNCTION_II(index, class, name, paramType1, paramType2) \ void class::setup_##name(paramType1 param1, paramType2 param2) { \ - Entity::setupII(#class "::setup_" #name, index, param1, param2); \ + Entity::setupII(#class "::setup_" #name, index, param1, param2); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ @@ -172,7 +165,7 @@ struct SavePoint; // setup with three uint parameters #define IMPLEMENT_FUNCTION_III(index, class, name, paramType1, paramType2, paramType3) \ void class::setup_##name(paramType1 param1, paramType2 param2, paramType3 param3) { \ - Entity::setupIII(#class "::setup_" #name, index, param1, param2, param3); \ + Entity::setupIII(#class "::setup_" #name, index, param1, param2, param3); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersIIII) \ @@ -190,7 +183,7 @@ struct SavePoint; // setup with one char *parameter and one uint #define IMPLEMENT_FUNCTION_SI(index, class, name, paramType2) \ void class::setup_##name(const char *seq1, paramType2 param4) { \ - Entity::setupSI(#class "::setup_" #name, index, seq1, param4); \ + Entity::setupSI(#class "::setup_" #name, index, seq1, param4); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ @@ -199,7 +192,7 @@ struct SavePoint; // setup with one char *parameter and two uints #define IMPLEMENT_FUNCTION_SII(index, class, name, paramType2, paramType3) \ void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5) { \ - Entity::setupSII(#class "::setup_" #name, index, seq1, param4, param5); \ + Entity::setupSII(#class "::setup_" #name, index, seq1, param4, param5); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ @@ -208,7 +201,7 @@ struct SavePoint; // setup with one char *parameter and three uints #define IMPLEMENT_FUNCTION_SIII(index, class, name, paramType2, paramType3, paramType4) \ void class::setup_##name(const char *seq, paramType2 param4, paramType3 param5, paramType4 param6) { \ - Entity::setupSIII(#class "::setup_" #name, index, seq, param4, param5, param6); \ + Entity::setupSIII(#class "::setup_" #name, index, seq, param4, param5, param6); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersSIII) \ @@ -216,7 +209,7 @@ struct SavePoint; #define IMPLEMENT_FUNCTION_SIIS(index, class, name, paramType2, paramType3) \ void class::setup_##name(const char *seq1, paramType2 param4, paramType3 param5, const char *seq2) { \ - Entity::setupSIIS(#class "::setup_" #name, index, seq1, param4, param5, seq2); \ + Entity::setupSIIS(#class "::setup_" #name, index, seq1, param4, param5, seq2); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersSIIS) \ @@ -232,7 +225,7 @@ struct SavePoint; #define IMPLEMENT_FUNCTION_SSI(index, class, name, paramType3) \ void class::setup_##name(const char *seq1, const char *seq2, paramType3 param7) { \ - Entity::setupSSI(#class "::setup_" #name, index, seq1, seq2, param7); \ + Entity::setupSSI(#class "::setup_" #name, index, seq1, seq2, param7); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersSSII) \ @@ -240,7 +233,7 @@ struct SavePoint; #define IMPLEMENT_FUNCTION_IS(index, class, name, paramType) \ void class::setup_##name(paramType param1, const char *seq) { \ - Entity::setupIS(#class "::setup_" #name, index, param1, seq); \ + Entity::setupIS(#class "::setup_" #name, index, param1, seq); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersISII) \ @@ -248,7 +241,7 @@ struct SavePoint; #define IMPLEMENT_FUNCTION_ISS(index, class, name, paramType) \ void class::setup_##name(paramType param1, const char *seq1, const char *seq2) { \ - Entity::setupISS(#class "::setup_" #name, index, param1, seq1, seq2); \ + Entity::setupISS(#class "::setup_" #name, index, param1, seq1, seq2); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersISSI) \ @@ -256,7 +249,7 @@ struct SavePoint; #define IMPLEMENT_FUNCTION_IIS(index, class, name, paramType1, paramType2) \ void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq) { \ - Entity::setupIIS(#class "::setup_" #name, index, param1, param2, seq); \ + Entity::setupIIS(#class "::setup_" #name, index, param1, param2, seq); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersIISI) \ @@ -264,7 +257,7 @@ struct SavePoint; #define IMPLEMENT_FUNCTION_IISS(index, class, name, paramType1, paramType2) \ void class::setup_##name(paramType1 param1, paramType2 param2, const char *seq1, const char *seq2) { \ - Entity::setupIISS(#class "::setup_" #name, index, param1, param2, seq1, seq2); \ + Entity::setupIISS(#class "::setup_" #name, index, param1, param2, seq1, seq2); \ } \ void class::name(const SavePoint &savepoint) { \ EXPOSE_PARAMS(EntityData::EntityParametersIISS) \ @@ -842,6 +835,15 @@ public: EntityData() {} + template + void resetCurrentParameters() { + EntityCallParameters *params = &_parameters[_data.currentCall]; + params->clear(); + + for (int i = 0; i < 4; i++) + params->parameters[i] = new T(); + } + EntityCallData *getCallData() { return &_data; } EntityParameters *getParameters(uint callback, byte index) const; @@ -1068,198 +1070,20 @@ protected: // Setup functions ////////////////////////////////////////////////////////////////////////// void setup(const char *name, uint index); + void setupI(const char *name, uint index, uint param1); + void setupII(const char *name, uint index, uint param1, uint param2); + void setupIII(const char *name, uint index, uint param1, uint param2, uint param3); void setupS(const char *name, uint index, const char *seq1); void setupSS(const char *name, uint index, const char *seq1, const char *seq2); - - template - void setupI(const char *name, uint index, T param1) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%d)", name, param1); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersIIII); - - EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); - params->param1 = (unsigned int)param1; - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupII(const char *name, uint index, T1 param1, T2 param2) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d)", name, param1, param2); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersIIII); - - EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); - params->param1 = param1; - params->param2 = param2; - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupIII(const char *name, uint index, T1 param1, T2 param2, T3 param3) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d, %d)", name, param1, param2, param3); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersIIII); - - EntityData::EntityParametersIIII *params = (EntityData::EntityParametersIIII *)_data->getCurrentParameters(); - params->param1 = param1; - params->param2 = param2; - params->param3 = param3; - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupSI(const char *name, uint index, const char *seq1, T param4) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d)", name, seq1, param4); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersSIIS); - - EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); - strncpy((char *)¶ms->seq1, seq1, 12); - params->param4 = param4; - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupSII(const char *name, uint index, const char *seq1, T1 param4, T2 param5) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d, %d)", name, seq1, param4, param5); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersSIIS); - - EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); - strncpy((char *)¶ms->seq1, seq1, 12); - params->param4 = param4; - params->param5 = param5; - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupSIII(const char *name, uint index, const char *seq, T1 param4, T2 param5, T3 param6) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d, %d, %d)", name, seq, param4, param5, param6); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersSIII); - - EntityData::EntityParametersSIII *params = (EntityData::EntityParametersSIII *)_data->getCurrentParameters(); - strncpy((char *)¶ms->seq, seq, 12); - params->param4 = param4; - params->param5 = param5; - params->param6 = param6; - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupSIIS(const char *name, uint index, const char *seq1, T1 param4, T2 param5, const char *seq2) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %d, %d, %s)", name, seq1, param4, param5, seq2); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersSIIS); - - EntityData::EntityParametersSIIS *params = (EntityData::EntityParametersSIIS *)_data->getCurrentParameters(); - strncpy((char *)¶ms->seq1, seq1, 12); - params->param4 = param4; - params->param5 = param5; - strncpy((char *)¶ms->seq2, seq2, 12); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupSSI(const char *name, uint index, const char *seq1, const char *seq2, T param7) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%s, %s, %d)", name, seq1, seq2, param7); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersSSII); - - EntityData::EntityParametersSSII *params = (EntityData::EntityParametersSSII *)_data->getCurrentParameters(); - strncpy((char *)¶ms->seq1, seq1, 12); - strncpy((char *)¶ms->seq2, seq2, 12); - params->param7 = param7; - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupIS(const char *name, uint index, T param1, const char *seq) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %s)", name, param1, seq); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersISII); - - EntityData::EntityParametersISII *params = (EntityData::EntityParametersISII *)_data->getCurrentParameters(); - params->param1 = (unsigned int)param1; - strncpy((char *)¶ms->seq, seq, 12); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupISS(const char *name, uint index, T param1, const char *seq1, const char *seq2) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %s, %s)", name, param1, seq1, seq2); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersISSI); - - EntityData::EntityParametersISSI *params = (EntityData::EntityParametersISSI *)_data->getCurrentParameters(); - params->param1 = param1; - strncpy((char *)¶ms->seq1, seq1, 12); - strncpy((char *)¶ms->seq2, seq2, 12); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupIIS(const char *name, uint index, T1 param1, T2 param2, const char *seq) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d, %s)", name, param1, param2, seq); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersIISI); - - EntityData::EntityParametersIISI *params = (EntityData::EntityParametersIISI *)_data->getCurrentParameters(); - params->param1 = param1; - params->param2 = param2; - strncpy((char *)¶ms->seq, seq, 12); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } - - template - void setupIISS(const char *name, uint index, T1 param1, T2 param2, const char *seq1, const char *seq2) { - debugC(6, kLastExpressDebugLogic, "Entity: %s(%d, %d, %s, %s)", name, param1, param2, seq1, seq2); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); - _data->setCurrentCallback(index); - RESET_PARAMS(_data, EntityData::EntityParametersIISS); - - EntityData::EntityParametersIISS *params = (EntityData::EntityParametersIISS *)_data->getCurrentParameters(); - params->param1 = param1; - params->param2 = param2; - strncpy((char *)¶ms->seq1, seq1, 12); - strncpy((char *)¶ms->seq2, seq2, 12); - - _engine->getGameLogic()->getGameState()->getGameSavePoints()->call(_entityIndex, _entityIndex, kActionDefault); - } + void setupSI(const char *name, uint index, const char *seq1, uint param4); + void setupSII(const char *name, uint index, const char *seq1, uint param4, uint param5); + void setupSIII(const char *name, uint index, const char *seq, uint param4, uint param5, uint param6); + void setupSIIS(const char *name, uint index, const char *seq1, uint param4, uint param5, const char *seq2); + void setupSSI(const char *name, uint index, const char *seq1, const char *seq2, uint param7); + void setupIS(const char *name, uint index, uint param1, const char *seq); + void setupISS(const char *name, uint index, uint param1, const char *seq1, const char *seq2); + void setupIIS(const char *name, uint index, uint param1, uint param2, const char *seq); + void setupIISS(const char *name, uint index, uint param1, uint param2, const char *seq1, const char *seq2); ////////////////////////////////////////////////////////////////////////// // Helper functions -- cgit v1.2.3