Skip to content

Commit

Permalink
DREAMWEB: Move Bresenham output out of data segment
Browse files Browse the repository at this point in the history
  • Loading branch information
wjp committed Dec 3, 2011
1 parent 29b1f9f commit 0336c67
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 100 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -35,6 +35,7 @@ p = parser(skip_binary_data = [
'stak',
'keyconverttab',
'atmospherelist',
'linedata',
# keypad.asm
'keypadlist',
'symbollist',
Expand Down
82 changes: 16 additions & 66 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -9844,7 +9844,7 @@ void DreamGenContext::getNamePos() {
_mul(cx);
dx = data;
es = dx;
bx = 3368;
bx = 2968;
_add(bx, ax);
al = data.byte(kCursorpos);
ah = 0;
Expand Down Expand Up @@ -9998,7 +9998,7 @@ void DreamGenContext::showNames() {
STACK_CHECK;
dx = data;
es = dx;
si = 3368+1;
si = 2968+1;
di = (60)+21;
bx = (52)+10;
cl = 0;
Expand Down Expand Up @@ -11670,84 +11670,34 @@ void DreamGenContext::__start() {
//0x0b70: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0b80: .... .... .... ....
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
//0x0b90: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0ba0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0bb0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0bc0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0bd0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0be0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0bf0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c00: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c10: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c20: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c30: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c40: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c50: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c60: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c70: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c80: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0c90: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0ca0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0cb0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0cc0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0cd0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0ce0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0cf0: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0d00: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0d10: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
//0x0d20: .... .... .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
//0x0d30: .... .... .... ....
//0x0ba0: .... .... .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,
//0x0d40: .... .... .... ....
//0x0bb0: .... .... .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01,
//0x0d50: .... .... .... ....
//0x0bc0: .... .... .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01,
//0x0d60: .... .... .... ....
//0x0bd0: .... .... .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01,
//0x0d70: .... .... .... ....
//0x0be0: .... .... .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00,
//0x0d80: .... .... .... ....
//0x0bf0: .... .... .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x44,
//0x0d90: .... .... .... ...D
//0x0c00: .... .... .... ...D
0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41,
//0x0da0: REAM WEB. D00. DREA
//0x0c10: REAM WEB. D00. DREA
0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45,
//0x0db0: MWEB .D01 .DRE AMWE
//0x0c20: MWEB .D01 .DRE AMWE
0x42, 0x2e, 0x44, 0x30, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44,
//0x0dc0: B.D0 2.DR EAMW EB.D
//0x0c30: B.D0 2.DR EAMW EB.D
0x30, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x34, 0x00,
//0x0dd0: 03.D REAM WEB. D04.
//0x0c40: 03.D REAM WEB. D04.
0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45,
//0x0de0: DREA MWEB .D05 .DRE
//0x0c50: DREA MWEB .D05 .DRE
0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x36, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57,
//0x0df0: AMWE B.D0 6.DR EAMW
//0x0c60: AMWE B.D0 6.DR EAMW
0x45, 0x42, 0x2e, 0x44, 0x45, 0x4d, 0x00, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src));
dreamweb();
Expand Down
15 changes: 7 additions & 8 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -509,14 +509,13 @@ class DreamGenContext : public Context {
static const uint16 kRoompics = 2816;
static const uint16 kOplist = 2831;
static const uint16 kInputline = 2834;
static const uint16 kLinedata = 2962;
static const uint16 kPresslist = 3362;
static const uint16 kSavenames = 3368;
static const uint16 kSavefiles = 3487;
static const uint16 kRecname = 3578;
static const uint16 kQuitrequested = 3591;
static const uint16 kSubtitles = 3592;
static const uint16 kForeignrelease = 3593;
static const uint16 kPresslist = 2962;
static const uint16 kSavenames = 2968;
static const uint16 kSavefiles = 3087;
static const uint16 kRecname = 3178;
static const uint16 kQuitrequested = 3191;
static const uint16 kSubtitles = 3192;
static const uint16 kForeignrelease = 3193;
static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0);
Expand Down
3 changes: 3 additions & 0 deletions engines/dreamweb/dreamweb.h
Expand Up @@ -46,6 +46,9 @@ namespace DreamGen {
const uint16 addr_backobject = 0xc170;
const uint16 addr_mainman = 0xc138;

// Output of Bresenham
extern Common::Point g_lineData[200];

}

namespace DreamWeb {
Expand Down
48 changes: 24 additions & 24 deletions engines/dreamweb/pathfind.cpp
Expand Up @@ -24,6 +24,10 @@

namespace DreamGen {

// Output of Bresenham
Common::Point g_lineData[200];

This comment has been minimized.

Copy link
@fingolfin

fingolfin Dec 4, 2011

Contributor

engines/dreamweb/pathfind.cpp:28: warning: ‘DreamGen::g_lineData’ requires global construction

This should be put into a class (member).



void DreamGenContext::turnPathOn() {
turnPathOn(al);
}
Expand Down Expand Up @@ -131,7 +135,7 @@ bool DreamGenContext::checkIfPathIsOn(uint8 index) {

void DreamGenContext::bresenhams() {
workoutFrames();
int8 *lineData = (int8 *)data.ptr(kLinedata, 0);
Common::Point *lineData = &g_lineData[0];
int16 startX = (int16)data.word(kLinestartx);
int16 startY = (int16)data.word(kLinestarty);
int16 endX = (int16)data.word(kLineendx);
Expand All @@ -152,13 +156,12 @@ void DreamGenContext::bresenhams() {
++deltaY;
int8 x = (int8)startX;
data.byte(kLinelength) = deltaY;
do {
lineData[0] = x;
lineData[1] = y;
lineData += 2;
for (; deltaY; --deltaY) {
lineData->x = x;
lineData->y = y;
++lineData;
++y;
--deltaY;
} while (deltaY);
}
return;
}
uint16 deltaX;
Expand All @@ -182,13 +185,12 @@ void DreamGenContext::bresenhams() {
int8 y = (int8)startY;
++deltaX;
data.byte(kLinelength) = deltaX;
do {
lineData[0] = x;
lineData[1] = y;
lineData += 2;
for (; deltaX; --deltaX) {
lineData->x = x;
lineData->y = y;
++lineData;
++x;
--deltaX;
} while (deltaX);
}
return;
}
uint16 deltaY;
Expand Down Expand Up @@ -219,32 +221,30 @@ void DreamGenContext::bresenhams() {
int8 y = (int8)startY;
data.byte(kLinelength) = delta1;
if (data.byte(kLineroutine) != 1) {
do {
lineData[0] = x;
lineData[1] = y;
lineData += 2;
for (; delta1; --delta1) {
lineData->x = x;
lineData->y = y;
++lineData;
++x;
if (remainder < 0) {
remainder += data.word(kIncrement1);
} else {
remainder += data.word(kIncrement2);
y += increment;
}
--delta1;
} while (delta1);
}
} else {
do {
lineData[0] = x;
lineData[1] = y;
lineData += 2;
for (; delta1; --delta1) {
lineData->x = x;
lineData->y = y;
++lineData;
y += increment;
if (remainder < 0) {
remainder += data.word(kIncrement1);
} else {
remainder += data.word(kIncrement2);
++x;
}
--delta1;
} while (delta1);

This comment has been minimized.

Copy link
@fingolfin

fingolfin Dec 4, 2011

Contributor

Did you really want to make a
for (...) { ... } while (...)
loop here? :) My compiler complaints about this (I assume the 'while' should be removed)

}
}
Expand Down
4 changes: 2 additions & 2 deletions engines/dreamweb/sprite.cpp
Expand Up @@ -196,8 +196,8 @@ void DreamGenContext::walking(Sprite *sprite) {
comp = data.byte(kLinelength);
}
if (data.byte(kLinepointer) < comp) {
sprite->x = data.byte(kLinedata + data.byte(kLinepointer) * 2 + 0);
sprite->y = data.byte(kLinedata + data.byte(kLinepointer) * 2 + 1);
sprite->x = (uint8)g_lineData[data.byte(kLinepointer)].x;
sprite->y = (uint8)g_lineData[data.byte(kLinepointer)].y;
return;
}

Expand Down

0 comments on commit 0336c67

Please sign in to comment.