aboutsummaryrefslogtreecommitdiff
path: root/engines/cryo
diff options
context:
space:
mode:
authorFilippos Karapetis2017-02-11 21:51:36 +0200
committerFilippos Karapetis2017-02-11 21:51:36 +0200
commite95ed8eb9053d4b772429fec99f05d3fbede1472 (patch)
tree2bec2fccecb2a580f6f2cd71d1e1546362089797 /engines/cryo
parent724730dbcc0c897a2b4a5e4daec3a81865c9aec1 (diff)
downloadscummvm-rg350-e95ed8eb9053d4b772429fec99f05d3fbede1472.tar.gz
scummvm-rg350-e95ed8eb9053d4b772429fec99f05d3fbede1472.tar.bz2
scummvm-rg350-e95ed8eb9053d4b772429fec99f05d3fbede1472.zip
CRYO: Clean up and document some variables
Diffstat (limited to 'engines/cryo')
-rw-r--r--engines/cryo/defs.h4
-rw-r--r--engines/cryo/eden.cpp84
-rw-r--r--engines/cryo/eden.h13
3 files changed, 54 insertions, 47 deletions
diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h
index 7952fef9ac..c69600c5f4 100644
--- a/engines/cryo/defs.h
+++ b/engines/cryo/defs.h
@@ -806,10 +806,6 @@ struct Cube {
Point3D *_vertices;
};
-extern float _translationZ;
-extern float flt_2DF80;
-extern float flt_2DF84;
-
struct XYZ {
signed short x, y, z;
};
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index f1d0f185e7..05dac787cb 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -49,13 +49,10 @@
namespace Cryo {
#define CRYO_DAT_VER 1 // 1 byte
-
-int16 _torchTick = 0;
-int16 _glowIndex = 0;
-int16 _torchCurIndex = 0;
-
-bool _allowDoubled = true;
-int _cursCenter = 11;
+#define Z_RESET -3400
+#define Z_STEP 200
+#define Z_UP 1
+#define Z_DOWN -1
EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
static uint8 statTab2CB1E[8][4] = {
@@ -170,6 +167,14 @@ EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
for (int j = 0; j < 4; j++)
tab_2CB1E[i][j] = statTab2CB1E[i][j];
}
+
+ _translationZ = Z_RESET;
+ _zDirection = Z_UP;
+
+ _torchTick = 0;
+ _glowIndex = 0;
+ _torchCurIndex = 0;
+ _cursCenter = 11;
}
void EdenGame::removeConsole() {
@@ -5875,19 +5880,18 @@ void EdenGame::signon(const char *s) {
void EdenGame::FRDevents() {
_vm->pollEvents();
- if (_allowDoubled) {
+
#if 0 // CLKeyboard_IsScanCodeDown currently always returns false
- if (_vm->isScanCodeDown(0x30)) { //TODO: const
- if (!_keyboardHeld) {
- _doubledScreen = !_doubledScreen;
- _mainView->_doubled = _doubledScreen;
- CLBlitter_FillScreenView(0);
- _keyboardHeld = true;
- }
- } else
+ if (_vm->isScanCodeDown(0x30)) { //TODO: const
+ if (!_keyboardHeld) {
+ _doubledScreen = !_doubledScreen;
+ _mainView->_doubled = _doubledScreen;
+ CLBlitter_FillScreenView(0);
+ _keyboardHeld = true;
+ }
+ } else
#endif
- _keyboardHeld = false;
- }
+ _keyboardHeld = false;
int16 mouseY;
int16 mouseX;
@@ -6361,19 +6365,19 @@ void EdenGame::showMovie(char arg1) {
CLBlitter_CopyView2Screen(_hnmView);
assert(_vm->_screenView->_pitch == 320);
_vm->pollEvents();
- if (_allowDoubled) {
+
#if 0 // CLKeyboard_IsScanCodeDown currently always returns false
- if (_vm->isScanCodeDown(0x30)) { //TODO: const
- if (!_keyboardHeld) {
- _doubledScreen = !_doubledScreen;
- _hnmView->_doubled = _doubledScreen; //TODO: but mainview ?
- CLBlitter_FillScreenView(0);
- _keyboardHeld = true;
- }
- } else
+ if (_vm->isScanCodeDown(0x30)) { //TODO: const
+ if (!_keyboardHeld) {
+ _doubledScreen = !_doubledScreen;
+ _hnmView->_doubled = _doubledScreen; //TODO: but mainview ?
+ CLBlitter_FillScreenView(0);
+ _keyboardHeld = true;
+ }
+ } else
#endif
- _keyboardHeld = false;
- }
+ _keyboardHeld = false;
+
if (arg1) {
if (_vm->isMouseButtonDown()) {
if (!_mouseHeld) {
@@ -8889,14 +8893,14 @@ void EdenGame::Eden_dep_and_rot() {
case 5:
_rotationAngleZ = 0;
_rotationAngleX = 0;
- _translationZ += flt_2DF84;
- if ((_translationZ < -3600.0 + flt_2DF80) || _translationZ > flt_2DF80)
- flt_2DF84 = -flt_2DF84;
+ _translationZ += _zDirection * Z_STEP;
+ if ((_translationZ < -3600 + Z_RESET) || _translationZ > Z_RESET)
+ _zDirection = -_zDirection;
break;
case 6:
_rotationAngleZ = 0;
_rotationAngleX = 0;
- _translationZ = flt_2DF80;
+ _translationZ = Z_RESET;
break;
case 7:
_rotationAngleZ -= 2;
@@ -8908,22 +8912,22 @@ void EdenGame::Eden_dep_and_rot() {
case 8:
_rotationAngleZ = 0;
_rotationAngleX = 0;
- _translationZ = flt_2DF80;
+ _translationZ = Z_RESET;
break;
case 9:
_rotationAngleZ = 0;
_rotationAngleX = 0;
- _translationZ = flt_2DF80;
+ _translationZ = Z_RESET;
break;
}
}
void EdenGame::restoreZDEP() {
- flt_2DF84 = 200.0;
- if (_translationZ < flt_2DF80)
- _translationZ += flt_2DF84;
- if (_translationZ > flt_2DF80)
- _translationZ -= flt_2DF84;
+ _zDirection = Z_UP;
+ if (_translationZ < Z_RESET)
+ _translationZ += _zDirection * Z_STEP;
+ if (_translationZ > Z_RESET)
+ _translationZ -= _zDirection * Z_STEP;
}
// Original name: affiche_polygone_mapping
diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h
index 9b0b75b806..8133ff7765 100644
--- a/engines/cryo/eden.h
+++ b/engines/cryo/eden.h
@@ -761,9 +761,16 @@ private:
byte _actionCursors[299];
byte _mapMode[12];
byte _cubeTextureCoords[3][6 * 2 * 3 * 2];
- float _translationZ = -3400;
- float flt_2DF80 = -3400;
- float flt_2DF84 = 200;
+
+ int32 _translationZ;
+ int8 _zDirection; // 1 (up) or -1 (down)
+
+ // Torch/glow related
+ int16 _torchTick;
+ int16 _glowIndex;
+ int16 _torchCurIndex;
+
+ int _cursCenter;
};
}