diff options
Diffstat (limited to 'engines/wintermute/ui')
-rw-r--r-- | engines/wintermute/ui/ui_button.cpp | 89 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_edit.cpp | 23 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_entity.cpp | 7 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_object.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_text.cpp | 19 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_tiled_image.cpp | 3 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_window.cpp | 35 |
7 files changed, 87 insertions, 93 deletions
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index af7e3262db..bb7d4d530d 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -104,8 +104,7 @@ bool UIButton::loadFile(const char *filename) { bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing BUTTON file '%s'", filename);
@@ -448,41 +447,41 @@ bool UIButton::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
- if (_backHover && _backHover->_filename)
- buffer->putTextIndent(indent + 2, "BACK_HOVER=\"%s\"\n", _backHover->_filename);
- if (_backPress && _backPress->_filename)
- buffer->putTextIndent(indent + 2, "BACK_PRESS=\"%s\"\n", _backPress->_filename);
- if (_backDisable && _backDisable->_filename)
- buffer->putTextIndent(indent + 2, "BACK_DISABLE=\"%s\"\n", _backDisable->_filename);
- if (_backFocus && _backFocus->_filename)
- buffer->putTextIndent(indent + 2, "BACK_FOCUS=\"%s\"\n", _backFocus->_filename);
-
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
- if (_imageHover && _imageHover->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_HOVER=\"%s\"\n", _imageHover->_filename);
- if (_imagePress && _imagePress->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_PRESS=\"%s\"\n", _imagePress->_filename);
- if (_imageDisable && _imageDisable->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_DISABLE=\"%s\"\n", _imageDisable->_filename);
- if (_imageFocus && _imageFocus->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_FOCUS=\"%s\"\n", _imageFocus->_filename);
-
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
- if (_fontHover && _fontHover->_filename)
- buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->_filename);
- if (_fontPress && _fontPress->_filename)
- buffer->putTextIndent(indent + 2, "FONT_PRESS=\"%s\"\n", _fontPress->_filename);
- if (_fontDisable && _fontDisable->_filename)
- buffer->putTextIndent(indent + 2, "FONT_DISABLE=\"%s\"\n", _fontDisable->_filename);
- if (_fontFocus && _fontFocus->_filename)
- buffer->putTextIndent(indent + 2, "FONT_FOCUS=\"%s\"\n", _fontFocus->_filename);
-
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ if (_backHover && _backHover->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_HOVER=\"%s\"\n", _backHover->getFilename());
+ if (_backPress && _backPress->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_PRESS=\"%s\"\n", _backPress->getFilename());
+ if (_backDisable && _backDisable->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_DISABLE=\"%s\"\n", _backDisable->getFilename());
+ if (_backFocus && _backFocus->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_FOCUS=\"%s\"\n", _backFocus->getFilename());
+
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ if (_imageHover && _imageHover->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_HOVER=\"%s\"\n", _imageHover->getFilename());
+ if (_imagePress && _imagePress->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_PRESS=\"%s\"\n", _imagePress->getFilename());
+ if (_imageDisable && _imageDisable->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_DISABLE=\"%s\"\n", _imageDisable->getFilename());
+ if (_imageFocus && _imageFocus->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_FOCUS=\"%s\"\n", _imageFocus->getFilename());
+
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ if (_fontHover && _fontHover->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->getFilename());
+ if (_fontPress && _fontPress->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_PRESS=\"%s\"\n", _fontPress->getFilename());
+ if (_fontDisable && _fontDisable->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_DISABLE=\"%s\"\n", _fontDisable->getFilename());
+ if (_fontFocus && _fontFocus->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_FOCUS=\"%s\"\n", _fontFocus->getFilename());
+
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
buffer->putTextIndent(indent + 2, "\n");
@@ -762,8 +761,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetDisabledImage") == 0) {
stack->correctParams(0);
- if (!_imageDisable || !_imageDisable->_filename) stack->pushNULL();
- else stack->pushString(_imageDisable->_filename);
+ if (!_imageDisable || !_imageDisable->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageDisable->getFilename());
return STATUS_OK;
}
@@ -803,8 +802,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetHoverImage") == 0) {
stack->correctParams(0);
- if (!_imageHover || !_imageHover->_filename) stack->pushNULL();
- else stack->pushString(_imageHover->_filename);
+ if (!_imageHover || !_imageHover->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageHover->getFilename());
return STATUS_OK;
}
@@ -843,8 +842,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetPressedImage") == 0) {
stack->correctParams(0);
- if (!_imagePress || !_imagePress->_filename) stack->pushNULL();
- else stack->pushString(_imagePress->_filename);
+ if (!_imagePress || !_imagePress->getFilename()) stack->pushNULL();
+ else stack->pushString(_imagePress->getFilename());
return STATUS_OK;
}
@@ -883,8 +882,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFocusedImage") == 0) {
stack->correctParams(0);
- if (!_imageFocus || !_imageFocus->_filename) stack->pushNULL();
- else stack->pushString(_imageFocus->_filename);
+ if (!_imageFocus || !_imageFocus->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageFocus->getFilename());
return STATUS_OK;
}
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index d9c6c6586a..b2e7b29284 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -100,8 +100,7 @@ bool UIEdit::loadFile(const char *filename) { bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing EDIT file '%s'", filename);
@@ -308,19 +307,19 @@ bool UIEdit::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
- if (_fontSelected && _fontSelected->_filename)
- buffer->putTextIndent(indent + 2, "FONT_SELECTED=\"%s\"\n", _fontSelected->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ if (_fontSelected && _fontSelected->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_SELECTED=\"%s\"\n", _fontSelected->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
buffer->putTextIndent(indent + 2, "\n");
diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index acbcd2430f..a67ba6b29f 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.cpp @@ -64,8 +64,7 @@ bool UIEntity::loadFile(const char *filename) { bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing ENTITY container file '%s'", filename);
@@ -188,8 +187,8 @@ bool UIEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
- if (_entity && _entity->_filename)
- buffer->putTextIndent(indent + 2, "ENTITY=\"%s\"\n", _entity->_filename);
+ if (_entity && _entity->getFilename())
+ buffer->putTextIndent(indent + 2, "ENTITY=\"%s\"\n", _entity->getFilename());
buffer->putTextIndent(indent + 2, "\n");
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index 20fd6c363f..416ad1e114 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -187,8 +187,8 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetImage") == 0) {
stack->correctParams(0);
- if (!_image || !_image->_filename) stack->pushNULL();
- else stack->pushString(_image->_filename);
+ if (!_image || !_image->getFilename()) stack->pushNULL();
+ else stack->pushString(_image->getFilename());
return STATUS_OK;
}
diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index fdf7f6287f..62ef968552 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.cpp @@ -104,8 +104,7 @@ bool UIText::loadFile(const char *filename) { bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing STATIC file '%s'", filename);
@@ -302,17 +301,17 @@ bool UIText::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
if (_text)
buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index fec30f46e9..6ee27bb411 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -128,8 +128,7 @@ bool UITiledImage::loadFile(const char *filename) { bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing TILED_IMAGE file '%s'", filename);
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 0fedfdc87a..5a1caa9fd4 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -216,8 +216,7 @@ bool UIWindow::loadFile(const char *filename) { bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing WINDOW file '%s'", filename);
@@ -584,23 +583,23 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
- if (_backInactive && _backInactive->_filename)
- buffer->putTextIndent(indent + 2, "BACK_INACTIVE=\"%s\"\n", _backInactive->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ if (_backInactive && _backInactive->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_INACTIVE=\"%s\"\n", _backInactive->getFilename());
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
- if (_imageInactive && _imageInactive->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_INACTIVE=\"%s\"\n", _imageInactive->_filename);
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ if (_imageInactive && _imageInactive->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_INACTIVE=\"%s\"\n", _imageInactive->getFilename());
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
- if (_fontInactive && _fontInactive->_filename)
- buffer->putTextIndent(indent + 2, "FONT_INACTIVE=\"%s\"\n", _fontInactive->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ if (_fontInactive && _fontInactive->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_INACTIVE=\"%s\"\n", _fontInactive->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
buffer->putTextIndent(indent + 2, "\n");
@@ -758,8 +757,8 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetInactiveImage") == 0) {
stack->correctParams(0);
- if (!_imageInactive || !_imageInactive->_filename) stack->pushNULL();
- else stack->pushString(_imageInactive->_filename);
+ if (!_imageInactive || !_imageInactive->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageInactive->getFilename());
return STATUS_OK;
}
|