From 4e420ef6fcc7b2d13f74704a14fe97ef9dc7fdee Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Mon, 29 Nov 2010 20:50:11 +0000 Subject: MOHAWK: Keep resource type around svn-id: r54595 --- engines/mohawk/myst.cpp | 32 +++++++++++++++++++++++--------- engines/mohawk/myst.h | 1 + 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index d8460e6201..3bd909938f 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -890,6 +890,7 @@ void MohawkEngine_Myst::drawResourceImages() { } static MystResource *loadResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) { + MystResource *resource = 0; uint16 type = rlstStream->readUint16LE(); debugC(kDebugResource, "\tType: %d", type); @@ -902,26 +903,39 @@ static MystResource *loadResource(MohawkEngine_Myst *vm, Common::SeekableReadStr case kMystDownResource: case kMystUpResource: case 14: // TODO: kMystBackwardResource? - return new MystResource(vm, rlstStream, parent); + resource = new MystResource(vm, rlstStream, parent); + break; case kMystActionResource: - return new MystResourceType5(vm, rlstStream, parent); + resource = new MystResourceType5(vm, rlstStream, parent); + break; case kMystVideoResource: - return new MystResourceType6(vm, rlstStream, parent); + resource = new MystResourceType6(vm, rlstStream, parent); + break; case kMystSwitchResource: - return new MystResourceType7(vm, rlstStream, parent); + resource = new MystResourceType7(vm, rlstStream, parent); + break; case 8: - return new MystResourceType8(vm, rlstStream, parent); + resource = new MystResourceType8(vm, rlstStream, parent); + break; case 10: - return new MystResourceType10(vm, rlstStream, parent); + resource = new MystResourceType10(vm, rlstStream, parent); + break; case 11: - return new MystResourceType11(vm, rlstStream, parent); + resource = new MystResourceType11(vm, rlstStream, parent); + break; case 12: - return new MystResourceType12(vm, rlstStream, parent); + resource = new MystResourceType12(vm, rlstStream, parent); + break; case 13: - return new MystResourceType13(vm, rlstStream, parent); + resource = new MystResourceType13(vm, rlstStream, parent); + break; default: error ("Unknown/Unhandled MystResource type %d", type); } + + resource->type = type; + + return resource; } void MohawkEngine_Myst::loadResources() { diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index fcd9e709a3..a2852f191d 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -154,6 +154,7 @@ public: virtual ~MystResource(); MystResource *_parent; + uint16 type; bool contains(Common::Point point) { return _rect.contains(point); } virtual void drawDataToScreen() {} -- cgit v1.2.3