diff options
author | Nicola Mettifogo | 2007-03-12 22:52:27 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-12 22:52:27 +0000 |
commit | 88ed62270220560081c7b127e2afc6506a69adc5 (patch) | |
tree | 0fa2528485002e2b548cafa82d111f5954a1e107 /engines | |
parent | cf816f54d9bb8ca826d0950e165a99d732355a86 (diff) | |
download | scummvm-rg350-88ed62270220560081c7b127e2afc6506a69adc5.tar.gz scummvm-rg350-88ed62270220560081c7b127e2afc6506a69adc5.tar.bz2 scummvm-rg350-88ed62270220560081c7b127e2afc6506a69adc5.zip |
moved background path buffer management into walk.cpp
svn-id: r26117
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/disk.cpp | 5 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 16 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 7 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/walk.cpp | 27 |
5 files changed, 27 insertions, 30 deletions
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index bb652129f2..5a72800b7a 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -24,6 +24,7 @@ #include "parallaction/graphics.h" #include "parallaction/parallaction.h" #include "parallaction/disk.h" +#include "parallaction/walk.h" namespace Parallaction { @@ -412,7 +413,7 @@ void Disk::loadBackground(const char *filename) { _vm->_gfx->setBackground(bg); _vm->_gfx->setMask(mask); - _vm->_gfx->setPath(path); + setPath(path); free(v4); @@ -445,7 +446,7 @@ void Disk::loadMaskAndPath(const char *name) { _archive.read(maskBuf, SCREENMASK_WIDTH*SCREEN_HEIGHT); _vm->_gfx->setMask(maskBuf); - _vm->_gfx->setPath(pathBuf); + setPath(pathBuf); return; } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index f4ff943b6a..4ff09e86e4 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -934,9 +934,6 @@ void Gfx::setMask(byte *mask) { memcpy(_buffers[kMask0], mask, SCREENMASK_WIDTH*SCREEN_HEIGHT); } -void Gfx::setPath(byte *path) { - memcpy(_buffers[kPath0], path, SCREENPATH_WIDTH*SCREEN_HEIGHT); -} void Gfx::copyRect(Gfx::Buffers dstbuffer, uint16 x, uint16 y, uint16 w, uint16 h, byte *src, uint16 pitch) { @@ -1019,17 +1016,6 @@ void Gfx::intGrottaHackMask() { return; } -uint16 Gfx::queryPath(uint16 x, uint16 y) { - - byte *v6 = _buffers[kPath0]; - - byte _al = v6[y*40 + x/8]; - byte _dl = 1 << (x % 8); - - return _al & _dl; - -} - int16 Gfx::queryMask(int16 v) { for (uint16 _si = 0; _si < 3; _si++) { @@ -1047,7 +1033,6 @@ void Gfx::initBuffers() { _buffers[kBit3] = (byte*)malloc(SCREEN_SIZE); // this buffer is also used by menu so it must stay this size _buffers[kMask0] = (byte*)malloc(SCREENMASK_WIDTH * SCREEN_HEIGHT); - _buffers[kPath0] = (byte*)malloc(SCREENPATH_WIDTH * SCREEN_HEIGHT); return; } @@ -1079,7 +1064,6 @@ Gfx::Gfx(Parallaction* vm) : Gfx::~Gfx() { free(_buffers[kMask0]); - free(_buffers[kPath0]); free(_buffers[kBitFront]); free(_buffers[kBitBack]); diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index a2d2700cc2..64358312cb 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -74,9 +74,7 @@ public: kBit2, kBit3, // mask buffers - kMask0, - // path buffers - kPath0 + kMask0 }; public: @@ -100,11 +98,8 @@ public: // location void setBackground(byte *background); void setMask(byte *mask); - void setPath(byte *path); void parseDepths(Common::SeekableReadStream &stream); void parseBackground(Common::SeekableReadStream &stream); - void loadMaskAndPath(const char *filename); - uint16 queryPath(uint16 x, uint16 y); int16 queryMask(int16 v); void intGrottaHackMask(); void restoreBackground(int16 left, int16 top, uint16 width, uint16 height); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index dc858020ad..680f7a83ad 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -36,6 +36,7 @@ #include "parallaction/music.h" #include "parallaction/inventory.h" #include "parallaction/graphics.h" +#include "parallaction/walk.h" #include "parallaction/zone.h" @@ -226,6 +227,7 @@ int Parallaction::init() { _location._comment = NULL; _location._endComment = NULL; + initWalk(); _yourTalk._width = 0; _yourTalk._height = 0; diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 8c456f595f..8a1f229cb2 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -24,15 +24,18 @@ #include "parallaction/parallaction.h" #include "parallaction/commands.h" #include "parallaction/graphics.h" +#include "parallaction/walk.h" #include "parallaction/zone.h" namespace Parallaction { uint16 walkFunc1(int16, int16, WalkNode *); -uint16 queryPath(uint16 x, uint16 y); + WalkNode _NULL_WALKNODE = { {NULL, NULL}, 0, 0 }; +static byte *_buffer; + static uint16 _doorData1 = 1000; static Zone *_zoneTrap = NULL; @@ -230,11 +233,6 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { } -uint16 queryPath(uint16 x, uint16 y) { - return _vm->_gfx->queryPath(x, y); -} - - // // x,y : top left coordinates // @@ -481,5 +479,22 @@ uint16 checkDoor() { return _yourself._frame; } +uint16 queryPath(uint16 x, uint16 y) { + + byte _al = _buffer[y*40 + x/8]; + byte _dl = 1 << (x % 8); + + return _al & _dl; + +} + +void setPath(byte *path) { + memcpy(_buffer, path, SCREENPATH_WIDTH*SCREEN_HEIGHT); +} + +void initWalk() { + _buffer = (byte*)malloc(SCREENPATH_WIDTH * SCREEN_HEIGHT); +} + } // namespace Parallaction |