diff options
| -rw-r--r-- | engines/cine/object.cpp | 17 | ||||
| -rw-r--r-- | engines/cine/object.h | 2 | 
2 files changed, 15 insertions, 4 deletions
| diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp index b00a636ae6..57a328eef9 100644 --- a/engines/cine/object.cpp +++ b/engines/cine/object.cpp @@ -99,21 +99,32 @@ int removeOverlay(uint16 objIdx, uint16 param) {  /*! \brief Add new overlay sprite to the list   * \param objIdx Associate the overlay with this object - * \param param Type of new overlay + * \param type Type of new overlay   * \todo Why are x, y, width and color left uninitialized?   */ -void addOverlay(uint16 objIdx, uint16 param) { +void addOverlay(uint16 objIdx, uint16 type) {  	Common::List<overlay>::iterator it;  	overlay tmp;  	for (it = overlayList.begin(); it != overlayList.end(); ++it) { +		// This is done for both Future Wars and Operation Stealth  		if (objectTable[it->objIdx].mask >= objectTable[objIdx].mask) {  			break;  		} + +		// There are additional checks in Operation Stealth's implementation +		if (g_cine->getGameType() == Cine::GType_OS && (it->type == 2 || it->type == 3)) { +			break; +		} +	} + +	// In Operation Stealth's implementation we might bail out early +	if (g_cine->getGameType() == Cine::GType_OS && it != overlayList.end() && it->objIdx == objIdx && it->type == type) { +		return;  	}  	tmp.objIdx = objIdx; -	tmp.type = param; +	tmp.type = type;  	overlayList.insert(it, tmp);  } diff --git a/engines/cine/object.h b/engines/cine/object.h index 12e72927e1..103b2f50ba 100644 --- a/engines/cine/object.h +++ b/engines/cine/object.h @@ -60,7 +60,7 @@ void loadObject(char *pObjectName);  void setupObject(byte objIdx, uint16 param1, uint16 param2, uint16 param3, uint16 param4);  void modifyObjectParam(byte objIdx, byte paramIdx, int16 newValue); -void addOverlay(uint16 objIdx, uint16 param); +void addOverlay(uint16 objIdx, uint16 type);  int removeOverlay(uint16 objIdx, uint16 param);  void addGfxElement(int16 objIdx, int16 param, int16 type);  void removeGfxElement(int16 objIdx, int16 param, int16 type); | 
