diff options
Diffstat (limited to 'engines/cge2')
-rw-r--r-- | engines/cge2/bitmap.h | 1 | ||||
-rw-r--r-- | engines/cge2/cge2.cpp | 1 | ||||
-rw-r--r-- | engines/cge2/cge2_main.h | 3 | ||||
-rw-r--r-- | engines/cge2/general.h | 52 | ||||
-rw-r--r-- | engines/cge2/snail.h | 3 | ||||
-rw-r--r-- | engines/cge2/vga13h.cpp | 4 | ||||
-rw-r--r-- | engines/cge2/vga13h.h | 49 |
7 files changed, 58 insertions, 55 deletions
diff --git a/engines/cge2/bitmap.h b/engines/cge2/bitmap.h index 07f83b8045..e5f38a05d7 100644 --- a/engines/cge2/bitmap.h +++ b/engines/cge2/bitmap.h @@ -35,6 +35,7 @@ namespace CGE2 { class CGE2Engine; class EncryptedStream; +class V2D; #define kMaxPath 128 enum { diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index 18016ec561..88fdfbb74d 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -37,6 +37,7 @@ #include "cge2/spare.h" #include "cge2/events.h" #include "cge2/talk.h" +#include "cge2/cge2_main.h" namespace CGE2 { diff --git a/engines/cge2/cge2_main.h b/engines/cge2/cge2_main.h index 7146e43115..a37370546b 100644 --- a/engines/cge2/cge2_main.h +++ b/engines/cge2/cge2_main.h @@ -28,11 +28,12 @@ #ifndef CGE2_MAIN_H #define CGE2_MAIN_H +#include "cge2/events.h" + namespace CGE2 { #define kLineMax 512 #define kIntroExt ".I80" -#define kNoByte -1 // Recheck this! We have no proof for it's original value. #define kTabName "CGE.TAB" #define kInfoW 140 #define kPocketFull 170 diff --git a/engines/cge2/general.h b/engines/cge2/general.h index bd145e1731..0239402ea3 100644 --- a/engines/cge2/general.h +++ b/engines/cge2/general.h @@ -29,67 +29,19 @@ #define CGE2_GENERAL_H #include "common/file.h" -#include "common/rect.h" -#include "cge2/fileio.h" -#include "cge2/cge2.h" namespace CGE2 { #define SCR_WID_ 320 +class CGE2Engine; + struct Dac { uint8 _r; uint8 _g; uint8 _b; }; -// From CGETYPE.H: -class V3D { -public: - double _x, _y, _z; - V3D(void) { } - V3D(double x, double y, double z = 0) : _x(x), _y(y), _z(z) { } - V3D(const V3D &p) : _x(p._x), _y(p._y), _z(p._z) { } - V3D operator+(const V3D &p) const { return V3D(_x + p._x, _y + p._y, _z + p._z); } - V3D operator-(const V3D &p) const { return V3D(_x - p._x, _y - p._y, _z - p._z); } - V3D operator*(long n) const { return V3D(_x * n, _y * n, _z * n); } - V3D operator/ (long n) const { return V3D(_x / n, _y / n, _z / n); } - bool operator==(V3D &p) const { return _x == p._x && _y == p._y && _z == p._z; } - bool operator!=(V3D &p) const { return _x != p._x || _y != p._y || _z != p._z; } - V3D& operator+=(const V3D &x) { return *this = *this + x; } - V3D& operator-=(const V3D &x) { return *this = *this - x; } -}; - -class V2D : public Common::Point { - CGE2Engine *_vm; -public: - V2D& operator=(const V3D &p3) { - double m = _vm->_eye->_z / (p3._z - _vm->_eye->_z); - x = round((_vm->_eye->_x + (_vm->_eye->_x - p3._x) * m)); - y = round((_vm->_eye->_y + (_vm->_eye->_y - p3._y) * m)); - return *this; - } - V2D(CGE2Engine *vm) : _vm(vm) { } - V2D(CGE2Engine *vm, const V3D &p3) : _vm(vm) { *this = p3; } - V2D(CGE2Engine *vm, int x, int y) : _vm(vm), Common::Point(x, y) { } - bool operator<(const V2D &p) const { return (x < p.x) && (y < p.y); } - bool operator<=(const V2D &p) const { return (x <= p.x) && (y <= p.y); } - bool operator>(const V2D &p) const { return (x > p.x) && (y > p.y); } - bool operator>=(const V2D &p) const { return (x >= p.x) && (y >= p.y); } - V2D operator+(const V2D &p) const { return V2D(_vm, x + p.x, y + p.y); } - V2D operator-(const V2D &p) const { return V2D(_vm, x - p.x, y - p.y); } - uint16 area(void) { return x * y; } - bool limited(const V2D &p) { - return (uint16(x) < uint16(p.x)) && (uint16(y) < uint16(p.y)); - } - V2D scale(int z) { - double m = _vm->_eye->_z / (_vm->_eye->_z - z); - return V2D(_vm, trunc(m * x), trunc(m * y)); - } - static double trunc(double d) { return (d > 0) ? floor(d) : ceil(d); } - static double round(double number) { return number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5); } -}; - } // End of namespace CGE2 #endif // CGE2_GENERAL_H diff --git a/engines/cge2/snail.h b/engines/cge2/snail.h index e3c231596b..afd52dfd45 100644 --- a/engines/cge2/snail.h +++ b/engines/cge2/snail.h @@ -29,12 +29,13 @@ #define CGE2_SNAIL_H #include "cge2/cge2.h" -#include "cge2/cge2_main.h" namespace CGE2 { #define kCommandFrameRate 80 #define kCommandFrameDelay (1000 / kCommandFrameRate) +#define kNoByte -1 // Recheck this! We have no proof for it's original value. + enum CommandType { kCmdCom0 = 128, diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 14bf97bbc4..bbfd6c471c 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -32,8 +32,8 @@ #include "cge2/general.h" #include "cge2/vga13h.h" #include "cge2/bitmap.h" -//#include "cge/text.h" -//#include "cge/cge_main.h" +#include "cge2/text.h" +#include "cge2/cge2_main.h" #include "cge2/cge2.h" #include "cge2/vga13h.h" diff --git a/engines/cge2/vga13h.h b/engines/cge2/vga13h.h index 77a2fd35be..20d97ee4eb 100644 --- a/engines/cge2/vga13h.h +++ b/engines/cge2/vga13h.h @@ -34,8 +34,8 @@ #include "cge2/general.h" #include "cge2/bitmap.h" #include "cge2/snail.h" -#include "cge2/cge2.h" #include "cge2/spare.h" +#include "cge2/cge2.h" namespace CGE2 { @@ -51,6 +51,53 @@ namespace CGE2 { #define kPalCount 256 #define kPalSize (kPalCount * 3) +// From CGETYPE.H: +class V3D { +public: + double _x, _y, _z; + V3D(void) { } + V3D(double x, double y, double z = 0) : _x(x), _y(y), _z(z) { } + V3D(const V3D &p) : _x(p._x), _y(p._y), _z(p._z) { } + V3D operator+(const V3D &p) const { return V3D(_x + p._x, _y + p._y, _z + p._z); } + V3D operator-(const V3D &p) const { return V3D(_x - p._x, _y - p._y, _z - p._z); } + V3D operator*(long n) const { return V3D(_x * n, _y * n, _z * n); } + V3D operator/ (long n) const { return V3D(_x / n, _y / n, _z / n); } + bool operator==(V3D &p) const { return _x == p._x && _y == p._y && _z == p._z; } + bool operator!=(V3D &p) const { return _x != p._x || _y != p._y || _z != p._z; } + V3D& operator+=(const V3D &x) { return *this = *this + x; } + V3D& operator-=(const V3D &x) { return *this = *this - x; } +}; + +class V2D : public Common::Point { + CGE2Engine *_vm; +public: + V2D& operator=(const V3D &p3) { + double m = _vm->_eye->_z / (p3._z - _vm->_eye->_z); + x = round((_vm->_eye->_x + (_vm->_eye->_x - p3._x) * m)); + y = round((_vm->_eye->_y + (_vm->_eye->_y - p3._y) * m)); + return *this; + } + V2D(CGE2Engine *vm) : _vm(vm) { } + V2D(CGE2Engine *vm, const V3D &p3) : _vm(vm) { *this = p3; } + V2D(CGE2Engine *vm, int x, int y) : _vm(vm), Common::Point(x, y) { } + bool operator<(const V2D &p) const { return (x < p.x) && (y < p.y); } + bool operator<=(const V2D &p) const { return (x <= p.x) && (y <= p.y); } + bool operator>(const V2D &p) const { return (x > p.x) && (y > p.y); } + bool operator>=(const V2D &p) const { return (x >= p.x) && (y >= p.y); } + V2D operator+(const V2D &p) const { return V2D(_vm, x + p.x, y + p.y); } + V2D operator-(const V2D &p) const { return V2D(_vm, x - p.x, y - p.y); } + uint16 area(void) { return x * y; } + bool limited(const V2D &p) { + return (uint16(x) < uint16(p.x)) && (uint16(y) < uint16(p.y)); + } + V2D scale(int z) { + double m = _vm->_eye->_z / (_vm->_eye->_z - z); + return V2D(_vm, trunc(m * x), trunc(m * y)); + } + static double trunc(double d) { return (d > 0) ? floor(d) : ceil(d); } + static double round(double number) { return number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5); } +}; + struct Seq { uint8 _now; uint8 _next; |