From c57991ddfa3532fe02d212f20aa583f9a6c60d62 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Jun 2014 19:47:37 +0200 Subject: CGE: Use booleans instead of uint16 in flag structure --- engines/cge/vga13h.cpp | 64 +++++++++++++++++++++++++------------------------- engines/cge/vga13h.h | 32 ++++++++++++------------- 2 files changed, 48 insertions(+), 48 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index d7dccd2c65..babcb7e667 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -482,39 +482,39 @@ void Sprite::sync(Common::Serializer &s) { uint16 flags = 0; if (s.isLoading()) { s.syncAsUint16LE(flags); - _flags._hide = flags & 0x0001 ? true : false; - _flags._near = flags & 0x0002 ? true : false; - _flags._drag = flags & 0x0004 ? true : false; - _flags._hold = flags & 0x0008 ? true : false; - _flags._dummy = flags & 0x0010 ? true : false; - _flags._slav = flags & 0x0020 ? true : false; - _flags._syst = flags & 0x0040 ? true : false; - _flags._kill = flags & 0x0080 ? true : false; - _flags._xlat = flags & 0x0100 ? true : false; - _flags._port = flags & 0x0200 ? true : false; - _flags._kept = flags & 0x0400 ? true : false; - _flags._east = flags & 0x0800 ? true : false; - _flags._shad = flags & 0x1000 ? true : false; - _flags._back = flags & 0x2000 ? true : false; - _flags._bDel = flags & 0x4000 ? true : false; - _flags._tran = flags & 0x8000 ? true : false; + _flags._hide = flags & 0x0001; + _flags._near = flags & 0x0002; + _flags._drag = flags & 0x0004; + _flags._hold = flags & 0x0008; + _flags._dummy = flags & 0x0010; + _flags._slav = flags & 0x0020; + _flags._syst = flags & 0x0040; + _flags._kill = flags & 0x0080; + _flags._xlat = flags & 0x0100; + _flags._port = flags & 0x0200; + _flags._kept = flags & 0x0400; + _flags._east = flags & 0x0800; + _flags._shad = flags & 0x1000; + _flags._back = flags & 0x2000; + _flags._bDel = flags & 0x4000; + _flags._tran = flags & 0x8000; } else { - flags = (flags << 1) | _flags._tran; - flags = (flags << 1) | _flags._bDel; - flags = (flags << 1) | _flags._back; - flags = (flags << 1) | _flags._shad; - flags = (flags << 1) | _flags._east; - flags = (flags << 1) | _flags._kept; - flags = (flags << 1) | _flags._port; - flags = (flags << 1) | _flags._xlat; - flags = (flags << 1) | _flags._kill; - flags = (flags << 1) | _flags._syst; - flags = (flags << 1) | _flags._slav; - flags = (flags << 1) | _flags._dummy; - flags = (flags << 1) | _flags._hold; - flags = (flags << 1) | _flags._drag; - flags = (flags << 1) | _flags._near; - flags = (flags << 1) | _flags._hide; + flags = (flags << 1) | (_flags._tran ? 1 : 0); + flags = (flags << 1) | (_flags._bDel ? 1 : 0); + flags = (flags << 1) | (_flags._back ? 1 : 0); + flags = (flags << 1) | (_flags._shad ? 1 : 0); + flags = (flags << 1) | (_flags._east ? 1 : 0); + flags = (flags << 1) | (_flags._kept ? 1 : 0); + flags = (flags << 1) | (_flags._port ? 1 : 0); + flags = (flags << 1) | (_flags._xlat ? 1 : 0); + flags = (flags << 1) | (_flags._kill ? 1 : 0); + flags = (flags << 1) | (_flags._syst ? 1 : 0); + flags = (flags << 1) | (_flags._slav ? 1 : 0); + flags = (flags << 1) | (_flags._dummy ? 1 : 0); + flags = (flags << 1) | (_flags._hold ? 1 : 0); + flags = (flags << 1) | (_flags._drag ? 1 : 0); + flags = (flags << 1) | (_flags._near ? 1 : 0); + flags = (flags << 1) | (_flags._hide ? 1 : 0); s.syncAsUint16LE(flags); } diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index 9511559df0..cc56eebdac 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -88,22 +88,22 @@ public: int _ref; signed char _scene; struct Flags { - uint16 _hide : 1; // general visibility switch - uint16 _near : 1; // Near action lock - uint16 _drag : 1; // sprite is moveable - uint16 _hold : 1; // sprite is held with mouse - uint16 _dummy : 1; // intrrupt driven animation - uint16 _slav : 1; // slave object - uint16 _syst : 1; // system object - uint16 _kill : 1; // dispose memory after remove - uint16 _xlat : 1; // 2nd way display: xlat table - uint16 _port : 1; // portable - uint16 _kept : 1; // kept in pocket - uint16 _east : 1; // talk to east (in opposite to west) - uint16 _shad : 1; // shadow - uint16 _back : 1; // 'send to background' request - uint16 _bDel : 1; // delete bitmaps in ~SPRITE - uint16 _tran : 1; // transparent (untouchable) + bool _hide : true; // general visibility switch + bool _near : true; // Near action lock + bool _drag : true; // sprite is moveable + bool _hold : true; // sprite is held with mouse + bool _dummy : true; // intrrupt driven animation + bool _slav : true; // slave object + bool _syst : true; // system object + bool _kill : true; // dispose memory after remove + bool _xlat : true; // 2nd way display: xlat table + bool _port : true; // portable + bool _kept : true; // kept in pocket + bool _east : true; // talk to east (in opposite to west) + bool _shad : true; // shadow + bool _back : true; // 'send to background' request + bool _bDel : true; // delete bitmaps in ~SPRITE + bool _tran : true; // transparent (untouchable) } _flags; int _x; int _y; -- cgit v1.2.3