DREAMWEB: Move Bresenham output out of data segment

This commit is contained in:
Willem Jan Palenstijn 2011-12-03 20:29:50 +01:00
parent 29b1f9f517
commit 0336c67bfd
6 changed files with 53 additions and 100 deletions

View file

@ -35,6 +35,7 @@ p = parser(skip_binary_data = [
'stak', 'stak',
'keyconverttab', 'keyconverttab',
'atmospherelist', 'atmospherelist',
'linedata',
# keypad.asm # keypad.asm
'keypadlist', 'keypadlist',
'symbollist', 'symbollist',

View file

@ -9844,7 +9844,7 @@ void DreamGenContext::getNamePos() {
_mul(cx); _mul(cx);
dx = data; dx = data;
es = dx; es = dx;
bx = 3368; bx = 2968;
_add(bx, ax); _add(bx, ax);
al = data.byte(kCursorpos); al = data.byte(kCursorpos);
ah = 0; ah = 0;
@ -9998,7 +9998,7 @@ void DreamGenContext::showNames() {
STACK_CHECK; STACK_CHECK;
dx = data; dx = data;
es = dx; es = dx;
si = 3368+1; si = 2968+1;
di = (60)+21; di = (60)+21;
bx = (52)+10; bx = (52)+10;
cl = 0; cl = 0;
@ -11670,84 +11670,34 @@ void DreamGenContext::__start() {
//0x0b70: .... .... .... .... //0x0b70: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0b80: .... .... .... .... //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: .... .... .... .... //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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, }; 0x45, 0x42, 0x2e, 0x44, 0x45, 0x4d, 0x00, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src)); ds.assign(src, src + sizeof(src));
dreamweb(); dreamweb();

View file

@ -509,14 +509,13 @@ public:
static const uint16 kRoompics = 2816; static const uint16 kRoompics = 2816;
static const uint16 kOplist = 2831; static const uint16 kOplist = 2831;
static const uint16 kInputline = 2834; static const uint16 kInputline = 2834;
static const uint16 kLinedata = 2962; static const uint16 kPresslist = 2962;
static const uint16 kPresslist = 3362; static const uint16 kSavenames = 2968;
static const uint16 kSavenames = 3368; static const uint16 kSavefiles = 3087;
static const uint16 kSavefiles = 3487; static const uint16 kRecname = 3178;
static const uint16 kRecname = 3578; static const uint16 kQuitrequested = 3191;
static const uint16 kQuitrequested = 3591; static const uint16 kSubtitles = 3192;
static const uint16 kSubtitles = 3592; static const uint16 kForeignrelease = 3193;
static const uint16 kForeignrelease = 3593;
static const uint16 kBlocktextdat = (0); static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0); static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0); static const uint16 kDebuglevel1 = (0);

View file

@ -46,6 +46,9 @@ namespace DreamGen {
const uint16 addr_backobject = 0xc170; const uint16 addr_backobject = 0xc170;
const uint16 addr_mainman = 0xc138; const uint16 addr_mainman = 0xc138;
// Output of Bresenham
extern Common::Point g_lineData[200];
} }
namespace DreamWeb { namespace DreamWeb {

View file

@ -24,6 +24,10 @@
namespace DreamGen { namespace DreamGen {
// Output of Bresenham
Common::Point g_lineData[200];
void DreamGenContext::turnPathOn() { void DreamGenContext::turnPathOn() {
turnPathOn(al); turnPathOn(al);
} }
@ -131,7 +135,7 @@ bool DreamGenContext::checkIfPathIsOn(uint8 index) {
void DreamGenContext::bresenhams() { void DreamGenContext::bresenhams() {
workoutFrames(); workoutFrames();
int8 *lineData = (int8 *)data.ptr(kLinedata, 0); Common::Point *lineData = &g_lineData[0];
int16 startX = (int16)data.word(kLinestartx); int16 startX = (int16)data.word(kLinestartx);
int16 startY = (int16)data.word(kLinestarty); int16 startY = (int16)data.word(kLinestarty);
int16 endX = (int16)data.word(kLineendx); int16 endX = (int16)data.word(kLineendx);
@ -152,13 +156,12 @@ void DreamGenContext::bresenhams() {
++deltaY; ++deltaY;
int8 x = (int8)startX; int8 x = (int8)startX;
data.byte(kLinelength) = deltaY; data.byte(kLinelength) = deltaY;
do { for (; deltaY; --deltaY) {
lineData[0] = x; lineData->x = x;
lineData[1] = y; lineData->y = y;
lineData += 2; ++lineData;
++y; ++y;
--deltaY; }
} while (deltaY);
return; return;
} }
uint16 deltaX; uint16 deltaX;
@ -182,13 +185,12 @@ void DreamGenContext::bresenhams() {
int8 y = (int8)startY; int8 y = (int8)startY;
++deltaX; ++deltaX;
data.byte(kLinelength) = deltaX; data.byte(kLinelength) = deltaX;
do { for (; deltaX; --deltaX) {
lineData[0] = x; lineData->x = x;
lineData[1] = y; lineData->y = y;
lineData += 2; ++lineData;
++x; ++x;
--deltaX; }
} while (deltaX);
return; return;
} }
uint16 deltaY; uint16 deltaY;
@ -219,10 +221,10 @@ void DreamGenContext::bresenhams() {
int8 y = (int8)startY; int8 y = (int8)startY;
data.byte(kLinelength) = delta1; data.byte(kLinelength) = delta1;
if (data.byte(kLineroutine) != 1) { if (data.byte(kLineroutine) != 1) {
do { for (; delta1; --delta1) {
lineData[0] = x; lineData->x = x;
lineData[1] = y; lineData->y = y;
lineData += 2; ++lineData;
++x; ++x;
if (remainder < 0) { if (remainder < 0) {
remainder += data.word(kIncrement1); remainder += data.word(kIncrement1);
@ -230,13 +232,12 @@ void DreamGenContext::bresenhams() {
remainder += data.word(kIncrement2); remainder += data.word(kIncrement2);
y += increment; y += increment;
} }
--delta1; }
} while (delta1);
} else { } else {
do { for (; delta1; --delta1) {
lineData[0] = x; lineData->x = x;
lineData[1] = y; lineData->y = y;
lineData += 2; ++lineData;
y += increment; y += increment;
if (remainder < 0) { if (remainder < 0) {
remainder += data.word(kIncrement1); remainder += data.word(kIncrement1);
@ -244,7 +245,6 @@ void DreamGenContext::bresenhams() {
remainder += data.word(kIncrement2); remainder += data.word(kIncrement2);
++x; ++x;
} }
--delta1;
} while (delta1); } while (delta1);
} }
} }

View file

@ -196,8 +196,8 @@ void DreamGenContext::walking(Sprite *sprite) {
comp = data.byte(kLinelength); comp = data.byte(kLinelength);
} }
if (data.byte(kLinepointer) < comp) { if (data.byte(kLinepointer) < comp) {
sprite->x = data.byte(kLinedata + data.byte(kLinepointer) * 2 + 0); sprite->x = (uint8)g_lineData[data.byte(kLinepointer)].x;
sprite->y = data.byte(kLinedata + data.byte(kLinepointer) * 2 + 1); sprite->y = (uint8)g_lineData[data.byte(kLinepointer)].y;
return; return;
} }