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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-03-29 15:59:37 +00:00
|
|
|
#include "common/endian.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
|
|
|
|
#include "cine/msg.h"
|
|
|
|
#include "cine/various.h"
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-25 00:26:14 +00:00
|
|
|
namespace Cine {
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
uint16 messageCount;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
void loadMsg(char *pMsgName) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 i;
|
2007-05-29 21:06:07 +00:00
|
|
|
byte *ptr, *dataPtr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
messageCount = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_MESSAGE; i++) {
|
|
|
|
messageTable[i].len = 0;
|
|
|
|
if (messageTable[i].ptr) {
|
|
|
|
free(messageTable[i].ptr);
|
2007-05-30 18:43:28 +00:00
|
|
|
messageTable[i].ptr = NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-29 21:06:07 +00:00
|
|
|
ptr = dataPtr = readBundleFile(findFileInBundle(pMsgName));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-16 20:29:07 +00:00
|
|
|
setMouseCursor(MOUSE_CURSOR_DISK);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
messageCount = READ_BE_UINT16(ptr); ptr += 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(messageCount <= NUM_MAX_MESSAGE);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
for (i = 0; i < messageCount; i++) {
|
2006-02-25 18:16:40 +00:00
|
|
|
messageTable[i].len = READ_BE_UINT16(ptr); ptr += 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
for (i = 0; i < messageCount; i++) {
|
2006-02-22 22:40:53 +00:00
|
|
|
if (messageTable[i].len) {
|
2006-03-23 03:45:52 +00:00
|
|
|
messageTable[i].ptr = (byte *) malloc(messageTable[i].len);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-03-23 03:17:47 +00:00
|
|
|
assert(messageTable[i].ptr);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
memcpy(messageTable[i].ptr, ptr, messageTable[i].len);
|
|
|
|
ptr += messageTable[i].len;
|
|
|
|
}
|
|
|
|
}
|
2007-05-29 21:06:07 +00:00
|
|
|
|
|
|
|
free(dataPtr);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
} // End of namespace Cine
|