From e31ad4d665e6987168f5b882e6d4b5115bc4ac70 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Tue, 23 Aug 2011 14:41:28 +0200 Subject: DREAMWEB: Renamed FreeObject to DynObject and ObjData to SetObject --- engines/dreamweb/backdrop.cpp | 4 ++-- engines/dreamweb/sprite.cpp | 20 ++++++++++---------- engines/dreamweb/structs.h | 13 +++++-------- engines/dreamweb/stubs.cpp | 30 ++++++++++++++---------------- engines/dreamweb/stubs.h | 24 ++++++++++++------------ 5 files changed, 43 insertions(+), 48 deletions(-) diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index cba1f14c5e..6243cee32f 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -150,9 +150,9 @@ void DreamGenContext::showallobs() { data.word(kFramesad) = kFrames; const Frame *frames = (const Frame *)segRef(data.word(kFrsegment)).ptr(0, 0); - ObjData *setEntries = (ObjData *)segRef(data.word(kSetdat)).ptr(0, 128 * sizeof(ObjData)); + SetObject *setEntries = (SetObject *)segRef(data.word(kSetdat)).ptr(0, 128 * sizeof(SetObject)); for (size_t i = 0; i < 128; ++i) { - ObjData *setEntry = setEntries + i; + SetObject *setEntry = setEntries + i; if (getmapad(setEntry->b58) == 0) continue; uint8 currentFrame = setEntry->b18[0]; diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index e9a40d7f8c..17d4ddbbed 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -267,7 +267,7 @@ void DreamGenContext::backobject() { } void DreamGenContext::backobject(Sprite *sprite) { - ObjData *objData = (ObjData *)segRef(data.word(kSetdat)).ptr(sprite->objData(), 0); + SetObject *objData = (SetObject *)segRef(data.word(kSetdat)).ptr(sprite->objData(), 0); if (sprite->delay != 0) { --sprite->delay; @@ -291,7 +291,7 @@ void DreamGenContext::backobject(Sprite *sprite) { steady(sprite, objData); } -void DreamGenContext::constant(Sprite *sprite, ObjData *objData) { +void DreamGenContext::constant(Sprite *sprite, SetObject *objData) { ++sprite->frame; if (objData->b18[sprite->frame] == 255) { sprite->frame = 0; @@ -301,13 +301,13 @@ void DreamGenContext::constant(Sprite *sprite, ObjData *objData) { sprite->b15 = b18; } -void DreamGenContext::random(Sprite *sprite, ObjData *objData) { +void DreamGenContext::random(Sprite *sprite, SetObject *objData) { randomnum1(); uint16 r = ax; sprite->b15 = objData->b18[r&7]; } -void DreamGenContext::doorway(Sprite *sprite, ObjData *objData) { +void DreamGenContext::doorway(Sprite *sprite, SetObject *objData) { data.byte(kDoorcheck1) = -24; data.byte(kDoorcheck2) = 10; data.byte(kDoorcheck3) = -30; @@ -315,7 +315,7 @@ void DreamGenContext::doorway(Sprite *sprite, ObjData *objData) { dodoor(sprite, objData); } -void DreamGenContext::widedoor(Sprite *sprite, ObjData *objData) { +void DreamGenContext::widedoor(Sprite *sprite, SetObject *objData) { data.byte(kDoorcheck1) = -24; data.byte(kDoorcheck2) = 24; data.byte(kDoorcheck3) = -30; @@ -325,11 +325,11 @@ void DreamGenContext::widedoor(Sprite *sprite, ObjData *objData) { void DreamGenContext::dodoor() { Sprite *sprite = (Sprite *)es.ptr(bx, sizeof(Sprite)); - ObjData *objData = (ObjData *)ds.ptr(di, 0); + SetObject *objData = (SetObject *)ds.ptr(di, 0); dodoor(sprite, objData); } -void DreamGenContext::dodoor(Sprite *sprite, ObjData *objData) { +void DreamGenContext::dodoor(Sprite *sprite, SetObject *objData) { uint8 ryanx = data.byte(kRyanx); uint8 ryany = data.byte(kRyany); if (ryanx < sprite->x) { @@ -380,13 +380,13 @@ shutdoor: data.byte(kThroughdoor) = 0; } -void DreamGenContext::steady(Sprite *sprite, ObjData *objData) { +void DreamGenContext::steady(Sprite *sprite, SetObject *objData) { uint8 b18 = objData->b18[0]; objData->b17 = b18; sprite->b15 = b18; } -void DreamGenContext::lockeddoorway(Sprite *sprite, ObjData *objData) { +void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) { if (data.byte(kRyanx) < sprite->x) { if (sprite->x - data.byte(kRyanx) > 24) goto shutdoor2; @@ -450,7 +450,7 @@ shutdoor2: } } -void DreamGenContext::liftsprite(Sprite *sprite, ObjData *objData) { +void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) { uint8 liftFlag = data.byte(kLiftflag); if (liftFlag == 0) { //liftclosed turnpathoffCPP(data.byte(kLiftpath)); diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 7e77bdf0e9..fe908f5857 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -54,7 +54,7 @@ struct Sprite { uint8 hidden; }; -struct ObjData { +struct SetObject { uint8 b0; uint8 b1; uint8 b2; @@ -102,9 +102,9 @@ struct ObjData { uint8 b63; }; -struct FreeObject { +struct DynObject { uint8 b0; - uint8 b1; + uint8 index; uint8 b2; uint8 b3; uint8 b4; @@ -114,11 +114,8 @@ struct FreeObject { uint8 b8; uint8 b9; uint8 b10; - uint8 b11; - uint8 b12; - uint8 b13; - uint8 b14; - uint8 b15; + uint8 location; + uint8 id[4]; }; struct ObjPos { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index b6cc25f78f..0afa755d66 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -667,7 +667,7 @@ void DreamGenContext::cancelch1() { engine->stopSound(1); } -void DreamGenContext::makebackob(ObjData *objData) { +void DreamGenContext::makebackob(SetObject *objData) { if (data.byte(kNewobs) == 0) return; uint8 priority = objData->priority; @@ -675,8 +675,8 @@ void DreamGenContext::makebackob(ObjData *objData) { Sprite *sprite = makesprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0); uint16 objDataOffset = (uint8 *)objData - segRef(data.word(kSetdat)).ptr(0, 0); - assert(objDataOffset % sizeof(ObjData) == 0); - assert(objDataOffset < 128 * sizeof(ObjData)); + assert(objDataOffset % sizeof(SetObject) == 0); + assert(objDataOffset < 128 * sizeof(SetObject)); sprite->setObjData(objDataOffset); if (priority == 255) priority = 0; @@ -1093,16 +1093,16 @@ void DreamGenContext::setallchanges() { } } -FreeObject *DreamGenContext::getfreead(uint8 index) { - return (FreeObject *)segRef(data.word(kFreedat)).ptr(0, 0) + index; +DynObject *DreamGenContext::getfreead(uint8 index) { + return (DynObject *)segRef(data.word(kFreedat)).ptr(0, 0) + index; } -FreeObject *DreamGenContext::getexad(uint8 index) { - return (FreeObject *)segRef(data.word(kExtras)).ptr(kExdata, 0) + index; +DynObject *DreamGenContext::getexad(uint8 index) { + return (DynObject *)segRef(data.word(kExtras)).ptr(kExdata, 0) + index; } -ObjData *DreamGenContext::getsetad(uint8 index) { - return (ObjData *)segRef(data.word(kSetdat)).ptr(0, 0) + index; +SetObject *DreamGenContext::getsetad(uint8 index) { + return (SetObject *)segRef(data.word(kSetdat)).ptr(0, 0) + index; } void DreamGenContext::dochange() { @@ -1113,7 +1113,7 @@ void DreamGenContext::dochange(uint8 index, uint8 value, uint8 type) { if (type == 0) { //object getsetad(index)->b58[0] = value; } else if (type == 1) { //freeobject - FreeObject *freeObject = getfreead(index); + DynObject *freeObject = getfreead(index); if (freeObject->b2 == 0xff) freeObject->b2 = value; } else { //path @@ -1124,16 +1124,14 @@ void DreamGenContext::dochange(uint8 index, uint8 value, uint8 type) { } void DreamGenContext::deletetaken() { - ds = data.word(kExtras); - si = kExdata; - FreeObject *freeObjects = (FreeObject *)segRef(data.word(kFreedat)).ptr(0, 0); + const DynObject *extraObjects = (const DynObject *)segRef(data.word(kExtras)).ptr(kExdata, 0); + DynObject *freeObjects = (DynObject *)segRef(data.word(kFreedat)).ptr(0, 0); for(size_t i = 0; i < kNumexobjects; ++i) { - uint8 location = ds.byte(si+11); + uint8 location = extraObjects[i].location; if (location == data.byte(kReallocation)) { - uint8 index = ds.byte(si+1); + uint8 index = extraObjects[i].index; freeObjects[index].b2 = 254; } - si += 16; } } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 8ba1d3d8e4..ed77e26ef2 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -87,15 +87,15 @@ void checkdest(const uint8 *roomsPaths); void aboutturn(Sprite *sprite); void backobject(Sprite *sprite); - void constant(Sprite *sprite, ObjData *objData); - void steady(Sprite *sprite, ObjData *objData); - void random(Sprite *sprite, ObjData *objData); + void constant(Sprite *sprite, SetObject *objData); + void steady(Sprite *sprite, SetObject *objData); + void random(Sprite *sprite, SetObject *objData); void dodoor(); - void dodoor(Sprite *sprite, ObjData *objData); - void doorway(Sprite *sprite, ObjData *objData); - void widedoor(Sprite *sprite, ObjData *objData); - void lockeddoorway(Sprite *sprite, ObjData *objData); - void liftsprite(Sprite *sprite, ObjData *objData); + void dodoor(Sprite *sprite, SetObject *objData); + void doorway(Sprite *sprite, SetObject *objData); + void widedoor(Sprite *sprite, SetObject *objData); + void lockeddoorway(Sprite *sprite, SetObject *objData); + void liftsprite(Sprite *sprite, SetObject *objData); void findsource(); Frame *findsourceCPP(); void showgamereel(); @@ -106,7 +106,7 @@ void turnpathoffCPP(uint8 param); void getroomspaths(); uint8 *getroomspathsCPP(); - void makebackob(ObjData *objData); + void makebackob(SetObject *objData); void modifychar(); void lockmon(); void cancelch0(); @@ -155,9 +155,9 @@ void findxyfrompath(); void findormake(); void findormake(uint8 index, uint8 value, uint8 type); - FreeObject *getfreead(uint8 index); - FreeObject *getexad(uint8 index); - ObjData *getsetad(uint8 index); + DynObject *getfreead(uint8 index); + DynObject *getexad(uint8 index); + SetObject *getsetad(uint8 index); void setallchanges(); void dochange(); void dochange(uint8 index, uint8 value, uint8 type); -- cgit v1.2.3