DREAMWEB: 'addpeoplelist' takes a ReelRoutine* param

This commit is contained in:
Bertrand Augereau 2011-08-29 14:55:57 +02:00
parent 3d85a4974b
commit 14ac4efa09
4 changed files with 16 additions and 9 deletions

View File

@ -890,10 +890,16 @@ void DreamGenContext::checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uin
}
void DreamGenContext::addtopeoplelist() {
addtopeoplelist((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
}
void DreamGenContext::addtopeoplelist(ReelRoutine *routine) {
uint16 routinePointer = (const uint8 *)routine - cs.ptr(0, 0);
People *people = (People *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(People));
people->setW0(es.word(bx+3));
people->setW2(bx);
people->b4 = es.byte(bx+7);
people->setReelPointer(routine->reelPointer());
people->setRoutinePointer(routinePointer);
people->b4 = routine->b7;
data.word(kListpos) += sizeof(People);
}

View File

@ -178,12 +178,12 @@ struct ReelRoutine {
struct People {
uint8 b0;
uint8 b1;
uint16 w0() const { return READ_LE_UINT16(&b0); }
void setW0(uint16 v) { WRITE_LE_UINT16(&b0, v); }
uint16 reelPointer() const { return READ_LE_UINT16(&b0); }
void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b0, v); }
uint8 b2;
uint8 b3;
uint16 w2() const { return READ_LE_UINT16(&b2); }
void setW2(uint16 v) { WRITE_LE_UINT16(&b2, v); }
uint16 routinePointer() const { return READ_LE_UINT16(&b2); }
void setRoutinePointer(uint16 v) { WRITE_LE_UINT16(&b2, v); }
uint8 b4;
};

View File

@ -985,7 +985,7 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
for (size_t i = 0; i < 12; ++i, ++people) {
if (people->b4 == 255)
continue;
data.word(kReelpointer) = people->w0();
data.word(kReelpointer) = people->reelPointer();
Reel *reel = getreelstart();
if (reel->frame() == 0xffff)
++reel;
@ -1002,7 +1002,7 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
continue;
if (y >= ymax)
continue;
data.word(kPersondata) = people->w2();
data.word(kPersondata) = people->routinePointer();
obname(people->b4, 5);
return true;
}

View File

@ -195,4 +195,5 @@
uint16 waitframes();
void drawflags();
void addtopeoplelist();
void addtopeoplelist(ReelRoutine *routine);