WINTERMUTE: Clean up byte/char casts in loading/parsing

This commit is contained in:
Willem Jan Palenstijn 2013-10-01 23:20:24 +02:00
parent e0dd19a21c
commit a979072410
62 changed files with 582 additions and 582 deletions

View File

@ -119,7 +119,7 @@ AdActor::~AdActor() {
//////////////////////////////////////////////////////////////////////////
bool AdActor::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdActor::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -179,7 +179,7 @@ TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF(ANIMATION)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdActor::loadBuffer(byte *buffer, bool complete) {
bool AdActor::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ACTOR)
TOKEN_TABLE(X)
@ -219,12 +219,12 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(ANIMATION)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ACTOR) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_ACTOR) {
_gameRef->LOG(0, "'ACTOR' keyword expected.");
return STATUS_FAILED;
}
@ -234,55 +234,55 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) {
AdGame *adGame = (AdGame *)_gameRef;
AdSpriteSet *spr = nullptr;
int ar = 0, ag = 0, ab = 0, alpha = 0;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_FONT:
setFont((char *)params);
setFont(params);
break;
case TOKEN_SCALABLE:
parser.scanStr((char *)params, "%b", &_zoomable);
parser.scanStr(params, "%b", &_zoomable);
break;
case TOKEN_ROTABLE:
case TOKEN_ROTATABLE:
parser.scanStr((char *)params, "%b", &_rotatable);
parser.scanStr(params, "%b", &_rotatable);
break;
case TOKEN_REGISTRABLE:
case TOKEN_INTERACTIVE:
parser.scanStr((char *)params, "%b", &_registrable);
parser.scanStr(params, "%b", &_registrable);
break;
case TOKEN_SHADOWABLE:
case TOKEN_COLORABLE:
parser.scanStr((char *)params, "%b", &_shadowable);
parser.scanStr(params, "%b", &_shadowable);
break;
case TOKEN_ACTIVE:
parser.scanStr((char *)params, "%b", &_active);
parser.scanStr(params, "%b", &_active);
break;
case TOKEN_WALK:
@ -348,7 +348,7 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_CURSOR:
@ -362,12 +362,12 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SOUND_VOLUME:
parser.scanStr((char *)params, "%d", &_sFXVolume);
parser.scanStr(params, "%d", &_sFXVolume);
break;
case TOKEN_SCALE: {
int s;
parser.scanStr((char *)params, "%d", &s);
parser.scanStr(params, "%d", &s);
_scale = (float)s;
}
@ -375,14 +375,14 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) {
case TOKEN_RELATIVE_SCALE: {
int s;
parser.scanStr((char *)params, "%d", &s);
parser.scanStr(params, "%d", &s);
_relativeScale = (float)s;
}
break;
case TOKEN_SOUND_PANNING:
parser.scanStr((char *)params, "%b", &_autoSoundPanning);
parser.scanStr(params, "%b", &_autoSoundPanning);
break;
case TOKEN_PROPERTY:
@ -432,15 +432,15 @@ bool AdActor::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_IGNORE_ITEMS:
parser.scanStr((char *)params, "%b", &_ignoreItems);
parser.scanStr(params, "%b", &_ignoreItems);
break;
case TOKEN_ALPHA_COLOR:
parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab);
break;
case TOKEN_ALPHA:
parser.scanStr((char *)params, "%d", &alpha);
parser.scanStr(params, "%d", &alpha);
break;
case TOKEN_EDITOR_PROPERTY:
@ -1410,20 +1410,20 @@ bool AdActor::mergeAnims(const char *animsFilename) {
TOKEN_TABLE_END
byte *fileBuffer = BaseFileManager::getEngineInstance()->readWholeFile(animsFilename);
char *fileBuffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(animsFilename);
if (fileBuffer == nullptr) {
_gameRef->LOG(0, "AdActor::MergeAnims failed for file '%s'", animsFilename);
return STATUS_FAILED;
}
byte *buffer = fileBuffer;
byte *params;
char *buffer = fileBuffer;
char *params;
int cmd;
BaseParser parser;
bool ret = STATUS_OK;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_ANIMATION: {
AdSpriteSet *anim = new AdSpriteSet(_gameRef, this);

View File

@ -57,7 +57,7 @@ public:
AdActor(BaseGame *inGame/*=nullptr*/);
virtual ~AdActor();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
private:

View File

@ -100,7 +100,7 @@ const char *AdEntity::getItemName() const {
//////////////////////////////////////////////////////////////////////////
bool AdEntity::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdEntity::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -166,7 +166,7 @@ TOKEN_DEF(WALK_TO_DIR)
TOKEN_DEF(SAVE_STATE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdEntity::loadBuffer(byte *buffer, bool complete) {
bool AdEntity::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ENTITY)
TOKEN_TABLE(SPRITE)
@ -212,12 +212,12 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(SAVE_STATE)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ENTITY) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_ENTITY) {
_gameRef->LOG(0, "'ENTITY' keyword expected.");
return STATUS_FAILED;
}
@ -227,27 +227,27 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
AdGame *adGame = (AdGame *)_gameRef;
BaseSprite *spr = nullptr;
int ar = 0, ag = 0, ab = 0, alpha = 0;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_SPRITE: {
delete _sprite;
_sprite = nullptr;
spr = new BaseSprite(_gameRef, this);
if (!spr || DID_FAIL(spr->loadFile((char *)params))) {
if (!spr || DID_FAIL(spr->loadFile(params))) {
cmd = PARSERR_GENERIC;
} else {
_sprite = spr;
@ -257,7 +257,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
case TOKEN_TALK: {
spr = new BaseSprite(_gameRef, this);
if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) {
if (!spr || DID_FAIL(spr->loadFile(params, adGame->_texTalkLifeTime))) {
cmd = PARSERR_GENERIC;
} else {
_talkSprites.add(spr);
@ -267,7 +267,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
case TOKEN_TALK_SPECIAL: {
spr = new BaseSprite(_gameRef, this);
if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) {
if (!spr || DID_FAIL(spr->loadFile(params, adGame->_texTalkLifeTime))) {
cmd = PARSERR_GENERIC;
} else {
_talkSpritesEx.add(spr);
@ -276,28 +276,28 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_ITEM:
setItem((char *)params);
setItem(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_FONT:
setFont((char *)params);
setFont(params);
break;
case TOKEN_SCALABLE:
parser.scanStr((char *)params, "%b", &_zoomable);
parser.scanStr(params, "%b", &_zoomable);
break;
case TOKEN_SCALE: {
int s;
parser.scanStr((char *)params, "%d", &s);
parser.scanStr(params, "%d", &s);
_scale = (float)s;
}
@ -305,7 +305,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
case TOKEN_RELATIVE_SCALE: {
int s;
parser.scanStr((char *)params, "%d", &s);
parser.scanStr(params, "%d", &s);
_relativeScale = (float)s;
}
@ -313,27 +313,27 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
case TOKEN_ROTABLE:
case TOKEN_ROTATABLE:
parser.scanStr((char *)params, "%b", &_rotatable);
parser.scanStr(params, "%b", &_rotatable);
break;
case TOKEN_REGISTRABLE:
case TOKEN_INTERACTIVE:
parser.scanStr((char *)params, "%b", &_registrable);
parser.scanStr(params, "%b", &_registrable);
break;
case TOKEN_SHADOWABLE:
case TOKEN_COLORABLE:
parser.scanStr((char *)params, "%b", &_shadowable);
parser.scanStr(params, "%b", &_shadowable);
break;
case TOKEN_ACTIVE:
parser.scanStr((char *)params, "%b", &_active);
parser.scanStr(params, "%b", &_active);
break;
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;
@ -341,7 +341,7 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_EDITOR_SELECTED:
parser.scanStr((char *)params, "%b", &_editorSelected);
parser.scanStr(params, "%b", &_editorSelected);
break;
case TOKEN_REGION: {
@ -402,11 +402,11 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_SUBTYPE: {
if (scumm_stricmp((char *)params, "sound") == 0) {
if (scumm_stricmp(params, "sound") == 0) {
delete _sprite;
_sprite = nullptr;
if (_gameRef->_editorMode) {
@ -430,23 +430,23 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SOUND:
playSFX((char *)params, false, false);
playSFX(params, false, false);
break;
case TOKEN_SOUND_START_TIME:
parser.scanStr((char *)params, "%d", &_sFXStart);
parser.scanStr(params, "%d", &_sFXStart);
break;
case TOKEN_SOUND_VOLUME:
parser.scanStr((char *)params, "%d", &_sFXVolume);
parser.scanStr(params, "%d", &_sFXVolume);
break;
case TOKEN_SOUND_PANNING:
parser.scanStr((char *)params, "%b", &_autoSoundPanning);
parser.scanStr(params, "%b", &_autoSoundPanning);
break;
case TOKEN_SAVE_STATE:
parser.scanStr((char *)params, "%b", &_saveState);
parser.scanStr(params, "%b", &_saveState);
break;
case TOKEN_PROPERTY:
@ -454,15 +454,15 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_IGNORE_ITEMS:
parser.scanStr((char *)params, "%b", &_ignoreItems);
parser.scanStr(params, "%b", &_ignoreItems);
break;
case TOKEN_ALPHA_COLOR:
parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab);
break;
case TOKEN_ALPHA:
parser.scanStr((char *)params, "%d", &alpha);
parser.scanStr(params, "%d", &alpha);
break;
case TOKEN_EDITOR_PROPERTY:
@ -470,16 +470,16 @@ bool AdEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_WALK_TO_X:
parser.scanStr((char *)params, "%d", &_walkToX);
parser.scanStr(params, "%d", &_walkToX);
break;
case TOKEN_WALK_TO_Y:
parser.scanStr((char *)params, "%d", &_walkToY);
parser.scanStr(params, "%d", &_walkToY);
break;
case TOKEN_WALK_TO_DIR: {
int i;
parser.scanStr((char *)params, "%d", &i);
parser.scanStr(params, "%d", &i);
if (i < 0) {
i = 0;
}

View File

@ -48,7 +48,7 @@ public:
AdEntity(BaseGame *inGame);
virtual ~AdEntity();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
int32 getWalkToX() const;
int32 getWalkToY() const;

View File

@ -1245,7 +1245,7 @@ bool AdGame::showCursor() {
//////////////////////////////////////////////////////////////////////////
bool AdGame::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdGame::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -1281,7 +1281,7 @@ TOKEN_DEF(STARTUP_SCENE)
TOKEN_DEF(DEBUG_STARTUP_SCENE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdGame::loadBuffer(byte *buffer, bool complete) {
bool AdGame::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(GAME)
TOKEN_TABLE(AD_GAME)
@ -1295,14 +1295,14 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(DEBUG_STARTUP_SCENE)
TOKEN_TABLE_END
byte *params;
byte *params2;
char *params;
char *params2;
int cmd = 1;
BaseParser parser;
bool itemFound = false, itemsFound = false;
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_GAME:
if (DID_FAIL(BaseGame::loadBuffer(params, false))) {
@ -1311,12 +1311,12 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_AD_GAME:
while (cmd > 0 && (cmd = parser.getCommand((char **)&params, commands, (char **)&params2)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&params, commands, &params2)) > 0) {
switch (cmd) {
case TOKEN_RESPONSE_BOX:
delete _responseBox;
_responseBox = new AdResponseBox(_gameRef);
if (_responseBox && !DID_FAIL(_responseBox->loadFile((char *)params2))) {
if (_responseBox && !DID_FAIL(_responseBox->loadFile(params2))) {
registerObject(_responseBox);
} else {
delete _responseBox;
@ -1328,7 +1328,7 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_INVENTORY_BOX:
delete _inventoryBox;
_inventoryBox = new AdInventoryBox(_gameRef);
if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile((char *)params2))) {
if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile(params2))) {
registerObject(_inventoryBox);
} else {
delete _inventoryBox;
@ -1339,7 +1339,7 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_ITEMS:
itemsFound = true;
BaseUtils::setString(&_itemsFile, (char *)params2);
BaseUtils::setString(&_itemsFile, params2);
if (DID_FAIL(loadItemsFile(_itemsFile))) {
delete[] _itemsFile;
_itemsFile = nullptr;
@ -1348,9 +1348,9 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_TALK_SKIP_BUTTON:
if (scumm_stricmp((char *)params2, "right") == 0) {
if (scumm_stricmp(params2, "right") == 0) {
_talkSkipButton = TALK_SKIP_RIGHT;
} else if (scumm_stricmp((char *)params2, "both") == 0) {
} else if (scumm_stricmp(params2, "both") == 0) {
_talkSkipButton = TALK_SKIP_BOTH;
} else {
_talkSkipButton = TALK_SKIP_LEFT;
@ -1359,7 +1359,7 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_SCENE_VIEWPORT: {
Rect32 rc;
parser.scanStr((char *)params2, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom);
parser.scanStr(params2, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom);
if (!_sceneViewport) {
_sceneViewport = new BaseViewport(_gameRef);
}
@ -1374,11 +1374,11 @@ bool AdGame::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_STARTUP_SCENE:
BaseUtils::setString(&_startupScene, (char *)params2);
BaseUtils::setString(&_startupScene, params2);
break;
case TOKEN_DEBUG_STARTUP_SCENE:
BaseUtils::setString(&_debugStartupScene, (char *)params2);
BaseUtils::setString(&_debugStartupScene, params2);
break;
}
}
@ -1518,7 +1518,7 @@ bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *ex
//////////////////////////////////////////////////////////////////////////
bool AdGame::loadItemsFile(const char *filename, bool merge) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdGame::LoadItemsFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -1541,12 +1541,12 @@ bool AdGame::loadItemsFile(const char *filename, bool merge) {
//////////////////////////////////////////////////////////////////////////
bool AdGame::loadItemsBuffer(byte *buffer, bool merge) {
bool AdGame::loadItemsBuffer(char *buffer, bool merge) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ITEM)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
@ -1556,7 +1556,7 @@ bool AdGame::loadItemsBuffer(byte *buffer, bool merge) {
}
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_ITEM: {
AdItem *item = new AdItem(_gameRef);
@ -1637,7 +1637,7 @@ bool AdGame::windowLoadHook(UIWindow *win, char **buffer, char **params) {
switch (cmd) {
case TOKEN_ENTITY_CONTAINER: {
UIEntity *ent = new UIEntity(_gameRef);
if (!ent || DID_FAIL(ent->loadBuffer((byte *)*params, false))) {
if (!ent || DID_FAIL(ent->loadBuffer(*params, false))) {
delete ent;
ent = nullptr;
cmd = PARSERR_GENERIC;

View File

@ -120,10 +120,10 @@ public:
BaseArray<AdObject *> _objects;
virtual bool loadFile(const char *filename);
virtual bool loadBuffer(byte *buffer, bool complete = true);
virtual bool loadBuffer(char *buffer, bool complete = true);
bool loadItemsFile(const char *filename, bool merge = false);
bool loadItemsBuffer(byte *buffer, bool merge = false);
bool loadItemsBuffer(char *buffer, bool merge = false);
// scripting interface
virtual ScValue *scGetProperty(const Common::String &name) override;

View File

@ -165,7 +165,7 @@ bool AdInventoryBox::display() {
//////////////////////////////////////////////////////////////////////////
bool AdInventoryBox::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdInventoryBox::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -203,7 +203,7 @@ TOKEN_DEF(HIDE_SELECTED)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) {
bool AdInventoryBox::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(INVENTORY_BOX)
TOKEN_TABLE(TEMPLATE)
@ -221,34 +221,34 @@ bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd = 2;
BaseParser parser;
bool alwaysVisible = false;
_exclusive = false;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_INVENTORY_BOX) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_INVENTORY_BOX) {
_gameRef->LOG(0, "'INVENTORY_BOX' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_WINDOW:
@ -264,35 +264,35 @@ bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_AREA:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_itemsArea.left, &_itemsArea.top, &_itemsArea.right, &_itemsArea.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_itemsArea.left, &_itemsArea.top, &_itemsArea.right, &_itemsArea.bottom);
break;
case TOKEN_EXCLUSIVE:
parser.scanStr((char *)params, "%b", &_exclusive);
parser.scanStr(params, "%b", &_exclusive);
break;
case TOKEN_HIDE_SELECTED:
parser.scanStr((char *)params, "%b", &_hideSelected);
parser.scanStr(params, "%b", &_hideSelected);
break;
case TOKEN_ALWAYS_VISIBLE:
parser.scanStr((char *)params, "%b", &alwaysVisible);
parser.scanStr(params, "%b", &alwaysVisible);
break;
case TOKEN_SPACING:
parser.scanStr((char *)params, "%d", &_spacing);
parser.scanStr(params, "%d", &_spacing);
break;
case TOKEN_ITEM_WIDTH:
parser.scanStr((char *)params, "%d", &_itemWidth);
parser.scanStr(params, "%d", &_itemWidth);
break;
case TOKEN_ITEM_HEIGHT:
parser.scanStr((char *)params, "%d", &_itemHeight);
parser.scanStr(params, "%d", &_itemHeight);
break;
case TOKEN_SCROLL_BY:
parser.scanStr((char *)params, "%d", &_scrollBy);
parser.scanStr(params, "%d", &_scrollBy);
break;
case TOKEN_EDITOR_PROPERTY:

View File

@ -51,7 +51,7 @@ public:
AdInventoryBox(BaseGame *inGame);
virtual ~AdInventoryBox();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
private:
bool _exclusive;

View File

@ -84,7 +84,7 @@ AdItem::~AdItem() {
//////////////////////////////////////////////////////////////////////////
bool AdItem::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdItem::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -134,7 +134,7 @@ TOKEN_DEF(AMOUNT_STRING)
TOKEN_DEF(AMOUNT)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdItem::loadBuffer(byte *buffer, bool complete) {
bool AdItem::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ITEM)
TOKEN_TABLE(TEMPLATE)
@ -164,12 +164,12 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(AMOUNT)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd = 2;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ITEM) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_ITEM) {
_gameRef->LOG(0, "'ITEM' keyword expected.");
return STATUS_FAILED;
}
@ -177,31 +177,31 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
}
int ar = 0, ag = 0, ab = 0, alpha = 255;
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_FONT:
setFont((char *)params);
setFont(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_IMAGE:
case TOKEN_SPRITE:
delete _sprite;
_sprite = new BaseSprite(_gameRef, this);
if (!_sprite || DID_FAIL(_sprite->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
if (!_sprite || DID_FAIL(_sprite->loadFile(params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
delete _sprite;
cmd = PARSERR_GENERIC;
}
@ -211,32 +211,32 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_SPRITE_HOVER:
delete _spriteHover;
_spriteHover = new BaseSprite(_gameRef, this);
if (!_spriteHover || DID_FAIL(_spriteHover->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
if (!_spriteHover || DID_FAIL(_spriteHover->loadFile(params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
delete _spriteHover;
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_AMOUNT:
parser.scanStr((char *)params, "%d", &_amount);
parser.scanStr(params, "%d", &_amount);
break;
case TOKEN_DISPLAY_AMOUNT:
parser.scanStr((char *)params, "%b", &_displayAmount);
parser.scanStr(params, "%b", &_displayAmount);
break;
case TOKEN_AMOUNT_OFFSET_X:
parser.scanStr((char *)params, "%d", &_amountOffsetX);
parser.scanStr(params, "%d", &_amountOffsetX);
break;
case TOKEN_AMOUNT_OFFSET_Y:
parser.scanStr((char *)params, "%d", &_amountOffsetY);
parser.scanStr(params, "%d", &_amountOffsetY);
break;
case TOKEN_AMOUNT_ALIGN:
if (scumm_stricmp((char *)params, "left") == 0) {
if (scumm_stricmp(params, "left") == 0) {
_amountAlign = TAL_LEFT;
} else if (scumm_stricmp((char *)params, "right") == 0) {
} else if (scumm_stricmp(params, "right") == 0) {
_amountAlign = TAL_RIGHT;
} else {
_amountAlign = TAL_CENTER;
@ -244,12 +244,12 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_AMOUNT_STRING:
BaseUtils::setString(&_amountString, (char *)params);
BaseUtils::setString(&_amountString, params);
break;
case TOKEN_TALK: {
BaseSprite *spr = new BaseSprite(_gameRef, this);
if (!spr || DID_FAIL(spr->loadFile((char *)params, ((AdGame *)_gameRef)->_texTalkLifeTime))) {
if (!spr || DID_FAIL(spr->loadFile(params, ((AdGame *)_gameRef)->_texTalkLifeTime))) {
cmd = PARSERR_GENERIC;
} else {
_talkSprites.add(spr);
@ -259,7 +259,7 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_TALK_SPECIAL: {
BaseSprite *spr = new BaseSprite(_gameRef, this);
if (!spr || DID_FAIL(spr->loadFile((char *)params, ((AdGame *)_gameRef)->_texTalkLifeTime))) {
if (!spr || DID_FAIL(spr->loadFile(params, ((AdGame *)_gameRef)->_texTalkLifeTime))) {
cmd = PARSERR_GENERIC;
} else {
_talkSpritesEx.add(spr);
@ -270,7 +270,7 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursorNormal;
_cursorNormal = new BaseSprite(_gameRef);
if (!_cursorNormal || DID_FAIL(_cursorNormal->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
if (!_cursorNormal || DID_FAIL(_cursorNormal->loadFile(params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
delete _cursorNormal;
_cursorNormal = nullptr;
cmd = PARSERR_GENERIC;
@ -280,7 +280,7 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR_HOVER:
delete _cursorHover;
_cursorHover = new BaseSprite(_gameRef);
if (!_cursorHover || DID_FAIL(_cursorHover->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
if (!_cursorHover || DID_FAIL(_cursorHover->loadFile(params, ((AdGame *)_gameRef)->_texItemLifeTime))) {
delete _cursorHover;
_cursorHover = nullptr;
cmd = PARSERR_GENERIC;
@ -288,11 +288,11 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_CURSOR_COMBINED:
parser.scanStr((char *)params, "%b", &_cursorCombined);
parser.scanStr(params, "%b", &_cursorCombined);
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PROPERTY:
@ -300,11 +300,11 @@ bool AdItem::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_ALPHA_COLOR:
parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab);
break;
case TOKEN_ALPHA:
parser.scanStr((char *)params, "%d", &alpha);
parser.scanStr(params, "%d", &alpha);
break;
case TOKEN_EDITOR_PROPERTY:

View File

@ -50,7 +50,7 @@ public:
AdItem(BaseGame *inGame);
virtual ~AdItem();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
// scripting interface
virtual ScValue *scGetProperty(const Common::String &name) override;

View File

@ -62,7 +62,7 @@ AdLayer::~AdLayer() {
//////////////////////////////////////////////////////////////////////////
bool AdLayer::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdLayer::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -100,7 +100,7 @@ TOKEN_DEF(CLOSE_UP)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdLayer::loadBuffer(byte *buffer, bool complete) {
bool AdLayer::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(LAYER)
TOKEN_TABLE(TEMPLATE)
@ -119,52 +119,52 @@ bool AdLayer::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_LAYER) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_LAYER) {
_gameRef->LOG(0, "'LAYER' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_MAIN:
parser.scanStr((char *)params, "%b", &_main);
parser.scanStr(params, "%b", &_main);
break;
case TOKEN_CLOSE_UP:
parser.scanStr((char *)params, "%b", &_closeUp);
parser.scanStr(params, "%b", &_closeUp);
break;
case TOKEN_WIDTH:
parser.scanStr((char *)params, "%d", &_width);
parser.scanStr(params, "%d", &_width);
break;
case TOKEN_HEIGHT:
parser.scanStr((char *)params, "%d", &_height);
parser.scanStr(params, "%d", &_height);
break;
case TOKEN_ACTIVE:
parser.scanStr((char *)params, "%b", &_active);
parser.scanStr(params, "%b", &_active);
break;
case TOKEN_REGION: {
@ -203,11 +203,11 @@ bool AdLayer::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_EDITOR_SELECTED:
parser.scanStr((char *)params, "%b", &_editorSelected);
parser.scanStr(params, "%b", &_editorSelected);
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PROPERTY:

View File

@ -43,7 +43,7 @@ public:
virtual ~AdLayer();
BaseArray<AdSceneNode *> _nodes;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
// scripting interface

View File

@ -69,7 +69,7 @@ bool AdRegion::hasDecoration() const {
//////////////////////////////////////////////////////////////////////////
bool AdRegion::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdRegion::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -110,7 +110,7 @@ TOKEN_DEF(PROPERTY)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdRegion::loadBuffer(byte *buffer, bool complete) {
bool AdRegion::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(REGION)
TOKEN_TABLE(TEMPLATE)
@ -131,12 +131,12 @@ bool AdRegion::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_REGION) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_REGION) {
_gameRef->LOG(0, "'REGION' keyword expected.");
return STATUS_FAILED;
}
@ -150,67 +150,67 @@ bool AdRegion::loadBuffer(byte *buffer, bool complete) {
int ar = 255, ag = 255, ab = 255, alpha = 255;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_ACTIVE:
parser.scanStr((char *)params, "%b", &_active);
parser.scanStr(params, "%b", &_active);
break;
case TOKEN_BLOCKED:
parser.scanStr((char *)params, "%b", &_blocked);
parser.scanStr(params, "%b", &_blocked);
break;
case TOKEN_DECORATION:
parser.scanStr((char *)params, "%b", &_decoration);
parser.scanStr(params, "%b", &_decoration);
break;
case TOKEN_ZOOM:
case TOKEN_SCALE: {
int j;
parser.scanStr((char *)params, "%d", &j);
parser.scanStr(params, "%d", &j);
_zoom = (float)j;
}
break;
case TOKEN_POINT: {
int x, y;
parser.scanStr((char *)params, "%d,%d", &x, &y);
parser.scanStr(params, "%d,%d", &x, &y);
_points.add(new BasePoint(x, y));
}
break;
case TOKEN_ALPHA_COLOR:
parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab);
break;
case TOKEN_ALPHA:
parser.scanStr((char *)params, "%d", &alpha);
parser.scanStr(params, "%d", &alpha);
break;
case TOKEN_EDITOR_SELECTED:
parser.scanStr((char *)params, "%b", &_editorSelected);
parser.scanStr(params, "%b", &_editorSelected);
break;
case TOKEN_EDITOR_SELECTED_POINT:
parser.scanStr((char *)params, "%d", &_editorSelectedPoint);
parser.scanStr(params, "%d", &_editorSelectedPoint);
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PROPERTY:

View File

@ -40,7 +40,7 @@ public:
AdRegion(BaseGame *inGame);
virtual ~AdRegion();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
bool hasDecoration() const;

View File

@ -217,7 +217,7 @@ bool AdResponseBox::createButtons() {
//////////////////////////////////////////////////////////////////////////
bool AdResponseBox::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdResponseBox::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -253,7 +253,7 @@ TOKEN_DEF(VERTICAL_ALIGN)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
bool AdResponseBox::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(RESPONSE_BOX)
TOKEN_TABLE(TEMPLATE)
@ -270,22 +270,22 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_RESPONSE_BOX) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_RESPONSE_BOX) {
_gameRef->LOG(0, "'RESPONSE_BOX' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
@ -306,7 +306,7 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
if (_font) {
_gameRef->_fontStorage->removeFont(_font);
}
_font = _gameRef->_fontStorage->addFont((char *)params);
_font = _gameRef->_fontStorage->addFont(params);
if (!_font) {
cmd = PARSERR_GENERIC;
}
@ -316,24 +316,24 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
if (_fontHover) {
_gameRef->_fontStorage->removeFont(_fontHover);
}
_fontHover = _gameRef->_fontStorage->addFont((char *)params);
_fontHover = _gameRef->_fontStorage->addFont(params);
if (!_fontHover) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_AREA:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_responseArea.left, &_responseArea.top, &_responseArea.right, &_responseArea.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_responseArea.left, &_responseArea.top, &_responseArea.right, &_responseArea.bottom);
break;
case TOKEN_HORIZONTAL:
parser.scanStr((char *)params, "%b", &_horizontal);
parser.scanStr(params, "%b", &_horizontal);
break;
case TOKEN_TEXT_ALIGN:
if (scumm_stricmp((char *)params, "center") == 0) {
if (scumm_stricmp(params, "center") == 0) {
_align = TAL_CENTER;
} else if (scumm_stricmp((char *)params, "right") == 0) {
} else if (scumm_stricmp(params, "right") == 0) {
_align = TAL_RIGHT;
} else {
_align = TAL_LEFT;
@ -341,9 +341,9 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_VERTICAL_ALIGN:
if (scumm_stricmp((char *)params, "top") == 0) {
if (scumm_stricmp(params, "top") == 0) {
_verticalAlign = VAL_TOP;
} else if (scumm_stricmp((char *)params, "center") == 0) {
} else if (scumm_stricmp(params, "center") == 0) {
_verticalAlign = VAL_CENTER;
} else {
_verticalAlign = VAL_BOTTOM;
@ -351,7 +351,7 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SPACING:
parser.scanStr((char *)params, "%d", &_spacing);
parser.scanStr(params, "%d", &_spacing);
break;
case TOKEN_EDITOR_PROPERTY:
@ -361,7 +361,7 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;

View File

@ -72,7 +72,7 @@ public:
virtual ~AdResponseBox();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
UIWindow *getResponseWindow();

View File

@ -53,7 +53,7 @@ AdRotLevel::~AdRotLevel() {
//////////////////////////////////////////////////////////////////////////
bool AdRotLevel::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdRotLevel::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -82,7 +82,7 @@ TOKEN_DEF(ROTATION)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdRotLevel::loadBuffer(byte *buffer, bool complete) {
bool AdRotLevel::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ROTATION_LEVEL)
TOKEN_TABLE(TEMPLATE)
@ -91,33 +91,33 @@ bool AdRotLevel::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ROTATION_LEVEL) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_ROTATION_LEVEL) {
_gameRef->LOG(0, "'ROTATION_LEVEL' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_ROTATION: {
int i;
parser.scanStr((char *)params, "%d", &i);
parser.scanStr(params, "%d", &i);
_rotation = (float)i;
}
break;

View File

@ -42,7 +42,7 @@ public:
float getRotation() const { return _rotation; }
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
};
} // End of namespace Wintermute

View File

@ -54,7 +54,7 @@ float AdScaleLevel::getScale() const {
//////////////////////////////////////////////////////////////////////////
bool AdScaleLevel::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdScaleLevel::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -83,7 +83,7 @@ TOKEN_DEF(SCALE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdScaleLevel::loadBuffer(byte *buffer, bool complete) {
bool AdScaleLevel::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SCALE_LEVEL)
TOKEN_TABLE(TEMPLATE)
@ -92,33 +92,33 @@ bool AdScaleLevel::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SCALE_LEVEL) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_SCALE_LEVEL) {
_gameRef->LOG(0, "'SCALE_LEVEL' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_SCALE: {
int i;
parser.scanStr((char *)params, "%d", &i);
parser.scanStr(params, "%d", &i);
_scale = (float)i;
}
break;

View File

@ -41,7 +41,7 @@ public:
virtual ~AdScaleLevel();
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
float getScale() const;
private:
float _scale;

View File

@ -538,7 +538,7 @@ bool AdScene::initLoop() {
//////////////////////////////////////////////////////////////////////////
bool AdScene::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdScene::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -600,7 +600,7 @@ TOKEN_DEF(PERSISTENT_STATE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdScene::loadBuffer(byte *buffer, bool complete) {
bool AdScene::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SCENE)
TOKEN_TABLE(TEMPLATE)
@ -643,12 +643,12 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) {
cleanup();
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SCENE) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_SCENE) {
_gameRef->LOG(0, "'SCENE' keyword expected.");
return STATUS_FAILED;
}
@ -659,20 +659,20 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) {
char camera[MAX_PATH_LENGTH] = "";
/* float waypointHeight = -1.0f; */
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_LAYER: {
@ -747,7 +747,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;
@ -755,99 +755,99 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_CAMERA:
Common::strlcpy(camera, (char *)params, MAX_PATH_LENGTH);
Common::strlcpy(camera, params, MAX_PATH_LENGTH);
break;
case TOKEN_EDITOR_MARGIN_H:
parser.scanStr((char *)params, "%d", &_editorMarginH);
parser.scanStr(params, "%d", &_editorMarginH);
break;
case TOKEN_EDITOR_MARGIN_V:
parser.scanStr((char *)params, "%d", &_editorMarginV);
parser.scanStr(params, "%d", &_editorMarginV);
break;
case TOKEN_EDITOR_COLOR_FRAME:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColFrame = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_ENTITY:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColEntity = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_ENTITY_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColEntitySel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_REGION_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColRegionSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_DECORATION_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColDecorSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_BLOCKED_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColBlockedSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_WAYPOINTS_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColWaypointsSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_REGION:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColRegion = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_DECORATION:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColDecor = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_BLOCKED:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColBlocked = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_WAYPOINTS:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColWaypoints = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_SCALE:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
parser.scanStr(params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
_editorColScale = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_SHOW_REGIONS:
parser.scanStr((char *)params, "%b", &_editorShowRegions);
parser.scanStr(params, "%b", &_editorShowRegions);
break;
case TOKEN_EDITOR_SHOW_BLOCKED:
parser.scanStr((char *)params, "%b", &_editorShowBlocked);
parser.scanStr(params, "%b", &_editorShowBlocked);
break;
case TOKEN_EDITOR_SHOW_DECORATION:
parser.scanStr((char *)params, "%b", &_editorShowDecor);
parser.scanStr(params, "%b", &_editorShowDecor);
break;
case TOKEN_EDITOR_SHOW_ENTITIES:
parser.scanStr((char *)params, "%b", &_editorShowEntities);
parser.scanStr(params, "%b", &_editorShowEntities);
break;
case TOKEN_EDITOR_SHOW_SCALE:
parser.scanStr((char *)params, "%b", &_editorShowScale);
parser.scanStr(params, "%b", &_editorShowScale);
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PROPERTY:
@ -856,7 +856,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_VIEWPORT: {
Rect32 rc;
parser.scanStr((char *)params, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom);
if (!_viewport) {
_viewport = new BaseViewport(_gameRef);
}
@ -866,11 +866,11 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) {
}
case TOKEN_PERSISTENT_STATE:
parser.scanStr((char *)params, "%b", &_persistentState);
parser.scanStr(params, "%b", &_persistentState);
break;
case TOKEN_PERSISTENT_STATE_SPRITES:
parser.scanStr((char *)params, "%b", &_persistentStateSprites);
parser.scanStr(params, "%b", &_persistentStateSprites);
break;
case TOKEN_EDITOR_PROPERTY:

View File

@ -124,7 +124,7 @@ public:
BaseArray<AdObject *> _objects;
BaseArray<AdWaypointGroup *> _waypointGroups;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
int32 _width;
int32 _height;
bool addObject(AdObject *Object);

View File

@ -60,7 +60,7 @@ AdSpriteSet::~AdSpriteSet() {
//////////////////////////////////////////////////////////////////////////
bool AdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdSpriteSet::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -93,7 +93,7 @@ TOKEN_DEF(TEMPLATE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
bool AdSpriteSet::loadBuffer(char *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SPRITESET)
TOKEN_TABLE(NAME)
@ -109,12 +109,12 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SPRITESET) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_SPRITESET) {
_gameRef->LOG(0, "'SPRITESET' keyword expected.");
return STATUS_FAILED;
}
@ -122,23 +122,23 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
}
BaseSprite *spr = nullptr;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params, lifeTime, cacheType))) {
if (DID_FAIL(loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_LEFT:
delete _sprites[DI_LEFT];
_sprites[DI_LEFT] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_LEFT] = spr;
@ -149,7 +149,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
delete _sprites[DI_RIGHT];
_sprites[DI_RIGHT] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_RIGHT] = spr;
@ -160,7 +160,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
delete _sprites[DI_UP];
_sprites[DI_UP] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_UP] = spr;
@ -171,7 +171,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
delete _sprites[DI_DOWN];
_sprites[DI_DOWN] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_DOWN] = spr;
@ -182,7 +182,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
delete _sprites[DI_UPLEFT];
_sprites[DI_UPLEFT] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_UPLEFT] = spr;
@ -193,7 +193,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
delete _sprites[DI_UPRIGHT];
_sprites[DI_UPRIGHT] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_UPRIGHT] = spr;
@ -204,7 +204,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
delete _sprites[DI_DOWNLEFT];
_sprites[DI_DOWNLEFT] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_DOWNLEFT] = spr;
@ -215,7 +215,7 @@ bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
delete _sprites[DI_DOWNRIGHT];
_sprites[DI_DOWNRIGHT] = nullptr;
spr = new BaseSprite(_gameRef, _owner);
if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, cacheType))) {
if (!spr || DID_FAIL(spr->loadFile(params, lifeTime, cacheType))) {
cmd = PARSERR_GENERIC;
} else {
_sprites[DI_DOWNRIGHT] = spr;

View File

@ -44,7 +44,7 @@ public:
AdSpriteSet(BaseGame *inGame, BaseObject *owner = nullptr);
virtual ~AdSpriteSet();
bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool loadBuffer(char *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
BaseSprite *_sprites[NUM_DIRECTIONS];
};

View File

@ -71,7 +71,7 @@ AdTalkDef::~AdTalkDef() {
//////////////////////////////////////////////////////////////////////////
bool AdTalkDef::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdTalkDef::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -101,7 +101,7 @@ TOKEN_DEF(DEFAULT_SPRITE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdTalkDef::loadBuffer(byte *buffer, bool complete) {
bool AdTalkDef::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TALK)
TOKEN_TABLE(TEMPLATE)
@ -112,22 +112,22 @@ bool AdTalkDef::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TALK) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_TALK) {
_gameRef->LOG(0, "'TALK' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
@ -145,11 +145,11 @@ bool AdTalkDef::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_DEFAULT_SPRITE:
BaseUtils::setString(&_defaultSpriteFilename, (char *)params);
BaseUtils::setString(&_defaultSpriteFilename, params);
break;
case TOKEN_DEFAULT_SPRITESET_FILE:
BaseUtils::setString(&_defaultSpriteSetFilename, (char *)params);
BaseUtils::setString(&_defaultSpriteSetFilename, params);
break;
case TOKEN_DEFAULT_SPRITESET: {

View File

@ -46,7 +46,7 @@ public:
AdTalkDef(BaseGame *inGame);
virtual ~AdTalkDef();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
BaseArray<AdTalkNode *> _nodes;
char *_defaultSpriteFilename;
BaseSprite *_defaultSprite;

View File

@ -79,7 +79,7 @@ TOKEN_DEF(PRECACHE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdTalkNode::loadBuffer(byte *buffer, bool complete) {
bool AdTalkNode::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ACTION)
TOKEN_TABLE(SPRITESET_FILE)
@ -92,12 +92,12 @@ bool AdTalkNode::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ACTION) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_ACTION) {
_gameRef->LOG(0, "'ACTION' keyword expected.");
return STATUS_FAILED;
}
@ -108,14 +108,14 @@ bool AdTalkNode::loadBuffer(byte *buffer, bool complete) {
_playToEnd = false;
_preCache = false;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_SPRITE:
BaseUtils::setString(&_spriteFilename, (char *)params);
BaseUtils::setString(&_spriteFilename, params);
break;
case TOKEN_SPRITESET_FILE:
BaseUtils::setString(&_spriteSetFilename, (char *)params);
BaseUtils::setString(&_spriteSetFilename, params);
break;
case TOKEN_SPRITESET: {
@ -130,20 +130,20 @@ bool AdTalkNode::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_START_TIME:
parser.scanStr((char *)params, "%d", &_startTime);
parser.scanStr(params, "%d", &_startTime);
break;
case TOKEN_END_TIME:
parser.scanStr((char *)params, "%d", &_endTime);
parser.scanStr(params, "%d", &_endTime);
break;
case TOKEN_PRECACHE:
parser.scanStr((char *)params, "%b", &_preCache);
parser.scanStr(params, "%b", &_preCache);
break;
case TOKEN_COMMENT:
if (_gameRef->_editorMode) {
BaseUtils::setString(&_comment, (char *)params);
BaseUtils::setString(&_comment, params);
}
break;

View File

@ -46,7 +46,7 @@ public:
AdTalkNode(BaseGame *inGame);
virtual ~AdTalkNode();
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0) override;
char *_spriteFilename;
BaseSprite *_sprite;

View File

@ -66,7 +66,7 @@ void AdWaypointGroup::cleanup() {
//////////////////////////////////////////////////////////////////////////
bool AdWaypointGroup::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "AdWaypointGroup::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -98,7 +98,7 @@ TOKEN_DEF(PROPERTY)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
bool AdWaypointGroup::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(WAYPOINTS)
TOKEN_TABLE(TEMPLATE)
@ -110,43 +110,43 @@ bool AdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_WAYPOINTS) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_WAYPOINTS) {
_gameRef->LOG(0, "'WAYPOINTS' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_POINT: {
int x, y;
parser.scanStr((char *)params, "%d,%d", &x, &y);
parser.scanStr(params, "%d,%d", &x, &y);
_points.add(new BasePoint(x, y));
}
break;
case TOKEN_EDITOR_SELECTED:
parser.scanStr((char *)params, "%b", &_editorSelected);
parser.scanStr(params, "%b", &_editorSelected);
break;
case TOKEN_EDITOR_SELECTED_POINT:
parser.scanStr((char *)params, "%d", &_editorSelectedPoint);
parser.scanStr(params, "%d", &_editorSelectedPoint);
break;
case TOKEN_PROPERTY:

View File

@ -41,7 +41,7 @@ public:
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
AdWaypointGroup(BaseGame *inGame);
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual ~AdWaypointGroup();
bool _active;

View File

@ -87,7 +87,7 @@ TOKEN_DEF(NAME)
TOKEN_DEF(VALUE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool BaseClass::parseEditorProperty(byte *buffer, bool complete) {
bool BaseClass::parseEditorProperty(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE(NAME)
@ -100,12 +100,12 @@ bool BaseClass::parseEditorProperty(byte *buffer, bool complete) {
}
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_EDITOR_PROPERTY) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_EDITOR_PROPERTY) {
BaseEngine::LOG(0, "'EDITOR_PROPERTY' keyword expected.");
return STATUS_FAILED;
}
@ -115,13 +115,13 @@ bool BaseClass::parseEditorProperty(byte *buffer, bool complete) {
char *propName = nullptr;
char *propValue = nullptr;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_NAME:
delete[] propName;
propName = new char[strlen((char *)params) + 1];
propName = new char[strlen(params) + 1];
if (propName) {
strcpy(propName, (char *)params);
strcpy(propName, params);
} else {
cmd = PARSERR_GENERIC;
}
@ -129,9 +129,9 @@ bool BaseClass::parseEditorProperty(byte *buffer, bool complete) {
case TOKEN_VALUE:
delete[] propValue;
propValue = new char[strlen((char *)params) + 1];
propValue = new char[strlen(params) + 1];
if (propValue) {
strcpy(propValue, (char *)params);
strcpy(propValue, params);
} else {
cmd = PARSERR_GENERIC;
}

View File

@ -46,7 +46,7 @@ public:
bool setEditorProp(const Common::String &propName, const Common::String &propValue);
Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = nullptr);
BaseClass(TDynamicConstructor, TDynamicConstructor) {}
bool parseEditorProperty(byte *buffer, bool complete = true);
bool parseEditorProperty(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0);
BaseClass();
BaseClass(BaseGame *GameOwner);

View File

@ -142,7 +142,7 @@ TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF(KILL_SOUND)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(DELAY)
TOKEN_TABLE(IMAGE)
@ -184,7 +184,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
BasePlatform::setRectEmpty(&rect);
char *surface_file = nullptr;
while ((cmd = parser.getCommand((char **)&buffer, commands, &params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_DELAY:
parser.scanStr(params, "%d", &_delay);
@ -249,7 +249,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
case TOKEN_SUBFRAME: {
BaseSubFrame *subframe = new BaseSubFrame(_gameRef);
if (!subframe || DID_FAIL(subframe->loadBuffer((byte *)params, lifeTime, keepLoaded))) {
if (!subframe || DID_FAIL(subframe->loadBuffer(params, lifeTime, keepLoaded))) {
delete subframe;
cmd = PARSERR_GENERIC;
} else {
@ -290,7 +290,7 @@ bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
break;
case TOKEN_EDITOR_PROPERTY:
parseEditorProperty((byte *)params, false);
parseEditorProperty(params, false);
break;
}
}

View File

@ -52,7 +52,7 @@ public:
uint32 _delay;
BaseArray<BaseSubFrame *> _subframes;
bool draw(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
bool loadBuffer(char *buffer, int lifeTime, bool keepLoaded);
BaseFrame(BaseGame *inGame);
virtual ~BaseFrame();

View File

@ -620,7 +620,7 @@ void BaseGame::getOffset(int *offsetX, int *offsetY) const {
//////////////////////////////////////////////////////////////////////////
bool BaseGame::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "BaseGame::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -690,7 +690,7 @@ TOKEN_DEF(GUID)
TOKEN_DEF(COMPAT_KILL_METHOD_THREADS)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool BaseGame::loadBuffer(byte *buffer, bool complete) {
bool BaseGame::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(GAME)
TOKEN_TABLE(TEMPLATE)
@ -740,32 +740,32 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) {
Common::String loadImageName = "";
Common::String saveImageName = "";
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_GAME) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_GAME) {
_gameRef->LOG(0, "'GAME' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_SYSTEM_FONT:
@ -774,7 +774,7 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) {
}
_systemFont = nullptr;
_systemFont = _gameRef->_fontStorage->addFont((char *)params);
_systemFont = _gameRef->_fontStorage->addFont(params);
break;
case TOKEN_VIDEO_FONT:
@ -783,14 +783,14 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) {
}
_videoFont = nullptr;
_videoFont = _gameRef->_fontStorage->addFont((char *)params);
_videoFont = _gameRef->_fontStorage->addFont(params);
break;
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;
@ -801,7 +801,7 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) {
delete _activeCursor;
_activeCursor = nullptr;
_activeCursor = new BaseSprite(_gameRef);
if (!_activeCursor || DID_FAIL(_activeCursor->loadFile((char *)params))) {
if (!_activeCursor || DID_FAIL(_activeCursor->loadFile(params))) {
delete _activeCursor;
_activeCursor = nullptr;
cmd = PARSERR_GENERIC;
@ -811,7 +811,7 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_NONINTERACTIVE_CURSOR:
delete _cursorNoninteractive;
_cursorNoninteractive = new BaseSprite(_gameRef);
if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile((char *)params))) {
if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile(params))) {
delete _cursorNoninteractive;
_cursorNoninteractive = nullptr;
cmd = PARSERR_GENERIC;
@ -819,23 +819,23 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PERSONAL_SAVEGAMES:
parser.scanStr((char *)params, "%b", &_personalizedSave);
parser.scanStr(params, "%b", &_personalizedSave);
break;
case TOKEN_SUBTITLES:
parser.scanStr((char *)params, "%b", &_subtitles);
parser.scanStr(params, "%b", &_subtitles);
break;
case TOKEN_SUBTITLES_SPEED:
parser.scanStr((char *)params, "%d", &_subtitlesSpeed);
parser.scanStr(params, "%d", &_subtitlesSpeed);
break;
case TOKEN_VIDEO_SUBTITLES:
parser.scanStr((char *)params, "%b", &_videoSubtitles);
parser.scanStr(params, "%b", &_videoSubtitles);
break;
case TOKEN_PROPERTY:
@ -847,66 +847,66 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_THUMBNAIL_WIDTH:
parser.scanStr((char *)params, "%d", &_thumbnailWidth);
parser.scanStr(params, "%d", &_thumbnailWidth);
break;
case TOKEN_THUMBNAIL_HEIGHT:
parser.scanStr((char *)params, "%d", &_thumbnailHeight);
parser.scanStr(params, "%d", &_thumbnailHeight);
break;
case TOKEN_INDICATOR_X:
parser.scanStr((char *)params, "%d", &indicatorX);
parser.scanStr(params, "%d", &indicatorX);
break;
case TOKEN_INDICATOR_Y:
parser.scanStr((char *)params, "%d", &indicatorY);
parser.scanStr(params, "%d", &indicatorY);
break;
case TOKEN_INDICATOR_COLOR: {
int r, g, b, a;
parser.scanStr((char *)params, "%d,%d,%d,%d", &r, &g, &b, &a);
parser.scanStr(params, "%d,%d,%d,%d", &r, &g, &b, &a);
indicatorColor = BYTETORGBA(r, g, b, a);
}
break;
case TOKEN_INDICATOR_WIDTH:
parser.scanStr((char *)params, "%d", &indicatorWidth);
parser.scanStr(params, "%d", &indicatorWidth);
break;
case TOKEN_INDICATOR_HEIGHT:
parser.scanStr((char *)params, "%d", &indicatorHeight);
parser.scanStr(params, "%d", &indicatorHeight);
break;
case TOKEN_SAVE_IMAGE:
saveImageName = (char *) params;
saveImageName = params;
break;
case TOKEN_SAVE_IMAGE_X:
parser.scanStr((char *)params, "%d", &saveImageX);
parser.scanStr(params, "%d", &saveImageX);
break;
case TOKEN_SAVE_IMAGE_Y:
parser.scanStr((char *)params, "%d", &saveImageY);
parser.scanStr(params, "%d", &saveImageY);
break;
case TOKEN_LOAD_IMAGE:
loadImageName = (char *) params;
loadImageName = params;
break;
case TOKEN_LOAD_IMAGE_X:
parser.scanStr((char *)params, "%d", &loadImageX);
parser.scanStr(params, "%d", &loadImageX);
break;
case TOKEN_LOAD_IMAGE_Y:
parser.scanStr((char *)params, "%d", &loadImageY);
parser.scanStr(params, "%d", &loadImageY);
break;
case TOKEN_LOCAL_SAVE_DIR:
_localSaveDir = (char *)params;
_localSaveDir = params;
break;
case TOKEN_COMPAT_KILL_METHOD_THREADS:
parser.scanStr((char *)params, "%b", &_compatKillMethodThreads);
parser.scanStr(params, "%b", &_compatKillMethodThreads);
break;
}
}

View File

@ -157,7 +157,7 @@ public:
int32 _sequence;
virtual bool loadFile(const char *filename);
virtual bool loadBuffer(byte *buffer, bool complete = true);
virtual bool loadBuffer(char *buffer, bool complete = true);
int32 _viewportSP;

View File

@ -103,7 +103,7 @@ bool BaseGameSettings::loadSettings(const char *filename) {
TOKEN_TABLE_END
byte *origBuffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *origBuffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (origBuffer == nullptr) {
BaseEngine::LOG(0, "BaseGame::LoadSettings failed for file '%s'", filename);
return STATUS_FAILED;
@ -111,78 +111,78 @@ bool BaseGameSettings::loadSettings(const char *filename) {
bool ret = STATUS_OK;
byte *buffer = origBuffer;
byte *params;
char *buffer = origBuffer;
char *params;
int cmd;
BaseParser parser;
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SETTINGS) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_SETTINGS) {
BaseEngine::LOG(0, "'SETTINGS' keyword expected in game settings file.");
return STATUS_FAILED;
}
buffer = params;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_GAME:
delete[] _gameFile;
_gameFile = new char[strlen((char *)params) + 1];
_gameFile = new char[strlen(params) + 1];
if (_gameFile) {
strcpy(_gameFile, (char *)params);
strcpy(_gameFile, params);
}
break;
case TOKEN_STRING_TABLE:
if (DID_FAIL(_stringTable->loadFile((char *)params))) {
if (DID_FAIL(_stringTable->loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_RESOLUTION:
parser.scanStr((char *)params, "%d,%d", &_resWidth, &_resHeight);
parser.scanStr(params, "%d,%d", &_resWidth, &_resHeight);
break;
case TOKEN_REQUIRE_3D_ACCELERATION:
parser.scanStr((char *)params, "%b", &_requireAcceleration);
parser.scanStr(params, "%b", &_requireAcceleration);
break;
case TOKEN_REQUIRE_SOUND:
parser.scanStr((char *)params, "%b", &_requireSound);
parser.scanStr(params, "%b", &_requireSound);
break;
case TOKEN_HWTL_MODE:
parser.scanStr((char *)params, "%d", &_TLMode);
parser.scanStr(params, "%d", &_TLMode);
break;
case TOKEN_ALLOW_WINDOWED_MODE:
parser.scanStr((char *)params, "%b", &_allowWindowed);
parser.scanStr(params, "%b", &_allowWindowed);
break;
case TOKEN_ALLOW_DESKTOP_RES:
parser.scanStr((char *)params, "%b", &_allowDesktopRes);
parser.scanStr(params, "%b", &_allowDesktopRes);
break;
case TOKEN_ALLOW_ADVANCED:
parser.scanStr((char *)params, "%b", &_allowAdvanced);
parser.scanStr(params, "%b", &_allowAdvanced);
break;
case TOKEN_ALLOW_ACCESSIBILITY_TAB:
parser.scanStr((char *)params, "%b", &_allowAccessTab);
parser.scanStr(params, "%b", &_allowAccessTab);
break;
case TOKEN_ALLOW_ABOUT_TAB:
parser.scanStr((char *)params, "%b", &_allowAboutTab);
parser.scanStr(params, "%b", &_allowAboutTab);
break;
case TOKEN_REGISTRY_PATH:
//BaseEngine::instance().getRegistry()->setBasePath((char *)params);
//BaseEngine::instance().getRegistry()->setBasePath(params);
break;
case TOKEN_RICH_SAVED_GAMES:
parser.scanStr((char *)params, "%b", &_richSavedGames);
parser.scanStr(params, "%b", &_richSavedGames);
break;
case TOKEN_SAVED_GAME_EXT:
_savedGameExt = (char *)params;
_savedGameExt = params;
break;
case TOKEN_GUID:

View File

@ -102,7 +102,7 @@ bool BaseRegion::pointInRegion(int x, int y) {
//////////////////////////////////////////////////////////////////////////
bool BaseRegion::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
BaseEngine::LOG(0, "BaseRegion::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -135,7 +135,7 @@ TOKEN_DEF(EDITOR_SELECTED_POINT)
TOKEN_DEF(PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool BaseRegion::loadBuffer(byte *buffer, bool complete) {
bool BaseRegion::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(REGION)
TOKEN_TABLE(TEMPLATE)
@ -148,12 +148,12 @@ bool BaseRegion::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_REGION) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_REGION) {
BaseEngine::LOG(0, "'REGION' keyword expected.");
return STATUS_FAILED;
}
@ -165,39 +165,39 @@ bool BaseRegion::loadBuffer(byte *buffer, bool complete) {
}
_points.clear();
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_ACTIVE:
parser.scanStr((char *)params, "%b", &_active);
parser.scanStr(params, "%b", &_active);
break;
case TOKEN_POINT: {
int x, y;
parser.scanStr((char *)params, "%d,%d", &x, &y);
parser.scanStr(params, "%d,%d", &x, &y);
_points.add(new BasePoint(x, y));
}
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_EDITOR_SELECTED_POINT:
parser.scanStr((char *)params, "%d", &_editorSelectedPoint);
parser.scanStr(params, "%d", &_editorSelectedPoint);
break;
case TOKEN_PROPERTY:

View File

@ -48,7 +48,7 @@ public:
bool pointInRegion(int x, int y);
bool createRegion();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
Rect32 _rect;
BaseArray<BasePoint *> _points;
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) { return saveAsText(buffer, indent, nullptr); }

View File

@ -370,19 +370,19 @@ TOKEN_DEF(NAME)
TOKEN_DEF(VALUE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) {
bool BaseScriptHolder::parseProperty(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(PROPERTY)
TOKEN_TABLE(NAME)
TOKEN_TABLE(VALUE)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_PROPERTY) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_PROPERTY) {
BaseEngine::LOG(0, "'PROPERTY' keyword expected.");
return STATUS_FAILED;
}
@ -392,13 +392,13 @@ bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) {
char *propName = nullptr;
char *propValue = nullptr;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_NAME:
delete[] propName;
propName = new char[strlen((char *)params) + 1];
propName = new char[strlen(params) + 1];
if (propName) {
strcpy(propName, (char *)params);
strcpy(propName, params);
} else {
cmd = PARSERR_GENERIC;
}
@ -406,9 +406,9 @@ bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) {
case TOKEN_VALUE:
delete[] propValue;
propValue = new char[strlen((char *)params) + 1];
propValue = new char[strlen(params) + 1];
if (propValue) {
strcpy(propValue, (char *)params);
strcpy(propValue, params);
} else {
cmd = PARSERR_GENERIC;
}

View File

@ -53,7 +53,7 @@ public:
bool applyEvent(const char *eventName, bool unbreakable = false);
void setFilename(const char *filename);
const char *getFilename() { return _filename; }
bool parseProperty(byte *buffer, bool complete = true);
bool parseProperty(char *buffer, bool complete = true);
bool _freezable;
bool _ready;

View File

@ -168,7 +168,7 @@ bool BaseSprite::loadFile(const Common::String &filename, int lifeTime, TSpriteC
ret = STATUS_OK;
}
} else {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer) {
if (DID_FAIL(ret = loadBuffer(buffer, true, lifeTime, cacheType))) {
BaseEngine::LOG(0, "Error parsing SPRITE file '%s'", filename.c_str());
@ -204,7 +204,7 @@ TOKEN_DEF(EDITOR_BG_ALPHA)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
bool BaseSprite::loadBuffer(char *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(CONTINUOUS)
TOKEN_TABLE(SPRITE)
@ -223,7 +223,7 @@ bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCa
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
@ -231,7 +231,7 @@ bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCa
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SPRITE) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_SPRITE) {
BaseEngine::LOG(0, "'SPRITE' keyword expected.");
return STATUS_FAILED;
}
@ -240,30 +240,30 @@ bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCa
int frameCount = 1;
BaseFrame *frame;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_CONTINUOUS:
parser.scanStr((char *)params, "%b", &_continuous);
parser.scanStr(params, "%b", &_continuous);
break;
case TOKEN_EDITOR_MUTED:
parser.scanStr((char *)params, "%b", &_editorMuted);
parser.scanStr(params, "%b", &_editorMuted);
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_LOOPING:
parser.scanStr((char *)params, "%b", &_looping);
parser.scanStr(params, "%b", &_looping);
break;
case TOKEN_PRECISE:
parser.scanStr((char *)params, "%b", &_precise);
parser.scanStr(params, "%b", &_precise);
break;
case TOKEN_STREAMED:
parser.scanStr((char *)params, "%b", &_streamed);
parser.scanStr(params, "%b", &_streamed);
if (_streamed && lifeTime == -1) {
lifeTime = 500;
cacheType = CACHE_ALL;
@ -271,33 +271,33 @@ bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCa
break;
case TOKEN_STREAMED_KEEP_LOADED:
parser.scanStr((char *)params, "%b", &_streamedKeepLoaded);
parser.scanStr(params, "%b", &_streamedKeepLoaded);
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_EDITOR_BG_FILE:
if (_gameRef->_editorMode) {
delete[] _editorBgFile;
_editorBgFile = new char[strlen((char *)params) + 1];
_editorBgFile = new char[strlen(params) + 1];
if (_editorBgFile) {
strcpy(_editorBgFile, (char *)params);
strcpy(_editorBgFile, params);
}
}
break;
case TOKEN_EDITOR_BG_OFFSET_X:
parser.scanStr((char *)params, "%d", &_editorBgOffsetX);
parser.scanStr(params, "%d", &_editorBgOffsetX);
break;
case TOKEN_EDITOR_BG_OFFSET_Y:
parser.scanStr((char *)params, "%d", &_editorBgOffsetY);
parser.scanStr(params, "%d", &_editorBgOffsetY);
break;
case TOKEN_EDITOR_BG_ALPHA:
parser.scanStr((char *)params, "%d", &_editorBgAlpha);
parser.scanStr(params, "%d", &_editorBgAlpha);
_editorBgAlpha = MIN<int32>(_editorBgAlpha, 255);
_editorBgAlpha = MAX<int32>(_editorBgAlpha, 0);
break;

View File

@ -53,7 +53,7 @@ public:
void reset();
bool isChanged();
bool isFinished();
bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool loadBuffer(char *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod);
bool _looping;

View File

@ -97,7 +97,7 @@ TOKEN_DEF(EDITOR_SELECTED)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(IMAGE)
TOKEN_TABLE(TRANSPARENT)
@ -127,7 +127,7 @@ bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
delete _surface;
_surface = nullptr;
while ((cmd = parser.getCommand((char **)&buffer, commands, &params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_IMAGE:
surfaceFile = params;
@ -179,7 +179,7 @@ bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
break;
case TOKEN_EDITOR_PROPERTY:
parseEditorProperty((byte *)params, false);
parseEditorProperty(params, false);
break;
}
}

View File

@ -51,7 +51,7 @@ public:
bool _editorSelected;
BaseSubFrame(BaseGame *inGame);
virtual ~BaseSubFrame();
bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
bool loadBuffer(char *buffer, int lifeTime, bool keepLoaded);
bool draw(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
const char* getSurfaceFilename();

View File

@ -118,18 +118,18 @@ bool BaseFont::isTrueType(BaseGame *gameRef, const Common::String &filename) {
TOKEN_TABLE_END
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
return false;
}
byte *workBuffer = buffer;
char *workBuffer = buffer;
char *params;
BaseParser parser;
bool ret = false;
if (parser.getCommand((char **)&workBuffer, commands, (char **)&params) == TOKEN_TTFONT) {
if (parser.getCommand(&workBuffer, commands, &params) == TOKEN_TTFONT) {
ret = true;
}

View File

@ -272,7 +272,7 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) {
//////////////////////////////////////////////////////////////////////
bool BaseFontBitmap::loadFile(const Common::String &filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "BaseFontBitmap::LoadFile failed for file '%s'", filename.c_str());
return STATUS_FAILED;
@ -311,7 +311,7 @@ TOKEN_DEF(WIDTHS_FRAME)
TOKEN_DEF(PAINT_WHOLE_CELL)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
bool BaseFontBitmap::loadBuffer(byte *buffer) {
bool BaseFontBitmap::loadBuffer(char *buffer) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(FONTEXT_FIX)
TOKEN_TABLE(FONT)
@ -335,11 +335,11 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) {
int cmd;
BaseParser parser;
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_FONT) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_FONT) {
_gameRef->LOG(0, "'FONT' keyword expected.");
return STATUS_FAILED;
}
buffer = (byte *)params;
buffer = params;
int widths[300];
int num = 0, defaultWidth = 8;
@ -354,15 +354,15 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) {
int spaceWidth = 0;
int expandWidth = 0;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_IMAGE:
surfaceFile = (char *)params;
surfaceFile = params;
break;
case TOKEN_SPRITE:
spriteFile = (char *)params;
spriteFile = params;
break;
case TOKEN_TRANSPARENT:
@ -418,7 +418,7 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) {
break;
case TOKEN_EDITOR_PROPERTY:
parseEditorProperty((byte *)params, false);
parseEditorProperty(params, false);
break;
}

View File

@ -37,7 +37,7 @@ class BaseSubFrame;
class BaseFontBitmap : public BaseFont {
public:
DECLARE_PERSISTENT(BaseFontBitmap, BaseFont)
bool loadBuffer(byte *Buffer);
bool loadBuffer(char *buffer);
bool loadFile(const Common::String &filename);
virtual int getTextWidth(const byte *text, int maxLength = -1) override;
virtual int getTextHeight(const byte *text, int width) override;

View File

@ -324,7 +324,7 @@ int BaseFontTT::getLetterHeight() {
//////////////////////////////////////////////////////////////////////
bool BaseFontTT::loadFile(const Common::String &filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "BaseFontTT::LoadFile failed for file '%s'", filename.c_str());
return STATUS_FAILED;
@ -361,7 +361,7 @@ TOKEN_DEF(OFFSET_X)
TOKEN_DEF(OFFSET_Y)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
bool BaseFontTT::loadBuffer(byte *buffer) {
bool BaseFontTT::loadBuffer(char *buffer) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TTFONT)
TOKEN_TABLE(SIZE)
@ -381,15 +381,15 @@ bool BaseFontTT::loadBuffer(byte *buffer) {
int cmd;
BaseParser parser;
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TTFONT) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_TTFONT) {
_gameRef->LOG(0, "'TTFONT' keyword expected.");
return STATUS_FAILED;
}
buffer = (byte *)params;
buffer = params;
uint32 baseColor = 0x00000000;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_SIZE:
parser.scanStr(params, "%d", &_fontHeight);
@ -439,7 +439,7 @@ bool BaseFontTT::loadBuffer(byte *buffer) {
case TOKEN_LAYER: {
BaseTTFontLayer *layer = new BaseTTFontLayer;
if (layer && DID_SUCCEED(parseLayer(layer, (byte *)params))) {
if (layer && DID_SUCCEED(parseLayer(layer, params))) {
_layers.add(layer);
} else {
delete layer;
@ -472,7 +472,7 @@ bool BaseFontTT::loadBuffer(byte *buffer) {
//////////////////////////////////////////////////////////////////////////
bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, byte *buffer) {
bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, char *buffer) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(OFFSET_X)
TOKEN_TABLE(OFFSET_Y)
@ -484,7 +484,7 @@ bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, byte *buffer) {
int cmd;
BaseParser parser;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_OFFSET_X:
parser.scanStr(params, "%d", &layer->_offsetX);

View File

@ -105,7 +105,7 @@ public:
virtual void drawText(const byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1) override;
virtual int getLetterHeight() override;
bool loadBuffer(byte *buffer);
bool loadBuffer(char *buffer);
bool loadFile(const Common::String &filename);
float getLineHeight() const {
@ -116,7 +116,7 @@ public:
void initLoop();
private:
bool parseLayer(BaseTTFontLayer *layer, byte *buffer);
bool parseLayer(BaseTTFontLayer *layer, char *buffer);
void measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight);

View File

@ -103,7 +103,7 @@ UIButton::~UIButton() {
//////////////////////////////////////////////////////////////////////////
bool UIButton::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "UIButton::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -162,7 +162,7 @@ TOKEN_DEF(PIXEL_PERFECT)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool UIButton::loadBuffer(byte *buffer, bool complete) {
bool UIButton::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(BUTTON)
TOKEN_TABLE(TEMPLATE)
@ -202,38 +202,38 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd = 2;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_BUTTON) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_BUTTON) {
_gameRef->LOG(0, "'BUTTON' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_BACK:
delete _back;
_back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
if (!_back || DID_FAIL(_back->loadFile(params))) {
delete _back;
_back = nullptr;
cmd = PARSERR_GENERIC;
@ -243,7 +243,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_HOVER:
delete _backHover;
_backHover = new UITiledImage(_gameRef);
if (!_backHover || DID_FAIL(_backHover->loadFile((char *)params))) {
if (!_backHover || DID_FAIL(_backHover->loadFile(params))) {
delete _backHover;
_backHover = nullptr;
cmd = PARSERR_GENERIC;
@ -253,7 +253,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_PRESS:
delete _backPress;
_backPress = new UITiledImage(_gameRef);
if (!_backPress || DID_FAIL(_backPress->loadFile((char *)params))) {
if (!_backPress || DID_FAIL(_backPress->loadFile(params))) {
delete _backPress;
_backPress = nullptr;
cmd = PARSERR_GENERIC;
@ -263,7 +263,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_DISABLE:
delete _backDisable;
_backDisable = new UITiledImage(_gameRef);
if (!_backDisable || DID_FAIL(_backDisable->loadFile((char *)params))) {
if (!_backDisable || DID_FAIL(_backDisable->loadFile(params))) {
delete _backDisable;
_backDisable = nullptr;
cmd = PARSERR_GENERIC;
@ -273,7 +273,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_FOCUS:
delete _backFocus;
_backFocus = new UITiledImage(_gameRef);
if (!_backFocus || DID_FAIL(_backFocus->loadFile((char *)params))) {
if (!_backFocus || DID_FAIL(_backFocus->loadFile(params))) {
delete _backFocus;
_backFocus = nullptr;
cmd = PARSERR_GENERIC;
@ -283,7 +283,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
if (!_image || DID_FAIL(_image->loadFile(params))) {
delete _image;
_image = nullptr;
cmd = PARSERR_GENERIC;
@ -293,7 +293,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_HOVER:
delete _imageHover;
_imageHover = new BaseSprite(_gameRef);
if (!_imageHover || DID_FAIL(_imageHover->loadFile((char *)params))) {
if (!_imageHover || DID_FAIL(_imageHover->loadFile(params))) {
delete _imageHover;
_imageHover = nullptr;
cmd = PARSERR_GENERIC;
@ -303,7 +303,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_PRESS:
delete _imagePress;
_imagePress = new BaseSprite(_gameRef);
if (!_imagePress || DID_FAIL(_imagePress->loadFile((char *)params))) {
if (!_imagePress || DID_FAIL(_imagePress->loadFile(params))) {
delete _imagePress;
_imagePress = nullptr;
cmd = PARSERR_GENERIC;
@ -313,7 +313,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_DISABLE:
delete _imageDisable;
_imageDisable = new BaseSprite(_gameRef);
if (!_imageDisable || DID_FAIL(_imageDisable->loadFile((char *)params))) {
if (!_imageDisable || DID_FAIL(_imageDisable->loadFile(params))) {
delete _imageDisable;
_imageDisable = nullptr;
cmd = PARSERR_GENERIC;
@ -323,7 +323,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_FOCUS:
delete _imageFocus;
_imageFocus = new BaseSprite(_gameRef);
if (!_imageFocus || DID_FAIL(_imageFocus->loadFile((char *)params))) {
if (!_imageFocus || DID_FAIL(_imageFocus->loadFile(params))) {
delete _imageFocus;
_imageFocus = nullptr;
cmd = PARSERR_GENERIC;
@ -334,7 +334,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
if (_font) {
_gameRef->_fontStorage->removeFont(_font);
}
_font = _gameRef->_fontStorage->addFont((char *)params);
_font = _gameRef->_fontStorage->addFont(params);
if (!_font) {
cmd = PARSERR_GENERIC;
}
@ -344,7 +344,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
if (_fontHover) {
_gameRef->_fontStorage->removeFont(_fontHover);
}
_fontHover = _gameRef->_fontStorage->addFont((char *)params);
_fontHover = _gameRef->_fontStorage->addFont(params);
if (!_fontHover) {
cmd = PARSERR_GENERIC;
}
@ -354,7 +354,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
if (_fontPress) {
_gameRef->_fontStorage->removeFont(_fontPress);
}
_fontPress = _gameRef->_fontStorage->addFont((char *)params);
_fontPress = _gameRef->_fontStorage->addFont(params);
if (!_fontPress) {
cmd = PARSERR_GENERIC;
}
@ -364,7 +364,7 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
if (_fontDisable) {
_gameRef->_fontStorage->removeFont(_fontDisable);
}
_fontDisable = _gameRef->_fontStorage->addFont((char *)params);
_fontDisable = _gameRef->_fontStorage->addFont(params);
if (!_fontDisable) {
cmd = PARSERR_GENERIC;
}
@ -374,21 +374,21 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
if (_fontFocus) {
_gameRef->_fontStorage->removeFont(_fontFocus);
}
_fontFocus = _gameRef->_fontStorage->addFont((char *)params);
_fontFocus = _gameRef->_fontStorage->addFont(params);
if (!_fontFocus) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_TEXT:
setText((char *)params);
setText(params);
_gameRef->expandStringByStringTable(&_text);
break;
case TOKEN_TEXT_ALIGN:
if (scumm_stricmp((char *)params, "left") == 0) {
if (scumm_stricmp(params, "left") == 0) {
_align = TAL_LEFT;
} else if (scumm_stricmp((char *)params, "right") == 0) {
} else if (scumm_stricmp(params, "right") == 0) {
_align = TAL_RIGHT;
} else {
_align = TAL_CENTER;
@ -396,25 +396,25 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_WIDTH:
parser.scanStr((char *)params, "%d", &_width);
parser.scanStr(params, "%d", &_width);
break;
case TOKEN_HEIGHT:
parser.scanStr((char *)params, "%d", &_height);
parser.scanStr(params, "%d", &_height);
break;
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;
@ -422,35 +422,35 @@ bool UIButton::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PARENT_NOTIFY:
parser.scanStr((char *)params, "%b", &_parentNotify);
parser.scanStr(params, "%b", &_parentNotify);
break;
case TOKEN_DISABLED:
parser.scanStr((char *)params, "%b", &_disable);
parser.scanStr(params, "%b", &_disable);
break;
case TOKEN_VISIBLE:
parser.scanStr((char *)params, "%b", &_visible);
parser.scanStr(params, "%b", &_visible);
break;
case TOKEN_FOCUSABLE:
parser.scanStr((char *)params, "%b", &_canFocus);
parser.scanStr(params, "%b", &_canFocus);
break;
case TOKEN_CENTER_IMAGE:
parser.scanStr((char *)params, "%b", &_centerImage);
parser.scanStr(params, "%b", &_centerImage);
break;
case TOKEN_PRESSED:
parser.scanStr((char *)params, "%b", &_stayPressed);
parser.scanStr(params, "%b", &_stayPressed);
break;
case TOKEN_PIXEL_PERFECT:
parser.scanStr((char *)params, "%b", &_pixelPerfect);
parser.scanStr(params, "%b", &_pixelPerfect);
break;
case TOKEN_EDITOR_PROPERTY:

View File

@ -48,7 +48,7 @@ public:
UIButton(BaseGame *inGame = nullptr);
virtual ~UIButton();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
// scripting interface

View File

@ -94,7 +94,7 @@ UIEdit::~UIEdit() {
//////////////////////////////////////////////////////////////////////////
bool UIEdit::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "UIEdit::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -139,7 +139,7 @@ TOKEN_DEF(EDIT)
TOKEN_DEF(CAPTION)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool UIEdit::loadBuffer(byte *buffer, bool complete) {
bool UIEdit::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TEMPLATE)
TOKEN_TABLE(DISABLED)
@ -165,34 +165,34 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(CAPTION)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd = 2;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_EDIT) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_EDIT) {
_gameRef->LOG(0, "'EDIT' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_BACK:
delete _back;
_back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
if (!_back || DID_FAIL(_back->loadFile(params))) {
delete _back;
_back = nullptr;
cmd = PARSERR_GENERIC;
@ -202,7 +202,7 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
if (!_image || DID_FAIL(_image->loadFile(params))) {
delete _image;
_image = nullptr;
cmd = PARSERR_GENERIC;
@ -213,7 +213,7 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) {
if (_font) {
_gameRef->_fontStorage->removeFont(_font);
}
_font = _gameRef->_fontStorage->addFont((char *)params);
_font = _gameRef->_fontStorage->addFont(params);
if (!_font) {
cmd = PARSERR_GENERIC;
}
@ -223,45 +223,45 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) {
if (_fontSelected) {
_gameRef->_fontStorage->removeFont(_fontSelected);
}
_fontSelected = _gameRef->_fontStorage->addFont((char *)params);
_fontSelected = _gameRef->_fontStorage->addFont(params);
if (!_fontSelected) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_TEXT:
setText((char *)params);
setText(params);
_gameRef->expandStringByStringTable(&_text);
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_WIDTH:
parser.scanStr((char *)params, "%d", &_width);
parser.scanStr(params, "%d", &_width);
break;
case TOKEN_HEIGHT:
parser.scanStr((char *)params, "%d", &_height);
parser.scanStr(params, "%d", &_height);
break;
case TOKEN_MAX_LENGTH:
parser.scanStr((char *)params, "%d", &_maxLength);
parser.scanStr(params, "%d", &_maxLength);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;
@ -269,27 +269,27 @@ bool UIEdit::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_CURSOR_BLINK_RATE:
parser.scanStr((char *)params, "%d", &_cursorBlinkRate);
parser.scanStr(params, "%d", &_cursorBlinkRate);
break;
case TOKEN_FRAME_WIDTH:
parser.scanStr((char *)params, "%d", &_frameWidth);
parser.scanStr(params, "%d", &_frameWidth);
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PARENT_NOTIFY:
parser.scanStr((char *)params, "%b", &_parentNotify);
parser.scanStr(params, "%b", &_parentNotify);
break;
case TOKEN_DISABLED:
parser.scanStr((char *)params, "%b", &_disable);
parser.scanStr(params, "%b", &_disable);
break;
case TOKEN_VISIBLE:
parser.scanStr((char *)params, "%b", &_visible);
parser.scanStr(params, "%b", &_visible);
break;
case TOKEN_EDITOR_PROPERTY:

View File

@ -51,7 +51,7 @@ public:
virtual ~UIEdit();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
// scripting interface

View File

@ -58,7 +58,7 @@ UIEntity::~UIEntity() {
//////////////////////////////////////////////////////////////////////////
bool UIEntity::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "UIEntity::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -92,7 +92,7 @@ TOKEN_DEF(SCRIPT)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool UIEntity::loadBuffer(byte *buffer, bool complete) {
bool UIEntity::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ENTITY_CONTAINER)
TOKEN_TABLE(TEMPLATE)
@ -106,54 +106,54 @@ bool UIEntity::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd = 2;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ENTITY_CONTAINER) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_ENTITY_CONTAINER) {
_gameRef->LOG(0, "'ENTITY_CONTAINER' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_DISABLED:
parser.scanStr((char *)params, "%b", &_disable);
parser.scanStr(params, "%b", &_disable);
break;
case TOKEN_VISIBLE:
parser.scanStr((char *)params, "%b", &_visible);
parser.scanStr(params, "%b", &_visible);
break;
case TOKEN_ENTITY:
if (DID_FAIL(setEntity((char *)params))) {
if (DID_FAIL(setEntity(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_EDITOR_PROPERTY:

View File

@ -39,7 +39,7 @@ public:
UIEntity(BaseGame *inGame);
virtual ~UIEntity();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete);
bool loadBuffer(char *buffer, bool complete);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
virtual bool display() override { return display(0, 0); }

View File

@ -103,7 +103,7 @@ bool UIText::display(int offsetX, int offsetY) {
//////////////////////////////////////////////////////////////////////////
bool UIText::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "UIText::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -146,7 +146,7 @@ TOKEN_DEF(PARENT_NOTIFY)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool UIText::loadBuffer(byte *buffer, bool complete) {
bool UIText::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(STATIC)
TOKEN_TABLE(TEMPLATE)
@ -170,38 +170,38 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd = 2;
BaseParser parser;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_STATIC) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_STATIC) {
_gameRef->LOG(0, "'STATIC' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while (cmd > 0 && (cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_BACK:
delete _back;
_back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
if (!_back || DID_FAIL(_back->loadFile(params))) {
delete _back;
_back = nullptr;
cmd = PARSERR_GENERIC;
@ -211,7 +211,7 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
if (!_image || DID_FAIL(_image->loadFile(params))) {
delete _image;
_image = nullptr;
cmd = PARSERR_GENERIC;
@ -222,21 +222,21 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
if (_font) {
_gameRef->_fontStorage->removeFont(_font);
}
_font = _gameRef->_fontStorage->addFont((char *)params);
_font = _gameRef->_fontStorage->addFont(params);
if (!_font) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_TEXT:
setText((char *)params);
setText(params);
_gameRef->expandStringByStringTable(&_text);
break;
case TOKEN_TEXT_ALIGN:
if (scumm_stricmp((char *)params, "left") == 0) {
if (scumm_stricmp(params, "left") == 0) {
_textAlign = TAL_LEFT;
} else if (scumm_stricmp((char *)params, "right") == 0) {
} else if (scumm_stricmp(params, "right") == 0) {
_textAlign = TAL_RIGHT;
} else {
_textAlign = TAL_CENTER;
@ -244,9 +244,9 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_VERTICAL_ALIGN:
if (scumm_stricmp((char *)params, "top") == 0) {
if (scumm_stricmp(params, "top") == 0) {
_verticalAlign = VAL_TOP;
} else if (scumm_stricmp((char *)params, "bottom") == 0) {
} else if (scumm_stricmp(params, "bottom") == 0) {
_verticalAlign = VAL_BOTTOM;
} else {
_verticalAlign = VAL_CENTER;
@ -254,25 +254,25 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_WIDTH:
parser.scanStr((char *)params, "%d", &_width);
parser.scanStr(params, "%d", &_width);
break;
case TOKEN_HEIGHT:
parser.scanStr((char *)params, "%d", &_height);
parser.scanStr(params, "%d", &_height);
break;
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;
@ -280,19 +280,19 @@ bool UIText::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PARENT_NOTIFY:
parser.scanStr((char *)params, "%b", &_parentNotify);
parser.scanStr(params, "%b", &_parentNotify);
break;
case TOKEN_DISABLED:
parser.scanStr((char *)params, "%b", &_disable);
parser.scanStr(params, "%b", &_disable);
break;
case TOKEN_VISIBLE:
parser.scanStr((char *)params, "%b", &_visible);
parser.scanStr(params, "%b", &_visible);
break;
case TOKEN_EDITOR_PROPERTY:

View File

@ -45,7 +45,7 @@ public:
UIText(BaseGame *inGame = nullptr);
virtual ~UIText();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
// scripting interface

View File

@ -114,7 +114,7 @@ bool UITiledImage::display(int x, int y, int width, int height) {
//////////////////////////////////////////////////////////////////////////
bool UITiledImage::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "UITiledImage::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -153,7 +153,7 @@ TOKEN_DEF(HORIZONTAL_TILES)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
bool UITiledImage::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TILED_IMAGE)
TOKEN_TABLE(TEMPLATE)
@ -172,7 +172,7 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd;
BaseParser parser;
bool hTiles = false, vTiles = false;
@ -180,17 +180,17 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
int v1 = 0, v2 = 0, v3 = 0;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TILED_IMAGE) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_TILED_IMAGE) {
_gameRef->LOG(0, "'TILED_IMAGE' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
@ -198,7 +198,7 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new BaseSubFrame(_gameRef);
if (!_image || DID_FAIL(_image->setSurface((char *)params))) {
if (!_image || DID_FAIL(_image->setSurface(params))) {
delete _image;
_image = nullptr;
cmd = PARSERR_GENERIC;
@ -206,48 +206,48 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_UP_LEFT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_upLeft.left, &_upLeft.top, &_upLeft.right, &_upLeft.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_upLeft.left, &_upLeft.top, &_upLeft.right, &_upLeft.bottom);
break;
case TOKEN_UP_RIGHT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_upRight.left, &_upRight.top, &_upRight.right, &_upRight.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_upRight.left, &_upRight.top, &_upRight.right, &_upRight.bottom);
break;
case TOKEN_UP_MIDDLE:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_upMiddle.left, &_upMiddle.top, &_upMiddle.right, &_upMiddle.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_upMiddle.left, &_upMiddle.top, &_upMiddle.right, &_upMiddle.bottom);
break;
case TOKEN_DOWN_LEFT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_downLeft.left, &_downLeft.top, &_downLeft.right, &_downLeft.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_downLeft.left, &_downLeft.top, &_downLeft.right, &_downLeft.bottom);
break;
case TOKEN_DOWN_RIGHT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_downRight.left, &_downRight.top, &_downRight.right, &_downRight.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_downRight.left, &_downRight.top, &_downRight.right, &_downRight.bottom);
break;
case TOKEN_DOWN_MIDDLE:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_downMiddle.left, &_downMiddle.top, &_downMiddle.right, &_downMiddle.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_downMiddle.left, &_downMiddle.top, &_downMiddle.right, &_downMiddle.bottom);
break;
case TOKEN_MIDDLE_LEFT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_middleLeft.left, &_middleLeft.top, &_middleLeft.right, &_middleLeft.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_middleLeft.left, &_middleLeft.top, &_middleLeft.right, &_middleLeft.bottom);
break;
case TOKEN_MIDDLE_RIGHT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_middleRight.left, &_middleRight.top, &_middleRight.right, &_middleRight.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_middleRight.left, &_middleRight.top, &_middleRight.right, &_middleRight.bottom);
break;
case TOKEN_MIDDLE_MIDDLE:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_middleMiddle.left, &_middleMiddle.top, &_middleMiddle.right, &_middleMiddle.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_middleMiddle.left, &_middleMiddle.top, &_middleMiddle.right, &_middleMiddle.bottom);
break;
case TOKEN_HORIZONTAL_TILES:
parser.scanStr((char *)params, "%d,%d,%d", &h1, &h2, &h3);
parser.scanStr(params, "%d,%d,%d", &h1, &h2, &h3);
hTiles = true;
break;
case TOKEN_VERTICAL_TILES:
parser.scanStr((char *)params, "%d,%d,%d", &v1, &v2, &v3);
parser.scanStr(params, "%d,%d,%d", &v1, &v2, &v3);
vTiles = true;
break;

View File

@ -42,7 +42,7 @@ public:
DECLARE_PERSISTENT(UITiledImage, BaseObject)
void correctSize(int32 *width, int32 *height);
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
bool display(int x, int y, int width, int height);

View File

@ -239,7 +239,7 @@ bool UIWindow::display(int offsetX, int offsetY) {
//////////////////////////////////////////////////////////////////////////
bool UIWindow::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
if (buffer == nullptr) {
_gameRef->LOG(0, "UIWindow::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
@ -298,7 +298,7 @@ TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF(EDIT)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool UIWindow::loadBuffer(byte *buffer, bool complete) {
bool UIWindow::loadBuffer(char *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(WINDOW)
TOKEN_TABLE(ALPHA_COLOR)
@ -338,7 +338,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE(EDIT)
TOKEN_TABLE_END
byte *params;
char *params;
int cmd = 2;
BaseParser parser;
@ -346,33 +346,33 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
int ar = 0, ag = 0, ab = 0, alpha = 0;
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_WINDOW) {
if (parser.getCommand(&buffer, commands, &params) != TOKEN_WINDOW) {
_gameRef->LOG(0, "'WINDOW' keyword expected.");
return STATUS_FAILED;
}
buffer = params;
}
while (cmd >= PARSERR_TOKENNOTFOUND && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) >= PARSERR_TOKENNOTFOUND) {
while (cmd >= PARSERR_TOKENNOTFOUND && (cmd = parser.getCommand(&buffer, commands, &params)) >= PARSERR_TOKENNOTFOUND) {
switch (cmd) {
case TOKEN_TEMPLATE:
if (DID_FAIL(loadFile((char *)params))) {
if (DID_FAIL(loadFile(params))) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_NAME:
setName((char *)params);
setName(params);
break;
case TOKEN_CAPTION:
setCaption((char *)params);
setCaption(params);
break;
case TOKEN_BACK:
delete _back;
_back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
if (!_back || DID_FAIL(_back->loadFile(params))) {
delete _back;
_back = nullptr;
cmd = PARSERR_GENERIC;
@ -382,7 +382,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_INACTIVE:
delete _backInactive;
_backInactive = new UITiledImage(_gameRef);
if (!_backInactive || DID_FAIL(_backInactive->loadFile((char *)params))) {
if (!_backInactive || DID_FAIL(_backInactive->loadFile(params))) {
delete _backInactive;
_backInactive = nullptr;
cmd = PARSERR_GENERIC;
@ -392,7 +392,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
if (!_image || DID_FAIL(_image->loadFile(params))) {
delete _image;
_image = nullptr;
cmd = PARSERR_GENERIC;
@ -402,7 +402,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_INACTIVE:
delete _imageInactive;
_imageInactive = new BaseSprite(_gameRef);
if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) {
if (!_imageInactive || DID_FAIL(_imageInactive->loadFile(params))) {
delete _imageInactive;
_imageInactive = nullptr;
cmd = PARSERR_GENERIC;
@ -413,7 +413,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
if (_font) {
_gameRef->_fontStorage->removeFont(_font);
}
_font = _gameRef->_fontStorage->addFont((char *)params);
_font = _gameRef->_fontStorage->addFont(params);
if (!_font) {
cmd = PARSERR_GENERIC;
}
@ -423,21 +423,21 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
if (_fontInactive) {
_gameRef->_fontStorage->removeFont(_fontInactive);
}
_fontInactive = _gameRef->_fontStorage->addFont((char *)params);
_fontInactive = _gameRef->_fontStorage->addFont(params);
if (!_fontInactive) {
cmd = PARSERR_GENERIC;
}
break;
case TOKEN_TITLE:
setText((char *)params);
setText(params);
_gameRef->expandStringByStringTable(&_text);
break;
case TOKEN_TITLE_ALIGN:
if (scumm_stricmp((char *)params, "left") == 0) {
if (scumm_stricmp(params, "left") == 0) {
_titleAlign = TAL_LEFT;
} else if (scumm_stricmp((char *)params, "right") == 0) {
} else if (scumm_stricmp(params, "right") == 0) {
_titleAlign = TAL_RIGHT;
} else {
_titleAlign = TAL_CENTER;
@ -445,33 +445,33 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_TITLE_RECT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_titleRect.left, &_titleRect.top, &_titleRect.right, &_titleRect.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_titleRect.left, &_titleRect.top, &_titleRect.right, &_titleRect.bottom);
break;
case TOKEN_DRAG_RECT:
parser.scanStr((char *)params, "%d,%d,%d,%d", &_dragRect.left, &_dragRect.top, &_dragRect.right, &_dragRect.bottom);
parser.scanStr(params, "%d,%d,%d,%d", &_dragRect.left, &_dragRect.top, &_dragRect.right, &_dragRect.bottom);
break;
case TOKEN_X:
parser.scanStr((char *)params, "%d", &_posX);
parser.scanStr(params, "%d", &_posX);
break;
case TOKEN_Y:
parser.scanStr((char *)params, "%d", &_posY);
parser.scanStr(params, "%d", &_posY);
break;
case TOKEN_WIDTH:
parser.scanStr((char *)params, "%d", &_width);
parser.scanStr(params, "%d", &_width);
break;
case TOKEN_HEIGHT:
parser.scanStr((char *)params, "%d", &_height);
parser.scanStr(params, "%d", &_height);
break;
case TOKEN_CURSOR:
delete _cursor;
_cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
if (!_cursor || DID_FAIL(_cursor->loadFile(params))) {
delete _cursor;
_cursor = nullptr;
cmd = PARSERR_GENERIC;
@ -532,48 +532,48 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_TRANSPARENT:
parser.scanStr((char *)params, "%b", &_transparent);
parser.scanStr(params, "%b", &_transparent);
break;
case TOKEN_SCRIPT:
addScript((char *)params);
addScript(params);
break;
case TOKEN_PARENT_NOTIFY:
parser.scanStr((char *)params, "%b", &_parentNotify);
parser.scanStr(params, "%b", &_parentNotify);
break;
case TOKEN_PAUSE_MUSIC:
parser.scanStr((char *)params, "%b", &_pauseMusic);
parser.scanStr(params, "%b", &_pauseMusic);
break;
case TOKEN_DISABLED:
parser.scanStr((char *)params, "%b", &_disable);
parser.scanStr(params, "%b", &_disable);
break;
case TOKEN_VISIBLE:
parser.scanStr((char *)params, "%b", &_visible);
parser.scanStr(params, "%b", &_visible);
break;
case TOKEN_MENU:
parser.scanStr((char *)params, "%b", &_isMenu);
parser.scanStr(params, "%b", &_isMenu);
break;
case TOKEN_IN_GAME:
parser.scanStr((char *)params, "%b", &_inGame);
parser.scanStr(params, "%b", &_inGame);
break;
case TOKEN_CLIP_CONTENTS:
parser.scanStr((char *)params, "%b", &_clipContents);
parser.scanStr(params, "%b", &_clipContents);
break;
case TOKEN_FADE_COLOR:
parser.scanStr((char *)params, "%d,%d,%d", &fadeR, &fadeG, &fadeB);
parser.scanStr(params, "%d,%d,%d", &fadeR, &fadeG, &fadeB);
_fadeBackground = true;
break;
case TOKEN_FADE_ALPHA:
parser.scanStr((char *)params, "%d", &fadeA);
parser.scanStr(params, "%d", &fadeA);
_fadeBackground = true;
break;
@ -582,16 +582,16 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_ALPHA_COLOR:
parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab);
break;
case TOKEN_ALPHA:
parser.scanStr((char *)params, "%d", &alpha);
parser.scanStr(params, "%d", &alpha);
break;
default:
if (DID_FAIL(_gameRef->windowLoadHook(this, (char **)&buffer, (char **)params))) {
if (DID_FAIL(_gameRef->windowLoadHook(this, &buffer, &params))) {
cmd = PARSERR_GENERIC;
}
}

View File

@ -62,7 +62,7 @@ public:
BaseArray<UIObject *> _widgets;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
bool loadBuffer(char *buffer, bool complete = true);
virtual bool listen(BaseScriptHolder *param1, uint32 param2);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;