DREAMWEB: Remove mapData segment

This commit is contained in:
Willem Jan Palenstijn 2011-12-27 14:09:29 +01:00
parent 39a0153fbf
commit 7bae1022ed
4 changed files with 11 additions and 6 deletions

View File

@ -27,7 +27,7 @@ namespace DreamGen {
void DreamBase::doBlocks() {
uint16 dstOffset = data.word(kMapady) * 320 + data.word(kMapadx);
uint16 mapOffset = kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx);
const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(mapOffset, 0);
const uint8 *mapData = _mapData + mapOffset;
const uint8 *blocks = getSegment(data.word(kBackdrop)).ptr(kBlocks, 0);
uint8 *dstBuffer = workspace() + dstOffset;
@ -242,7 +242,8 @@ void DreamBase::showAllFree() {
void DreamBase::drawFlags() {
uint8 *mapFlags = _mapFlags;
const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0);
uint16 mapOffset = kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx);
const uint8 *mapData = _mapData + mapOffset;
const uint8 *backdropFlags = getSegment(data.word(kBackdrop)).ptr(kFlags, 0);
for (size_t i = 0; i < 10; ++i) {

View File

@ -48,6 +48,9 @@ const unsigned int kUnderTimedTextBufSize = 256 * kUnderTimedTextSizeY_f;
const unsigned int kLengthOfVars = 68;
const unsigned int kNumChanges = 250;
const unsigned int kLenOfMapStore = 22*8*20*8;
const unsigned int kMapWidth = 66;
const unsigned int kMapHeight = 60;
const unsigned int kLengthOfMap = kMapWidth * kMapHeight;
/**
* This class is one of the parent classes of DreamGenContext. Its sole purpose
@ -62,6 +65,9 @@ class DreamBase : public SegmentManager {
protected:
DreamWeb::DreamWebEngine *engine;
// from backdrop.cpp
uint8 _mapData[kLengthOfMap + 32];
// from keypad.cpp
uint8 _pressList[6];

View File

@ -1100,8 +1100,7 @@ void DreamBase::clearBeforeLoad() {
clearReels();
//clearRest
uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0);
memset(dst, 0, kMaplen);
memset(_mapData, 0, kMaplen);
deallocateMem(data.word(kBackdrop));
deallocateMem(data.word(kSetframes));
deallocateMem(data.word(kReels));

View File

@ -1885,7 +1885,7 @@ void DreamBase::zoomOnOff() {
void DreamBase::sortOutMap() {
const uint8 *src = workspace();
uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0);
uint8 *dst = _mapData;
for (uint16 y = 0; y < kMaplength; ++y) {
memcpy(dst, src, kMapwidth);
dst += kMapwidth;
@ -2461,7 +2461,6 @@ void DreamBase::drawFloor() {
void DreamBase::allocateBuffers() {
data.word(kExtras) = allocateMem(kLengthofextra/16);
data.word(kMapdata) = allocateMem(kLengthofmap/16);
data.word(kFreedat) = allocateMem(kFreedatlen/16);
data.word(kSetdat) = allocateMem(kSetdatlen/16);
}