From 49b9ffa6ef60d34c70cb3226d4029f115d64bc4e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 18 Jan 2017 22:33:00 +0100 Subject: CRYO: Some renaming, move some static arrays to handleHNMSubtitles --- engines/cryo/defs.h | 21 ++++------- engines/cryo/eden.cpp | 89 +++++++++++++++++++++++++++++++++++++-------- engines/cryo/eden.h | 12 +++--- engines/cryo/staticdata.cpp | 58 ----------------------------- 4 files changed, 88 insertions(+), 92 deletions(-) (limited to 'engines/cryo') diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h index 01e94572d5..454b173a4f 100644 --- a/engines/cryo/defs.h +++ b/engines/cryo/defs.h @@ -793,11 +793,6 @@ extern char kPersoRoomBankTable[]; // area transition descriptors extern Goto gotos[]; -extern uint16 kFramesVid170[]; -extern uint16 kFramesVid83[]; -extern uint16 kFramesVid88[]; -extern uint16 kFramesVid89[]; -extern uint16 kFramesVid94[]; extern object_t _objects[]; extern uint16 kObjectLocations[100]; extern perso_t kPersons[]; @@ -815,7 +810,7 @@ extern int16 tab_2CEF0[64]; extern int16 tab_2CF70[64]; extern int16 kActionCursors[299]; -struct cubeface_t { +struct CubeFace { int tri; char ff_4; char ff_5; @@ -825,17 +820,17 @@ struct cubeface_t { int16 *_uv; }; -struct Projection { +struct Point3D { int16 x; int16 y; int16 z; }; -struct cube_t { - int _num; - cubeface_t **_faces; - Projection *_projection; // projected XYZ coords - int16 *_vertices; +struct Cube { + int _num; + CubeFace **_faces; + Point3D *_projection; // projected XYZ coords + Point3D *_vertices; }; extern float _translationZ; @@ -846,7 +841,7 @@ struct XYZ { signed short x, y, z; }; -struct cubeCursor { +struct CubeCursor { uint8 _sides[6]; // spr idx for each side uint8 _kind; int8 _speed; diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 9801542c11..22e6070798 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -6505,6 +6505,65 @@ void EdenGame::playHNM(int16 num) { // Original name bullehnm void EdenGame::handleHNMSubtitles() { +#define SUB_LINE(start, end) \ + (start), (end) | 0x8000 + + static uint16 kFramesVid170[] = { + SUB_LINE( 68, 120), + SUB_LINE( 123, 196), + SUB_LINE( 199, 274), + SUB_LINE( 276, 370), + SUB_LINE( 799, 885), + SUB_LINE( 888, 940), + SUB_LINE( 947, 1000), + SUB_LINE(1319, 1378), + SUB_LINE(1380, 1440), + SUB_LINE(1854, 1898), + SUB_LINE(1900, 1960), + SUB_LINE(2116, 2184), + SUB_LINE(2186, 2252), + SUB_LINE(2254, 2320), + SUB_LINE(3038, 3094), + SUB_LINE(3096, 3160), + 0xFFFF + }; + + static uint16 kFramesVid83[] = { + SUB_LINE(99, 155), + SUB_LINE(157, 256), + 0xFFFF + }; + + static uint16 kFramesVid88[] = { + SUB_LINE(106, 173), + SUB_LINE(175, 244), + SUB_LINE(246, 350), + SUB_LINE(352, 467), + 0xFFFF + }; + + static uint16 kFramesVid89[] = { + SUB_LINE(126, 176), + SUB_LINE(178, 267), + SUB_LINE(269, 342), + SUB_LINE(344, 398), + SUB_LINE(400, 458), + SUB_LINE(460, 558), + 0xFFFF + }; + + static uint16 kFramesVid94[] = { + SUB_LINE(101, 213), + SUB_LINE(215, 353), + SUB_LINE(355, 455), + SUB_LINE(457, 518), + SUB_LINE(520, 660), + SUB_LINE(662, 768), + 0xFFFF + }; + +#undef SUB_LINE + uint16 *frames; perso_t *perso; switch (_vm->_video->_curVideoNum) { @@ -8593,11 +8652,11 @@ void EdenGame::makeMatriceFix() { _passMat13 = (_cosTable[rotAngleTheta] * _cosTable[rotAnglePsi]) >> 8; } -void EdenGame::projectionFix(cube_t *cubep, int n) { +void EdenGame::projectionFix(Cube *cubep, int n) { for (int i = 0; i < n; i++) { - int x = cubep->_vertices[i * 4]; - int y = cubep->_vertices[i * 4 + 1]; - int z = cubep->_vertices[i * 4 + 2]; + int x = cubep->_vertices[i].x; + int y = cubep->_vertices[i].y; + int z = cubep->_vertices[i].z; int transformX = _passMat31 * x + _passMat21 * y + _passMat11 * z + (int)(_translationX * 256.0f); int transformY = _passMat32 * x + _passMat22 * y + _passMat12 * z + (int)(_translationY * 256.0f); @@ -8627,7 +8686,7 @@ void EdenGame::engineMac() { } // Original name: affiche_objet -void EdenGame::displayObject(cube_t *cubep) { +void EdenGame::displayObject(Cube *cubep) { for (int i = 0; i < cubep->_num; i++) displayPolygoneMapping(cubep, cubep->_faces[i]); } @@ -8674,7 +8733,7 @@ void EdenGame::loadMap(int file_id, byte *buffer) { } } -void EdenGame::NEWcharge_objet_mob(cube_t *cubep, int fileNum, byte *texturePtr) { +void EdenGame::NEWcharge_objet_mob(Cube *cubep, int fileNum, byte *texturePtr) { char *tmp1 = (char *)malloc(454); if (_vm->getPlatform() == Common::kPlatformMacintosh) loadpartoffile(fileNum, tmp1, 0, 454); @@ -8694,17 +8753,17 @@ void EdenGame::NEWcharge_objet_mob(cube_t *cubep, int fileNum, byte *texturePtr) char *next = tmp1; char error; _cubeFaces = nextVal(&next, &error); - int16 *vertices = (int16 *)malloc(_cubeFaces * 4 * sizeof(*vertices)); - Projection *projection = (Projection *)malloc(_cubeFaces * sizeof(*projection)); + Point3D *vertices = (Point3D *)malloc(_cubeFaces * sizeof(*vertices)); + Point3D *projection = (Point3D *)malloc(_cubeFaces * sizeof(*projection)); for (int i = 0; i < _cubeFaces; i++) { - vertices[i * 4] = nextVal(&next, &error); - vertices[i * 4 + 1] = nextVal(&next, &error); - vertices[i * 4 + 2] = nextVal(&next, &error); + vertices[i].x = nextVal(&next, &error); + vertices[i].y = nextVal(&next, &error); + vertices[i].z = nextVal(&next, &error); } int count2 = nextVal(&next, &error); - cubeface_t **tmp4 = (cubeface_t **)malloc(count2 * sizeof(*tmp4)); + CubeFace **tmp4 = (CubeFace **)malloc(count2 * sizeof(*tmp4)); for (int i = 0; i < count2; i++) { - tmp4[i] = (cubeface_t *)malloc(sizeof(cubeface_t)); + tmp4[i] = (CubeFace *)malloc(sizeof(CubeFace)); tmp4[i]->tri = 3; char textured = nextVal(&next, &error); tmp4[i]->ff_5 = nextVal(&next, &error); @@ -8900,7 +8959,7 @@ void EdenGame::restoreZDEP() { } // Original name: affiche_polygone_mapping -void EdenGame::displayPolygoneMapping(cube_t *cubep, cubeface_t *face) { +void EdenGame::displayPolygoneMapping(Cube *cubep, CubeFace *face) { uint16 *indices = face->_indices; int idx = indices[0]; int16 projX0 = cubep->_projection[idx].x; @@ -9049,7 +9108,7 @@ void EdenGame::displayMappingLine(int16 r3, int16 r4, byte *target, byte *textur } // PC cursor -cubeCursor _cursorsPC[9] = { +CubeCursor _cursorsPC[9] = { { { 0, 0, 0, 0, 0, 0 }, 3, 2 }, { { 1, 1, 0, 1, 1, 0 }, 2, -2 }, { { 2, 2, 2, 2, 2, 2 }, 1, 2 }, diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index 0946c8968b..b98dfcb3ea 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -489,17 +489,17 @@ private: void actionNop(); void initSinCosTable(); void makeMatriceFix(); - void projectionFix(cube_t *cube, int n); + void projectionFix(Cube *cube, int n); void initCubeMac(); void engineMac(); - void displayObject(cube_t *cube); + void displayObject(Cube *cube); void loadMap(int file_id, byte *buffer); - void NEWcharge_objet_mob(cube_t *cube, int fileNum, byte *texturePtr); + void NEWcharge_objet_mob(Cube *cube, int fileNum, byte *texturePtr); static int nextVal(char **ptr, char *error); void selectMap(int16 num); void Eden_dep_and_rot(); void restoreZDEP(); - void displayPolygoneMapping(cube_t *cube, cubeface_t *face); + void displayPolygoneMapping(Cube *cube, CubeFace *face); void drawMappingLine(int16 r3, int16 r4, int16 r5, int16 r6, int16 r7, int16 r8, int16 r9, int16 r10, int16 *lines); void displayMappingLine(int16 r3, int16 r4, byte *target, byte *texture); int16 OpenDialog(void *arg1, void *arg2); @@ -531,7 +531,7 @@ private: void incZoom(); void decZoom(); - cubeCursor *_pcCursor; + CubeCursor *_pcCursor; int8 tab1[30]; int8 tab2[30]; @@ -725,7 +725,7 @@ private: int16 _rotationAngleY; // CHECKME: USeless? int16 _rotationAngleX, _rotationAngleZ; float _translationY, _translationX; // CHECKME: Useless? - cube_t _cube; + Cube _cube; int16 _cursCurPCMap; int16 _lines[200 * 8]; byte _cubeTexture[0x4000]; diff --git a/engines/cryo/staticdata.cpp b/engines/cryo/staticdata.cpp index a9783412ac..404ad2ecd4 100644 --- a/engines/cryo/staticdata.cpp +++ b/engines/cryo/staticdata.cpp @@ -236,64 +236,6 @@ Goto gotos[] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, }; -#define SUB_LINE(start, end) \ - (start), (end) | 0x8000 - -uint16 kFramesVid170[] = { - SUB_LINE( 68, 120), - SUB_LINE( 123, 196), - SUB_LINE( 199, 274), - SUB_LINE( 276, 370), - SUB_LINE( 799, 885), - SUB_LINE( 888, 940), - SUB_LINE( 947, 1000), - SUB_LINE(1319, 1378), - SUB_LINE(1380, 1440), - SUB_LINE(1854, 1898), - SUB_LINE(1900, 1960), - SUB_LINE(2116, 2184), - SUB_LINE(2186, 2252), - SUB_LINE(2254, 2320), - SUB_LINE(3038, 3094), - SUB_LINE(3096, 3160), - 0xFFFF -}; - -uint16 kFramesVid83[] = { - SUB_LINE(99, 155), - SUB_LINE(157, 256), - 0xFFFF -}; - -uint16 kFramesVid88[] = { - SUB_LINE(106, 173), - SUB_LINE(175, 244), - SUB_LINE(246, 350), - SUB_LINE(352, 467), - 0xFFFF -}; - -uint16 kFramesVid89[] = { - SUB_LINE(126, 176), - SUB_LINE(178, 267), - SUB_LINE(269, 342), - SUB_LINE(344, 398), - SUB_LINE(400, 458), - SUB_LINE(460, 558), - 0xFFFF -}; - -uint16 kFramesVid94[] = { - SUB_LINE(101, 213), - SUB_LINE(215, 353), - SUB_LINE(355, 455), - SUB_LINE(457, 518), - SUB_LINE(520, 660), - SUB_LINE(662, 768), - 0xFFFF -}; -#undef SUB_LINE - object_t _objects[] = { //id,fl,loc,masklow,maskhi,ct { 1, 0, 3, 1, 0, 0}, // Eve's Way Stone -- cgit v1.2.3