2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2006-02-22 22:40:53 +00:00
|
|
|
*
|
2007-05-30 21:56:52 +00:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-02-22 22:40:53 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-11-08 21:46:57 +00:00
|
|
|
#include "common/endian.h"
|
|
|
|
#include "common/stream.h"
|
|
|
|
|
|
|
|
#include "cine/cine.h"
|
|
|
|
#include "cine/main_loop.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
#include "cine/object.h"
|
2006-11-08 21:46:57 +00:00
|
|
|
#include "cine/various.h"
|
|
|
|
#include "cine/bg_list.h"
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 00:26:14 +00:00
|
|
|
namespace Cine {
|
|
|
|
|
2006-11-08 21:46:57 +00:00
|
|
|
uint32 var8;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2010-04-21 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* Add masked sprite to the background
|
|
|
|
* @param objIdx Sprite description
|
2008-04-07 20:24:40 +00:00
|
|
|
*/
|
2008-05-24 22:11:41 +00:00
|
|
|
void addToBGList(int16 objIdx) {
|
2010-08-09 11:38:01 +00:00
|
|
|
renderer->incrustSprite(g_cine->_objectTable[objIdx]);
|
2006-11-08 21:46:57 +00:00
|
|
|
|
2008-05-24 22:11:41 +00:00
|
|
|
createBgIncrustListElement(objIdx, 0);
|
2006-11-08 21:46:57 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* Add filled sprite to the background
|
|
|
|
* @param objIdx Sprite description
|
2008-04-07 20:24:40 +00:00
|
|
|
*/
|
2008-05-24 22:11:41 +00:00
|
|
|
void addSpriteFilledToBGList(int16 objIdx) {
|
2010-08-09 11:38:01 +00:00
|
|
|
renderer->incrustMask(g_cine->_objectTable[objIdx]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2008-05-24 22:11:41 +00:00
|
|
|
createBgIncrustListElement(objIdx, 1);
|
2006-11-08 21:46:57 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* Add new element to incrust list
|
|
|
|
* @param objIdx Element description
|
|
|
|
* @param param Type of element
|
2008-04-07 20:24:40 +00:00
|
|
|
*/
|
2006-11-08 21:46:57 +00:00
|
|
|
void createBgIncrustListElement(int16 objIdx, int16 param) {
|
2008-04-07 20:24:40 +00:00
|
|
|
BGIncrust tmp;
|
2006-11-08 21:46:57 +00:00
|
|
|
|
2008-07-01 10:33:25 +00:00
|
|
|
tmp.unkPtr = 0;
|
2008-04-07 20:24:40 +00:00
|
|
|
tmp.objIdx = objIdx;
|
|
|
|
tmp.param = param;
|
2010-08-09 11:38:01 +00:00
|
|
|
tmp.x = g_cine->_objectTable[objIdx].x;
|
|
|
|
tmp.y = g_cine->_objectTable[objIdx].y;
|
|
|
|
tmp.frame = g_cine->_objectTable[objIdx].frame;
|
|
|
|
tmp.part = g_cine->_objectTable[objIdx].part;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2010-08-09 11:38:01 +00:00
|
|
|
g_cine->_bgIncrustList.push_back(tmp);
|
2006-11-08 21:46:57 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* Reset var8 (probably something related to bgIncrustList)
|
2008-04-07 20:24:40 +00:00
|
|
|
*/
|
2009-11-02 21:54:57 +00:00
|
|
|
void resetBgIncrustList() {
|
2006-11-08 21:46:57 +00:00
|
|
|
var8 = 0;
|
|
|
|
}
|
|
|
|
|
2010-04-21 21:22:43 +00:00
|
|
|
/**
|
|
|
|
* Restore incrust list from savefile
|
|
|
|
* @param fHandle Savefile open for reading
|
2008-04-07 20:24:40 +00:00
|
|
|
*/
|
2008-07-22 10:15:58 +00:00
|
|
|
void loadBgIncrustFromSave(Common::SeekableReadStream &fHandle) {
|
2008-04-07 20:24:40 +00:00
|
|
|
BGIncrust tmp;
|
|
|
|
int size = fHandle.readSint16BE();
|
|
|
|
|
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
|
fHandle.readUint32BE();
|
|
|
|
fHandle.readUint32BE();
|
|
|
|
|
2008-07-01 10:33:25 +00:00
|
|
|
tmp.unkPtr = 0;
|
2008-04-07 20:24:40 +00:00
|
|
|
tmp.objIdx = fHandle.readUint16BE();
|
|
|
|
tmp.param = fHandle.readUint16BE();
|
|
|
|
tmp.x = fHandle.readUint16BE();
|
|
|
|
tmp.y = fHandle.readUint16BE();
|
|
|
|
tmp.frame = fHandle.readUint16BE();
|
|
|
|
tmp.part = fHandle.readUint16BE();
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2010-08-09 11:38:01 +00:00
|
|
|
g_cine->_bgIncrustList.push_back(tmp);
|
2008-04-07 20:24:40 +00:00
|
|
|
|
|
|
|
if (tmp.param == 0) {
|
2010-08-09 11:38:01 +00:00
|
|
|
renderer->incrustSprite(g_cine->_objectTable[tmp.objIdx]);
|
2006-11-08 21:46:57 +00:00
|
|
|
} else {
|
2010-08-09 11:38:01 +00:00
|
|
|
renderer->incrustMask(g_cine->_objectTable[tmp.objIdx]);
|
2006-11-08 21:46:57 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
}
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
} // End of namespace Cine
|