From a3c8c1334ba5c948912e35ca8bdc30d479190df0 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 4 Aug 2011 11:03:08 +0200 Subject: DREAMWEB: Helper function to acquire a temporary segment ref to avoid ds and es pollution --- engines/dreamweb/runtime.h | 6 ++++++ engines/dreamweb/sprite.cpp | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'engines/dreamweb') diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index 714a8d5850..ba16f03d1c 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -287,6 +287,12 @@ public: _freeSegments.push_back(id); } + SegmentRef segRef(uint16 seg) { + SegmentRef result(this); + result = seg; + return result; + } + inline void _cmp(uint8 a, uint8 b) { _sub(a, b); } diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 00cbd2c4dc..8cf0da1de7 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -580,8 +580,7 @@ void DreamGenContext::showrain() { si = 6*58; ax = ds.word(si+2); si = ax + 2080; - es = data.word(kBuffers); - Rain *rain = (Rain *)es.ptr(kRainlist, 0); + Rain *rain = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0); if (rain->x == 255) return; while (true) { -- cgit v1.2.3