diff options
| -rw-r--r-- | queen/bankman.cpp | 20 | ||||
| -rw-r--r-- | queen/bankman.h | 1 | ||||
| -rw-r--r-- | queen/command.cpp | 74 | ||||
| -rw-r--r-- | queen/cutaway.cpp | 6 | ||||
| -rw-r--r-- | queen/graphics.cpp | 44 | ||||
| -rw-r--r-- | queen/graphics.h | 2 | ||||
| -rw-r--r-- | queen/logic.cpp | 13 | ||||
| -rw-r--r-- | queen/logic.h | 2 | ||||
| -rw-r--r-- | queen/queen.cpp | 17 | ||||
| -rw-r--r-- | queen/structs.h | 10 | 
10 files changed, 23 insertions, 166 deletions
| diff --git a/queen/bankman.cpp b/queen/bankman.cpp index 827a273c01..236573b664 100644 --- a/queen/bankman.cpp +++ b/queen/bankman.cpp @@ -26,14 +26,12 @@  namespace Queen { -  BankManager::BankManager(Resource *res)   	: _res(res) {  	memset(_frames, 0, sizeof(_frames));  	memset(_banks, 0, sizeof(_banks));  } -  BankManager::~BankManager() {  	for(uint32 i = 0; i < MAX_BANKS_NUMBER; ++i) {  		close(i); @@ -41,20 +39,15 @@ BankManager::~BankManager() {  	eraseFrames(true);  } -  void BankManager::load(const char *bankname, uint32 bankslot) {  	close(bankslot);  	_banks[bankslot].data = _res->loadFile(bankname); -	if (!_banks[bankslot].data) { -		error("Unable to open bank '%s'", bankname);	 -	}  	int16 entries = (int16)READ_LE_UINT16(_banks[bankslot].data);  	if (entries < 0 || entries >= MAX_BANK_SIZE) {  		error("Maximum bank size exceeded or negative bank size : %d", entries);  	} -  	debug(9, "BankManager::load(%s, %d) - entries = %d", bankname, bankslot, entries);   	uint32 offset = 2; @@ -68,11 +61,9 @@ void BankManager::load(const char *bankname, uint32 bankslot) {  	}  } -  void BankManager::unpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) {  	debug(9, "BankManager::unpack(%d, %d, %d)", srcframe, dstframe, bankslot); -	if (!_banks[bankslot].data) -		error("BankManager::unpack() _banks[bankslot].data is NULL!"); +	assert(_banks[bankslot].data != NULL);  	BobFrame *pbf = &_frames[dstframe];  	uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe]; @@ -87,11 +78,9 @@ void BankManager::unpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) {  	memcpy(pbf->data, p + 8, size);  } -  void BankManager::overpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) {  	debug(9, "BankManager::overpack(%d, %d, %d)", srcframe, dstframe, bankslot); -	if (!_banks[bankslot].data) -		error("BankManager::overpack() _banks[bankslot].data is NULL!"); +	assert(_banks[bankslot].data != NULL);  	uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe];  	uint16 src_w = READ_LE_UINT16(p + 0); @@ -106,14 +95,12 @@ void BankManager::overpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) {  	}  } -  void BankManager::close(uint32 bankslot) {  	debug(9, "BankManager::close(%d)", bankslot);  	delete[] _banks[bankslot].data;  	memset(&_banks[bankslot], 0, sizeof(_banks[bankslot]));  } -  BobFrame *BankManager::fetchFrame(uint32 index) {  	debug(9, "BankManager::fetchFrame(%d)", index);  	if (index >= MAX_FRAMES_NUMBER) { @@ -122,7 +109,6 @@ BobFrame *BankManager::fetchFrame(uint32 index) {  	return &_frames[index];  } -  void BankManager::eraseFrame(uint32 index) {  	debug(9, "BankManager::eraseFrame(%d)", index);  	BobFrame *pbf = &_frames[index]; @@ -130,7 +116,6 @@ void BankManager::eraseFrame(uint32 index) {  	memset(pbf, 0, sizeof(BobFrame));  } -  void BankManager::eraseFrames(bool joe) {      uint32 i = 0;  	if (!joe) { @@ -142,5 +127,4 @@ void BankManager::eraseFrames(bool joe) {  	}  } -  } // End of namespace Queen diff --git a/queen/bankman.h b/queen/bankman.h index 58ac3cf686..df8777d899 100644 --- a/queen/bankman.h +++ b/queen/bankman.h @@ -50,7 +50,6 @@ public:  		MAX_BANKS_NUMBER  =  18  	}; -  private:  	struct PackedBank { diff --git a/queen/command.cpp b/queen/command.cpp index 4c3746eaa9..8d4759e96c 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -35,18 +35,15 @@  namespace Queen { -  void CmdText::clear() {  	memset(_command, 0, sizeof(_command));  } -  void CmdText::display(uint8 color) {  	_vm->display()->textCurrentColor(color);  	_vm->display()->setTextCentered(COMMAND_Y_POS, _command, false);  } -  void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) {  	char temp[MAX_COMMAND_LEN];  	if (locked) { @@ -62,7 +59,6 @@ void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) {  	_vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);  } -  void CmdText::displayTemp(uint8 color, const char *name) {  	char temp[MAX_COMMAND_LEN];  	sprintf(temp, "%s %s", _command, name); @@ -70,29 +66,24 @@ void CmdText::displayTemp(uint8 color, const char *name) {  	_vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);  } -  void CmdText::setVerb(Verb v) {  	strcpy(_command, _vm->logic()->verbName(v));  } -  void CmdText::addLinkWord(Verb v) {  	strcat(_command, " ");  	strcat(_command, _vm->logic()->verbName(v));  } -  void CmdText::addObject(const char *objName) {  	strcat(_command, " ");  	strcat(_command, objName);  } -  bool CmdText::isEmpty() const {  	return _command[0] == 0;  } -  void CmdState::init() {  	commandLevel = 1;  	oldVerb = verb = action = VERB_NONE; @@ -102,14 +93,12 @@ void CmdState::init() {  	selNoun = 0;  } -  Command::Command(QueenEngine *vm)  	: _vm(vm) {  	_cmdText._vm = vm;  } -  void Command::clear(bool clearTexts) {  	_cmdText.clear();  	if (clearTexts) { @@ -119,14 +108,9 @@ void Command::clear(bool clearTexts) {  	_state.init();  } -  void Command::executeCurrentAction() {  	_vm->logic()->entryObj(0); -//	if (_state.commandLevel == 2 && _mouseKey == Input::MOUSE_RBUTTON) { -//		_mouseKey = Input::MOUSE_LBUTTON; -//	} -  	if (_mouseKey == Input::MOUSE_RBUTTON && _state.subject[0] > 0) {  		ObjectData *od = _vm->logic()->objectData(_state.subject[0]); @@ -216,7 +200,6 @@ void Command::executeCurrentAction() {  	cleanupCurrentAction();  } -  void Command::updatePlayer() {	  	if (_vm->logic()->joeWalk() != JWM_MOVE) {  		int16 cx = _vm->input()->mousePosX(); @@ -255,15 +238,18 @@ void Command::updatePlayer() {  	}  } -  void Command::readCommandsFrom(byte *&ptr) {  	uint16 i;  	_numCmdList = READ_BE_UINT16(ptr); ptr += 2;  	_cmdList = new CmdListData[_numCmdList + 1]; -	memset(&_cmdList[0], 0, sizeof(CmdListData)); -	for (i = 1; i <= _numCmdList; i++) { -		_cmdList[i].readFromBE(ptr); +	if (_numCmdList == 0) { +		_cmdList[0].readFromBE(ptr); +	} else { +		memset(&_cmdList[0], 0, sizeof(CmdListData)); +		for (i = 1; i <= _numCmdList; i++) { +			_cmdList[i].readFromBE(ptr); +		}  	}  	_numCmdArea = READ_BE_UINT16(ptr); ptr += 2; @@ -311,7 +297,6 @@ void Command::readCommandsFrom(byte *&ptr) {  	}  } -  ObjectData *Command::findObjectData(uint16 objRoomNum) const {  	ObjectData *od = NULL;  	if (objRoomNum != 0) { @@ -321,7 +306,6 @@ ObjectData *Command::findObjectData(uint16 objRoomNum) const {  	return od;  } -  ItemData *Command::findItemData(Verb invNum) const {  	ItemData *id = NULL;  	uint16 itNum = _vm->logic()->findInventoryItem(invNum - VERB_INV_FIRST); @@ -331,7 +315,6 @@ ItemData *Command::findItemData(Verb invNum) const {  	return id;  } -  int16 Command::executeCommand(uint16 comId, int16 condResult) {  	// execute.c l.313-452  	debug(6, "Command::executeCommand() - cond = %X, com = %X", condResult, comId); @@ -355,9 +338,6 @@ int16 Command::executeCommand(uint16 comId, int16 condResult) {  	bool cutDone = false;  	if (condResult > 0) { -		// as we don't handle the pinnacle room exactly like the original,  -		// the hack described on l.334-339 in execute.c became useless -  		// check for cutaway/dialogs before updating Objects  		const char *desc = _vm->logic()->objectTextualDescription(condResult);  		if (executeIfCutaway(desc)) { @@ -454,7 +434,6 @@ int16 Command::executeCommand(uint16 comId, int16 condResult) {  	return condResult;  } -  int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWalk) {  	// Check to see if object is actually an exit to another  	// room. If so, then set up new room @@ -502,7 +481,6 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWa  	return p;  } -  void Command::grabCurrentSelection() {  	_selPosX = _vm->input()->mousePosX();  	_selPosY = _vm->input()->mousePosY(); @@ -530,7 +508,6 @@ void Command::grabCurrentSelection() {  	}  } -  void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) {  	if (_state.action != VERB_NONE) {  		_cmdText.addObject(_vm->logic()->objectName(objName)); @@ -570,7 +547,6 @@ void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName)  	}  } -  void Command::grabSelectedItem() {  //	_parse = true; @@ -644,7 +620,6 @@ void Command::grabSelectedItem() {  	grabSelectedObject(-item, id->state, id->name);  } -  void Command::grabSelectedNoun() {  	// if the NOUN has been selected from screen then it is positive  	// otherwise it has been selected from inventory and is negative @@ -707,7 +682,6 @@ void Command::grabSelectedNoun() {  	grabSelectedObject(objNum, od->state, od->name);  } -  void Command::grabSelectedVerb() {  	_state.action = _state.verb;  	_state.subject[0] = 0; @@ -731,7 +705,6 @@ void Command::grabSelectedVerb() {  	}  } -  bool Command::executeIfCutaway(const char *description) {  	if (strlen(description) > 4 &&   		scumm_stricmp(description + strlen(description) - 4, ".cut") == 0) { @@ -749,7 +722,6 @@ bool Command::executeIfCutaway(const char *description) {  	return false;  } -  bool Command::executeIfDialog(const char *description) {  	if (strlen(description) > 4 &&   		scumm_stricmp(description + strlen(description) - 4, ".dog") == 0) { @@ -770,7 +742,6 @@ bool Command::executeIfDialog(const char *description) {  	return false;  } -  bool Command::handleWrongAction() {  	// l.96-141 execute.c  	uint16 objMax = _vm->grid()->objMax(_vm->logic()->currentRoom()); @@ -813,7 +784,6 @@ bool Command::handleWrongAction() {  	return false;  } -  void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) {  	// l.158-272 execute.c  	switch (action) { @@ -895,13 +865,12 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) {  			}  		}  		break; - +		  	default:  		break;  	}  } -  void Command::changeObjectState(Verb action, int16 obj, int16 song, bool cutDone) {  	// l.456-533 execute.c  	ObjectData *objData = _vm->logic()->objectData(obj); @@ -956,7 +925,6 @@ void Command::cleanupCurrentAction() {  	_state.oldVerb = VERB_NONE;  } -  void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) {  	CmdListData *cmdList = &_cmdList[1];  	uint16 com = 0; @@ -1010,7 +978,6 @@ void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) {  	}  } -  int16 Command::setConditions(uint16 command, bool lastCmd) {  	debug(9, "Command::setConditions(%d, %d)", command, lastCmd);  	// Test conditions, if FAIL write &&  exit, Return -1 @@ -1066,7 +1033,6 @@ int16 Command::setConditions(uint16 command, bool lastCmd) {  	return ret;  } -  void Command::setAreas(uint16 command) {  	debug(9, "Command::setAreas(%d)", command); @@ -1087,7 +1053,6 @@ void Command::setAreas(uint16 command) {  	}  } -  void Command::setObjects(uint16 command) {  	debug(9, "Command::setObjects(%d)", command); @@ -1160,7 +1125,6 @@ void Command::setObjects(uint16 command) {  	}  } -  void Command::setItems(uint16 command) {  	debug(9, "Command::setItems(%d)", command); @@ -1194,7 +1158,6 @@ void Command::setItems(uint16 command) {  	}  } -  uint16 Command::nextObjectDescription(ObjectDescription* objDesc, uint16 firstDesc) {  	// l.69-103 select.c  	uint16 i; @@ -1233,7 +1196,6 @@ uint16 Command::nextObjectDescription(ObjectDescription* objDesc, uint16 firstDe  	return objDesc->lastSeenNumber;  } -  void Command::lookAtSelectedObject() {  	uint16 desc;  	if (_state.subject[0] < 0) { @@ -1262,7 +1224,6 @@ void Command::lookAtSelectedObject() {  	_vm->logic()->joeFace();  } -  void Command::lookForCurrentObject(int16 cx, int16 cy) {  	uint16 obj = _vm->grid()->findObjectUnderCursor(cx, cy);  	_state.noun = _vm->grid()->findObjectNumber(obj); @@ -1271,23 +1232,6 @@ void Command::lookForCurrentObject(int16 cx, int16 cy) {  		return;  	} -	// if pointing at an Area then exit -	// if the AREA is linked to an object, then dont exit. Find -	// the object its linked to &&  store in AOBJ - -//	if (_state.noun > _vm->logic()->currentRoomObjMax()) { -//		if (_state.oldNoun != 0) { -//			if (_state.defaultVerb != VERB_NONE) { -//				_cmdText.displayTemp(INK_CMD_LOCK, true, _state.defaultVerb); -//			} -//			else if (_state.action != VERB_NONE) { -//				_cmdText.display(INK_CMD_NORMAL); -//			} -//			_state.oldNoun = 0; -//			return; -//		} -//	} -  	ObjectData *od = findObjectData(_state.noun);  	if (od == NULL || od->name <= 0) {  		_state.oldNoun = _state.noun; @@ -1317,7 +1261,6 @@ void Command::lookForCurrentObject(int16 cx, int16 cy) {  	_state.oldNoun = _state.noun;  } -  void Command::lookForCurrentIcon(int16 cx, int16 cy) {  	_state.verb = _vm->grid()->findVerbUnderCursor(cx, cy);  	if (_state.oldVerb != _state.verb) { @@ -1350,5 +1293,4 @@ void Command::lookForCurrentIcon(int16 cx, int16 cy) {  	}  } -  } // End of namespace Queen diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index 5c4e7cb369..b9aa46b1a0 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -401,9 +401,9 @@ void Cutaway::changeRooms(CutawayObject &object) {  		comPanel = 1;  	} -	// FIXME: in the original engine, panel is hidden after displaying head. We do -	// it before. -	if(object.room == FAYE_HEAD || object.room == AZURA_HEAD || object.room == FRANK_HEAD) { +	// FIXME - in the original engine, panel is hidden once the 'head room' is displayed, we +	// do it before (ie before palette fading) +	if (object.room == FAYE_HEAD || object.room == AZURA_HEAD || object.room == FRANK_HEAD) {  		comPanel = 2;  	} diff --git a/queen/graphics.cpp b/queen/graphics.cpp index 14ede39b2a..0d009cd82b 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -32,14 +32,12 @@  namespace Queen { -  void BobSlot::curPos(int16 xx, int16 yy) {  	active = true;  	x = xx;  	y = yy;  } -  void BobSlot::move(int16 dstx, int16 dsty, int16 spd) {  	active = true;  	moving = true; @@ -78,7 +76,6 @@ void BobSlot::move(int16 dstx, int16 dsty, int16 spd) {  	moveOneStep();  } -  void BobSlot::moveOneStep() {  	if(xmajor) {  		if(x == endx) { @@ -107,7 +104,6 @@ void BobSlot::moveOneStep() {  	}  } -  void BobSlot::animOneStep() {  	if (anim.string.buffer != NULL) {  		--anim.speed; @@ -142,7 +138,6 @@ void BobSlot::animOneStep() {  	}  } -  void BobSlot::animString(const AnimFrame *animBuf) {  	active = true;  	animating = true; @@ -152,7 +147,6 @@ void BobSlot::animString(const AnimFrame *animBuf) {  	anim.speed = animBuf->speed / 4;  } -  void BobSlot::animNormal(uint16 firstFrame, uint16 lastFrame, uint16 spd, bool rebound, bool flip) {  	active = true;  	animating = true; @@ -167,7 +161,6 @@ void BobSlot::animNormal(uint16 firstFrame, uint16 lastFrame, uint16 spd, bool r  	xflip = flip;  } -  void BobSlot::clear() {  	active = false;  	xflip  = false; @@ -190,12 +183,10 @@ Graphics::Graphics(QueenEngine *vm)  	_shrinkBuffer.data = new uint8[ BOB_SHRINK_BUF_SIZE ];  } -  Graphics::~Graphics() {  	delete[] _shrinkBuffer.data;  } -  void Graphics::unpackControlBank() {  	_vm->bankMan()->load("control.BBK",17);  	_vm->bankMan()->unpack(1, 1, 17); // Mouse pointer @@ -204,13 +195,11 @@ void Graphics::unpackControlBank() {  	_vm->bankMan()->close(17);  } -  void Graphics::setupMouseCursor() {  	BobFrame *bf = _vm->bankMan()->fetchFrame(1);  	_vm->display()->setMouseCursor(bf->data, bf->width, bf->height);  } -  void Graphics::drawBob(const BobSlot *bs, int16 x, int16 y) {  	debug(9, "Graphics::drawBob(%d, %d, %d)", bs->frameNum, x, y); @@ -264,7 +253,6 @@ void Graphics::drawBob(const BobSlot *bs, int16 x, int16 y) {  	}  } -  void Graphics::drawInventoryItem(uint32 frameNum, uint16 x, uint16 y) {  	if (frameNum != 0) {  		BobFrame *bf = _vm->bankMan()->fetchFrame(frameNum); @@ -274,7 +262,6 @@ void Graphics::drawInventoryItem(uint32 frameNum, uint16 x, uint16 y) {  	}  } -  void Graphics::pasteBob(uint16 objNum, uint16 image) {  	GraphicData *pgd = _vm->logic()->graphicData(objNum);  	_vm->bankMan()->unpack(pgd->firstFrame, image, 15); @@ -283,7 +270,6 @@ void Graphics::pasteBob(uint16 objNum, uint16 image) {  	_vm->bankMan()->eraseFrame(image);  } -  void Graphics::shrinkFrame(const BobFrame *bf, uint16 percentage) {  	// computing new size, rounding to upper value  	uint16 new_w = (bf->width  * percentage + 50) / 100; @@ -328,7 +314,6 @@ void Graphics::shrinkFrame(const BobFrame *bf, uint16 percentage) {  	}  } -  void Graphics::clearBob(uint32 bobNum) {  	BobSlot *pbs = bob(bobNum);  	pbs->clear(); @@ -337,7 +322,6 @@ void Graphics::clearBob(uint32 bobNum) {  	}  } -  void Graphics::sortBobs() {  	_sortedBobsCount = 0; @@ -377,10 +361,8 @@ void Graphics::sortBobs() {  			SWAP(_sortedBobs[index], _sortedBobs[smallest]);  		}  	} -  } -  void Graphics::drawBobs() {  	int i;  	for (i = 0; i < _sortedBobsCount; ++i) { @@ -412,21 +394,18 @@ void Graphics::drawBobs() {  	}  } -  void Graphics::clearBobs() {  	for(int32 i = 0; i < ARRAYSIZE(_bobs); ++i) {  		clearBob(i);  	}  } -  void Graphics::stopBobs() {  	for(int32 i = 0; i < ARRAYSIZE(_bobs); ++i) {  		_bobs[i].moving = false;  	}  } -  BobSlot *Graphics::bob(int index) {  	if (index < MAX_BOBS_NUMBER)  		return _bobs + index; @@ -436,7 +415,6 @@ BobSlot *Graphics::bob(int index) {  	}  } -  void Graphics::setBobText(  		BobSlot *pbs,   		const char *text,  @@ -551,7 +529,6 @@ void Graphics::setBobText(  	}  } -  void Graphics::handleParallax(uint16 roomNum) {  	int i;  	uint16 screenScroll = _vm->display()->horizontalScroll(); @@ -619,7 +596,6 @@ void Graphics::handleParallax(uint16 roomNum) {  	}  } -  void Graphics::setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount) {  	// reset sprites table (bounding box...)  	clearBobs(); @@ -638,7 +614,6 @@ void Graphics::setupNewRoom(const char *room, uint16 roomNum, int16 *furniture,  	}  } -  void Graphics::fillAnimBuffer(const char *anim, AnimFrame *af) {  	while (true) {  		sscanf(anim, "%3hu,%3hu", &af->frame, &af->speed); @@ -649,7 +624,6 @@ void Graphics::fillAnimBuffer(const char *anim, AnimFrame *af) {  	}  } -  uint16 Graphics::countAnimFrames(const char *anim) {  	AnimFrame afbuf[30];  	fillAnimBuffer(anim, afbuf); @@ -671,7 +645,6 @@ uint16 Graphics::countAnimFrames(const char *anim) {  	return count;  } -  void Graphics::setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible) {  	int16 tempFrames[20];  	memset(tempFrames, 0, sizeof(tempFrames)); @@ -747,7 +720,6 @@ void Graphics::setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16  	}  } -  uint16 Graphics::setupPersonAnim(const ActorData *ad, const char *anim, uint16 curImage) {  	debug(9, "Graphics::setupPersonAnim(%s, %d)", anim, curImage);  	_personFrames[ad->bobNum] = curImage + 1; @@ -795,14 +767,12 @@ uint16 Graphics::setupPersonAnim(const ActorData *ad, const char *anim, uint16 c  	return curImage;  } -  void Graphics::resetPersonAnim(uint16 bobNum) {  	if (_newAnim[bobNum][0].frame != 0) {  		bob(bobNum)->animString(_newAnim[bobNum]);  	}  } -  void Graphics::erasePersonAnim(uint16 bobNum) {  	_newAnim[bobNum][0].frame = 0;  	BobSlot *pbs = bob(bobNum); @@ -810,14 +780,12 @@ void Graphics::erasePersonAnim(uint16 bobNum) {  	pbs->anim.string.buffer = NULL;  } -  void Graphics::eraseAllAnims() {  	for (int i = 1; i <= 16; ++i) {  		_newAnim[i][0].frame = 0;  	}  } -  uint16 Graphics::refreshObject(uint16 obj) {  	debug(6, "Graphics::refreshObject(%X)", obj);  	uint16 curImage = _numFrames; @@ -903,7 +871,6 @@ uint16 Graphics::refreshObject(uint16 obj) {  	return curImage;  } -  void Graphics::setupRoomFurniture(int16 *furniture, uint16 furnitureCount) {  	uint16 i;  	uint16 curImage = 36 + FRAMES_JOE_XTRA; @@ -974,7 +941,6 @@ void Graphics::setupRoomFurniture(int16 *furniture, uint16 furnitureCount) {  	}  } -  void Graphics::setupRoomObjects() {  	uint16 i;  	// furniture frames are reserved in ::setupRoomFurniture(), we append objects  @@ -1085,7 +1051,6 @@ void Graphics::setupRoomObjects() {  	}  } -  uint16 Graphics::setupPerson(uint16 noun, uint16 curImage) {  	if (noun == 0) {  		warning("Trying to setup person 0"); @@ -1123,7 +1088,6 @@ uint16 Graphics::setupPerson(uint16 noun, uint16 curImage) {  	return curImage;  } -  uint16 Graphics::allocPerson(uint16 noun, uint16 curImage) {  	Person p;  	if (_vm->logic()->initPerson(noun, "", false, &p) && p.anim != NULL) { @@ -1133,7 +1097,6 @@ uint16 Graphics::allocPerson(uint16 noun, uint16 curImage) {  	return curImage;  } -  void Graphics::update(uint16 room) {  	sortBobs();  	if (_cameraBob >= 0) { @@ -1145,12 +1108,10 @@ void Graphics::update(uint16 room) {  } -  BamScene::BamScene(QueenEngine *vm)  	: _flag(F_STOP), _screenShaked(false), _fightData(_fight1Data), _vm(vm) {  } -  void BamScene::playSfx() {  	// FIXME - we don't play all sfx here. This is only necessary for  	// the fight bam, where the number of 'sfx bam frames' is too much  @@ -1163,7 +1124,6 @@ void BamScene::playSfx() {  	}  } -  void BamScene::prepareAnimation() {  	_obj1 = _vm->graphics()->bob(BOB_OBJ1);  	_obj1->clear(); @@ -1181,7 +1141,6 @@ void BamScene::prepareAnimation() {  	_lastSoundIndex = 0;  } -  void BamScene::updateCarAnimation() {  	if (_flag != F_STOP) {  		const BamDataBlock *bdb = &_carData[_index]; @@ -1215,7 +1174,6 @@ void BamScene::updateCarAnimation() {  	}  } -  void BamScene::updateFightAnimation() {  	if (_flag != F_STOP) {  		const BamDataBlock *bdb = &_fightData[_index]; @@ -1275,7 +1233,6 @@ void BamScene::updateFightAnimation() {  	}  } -  const BamScene::BamDataBlock BamScene::_carData[] = {  	{ { 310, 105, 1 }, { 314, 106, 17 }, { 366, 101,  1 },  0 },  	{ { 303, 105, 1 }, { 307, 106, 17 }, { 214,   0, 10 },  0 }, @@ -1543,6 +1500,5 @@ const BamScene::BamDataBlock BamScene::_fight3Data[] = {  	{ {  75, 96,  1 }, { 187,  96, -23 }, { 183,  41, 47 }, 99 }  }; -  } // End of namespace Queen diff --git a/queen/graphics.h b/queen/graphics.h index 99e4099b21..5deef58555 100644 --- a/queen/graphics.h +++ b/queen/graphics.h @@ -138,7 +138,6 @@ public:  	void update(uint16 room); -  	enum {  		MAX_BOBS_NUMBER     =  64,  		MAX_STRING_LENGTH   = 255, @@ -181,7 +180,6 @@ private:  	QueenEngine *_vm;  }; -  class BamScene {  public: diff --git a/queen/logic.cpp b/queen/logic.cpp index 84fb807bea..0a038f0a51 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -511,7 +511,7 @@ void Logic::setupRoom(const char *room, int comPanel, bool inCutaway) {  	for (uint16 i = 1; i <= _numFurniture; ++i) {  		if (_furnitureData[i].room == _currentRoom) {  			++furnTot; -			furn[furnTot] = _furnitureData[i].gameStateValue; +			furn[furnTot] = _furnitureData[i].objNum;  		}  	}  	_vm->graphics()->setupNewRoom(room, _currentRoom, furn, furnTot); @@ -548,7 +548,7 @@ void Logic::displayRoom(uint16 room, RoomDisplayMode mode, uint16 scale, int com  ActorData *Logic::findActor(uint16 noun, const char *name) {  	uint16 obj = currentRoomData() + noun; -	int16 img = _objectData[obj].image; +	int16 img = objectData(obj)->image;  	if (img != -3 && img != -4) {  		warning("Logic::findActor() - Object %d is not a person", obj);  		return NULL; @@ -573,10 +573,7 @@ ActorData *Logic::findActor(uint16 noun, const char *name) {  } -bool Logic::initPerson(int16 noun, const char *actorName, bool loadBank, Person *pp) { -	if (noun <= 0) { -		warning("Logic::initPerson() - Invalid object number: %i", noun); -	} +bool Logic::initPerson(uint16 noun, const char *actorName, bool loadBank, Person *pp) {  	ActorData *pad = findActor(noun, actorName);  	if (pad != NULL) {  		pp->actor = pad; @@ -634,15 +631,13 @@ void Logic::setupJoe() {  ObjectData *Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {  	debug(9, "Logic::setupJoeInRoom(%d, %d) joe.x=%d joe.y=%d", autoPosition, scale, _joe.x, _joe.y); - -	uint16 oldx; -	uint16 oldy;  	WalkOffData *pwo = NULL;  	ObjectData *pod = objectData(_entryObj);  	if (pod == NULL) {  		error("Logic::setupJoeInRoom() - No object data for obj %d", _entryObj);  	} +	uint16 oldx, oldy;  	if (!autoPosition || joeX() != 0 || joeY() != 0) {  		oldx = joeX();  		oldy = joeY(); diff --git a/queen/logic.h b/queen/logic.h index d9d929e6ec..a41c013814 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -146,7 +146,7 @@ public:  	void entryObj(int16 obj) { _entryObj = obj; }  	ActorData *findActor(uint16 noun, const char *name = NULL); -	bool initPerson(int16 noun, const char *actorName, bool loadBank, Person *pp); +	bool initPerson(uint16 noun, const char *actorName, bool loadBank, Person *pp);  	uint16 findPersonNumber(uint16 obj) const;  	void loadJoeBanks(const char *animBank, const char *standBank); diff --git a/queen/queen.cpp b/queen/queen.cpp index 3133aecf24..e9ea1dbda7 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -100,7 +100,6 @@ QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst)  	_system->init_size(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);  } -  QueenEngine::~QueenEngine() {  	_timer->removeTimerProc(&timerHandler);  	delete _bam; @@ -118,7 +117,6 @@ QueenEngine::~QueenEngine() {  	delete _walk;	  } -  void QueenEngine::registerDefaultSettings() {  	ConfMan.registerDefault("master_volume", 255);  	ConfMan.registerDefault("music_mute", false); @@ -128,7 +126,6 @@ void QueenEngine::registerDefaultSettings() {  	ConfMan.registerDefault("subtitles", true);  } -  void QueenEngine::checkOptionSettings() {  	// check talkspeed value  	if (_talkSpeed < 4) { @@ -150,7 +147,6 @@ void QueenEngine::checkOptionSettings() {  	}  } -  void QueenEngine::readOptionSettings() {  	// XXX master_volume  	_sound->musicToggle(!ConfMan.getBool("music_mute")); @@ -161,7 +157,6 @@ void QueenEngine::readOptionSettings() {  	checkOptionSettings();  } -  void QueenEngine::writeOptionSettings() {  	// XXX master_volume  	ConfMan.set("music_mute", !_sound->musicOn()); @@ -172,7 +167,6 @@ void QueenEngine::writeOptionSettings() {  	ConfMan.flushToDisk();  } -  void QueenEngine::update(bool checkPlayerInput) {  	if (_debugger->isAttached()) {  		_debugger->onFrame(); @@ -214,13 +208,8 @@ void QueenEngine::update(bool checkPlayerInput) {  void QueenEngine::errorString(const char *buf1, char *buf2) {  	strcpy(buf2, buf1); -	if (_debugger && !_debugger->isAttached()) { -		_debugger->attach(buf2); -		_debugger->onFrame(); -	}  } -  void QueenEngine::go() {  	initialise(); @@ -247,9 +236,6 @@ void QueenEngine::go() {  				_logic->joeWalk(JWM_NORMAL);  				_command->executeCurrentAction();  			} else { -//				if (_command->parse()) { -//					_command->clear(true); -//				}  				_logic->joeWalk(JWM_NORMAL);  				update(true);  			} @@ -257,7 +243,6 @@ void QueenEngine::go() {  	}  } -  void QueenEngine::initialise(void) {  	_bam = new BamScene(this);  	_resource = new Resource(_gameDataPath, _system->get_savefile_manager(), getSavePath()); @@ -287,12 +272,10 @@ void QueenEngine::initialise(void) {  	_timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second  } -  void QueenEngine::timerHandler(void *ptr) {  	((QueenEngine *)ptr)->gotTimerTick();  } -  void QueenEngine::gotTimerTick() {  	_display->handleTimer();  } diff --git a/queen/structs.h b/queen/structs.h index 5b90bec5d6..b94e5320ac 100644 --- a/queen/structs.h +++ b/queen/structs.h @@ -511,12 +511,12 @@ struct CmdGameState {  struct FurnitureData {  	//! room in which the furniture are  	int16 room; -	//! type of furniture (stored in GAMESTATE)  +	//! furniture object number  	/*!  		<table>  			<tr> -				<td>value</td> -				<td>description</td> +				<td>range</td> +				<td>type</td>  			</tr>  			<tr>  				<td>]0..5000]</td> @@ -528,11 +528,11 @@ struct FurnitureData {  			</tr>  		</table>  	*/ -	int16 gameStateValue; +	int16 objNum;  	void readFromBE(byte *&ptr) {  		room = (int16)READ_BE_UINT16(ptr); ptr += 2; -		gameStateValue = (int16)READ_BE_UINT16(ptr); ptr += 2; +		objNum = (int16)READ_BE_UINT16(ptr); ptr += 2;  	}  }; | 
