[Scummvm-cvs-logs] CVS: scummvm/saga events.cpp,1.49,1.50 gfx.cpp,1.45,1.46 gfx.h,1.23,1.24 interface.cpp,1.79,1.80 isomap.cpp,1.43,1.44 isomap.h,1.20,1.21 saveload.cpp,1.1,1.2 scene.cpp,1.97,1.98 script.h,1.77,1.78
Eugene Sandulenko
sev at users.sourceforge.net
Thu Apr 21 18:38:56 CEST 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27291
Modified Files:
events.cpp gfx.cpp gfx.h interface.cpp isomap.cpp isomap.h
saveload.cpp scene.cpp script.h
Log Message:
o Fix save/load. Now it restores game properly but still at exit #0.
o Proper background for inset rooms. Crowd is gone now.
o Draw black border around inset rooms.
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- events.cpp 18 Apr 2005 20:03:10 -0000 1.49
+++ events.cpp 22 Apr 2005 01:38:27 -0000 1.50
@@ -302,7 +302,7 @@
break;
case BG_EVENT:
{
- BUFFER_INFO rbuf_info;
+ BUFFER_INFO rbuf_info;
Point bg_pt;
if (!(_vm->_scene->getFlags() & kSceneFlagISO)) {
@@ -317,6 +317,29 @@
bufToBuffer(rbuf_info.bg_buf, rbuf_info.bg_buf_w, rbuf_info.bg_buf_h,
bginfo.bg_buf, bginfo.bg_w, bginfo.bg_h, NULL, &bg_pt);
+
+ // If it is inset scene then draw black border
+ if (bginfo.bg_w < _vm->getDisplayWidth() || bginfo.bg_h < _vm->getSceneHeight()) {
+ SURFACE s;
+ s.pixels = rbuf_info.bg_buf;
+ s.w = s.pitch = rbuf_info.bg_buf_w;
+ s.h = rbuf_info.bg_buf_h;
+ s.bytesPerPixel = 1;
+ Common::Rect rect1(2, bginfo.bg_h + 4);
+ Common::Rect rect2(bginfo.bg_w + 4, 2);
+ Common::Rect rect3(2, bginfo.bg_h + 4);
+ Common::Rect rect4(bginfo.bg_w + 4, 2);
+ rect1.moveTo(bginfo.bg_x - 2, bginfo.bg_y - 2);
+ rect2.moveTo(bginfo.bg_x - 2, bginfo.bg_y - 2);
+ rect3.moveTo(bginfo.bg_x + bginfo.bg_w, bginfo.bg_y - 2);
+ rect4.moveTo(bginfo.bg_x - 2, bginfo.bg_y + bginfo.bg_h);
+
+ drawRect(&s, rect1, kITEColorBlack);
+ drawRect(&s, rect2, kITEColorBlack);
+ drawRect(&s, rect3, kITEColorBlack);
+ drawRect(&s, rect4, kITEColorBlack);
+ }
+
if (event->param == SET_PALETTE) {
PALENTRY *pal_p;
_vm->_scene->getBGPal(&pal_p);
@@ -436,7 +459,7 @@
rect.bottom = event->param3;
rect.left = event->param4;
rect.right = event->param5;
- drawRect((SURFACE *)event->data, &rect, event->param);
+ drawRect((SURFACE *)event->data, rect, event->param);
break;
case EVENT_SETFLAG:
_vm->_render->setFlag(event->param);
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- gfx.cpp 27 Jan 2005 20:06:51 -0000 1.45
+++ gfx.cpp 22 Apr 2005 01:38:27 -0000 1.46
@@ -87,7 +87,7 @@
pal_rect.left = (x * 8) + 4;
pal_rect.right = pal_rect.left + 8;
- drawRect(dst_s, &pal_rect, color);
+ drawRect(dst_s, pal_rect, color);
color++;
}
}
@@ -355,20 +355,15 @@
// Fills a rectangle in the surface ds from point 'p1' to point 'p2' using
// the specified color.
-int drawRect(SURFACE *ds, const Rect *dst_rect, int color) {
- Rect r(ds->w, ds->h);
-
- if (dst_rect != NULL) {
- r = *dst_rect;
- r.clip(ds->w, ds->h);
+int drawRect(SURFACE *ds, Rect &dst_rect, int color) {
+ dst_rect.clip(ds->w, ds->h);
- if (!r.isValidRect()) {
- // Empty or negative region
- return FAILURE;
- }
+ if (!dst_rect.isValidRect()) {
+ // Empty or negative region
+ return FAILURE;
}
- ds->fillRect(r, color);
+ ds->fillRect(dst_rect, color);
return SUCCESS;
}
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- gfx.h 27 Jan 2005 20:07:01 -0000 1.23
+++ gfx.h 22 Apr 2005 01:38:27 -0000 1.24
@@ -79,7 +79,7 @@
int bufToBuffer(byte * dst_buf, int dst_w, int dst_h, const byte *src,
int src_w, int src_h, Rect *src_rect, Point *dst_pt);
int getClipInfo(CLIPINFO *clipinfo);
-int drawRect(SURFACE *ds, const Rect *dst_rect, int color);
+int drawRect(SURFACE *ds, Rect &dst_rect, int color);
int drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color);
int drawPolyLine(SURFACE *ds, const Point *pts, int pt_ct, int draw_color);
int clipLine(SURFACE *ds, const Point *src_p1, const Point *src_p2, Point *dst_p1, Point *dst_p2);
Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- interface.cpp 21 Apr 2005 01:30:07 -0000 1.79
+++ interface.cpp 22 Apr 2005 01:38:27 -0000 1.80
@@ -440,7 +440,7 @@
rect.right = _vm->getDisplayWidth();
rect.bottom = _vm->getDisplayInfo().statusY + _vm->getDisplayInfo().statusHeight;
- drawRect(backBuffer, &rect, _vm->getDisplayInfo().statusBGColor);
+ drawRect(backBuffer, rect, _vm->getDisplayInfo().statusBGColor);
string_w = _vm->_font->getStringWidth(SMALL_FONT_ID, _statusText, 0, 0);
@@ -835,7 +835,7 @@
rect.moveTo(_conversePanel.x + _conversePanel.buttons[0].xOffset,
_conversePanel.y + _conversePanel.buttons[0].yOffset);
- drawRect(ds, &rect, kITEColorDarkGrey); //fill bullet place
+ drawRect(ds, rect, kITEColorDarkGrey); //fill bullet place
for (int i = 0; i < CONVERSE_TEXT_LINES; i++) {
relPos = _converseStartPos + i;
@@ -854,7 +854,7 @@
_conversePanel.calcPanelButtonRect(&_conversePanel.buttons[i], rect);
rect.left += 8;
- drawRect(ds, &rect, backgnd);
+ drawRect(ds, rect, backgnd);
str = _converseText[relPos].text;
Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- isomap.cpp 3 Apr 2005 15:32:02 -0000 1.43
+++ isomap.cpp 22 Apr 2005 01:38:27 -0000 1.44
@@ -380,13 +380,18 @@
int IsoMap::draw(SURFACE *ds) {
Rect isoRect(_vm->getDisplayWidth(), _vm->getDisplayInfo().sceneHeight);
- drawRect(ds, &isoRect, 0);
+ drawRect(ds, isoRect, 0);
_tileClip = isoRect;
drawTiles(ds, NULL);
return SUCCESS;
}
+void IsoMap::setMapPosition(int x, int y) {
+ _mapPosition.x = x;
+ _mapPosition.y = y;
+}
+
void IsoMap::drawSprite(SURFACE *ds, SpriteList &spriteList, int spriteNumber, const Location &location, const Point &screenPosition, int scale) {
int width;
int height;
Index: isomap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- isomap.h 21 Apr 2005 01:30:07 -0000 1.20
+++ isomap.h 22 Apr 2005 01:38:27 -0000 1.21
@@ -168,6 +168,7 @@
bool nextTileTarget(ActorData* actor);
void setTileDoorState(int doorNumber, int doorState);
Point getMapPosition() { return _mapPosition; }
+ void setMapPosition(int x, int y);
private:
void drawTiles(SURFACE *ds, const Location *location);
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saveload.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- saveload.cpp 21 Apr 2005 01:30:07 -0000 1.1
+++ saveload.cpp 22 Apr 2005 01:38:27 -0000 1.2
@@ -35,6 +35,7 @@
#include "saga/script.h"
#include "saga/interface.h"
#include "saga/scene.h"
+#include "saga/render.h"
namespace Saga {
@@ -103,46 +104,49 @@
}
void SagaEngine::load() {
- File out;
+ File in;
int actorsCount, objsCount, commonBufferSize;
int scenenum, inset;
+ int mapx, mapy;
- out.open("ite.sav");
+ in.open("ite.sav");
- if (!out.isOpen())
+ if (!in.isOpen())
return;
- actorsCount = out.readSint16LE();
- objsCount = out.readSint16LE();
- commonBufferSize = out.readSint16LE();
- _actor->setProtagState(out.readSint16LE());
+ actorsCount = in.readSint16LE();
+ objsCount = in.readSint16LE();
+ commonBufferSize = in.readSint16LE();
+ _actor->setProtagState(in.readSint16LE());
// Surrounding scene
- scenenum = out.readSint32LE();
- out.readSint32LE();
+ scenenum = in.readSint32LE();
+ in.readSint32LE();
// Inset scene
- inset = out.readSint32LE();
- out.readSint32LE();
+ inset = in.readSint32LE();
+ in.readSint32LE();
+
+ debug(0, "scene: %d out: %d", scenenum, inset);
uint16 i;
for (i = 0; i < actorsCount; i++) {
ActorData *a = _actor->_actors[i];
- a->sceneNumber = out.readSint32LE();
- a->location.x = out.readSint16LE();
- a->location.y = out.readSint16LE();
- a->location.z = out.readSint16LE();
- a->finalTarget.x = out.readSint16LE();
- a->finalTarget.y = out.readSint16LE();
- a->finalTarget.z = out.readSint16LE();
- a->currentAction = out.readByte();
- a->facingDirection = out.readByte();
- a->targetObject = out.readSint16LE();
- a->flags = (a->flags & ~(kProtagonist | kFollower) | out.readByte());
- a->frameNumber = out.readByte();
- out.readSint16LE();
+ a->sceneNumber = in.readSint32LE();
+ a->location.x = in.readSint16LE();
+ a->location.y = in.readSint16LE();
+ a->location.z = in.readSint16LE();
+ a->finalTarget.x = in.readSint16LE();
+ a->finalTarget.y = in.readSint16LE();
+ a->finalTarget.z = in.readSint16LE();
+ a->currentAction = in.readByte();
+ a->facingDirection = in.readByte();
+ a->targetObject = in.readSint16LE();
+ a->flags = (a->flags & ~(kProtagonist | kFollower) | in.readByte());
+ a->frameNumber = in.readByte();
+ in.readSint16LE();
}
_interface->clearInventory();
@@ -151,28 +155,29 @@
ObjectData *o = _actor->_objs[i];
int pos;
- o->sceneNumber = out.readSint32LE();
- o->id = out.readSint32LE();
- o->location.x = out.readSint16LE();
- o->location.y = out.readSint16LE();
- o->location.z = out.readSint16LE();
- o->nameIndex = out.readSint16LE();
+ o->sceneNumber = in.readSint32LE();
+ o->id = in.readSint32LE();
+ o->location.x = in.readSint16LE();
+ o->location.y = in.readSint16LE();
+ o->location.z = in.readSint16LE();
+ o->nameIndex = in.readSint16LE();
- pos = out.readSint16LE();
+ pos = in.readSint16LE();
if (o->sceneNumber == ITE_SCENE_INV) {
_interface->addToInventory(_actor->objIndexToId(i), pos);
}
- out.readByte();
+ in.readByte();
}
for (i = 0; i < commonBufferSize; i++)
- _script->_commonBuffer[i] = out.readByte();
+ _script->_commonBuffer[i] = in.readByte();
- _isoMap->getMapPosition().x = out.readSint16LE();
- _isoMap->getMapPosition().y = out.readSint16LE();
+ mapx = in.readSint16LE();
+ mapy = in.readSint16LE();
- out.close();
+ in.close();
+ _isoMap->setMapPosition(mapx, mapy);
// FIXME: When save/load screen will be implemented we should
// call these after that screen left by user
@@ -184,6 +189,7 @@
_scene->changeScene(scenenum, 0);
if (inset != scenenum) {
+ _render->drawScene();
_scene->clearSceneQueue();
_scene->changeScene(inset, 0);
}
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- scene.cpp 21 Apr 2005 01:30:07 -0000 1.97
+++ scene.cpp 22 Apr 2005 01:38:27 -0000 1.98
@@ -1013,6 +1013,12 @@
_vm->_script->abortAllThreads();
_vm->_script->_skipSpeeches = false;
+ // Copy current screen to render buffer so inset rooms will get proper background
+ SURFACE *back_buf = _vm->_gfx->getBackBuffer();
+ BUFFER_INFO rbuf_info;
+
+ _vm->_render->getBufferInfo(&rbuf_info);
+ bufToBuffer(rbuf_info.bg_buf, rbuf_info.bg_buf_w, rbuf_info.bg_buf_h, (byte *)back_buf->pixels, back_buf->w, back_buf->h, NULL, NULL);
// Free scene background
if (_bg.loaded) {
free(_bg.buf);
Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- script.h 21 Apr 2005 01:30:07 -0000 1.77
+++ script.h 22 Apr 2005 01:38:27 -0000 1.78
@@ -31,7 +31,7 @@
namespace Saga {
-#define COMMON_BUFFER_SIZE 1024
+#define COMMON_BUFFER_SIZE 1024 // Why 1024?
#define S_LUT_ENTRYLEN_ITECD 22
#define S_LUT_ENTRYLEN_ITEDISK 16
More information about the Scummvm-git-logs
mailing list