DREAMWEB: Convert clearBuffers, clearChanges

This commit is contained in:
Willem Jan Palenstijn 2011-12-17 22:20:32 +01:00
parent 46caa77164
commit 30089ec315
5 changed files with 39 additions and 69 deletions

View File

@ -305,6 +305,8 @@ generator = cpp(context, "DreamGen", blacklist = [
'checkspeed',
'chewy',
'clearbeforeload',
'clearbuffers',
'clearchanges',
'clearendpal',
'clearpalette',
'clearreels',

View File

@ -390,6 +390,8 @@ public:
void getTime();
void doChange(uint8 index, uint8 value, uint8 type);
bool isRyanHolding(const char *id);
void clearBuffers();
void clearChanges();
// from use.cpp
void placeFreeObject(uint8 index);

View File

@ -2593,73 +2593,6 @@ gotkeyp:
showDiaryPage();
}
void DreamGenContext::clearBuffers() {
STACK_CHECK;
es = data.word(kBuffers);
cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441+68-0)/2;
ax = 0;
di = 0;
_stosw(cx, true);
es = data.word(kExtras);
cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2;
ax = 0x0ffff;
di = 0;
_stosw(cx, true);
es = data.word(kBuffers);
di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64));
ds = cs;
si = 441;
cx = (898-441);
_movsb(cx, true);
es = data.word(kBuffers);
di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441);
ds = cs;
si = 0;
cx = (68-0);
_movsb(cx, true);
clearChanges();
}
void DreamGenContext::clearChanges() {
STACK_CHECK;
es = data.word(kBuffers);
cx = (250)*2;
ax = 0x0ffff;
di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80));
_stosw(cx, true);
ds = data.word(kBuffers);
si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64));
es = cs;
di = 441;
cx = (898-441);
_movsb(cx, true);
ds = data.word(kBuffers);
si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441);
es = cs;
di = 0;
cx = (68-0);
_movsb(cx, true);
data.byte(kExpos) = 0;
data.word(kExframepos) = 0;
data.word(kExtextpos) = 0;
es = data.word(kExtras);
cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2;
ax = 0x0ffff;
di = 0;
_stosw(cx, true);
es = cs;
di = 1120;
al = 1;
_stosb(2);
al = 0;
_stosb();
al = 1;
_stosb();
ax = 0;
cx = 6;
_stosw(cx, true);
}
void DreamGenContext::findPathOfPoint() {
STACK_CHECK;
push(ax);

View File

@ -471,7 +471,6 @@ public:
void fadeDownMon();
void getPersonText();
void clearBuffers();
void getObTextStart();
void checkObjectSize();
void fillOpen();
@ -522,7 +521,6 @@ public:
void searchForString();
void selectOpenOb();
void incRyanPage();
void clearChanges();
void searchForFiles();
void getExAd();
void initialMonCols();

View File

@ -4593,4 +4593,39 @@ void DreamGenContext::showSlots() {
}
}
void DreamBase::clearBuffers() {
memset(getSegment(data.word(kBuffers)).ptr(0, kLengthofbuffer), 0, kLengthofbuffer);
memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra);
// TODO: Remove this line
// (once the ReelRoutines are no longer in the data segment)
memcpy(getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), data.ptr(kReelroutines, kLenofreelrouts), kLenofreelrouts);
memcpy(getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), data.ptr(kStartvars, kLengthofvars), kLengthofvars);
clearChanges();
}
void DreamBase::clearChanges() {
memset(getSegment(data.word(kBuffers)).ptr(kListofchanges, 4*kNumchanges), 0xFF, 4*kNumchanges);
// TODO: Call setupInitialReelRoutines instead
// (once the ReelRoutines are no longer in the data segment)
memcpy(data.ptr(kReelroutines, kLenofreelrouts), getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), kLenofreelrouts);
memcpy(data.ptr(kStartvars, kLengthofvars), getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), kLengthofvars);
data.byte(kExpos) = 0;
data.word(kExframepos) = 0;
data.word(kExtextpos) = 0;
memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra);
const uint8 initialRoomsCanGo[] = { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
memcpy(data.ptr(kRoomscango, 16), initialRoomsCanGo, 16);
}
} // End of namespace DreamGen