[Scummvm-cvs-logs] SF.net SVN: scummvm: [26317] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Thu Mar 29 20:34:32 CEST 2007
Revision: 26317
http://scummvm.svn.sourceforge.net/scummvm/?rev=26317&view=rev
Author: peres001
Date: 2007-03-29 11:34:31 -0700 (Thu, 29 Mar 2007)
Log Message:
-----------
- implemented destructor for Cnv, thus removing calls to Gfx::freeCnv()
- enforced use of getFramePtr instead of Cnv::_array member
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/animation.cpp
scummvm/trunk/engines/parallaction/defs.h
scummvm/trunk/engines/parallaction/dialogue.cpp
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/inventory.cpp
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/parallaction.h
scummvm/trunk/engines/parallaction/zone.cpp
Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/animation.cpp 2007-03-29 18:34:31 UTC (rev 26317)
@@ -168,7 +168,6 @@
Animation *v4 = (Animation*)_animations._next;
while (v4) {
freeScript(v4->_program);
- _vm->_gfx->freeCnv(v4->_cnv);
if (v4->_cnv) delete v4->_cnv;
v4 = (Animation*)v4->_next;
Modified: scummvm/trunk/engines/parallaction/defs.h
===================================================================
--- scummvm/trunk/engines/parallaction/defs.h 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/defs.h 2007-03-29 18:34:31 UTC (rev 26317)
@@ -101,6 +101,17 @@
_array = NULL;
}
+ ~Cnv() {
+ if (_count == 0 || _array == NULL) return;
+
+ for (uint16 _si = 0; _si < _count; _si++) {
+ if (_array[_si])
+ free(_array[_si]);
+ }
+
+ free(_array);
+ }
+
byte* getFramePtr(uint16 index) {
if (index >= _count)
return NULL;
Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp 2007-03-29 18:34:31 UTC (rev 26317)
@@ -318,7 +318,7 @@
StaticCnv face;
face._width = cnv->_width;
face._height = cnv->_height;
- face._data0 = cnv->_array[q->_mood & 0xF];
+ face._data0 = cnv->getFramePtr(q->_mood & 0xF);
face._data1 = NULL; // cnv->field_8[v60->_mood & 0xF];
_vm->_gfx->flatBlitCnv(&face, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y, Gfx::kBitFront);
@@ -344,7 +344,7 @@
StaticCnv face;
face._width = cnv->_width;
face._height = cnv->_height;
- face._data0 = cnv->_array[0];
+ face._data0 = cnv->getFramePtr(0);
face._data1 = NULL; // cnv->field_8[0];
_vm->_gfx->flatBlitCnv(&face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront);
@@ -399,7 +399,6 @@
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
if (isNpc) {
- _vm->_gfx->freeCnv(face);
delete face;
}
@@ -427,7 +426,7 @@
if (numAvailableAnswers == 1) {
_vm->_gfx->displayWrappedString(q->_answers[_di], _answerBalloonX[_di], _answerBalloonY[_di], MAX_BALLOON_WIDTH, 0);
- cnv->_data0 = _vm->_char._talk->_array[q->_answer_moods[_di] & 0xF];
+ cnv->_data0 = _vm->_char._talk->getFramePtr(q->_answer_moods[_di] & 0xF);
// cnv->_data1 = _vm->_char._talk->field_8[q->_answer_moods[_di] & 0xF];
_vm->_gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront);
waitUntilLeftClick();
@@ -447,7 +446,7 @@
_vm->_gfx->displayWrappedString(q->_answers[v2], _answerBalloonX[v2], _answerBalloonY[v2], MAX_BALLOON_WIDTH, 3);
_vm->_gfx->displayWrappedString(q->_answers[_si], _answerBalloonX[_si], _answerBalloonY[_si], MAX_BALLOON_WIDTH, 0);
- cnv->_data0 = _vm->_char._talk->_array[q->_answer_moods[_si] & 0xF];
+ cnv->_data0 = _vm->_char._talk->getFramePtr(q->_answer_moods[_si] & 0xF);
// cnv->_data1 = _vm->_char._talk->field_8[q->_answer_moods[_si] & 0xF];
_vm->_gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront);
}
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2007-03-29 18:34:31 UTC (rev 26317)
@@ -552,7 +552,7 @@
tmp._width = _font->_width;
tmp._height = _font->_height;
- tmp._data0 = _font->_array[c];
+ tmp._data0 = _font->getFramePtr(c);
flatBlitCnv(&tmp, x, y, kBitFront);
@@ -572,7 +572,7 @@
byte c = mapChar(text[i]);
uint16 w = _proportionalFont ? _glyphWidths[(int)c] : 8;
- byte *s = _font->_array[c];
+ byte *s = _font->getFramePtr(c);
byte *d = _buffers[kBitFront] + x + y*SCREEN_WIDTH;
// printf("%i\n", text[i]);
@@ -705,7 +705,6 @@
void Gfx::setFont(const char* name) {
- freeCnv(_font);
if (_font) delete _font;
_font = _vm->_disk->loadFont(name);
@@ -757,7 +756,7 @@
for (uint16 i = 0; i < len; i++) {
byte c = mapChar(text[i]);
- byte *s = _font->_array[c];
+ byte *s = _font->getFramePtr(c);
byte *d = cnv->_data0 + _font->_width * i;
for (uint16 j = 0; j < _font->_height; j++) {
@@ -785,31 +784,6 @@
}
-void Gfx::freeCnv(Cnv *cnv) {
-// printf("Gfx::freeCnv()\n");
-
- if (!cnv) return;
- if (cnv->_count == 0) return;
- if (!cnv->_array) return;
-
- for (uint16 _si = 0; _si < cnv->_count; _si++) {
- if (cnv->_array[_si]) {
- free(cnv->_array[_si]);
- }
- cnv->_array[_si] = NULL;
- }
-
- if (cnv->_array)
- free(cnv->_array);
-
- cnv->_count = 0;
- cnv->_array = NULL;
-
- return;
-}
-
-
-
void Gfx::freeStaticCnv(StaticCnv *cnv) {
// printf("free_static_cnv()\n");
@@ -944,7 +918,6 @@
free(_buffers[kBitBack]);
free(_buffers[kBit2]);
- freeCnv(_font);
if (_font) delete _font;
return;
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/graphics.h 2007-03-29 18:34:31 UTC (rev 26317)
@@ -98,7 +98,6 @@
// cnv management
void makeCnvFromString(StaticCnv *cnv, char *text);
- void freeCnv(Cnv *cnv);
void freeStaticCnv(StaticCnv *cnv);
void backupDoorBackground(DoorData *data, int16 x, int16 y);
void backupGetBackground(GetData *data, int16 x, int16 y);
Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/inventory.cpp 2007-03-29 18:34:31 UTC (rev 26317)
@@ -187,7 +187,7 @@
uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
// FIXME: this will end up in a general blit function
- byte* s = _vm->_char._objs->_array[item->_index];
+ byte* s = _vm->_char._objs->getFramePtr(item->_index);
byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._objs->_height * INVENTORY_WIDTH;
for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
memcpy(d, s, INVENTORYITEM_WIDTH);
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2007-03-29 18:34:31 UTC (rev 26317)
@@ -696,24 +696,26 @@
void Parallaction::freeCharacter() {
- _vm->_gfx->freeCnv(_vm->_char._normalFrames);
- if (_vm->_char._normalFrames) delete _vm->_char._normalFrames;
+ if (_vm->_char._normalFrames)
+ delete _vm->_char._normalFrames;
if (!IS_DUMMY_CHARACTER(_vm->_characterName)) {
- _vm->_gfx->freeCnv(_vm->_char._miniFrames);
- if (_vm->_char._miniFrames) delete _vm->_char._miniFrames;
+ if (_vm->_char._miniFrames)
+ delete _vm->_char._miniFrames;
- if (_objectsNames) delete _objectsNames;
+ if (_objectsNames)
+ delete _objectsNames;
_objectsNames = NULL;
- _vm->_gfx->freeCnv(_vm->_char._talk);
- if (_vm->_char._talk) delete _vm->_char._talk;
+ if (_vm->_char._talk)
+ delete _vm->_char._talk;
_vm->_gfx->freeStaticCnv(_vm->_char._head);
- if (_vm->_char._head) delete _vm->_char._head;
+ if (_vm->_char._head)
+ delete _vm->_char._head;
- _vm->_gfx->freeCnv(_vm->_char._objs);
- if (_vm->_char._objs) delete _vm->_char._objs;
+ if (_vm->_char._objs)
+ delete _vm->_char._objs;
}
return;
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2007-03-29 18:34:31 UTC (rev 26317)
@@ -229,7 +229,6 @@
// ._width = 0;
// _talk._height = 0;
// _talk._count = 0;
-// _talk._array = NULL;
_head = NULL;
// _head._width = 0;
Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp 2007-03-29 17:55:39 UTC (rev 26316)
+++ scummvm/trunk/engines/parallaction/zone.cpp 2007-03-29 18:34:31 UTC (rev 26317)
@@ -150,7 +150,6 @@
case kZoneDoor:
free(z->u.door->_location);
free(z->u.door->_background);
- _vm->_gfx->freeCnv(z->u.door->_cnv);
if (z->u.door->_cnv)
delete z->u.door->_cnv;
delete z->u.door;
@@ -276,7 +275,7 @@
vE0._height = u->door->_cnv->_height;
uint16 _ax = (z->_flags & kFlagsClosed ? 0 : 1);
- vE0._data0 = u->door->_cnv->_array[_ax];
+ vE0._data0 = u->door->_cnv->getFramePtr(_ax);
// _ax = (z->_flags & kFlagsClosed ? 0 : 1);
// vE0._data1 = doorcnv->field_8[_ax];
@@ -356,7 +355,7 @@
StaticCnv v3C;
v3C._width = _vm->_char._talk->_width;
v3C._height = _vm->_char._talk->_height;
- v3C._data0 = _vm->_char._talk->_array[0];
+ v3C._data0 = _vm->_char._talk->getFramePtr(0);
v3C._data1 = NULL; //_talk->field_8[0];
_vm->_gfx->setFont("comic");
@@ -484,7 +483,7 @@
uint16 _ax = (z->_flags & kFlagsClosed ? 0 : 1);
- v14._data0 = z->u.door->_cnv->_array[_ax];
+ v14._data0 = z->u.door->_cnv->getFramePtr(_ax);
_vm->_gfx->flatBlitCnv(&v14, z->_left, z->_top, Gfx::kBitBack);
_vm->_gfx->flatBlitCnv(&v14, z->_left, z->_top, Gfx::kBit2);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list