diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/globals.h | 5 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 49 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 2 | ||||
-rw-r--r-- | engines/hopkins/menu.cpp | 265 | ||||
-rw-r--r-- | engines/hopkins/menu.h | 2 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 1 |
6 files changed, 321 insertions, 3 deletions
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 61392e36fe..3bbaa2c9f4 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -214,6 +214,7 @@ enum SauvegardeOffset { , svField6 , svField8 , svField9 + , svField10 , svField13 , svField80 , svField94 @@ -264,10 +265,12 @@ enum SauvegardeOffset { , svField357 , svField399 , svField401 + , svField1300 }; +// TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { - byte data[999]; // TODO: GET CORRECT SIZE + byte data[0x802]; Sauvegarde1 field360; Sauvegarde1 field370; Sauvegarde1 field380; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f54649f976..9a93b8eca9 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2513,4 +2513,53 @@ Video_Cont_Vbe: } } +// TODO: Check that v9 doesn't get set anywhere (apart from the current init to zero) +void GraphicsManager::Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7) { + byte *v7; + byte *v8; + int v9 = 0; + int v10 = 0; + int v11; + int v12; + byte *v13; + int v14; + + v7 = a3 + nbrligne2 * a4 + a1; + v8 = a2; + Red = a7; + Largeur = a5; + Red_x = 0; + Red_y = 0; + if (a7 < 100) { + Reduc_Ecran_L = Asm_Reduc(a5, Red); + Reduc_Ecran_H = Asm_Reduc(v9, Red); + v11 = Red; + do { + v14 = v10; + v13 = v7; + Red_y += v11; + if ((uint16)Red_y < 0x64u) { + Red_x = 0; + v12 = Largeur; + do { + Red_x += v11; + if ((uint16)Red_x < 0x64u) { + *v8++ = *v7++; + } else { + Red_x = Red_x - 100; + ++v7; + } + --v12; + } while (v12); + v10 = v14; + v7 = nbrligne2 + v13; + } else { + Red_y = Red_y - 100; + v7 += nbrligne2; + } + --v10; + } while (v10); + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 59febac9f1..e41b37f187 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -99,6 +99,7 @@ public: int Compteur_y; int spec_largeur; bool NOFADE; + int Reduc_Ecran_L, Reduc_Ecran_H; public: GraphicsManager(); ~GraphicsManager(); @@ -182,6 +183,7 @@ public: void videkey(); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); + void Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7); }; } // End of namespace Hopkins diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index f692d4ee42..66436a830f 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "common/events.h" +#include "common/file.h" #include "common/util.h" #include "hopkins/menu.h" #include "hopkins/dialogs.h" @@ -233,11 +234,132 @@ int MenuManager::MENU() { } void MenuManager::CHARGE_PARTIE() { - warning("CHARGE_PARTIE"); + int v1; + char v3; + byte *v4; + int v5; + Common::String s; + Common::String v8; + char v9; + char v10; + char v11; + Common::String v12; + char v13; + char v14; + char v15; + char v16; + char v17; + Common::File f; + + _vm->_eventsManager.VBL(); + LOAD_SAUVE(2); + do { + do { + v1 = CHERCHE_PARTIE(); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + } while (!v1); + _vm->_objectsManager.SL_FLAG = 0; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, 457, 413); + _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + if (v1 != 7) { + s = Common::String::format("%d", v1); + v8 = 80; + v9 = 65; + v10 = 82; + v11 = 84; + v12 = s; + v13 = 46; + v14 = 68; + v15 = 65; + v16 = 84; + v17 = 0; + FileManager::CONSTRUIT_LINUX(v8); + if (f.open(_vm->_globals.NFICHIER)) { + f.close(); + + v3 = _vm->_globals.SAUVEGARDE->data[svField10]; + FileManager::CONSTRUIT_LINUX(v8); + FileManager::bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); + + v4 = &_vm->_globals.SAUVEGARDE->data[svField1300]; + v5 = 0; + do { + _vm->_globals.INVENTAIRE[v5] = READ_LE_UINT16(v4 + 2 * v5); + ++v5; + } while (v5 <= 34); + + _vm->_globals.SAUVEGARDE->data[svField10] = v3; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; + _vm->_globals.SAUVEGARDE->data[svField6] = 0; + _vm->_globals.ECRAN = 0; + } + } + + _vm->_objectsManager.CHANGE_OBJET(14); } void MenuManager::SAUVE_PARTIE() { - warning("SAUVE_PARTIE"); + byte *v1; + int v2; + byte *v3; + int v4; + Common::String s; + Common::String v7; + char v12; + char v13; + char v14; + char v15; + char v16; + + _vm->_eventsManager.VBL(); + v1 = _vm->_globals.dos_malloc2(0x2DB4u); + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, v1, _vm->_eventsManager.start_x, 20, SCREEN_WIDTH * 2, 440, 0x50u); + _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); + _vm->_graphicsManager.Trans_bloc2(v1, _vm->_graphicsManager.TABLE_COUL, 11136); + LOAD_SAUVE(1); + do { + do { + v2 = CHERCHE_PARTIE(); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + } while (!v2); + _vm->_objectsManager.SL_FLAG = 0; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); + _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + if (v2 != 7) { + s = Common::String::format("%d", v2); + v7 = Common::String::format("PART%c.DAT", s[0]); + + _vm->_globals.SAUVEGARDE->data[svField10] = v2; + v3 = &_vm->_globals.SAUVEGARDE->data[svField1300]; + v4 = 0; + do { + WRITE_LE_UINT16(v3 + 2 * v4, _vm->_globals.INVENTAIRE[v4]); + ++v4; + } while (v4 <= 34); + + FileManager::CONSTRUIT_LINUX(v7); + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); + v12 = 46; + v13 = 69; + v14 = 67; + v15 = 82; + v16 = 0; + FileManager::CONSTRUIT_LINUX(v7); + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); + } + _vm->_globals.dos_free2(v1); } void MenuManager::COMPUT_HOPKINS(int idx) { @@ -437,4 +559,143 @@ void MenuManager::COMPUT_HOPKINS(int idx) { */ } +void MenuManager::LOAD_SAUVE(int a1) { + int v1; + byte *v2; + byte *v3; + Common::String s; + char v5; + char v6; + char v7; + char v8; + char v9; + char v10; + char v11; + char v12; + char v13; + char v14; + Common::File f; + + if (_vm->_globals.FR == 1) + FileManager::CONSTRUIT_SYSTEM("SAVEFR.SPR"); + if (!_vm->_globals.FR) + FileManager::CONSTRUIT_SYSTEM("SAVEAN.SPR"); + if (_vm->_globals.FR == 2) + FileManager::CONSTRUIT_SYSTEM("SAVEES.SPR"); + _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + FileManager::CONSTRUIT_SYSTEM("SAVE2.SPR"); + _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); + if (_vm->_globals.FR) { + if (a1 == 1) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 525, 375, 1); + if (a1 == 2) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 515, 375, 2); + } else { + if (a1 == 1) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 535, 372, 1); + if (a1 == 2) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 539, 372, 2); + } + v1 = 1; + do { + memset(&s, 0, 0x13u); + sprintf(&v14, "%d", v1); + s = 80; + v5 = 65; + v6 = 82; + v7 = 84; + v8 = v14; + v9 = 46; + v10 = 69; + v11 = 67; + v12 = 82; + v13 = 0; + FileManager::CONSTRUIT_LINUX(s); + if (f.exists(_vm->_globals.NFICHIER)) { + v2 = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + v3 = v2; + if (v1 == 1) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v2, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); + if (v1 == 2) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 112, 0x80u, 87); + if (v1 == 3) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 203, 0x80u, 87); + if (v1 == 4) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 203, 0x80u, 87); + if (v1 == 5) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 294, 0x80u, 87); + if (v1 == 6) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); + _vm->_globals.dos_free2(v3); + } + ++v1; + } while (v1 <= 6); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); + _vm->_objectsManager.SL_FLAG = 1; + _vm->_objectsManager.SL_MODE = a1; + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; +} + +int MenuManager::CHERCHE_PARTIE() { + int v0; + int v1; + int v2; + + v0 = 0; + v1 = _vm->_eventsManager.XMOUSE(); + v2 = _vm->_eventsManager.YMOUSE(); + _vm->_graphicsManager.ofscroll = _vm->_eventsManager.start_x; + if ((uint16)(v2 - 112) <= 0x56u) { + if (v1 > _vm->_eventsManager.start_x + 189 && v1 < _vm->_eventsManager.start_x + 318) + v0 = 1; + if ((uint16)(v2 - 112) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 2; + } + if ((uint16)(v2 - 203) <= 0x56u) { + if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) + v0 = 3; + if ((uint16)(v2 - 203) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 4; + } + if ((uint16)(v2 - 294) <= 0x56u) { + if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) + v0 = 5; + if ((uint16)(v2 - 294) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 6; + } + if ((uint16)(v2 - 388) <= 0x10u && v1 > _vm->_graphicsManager.ofscroll + 273 && v1 < _vm->_graphicsManager.ofscroll + 355) + v0 = 7; + if (v0 == 1) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 111; + } + if (v0 == 2) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 111; + } + if (v0 == 3) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 202; + } + if (v0 == 4) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 202; + } + if (v0 == 5) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 293; + } + if (v0 == 6) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 293; + } + if (v0 == 7 || !v0) { + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + } + return v0; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index c8a1a4eec0..8b2812b476 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -43,6 +43,8 @@ public: void CHARGE_PARTIE(); void SAUVE_PARTIE(); void COMPUT_HOPKINS(int a1); + void LOAD_SAUVE(int a1); + int CHERCHE_PARTIE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 944f9b3380..075a9dfc88 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -78,6 +78,7 @@ public: const byte *S_old_spr; bool PERSO_ON; bool SL_FLAG; + int SL_MODE; bool FLAG_VISIBLE; bool DESACTIVE_INVENT; int DESACTIVE_CURSOR; |