diff options
-rw-r--r-- | engines/hopkins/anim.cpp | 42 | ||||
-rw-r--r-- | engines/hopkins/anim.h | 3 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 278 | ||||
-rw-r--r-- | engines/hopkins/events.h | 11 | ||||
-rw-r--r-- | engines/hopkins/files.cpp | 5 | ||||
-rw-r--r-- | engines/hopkins/files.h | 1 | ||||
-rw-r--r-- | engines/hopkins/font.cpp | 37 | ||||
-rw-r--r-- | engines/hopkins/font.h | 46 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 7 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 12 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 59 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 18 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 9 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 2 | ||||
-rw-r--r-- | engines/hopkins/menu.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/module.mk | 1 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 40 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 6 |
18 files changed, 502 insertions, 77 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 3977729b75..665f5590e1 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -416,8 +416,8 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam v8 = 0; do { ptr = v4; - width = Get_Largeur(v4, v8); - height = Get_Hauteur(ptr, v8); + width = _vm->_objectsManager.Get_Largeur(v4, v8); + height = _vm->_objectsManager.Get_Hauteur(ptr, v8); v4 = ptr; if (!width && !height) v7 = 1; @@ -449,9 +449,9 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam v20 = READ_LE_UINT16(v13 + 6); v13 += 8; - set_offsetxy(GLOBALS.Bank[idx].data, v14, v16, v17, 0); + _vm->_objectsManager.set_offsetxy(GLOBALS.Bank[idx].data, v14, v16, v17, 0); if (GLOBALS.Bank[idx].fileHeader == 2) - set_offsetxy(GLOBALS.Bank[idx].data, v14, v21, v20, 1); + _vm->_objectsManager.set_offsetxy(GLOBALS.Bank[idx].data, v14, v21, v20, 1); } } @@ -473,24 +473,6 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam return result; } -void AnimationManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { - byte *startP = data + 3; - for (int i = idx; i; --i) - startP += READ_LE_UINT32(startP) + 16; - - byte *rectP = startP + 8; - if (isSize == 1) { - // Set size - byte *pointP = rectP + 4; - WRITE_LE_UINT16(pointP, xp); - WRITE_LE_UINT16(pointP + 2, yp); - } else { - // Set position - WRITE_LE_UINT16(rectP, xp); - WRITE_LE_UINT16(rectP + 2, yp); - } -} - void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { int v4; const byte *v5; @@ -598,20 +580,4 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { } while (v21 <= nbytes && !doneFlag); } -int AnimationManager::Get_Largeur(const byte *data, int idx) { - const byte *rectP = data + 3; - for (int i = idx; i; --i) - rectP += READ_LE_UINT32(rectP) + 16; - - return (int16)READ_LE_UINT16(rectP + 4); -} - -int AnimationManager::Get_Hauteur(const byte *data, int idx) { - const byte *rectP = data + 3; - for (int i = idx; i; --i) - rectP += READ_LE_UINT32(rectP) + 16; - - return (int16)READ_LE_UINT16(rectP + 6); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index a85fc3cbad..3046142623 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -49,10 +49,7 @@ public: void BOBANIM_OFF(int idx); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); - void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); - int Get_Largeur(const byte *data, int idx); - int Get_Hauteur(const byte *data, int idx); }; } // End of namespace Hopkins diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 5470f3167b..af1b5385d2 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -24,12 +24,22 @@ #include "common/events.h" #include "common/textconsole.h" #include "hopkins/events.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/hopkins.h" +#include "hopkins/sound.h" namespace Hopkins { EventsManager::EventsManager() { souris_flag = false; mouse_linux = false; + min_x = 0; + min_y = 20; + max_x = 1280; + max_y = 460; + min_x = min_y = 0; + max_x = max_y = 0; souris_sizex = souris_sizey = 0; ofset_souris_x = ofset_souris_y = 0; start_x = start_y = 0; @@ -41,6 +51,11 @@ EventsManager::EventsManager() { lItCounter = 0; ESC_KEY = false; _priorFrameTime = 0; + btsouris = 0; +} + +void EventsManager::setParent(HopkinsEngine *vm) { + _vm = vm; } void EventsManager::INSTALL_SOURIS() { @@ -95,15 +110,28 @@ bool EventsManager::BMOUSE() { } void EventsManager::MOUSE_OFF() { - warning("TODO: MOUSE_OFF"); + souris_flag = false; } void EventsManager::MOUSE_ON() { - warning("TODO: MOUSE_ON"); + souris_on(); + souris_flag = true; } void EventsManager::CHANGE_MOUSE(int id) { - warning("TODO: CHANGE_MOUSE"); + int cursorId = id; + + if (btsouris != 23) { + if (id == 4 && btsouris == 4 && _vm->_globals.NOMARCHE) + cursorId = 0; + if (cursorId == 25) + cursorId = 5; + + if (OLD_ICONE != cursorId || !cursorId) { + OLD_ICONE = cursorId; + souris_n = cursorId; + } + } } void EventsManager::CONTROLE_MES() { @@ -156,7 +184,247 @@ void EventsManager::pollEvents() { } void EventsManager::VBL() { - warning("TODO: VBL"); -} + int a1 = 0; + signed __int16 v1; + int v2; + int v3; + int v4; + int v5; + int v6; + signed __int16 v7; + int v10; + signed int v11 = 0; + signed int v12 = 0; + int v13 = 0; + unsigned int v14 = 0; + int v15 = 0; + + if (_vm->_graphicsManager.REDRAW) { + _vm->_graphicsManager.DD_Lock(); + if (CASSE) { + _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.REDRAW = 0; + } else { + if (_vm->_globals.iRegul == 3) + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); + else + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); + FileManager::DMESS(); + --_vm->_graphicsManager.REDRAW; + } + _vm->_graphicsManager.DD_Unlock(); + } + + if (souris_flag) { + v1 = 20; + if (!mouse_linux) + v1 = 10; + v2 = 20; + if (!mouse_linux) + v2 = 15; + + v15 = souris_x - v1; + a1 = souris_y; + v14 = souris_sizex; + v13 = souris_sizey; + if (btsouris == 23) { + v14 = _vm->_globals.OBJL; + v13 = _vm->_globals.OBJH; + goto LABEL_35; + } + + if (CASSE) { + if (v15 < min_x) + v15 = min_x; + if (souris_y < min_y) + a1 = min_y; + + if (souris_sizex + v15 >= max_x) + v14 = souris_sizex - (souris_sizex + v15 - max_x); + if (a1 + souris_sizey < max_y) + goto LABEL_34; + + v3 = a1 + souris_sizey - max_y; + } else { + if (v15 < min_x) + v15 = min_x - v1; + v2 = (signed __int16)v2; + if (souris_y < min_y - (signed __int16)v2) + a1 = min_y - (signed __int16)v2; + if (souris_sizex + v15 >= max_x) + v14 = souris_sizex - (souris_sizex + v15 - max_x - v1); + if (a1 + souris_sizey < v2 + max_y) + goto LABEL_34; + + v3 = v2 + a1 + souris_sizey - max_y; + } + + v13 = souris_sizey - v3; +LABEL_34: + v12 = v14 + v15; + v11 = a1 + v13; + } +LABEL_35: + + if (!_vm->_globals.PUBEXIT) + _vm->_graphicsManager.AFF_SPRITES(); + if (souris_flag != 1) + goto LABEL_54; + if (btsouris == 23) + goto LABEL_45; + + if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { + if (btsouris != 23) + goto LABEL_54; + +LABEL_45: + if (a1 < max_y && v15 < max_x) { + if ((signed int)(v14 + v15) > max_x) + v14 -= v14 + v15 - max_x; + if (a1 + v13 > max_y) + v13 -= a1 + v13 - max_y; + + if ((signed int)v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + goto LABEL_54; + } + + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, pointeur_souris, v15 + 300, a1 + 300, souris_n); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v12, v11); + +LABEL_54: + _vm->_globals.vitesse = 2; + + do { + for (;;) { + while (CASSE || _vm->_globals.iRegul != 1) { + if (CASSE != 1) + goto LABEL_63; + + if (lItCounter > 1) + goto LABEL_65; + } + + if (_vm->_globals.vitesse != 2) + break; + + if (lItCounter > 9) + goto LABEL_65; + } +LABEL_63: + ; + } while (_vm->_globals.iRegul == 3 && lItCounter <= 15); + +LABEL_65: + _vm->_globals.vitesse = 2; + lItCounter = 0; + + if (_vm->_graphicsManager.DOUBLE_ECRAN != 1 || _vm->_graphicsManager.no_scroll == 1) { + _vm->_graphicsManager.Affiche_Segment_Vesa(); + } else { + if (_vm->_graphicsManager.no_scroll != 2) { + if ((signed __int16)XMOUSE() > _vm->_graphicsManager.SCROLL + 620) + _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; + + if ((signed __int16)XMOUSE() < _vm->_graphicsManager.SCROLL + 10) + _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; + } + + if (_vm->_graphicsManager.SCROLL < 0) + _vm->_graphicsManager.SCROLL = 0; + + if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) + _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; + + if (_vm->_graphicsManager.SDL_ECHELLE) + v4 = _vm->_graphicsManager.Magic_Number(_vm->_graphicsManager.SCROLL); + else + v4 = _vm->_graphicsManager.SCROLL; + + if (_vm->_graphicsManager.OLD_SCROLL == v4) { + _vm->_graphicsManager.Affiche_Segment_Vesa(); + } else { + _vm->_fontManager.TEXTE_OFF(9); + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.SDL_ECHELLE) { + if (_vm->_graphicsManager.Winbpp == 2) { + v5 = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v5); + } else { + v6 = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v6); + } + + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.Reel_Zoom(0, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.Reel_Zoom(SCREEN_WIDTH, _vm->_graphicsManager.SDL_ECHELLE)); + _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.Reel_Zoom(440, _vm->_graphicsManager.SDL_ECHELLE)); + } else { + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); + + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); + } + + if (!_vm->_globals.BPP_NOAFF) { + // TODO: Useful for future dirty rect processing? +// SDL_UpdateRects(LinuxScr, 1, dstrect); + } + if (_vm->_globals.NBBLOC) { + v7 = 1; + v10 = _vm->_globals.NBBLOC + 1; + + do { + if (_vm->_globals.BLOC[v7].field0 == 1) + _vm->_globals.BLOC[v7].field0 = 0; + ++v7; + } while (v10 != v7); + } + + _vm->_globals.NBBLOC = 0; + start_x = v4; + _vm->_graphicsManager.ofscroll = v4; + _vm->_graphicsManager.SCROLL = v4; + } + + _vm->_graphicsManager.OLD_SCROLL = v4; + start_x = v4; + _vm->_graphicsManager.ofscroll = v4; + } + + souris_bb = souris_b; + souris_b = 0; + if (souris_flag == 1) { + if (btsouris != 23) { + if (a1 < max_y && v15 < max_x && (signed int)v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v12, v11); + goto LABEL_113; + } + + if (btsouris != 23) + goto LABEL_113; + } + + if (a1 < max_y && v15 < max_x && (signed int)v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + +LABEL_113: + + _vm->_soundManager.VERIF_SOUND(); + return CONTROLE_MES(); +} } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 792e2774c4..51decf7912 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -31,27 +31,36 @@ namespace Hopkins { #define GAME_FRAME_RATE 50 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) +class HopkinsEngine; + class EventsManager { private: + HopkinsEngine *_vm; + void pollEvents(); void checkForNextFrameCounter(); public: bool souris_flag; bool mouse_linux; + int min_x, min_y; + int max_x, max_y; int souris_sizex, souris_sizey; int ofset_souris_x, ofset_souris_y; int start_x, start_y; int souris_x, souris_y; bool CASSE; + int OLD_ICONE; int souris_n; int souris_bb; int souris_b; - void *pointeur_souris; + byte *pointeur_souris; uint32 lItCounter; uint32 _priorFrameTime; bool ESC_KEY; + int btsouris; public: EventsManager(); + void setParent(HopkinsEngine *vm); void INSTALL_SOURIS(); void souris_on(); diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 90b5cf0ae8..68c32bfde0 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -117,7 +117,12 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) { return data; } +void FileManager::DMESS() { + // No implementation in original +} + void FileManager::DMESS1() { + // No implementation in original } int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) { diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index e5e4be3566..fbc8a04cab 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -37,6 +37,7 @@ public: static bool bsave(const Common::String &file, const void *buf, size_t n); static void Chage_Inifile(Common::StringMap &iniParams); static byte *CHARGE_FICHIER(const Common::String &file); + static void DMESS(); static void DMESS1(); static int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); static void F_Censure(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp new file mode 100644 index 0000000000..fe4e9df46c --- /dev/null +++ b/engines/hopkins/font.cpp @@ -0,0 +1,37 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/system.h" +#include "common/textconsole.h" +#include "hopkins/font.h" + +namespace Hopkins { + +void FontManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void FontManager::TEXTE_OFF(int idx) { + warning("TODO: TEXTE_OFF"); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h new file mode 100644 index 0000000000..4ecab0c176 --- /dev/null +++ b/engines/hopkins/font.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef HOPKINS_FONT_H +#define HOPKINS_FONT_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Hopkins { + +class HopkinsEngine; + +class FontManager { +public: + HopkinsEngine *_vm; + + +public: + void setParent(HopkinsEngine *vm); + + void TEXTE_OFF(int idx); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_FONT_H */ diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index aecad64dde..55c943baa2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -39,8 +39,6 @@ Globals::Globals() { VOICEVOL = 6; XSETMODE = 0; XZOOM = 0; - min_x = min_y = 0; - max_x = max_y = 0; lItCounter = 0; lOldItCounter = 0; g_old_anim = 0; @@ -72,7 +70,7 @@ Globals::Globals() { Max_Ligne_Long = 0; Max_Perso_Y = 0; Max_Propre = 0; - btsouris = 0; + NBBLOC = 0; // Initialise pointers ICONE = NULL; @@ -100,6 +98,8 @@ Globals::Globals() { police = NULL; PERSO = NULL; + + // Reset flags MUSICOFF = false; SOUNDOFF = false; @@ -118,6 +118,7 @@ Globals::Globals() { DESACTIVE_INVENT = false; FLAG_VISIBLE = false; netscape = false; + NOMARCHE = false; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 47ea2b09ef..c1209d01fb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -118,6 +118,10 @@ struct ObjetWItem { byte field7; }; +struct BlocItem { + uint16 field0; +}; + /** * Engine Globals */ @@ -156,10 +160,6 @@ public: bool MUSICOFF; bool VOICEOFF; bool CENSURE; - int min_x; - int min_y; - int max_x; - int max_y; int lItCounter; int lOldItCounter; int g_old_anim; @@ -184,6 +184,7 @@ public: BlAnimItem BL_ANIM[30]; VBobItem VBob[35]; ObjetWItem ObjetW[300]; + BlocItem BLOC[250]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -235,7 +236,8 @@ public: bool DESACTIVE_INVENT; bool FLAG_VISIBLE; bool netscape; - int btsouris; + bool NOMARCHE; + int NBBLOC; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 72fbd0319b..a1a5206fe3 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -58,6 +58,7 @@ GraphicsManager::GraphicsManager() { FADE_LINUX = 0; NOLOCK = false; no_scroll = 0; + REDRAW = false; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); @@ -70,6 +71,10 @@ GraphicsManager::~GraphicsManager() { GLOBALS.dos_free2(VESA_BUFFER); } +void GraphicsManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + void GraphicsManager::SET_MODE(int width, int height) { if (!SDL_MODEYES) { SDL_ECHELLE = 0; @@ -182,7 +187,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { if (!DOUBLE_ECRAN) { souris_max(); SCANLINE(SCREEN_WIDTH); - GLOBALS.max_x = SCREEN_WIDTH; + _vm->_eventsManager.max_x = SCREEN_WIDTH; DD_Lock(); Cls_Video(); if (Winbpp == 2) { @@ -200,7 +205,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { DD_Unlock(); } else { SCANLINE(SCREEN_WIDTH * 2); - GLOBALS.max_x = SCREEN_WIDTH * 2; + _vm->_eventsManager.max_x = SCREEN_WIDTH * 2; DD_Lock(); Cls_Video(); DD_Unlock(); @@ -957,6 +962,14 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { } } +void GraphicsManager::Capture_Mem(byte *a1, void *a2, int a3, int a4, unsigned int a5, int a6) { + warning("TODO: Capture_Mem"); +} + +void GraphicsManager::Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5) { + warning("TODO: Sprite_Vesa"); +} + void GraphicsManager::FIN_VISU() { warning("TODO: FIN_VISU"); } @@ -969,4 +982,46 @@ void GraphicsManager::RESET_SEGMENT_VESA() { warning("TODO: RESET_SEGMENT_VESA"); } +void GraphicsManager::Ajoute_Segment_Vesa(int a1, int a2, int a3, int a4) { + warning("TODO: Ajoute_Segment_Vesa"); +} + +int GraphicsManager::Magic_Number(signed int v) { + int result = v; + + if (!v) + result = 4; + if (result & 1) + ++result; + if (result & 2) + result += 2; + + return result; +} + +void GraphicsManager::Affiche_Segment_Vesa() { + warning("TODO: Affiche_Segment_Vesa"); +} + +void GraphicsManager::CopyAsm(const byte *surface) { + warning("TODO: CopyAsm"); +} + +void GraphicsManager::Restore_Mem(const byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6) { + warning("TODO: Restore_Mem"); +} + +int GraphicsManager::Reel_Zoom(int a1, int a2) { + warning("TODO: Reel_Zoom"); + return 0; +} + +void GraphicsManager::AFF_SPRITES() { + warning("TODO: AFF_SPRITES"); +} + +void GraphicsManager::Affiche_Perfect(const byte *a1, const byte *a2, int a3, int a4, int a5, int a6, int a7, int a8) { + warning("TODO: Affice_Perfect"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index be1bc751cd..113147ba7d 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/endian.h" +#include "common/rect.h" #include "common/str.h" #include "graphics/surface.h" @@ -40,8 +41,12 @@ struct RGB8 { byte b; }; +class HopkinsEngine; + class GraphicsManager { private: + HopkinsEngine *_vm; + void CHARGE_ECRAN(const Common::String &file); public: int _lockCtr; @@ -78,9 +83,12 @@ public: int FADE_LINUX; bool NOLOCK; int no_scroll; + Common::Rect dstrect[50]; + int REDRAW; public: GraphicsManager(); ~GraphicsManager(); + void setParent(HopkinsEngine *vm); void SET_MODE(int width, int height); void DD_Lock(); @@ -117,9 +125,19 @@ public: void Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface); void Copy_Video_Vbe3(const byte *surface); void Copy_Video_Vbe16(const byte *surface); + void Capture_Mem(byte *a1, void *a2, int a3, int a4, unsigned int a5, int a6); + void Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5); void FIN_VISU(); void VISU_ALL(); void RESET_SEGMENT_VESA(); + void Ajoute_Segment_Vesa(int a1, int a2, int a3, int a4); + int Magic_Number(int v); + void Affiche_Segment_Vesa(); + void CopyAsm(const byte *surface); + void Restore_Mem(const byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); + int Reel_Zoom(int a1, int a2); + void AFF_SPRITES(); + void Affiche_Perfect(const byte *a1, const byte *a2, int a3, int a4, int a5, int a6, int a7, int a8); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 65b31903ac..0b41bf16aa 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -38,6 +38,8 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _gameDescription(gameDesc), _randomSource("Hopkins"), _animationManager() { g_vm = this; _animationManager.setParent(this); + _eventsManager.setParent(this); + _fontManager.setParent(this); _menuManager.setParent(this); _objectsManager.setParent(this); _soundManager.setParent(this); @@ -549,11 +551,6 @@ void HopkinsEngine::INIT_SYSTEM() { break; } - GLOBALS.min_x = 0; - GLOBALS.min_y = 20; - GLOBALS.max_x = 1280; - GLOBALS.max_y = 460; - _eventsManager.INSTALL_SOURIS(); _eventsManager.souris_on(); _eventsManager.souris_flag = false; @@ -861,7 +858,7 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_INW(); _eventsManager.MOUSE_ON(); _eventsManager.CHANGE_MOUSE(0); - _globals.btsouris = 0; + _eventsManager.btsouris = 0; _eventsManager.souris_n = 0; _globals.netscape = true; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index da62e43b0d..062fc1e191 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -33,6 +33,7 @@ #include "graphics/surface.h" #include "hopkins/anim.h" #include "hopkins/events.h" +#include "hopkins/font.h" #include "hopkins/globals.h" #include "hopkins/graphics.h" #include "hopkins/menu.h" @@ -97,6 +98,7 @@ protected: public: AnimationManager _animationManager; EventsManager _eventsManager; + FontManager _fontManager; Globals _globals; GraphicsManager _graphicsManager; MenuManager _menuManager; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 17ee630aa9..93d30f96a9 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -87,7 +87,7 @@ int MenuManager::MENU() { v1 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_eventsManager.MOUSE_ON(); _vm->_eventsManager.CHANGE_MOUSE(0); - _vm->_globals.btsouris = 0; + _vm->_eventsManager.btsouris = 0; _vm->_eventsManager.souris_n = 0; for (;;) { diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index 6768c6add2..b924037680 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS := \ detection.o \ events.o \ files.o \ + font.o \ graphics.o \ globals.o \ hopkins.o \ diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c464a0241f..938099f083 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -95,20 +95,38 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { return result; } -int ObjectsManager::Get_Largeur(const byte *objectData, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) - objP += READ_LE_UINT32(objP) + 16; - - return READ_LE_UINT16(objP + 4); +void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { + byte *startP = data + 3; + for (int i = idx; i; --i) + startP += READ_LE_UINT32(startP) + 16; + + byte *rectP = startP + 8; + if (isSize == 1) { + // Set size + byte *pointP = rectP + 4; + WRITE_LE_UINT16(pointP, xp); + WRITE_LE_UINT16(pointP + 2, yp); + } else { + // Set position + WRITE_LE_UINT16(rectP, xp); + WRITE_LE_UINT16(rectP + 2, yp); + } } -int ObjectsManager::Get_Hauteur(const byte *objectData, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) - objP += READ_LE_UINT32(objP) + 16; +int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { + const byte *rectP = objectData + 3; + for (int i = idx; i; --i) + rectP += READ_LE_UINT32(rectP) + 16; + + return (int16)READ_LE_UINT16(rectP + 4); +} - return READ_LE_UINT16(objP + 6); +int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { + const byte *rectP = objectData + 3; + for (int i = idx; i; --i) + rectP += READ_LE_UINT32(rectP) + 16; + + return (int16)READ_LE_UINT16(rectP + 6); } int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7ebb93da9e..845c4077a3 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -40,12 +40,14 @@ public: byte *CHANGE_OBJET(int objIndex); byte *CAPTURE_OBJET(int objIndex, int mode); - int Get_Largeur(const byte *objectData, int objIndex); - int Get_Hauteur(const byte *objectData, int objIndex); + int Get_Largeur(const byte *objectData, int idx); + int Get_Hauteur(const byte *objectData, int idx); int sprite_alone(const byte *objectData, byte *sprite, int objIndex); byte *DEL_FICHIER_OBJ(); byte *CHARGE_SPRITE(const Common::String &file); + void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); + int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); int AJOUTE_OBJET(int objIndex); }; |