Skip to content

Commit

Permalink
HOPKINS: Bugfixes for INILINK initialisatoin
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Oct 8, 2012
1 parent 2b59203 commit 4e0738a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions engines/hopkins/files.cpp
Expand Up @@ -200,6 +200,9 @@ byte *FileManager::LIBERE_FICHIER(byte *ptr) {
byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) {
byte *ptr = NULL;
Common::File f;

Common::String filename = file;
filename.toUppercase();

switch (a2) {
case 1:
Expand Down
2 changes: 1 addition & 1 deletion engines/hopkins/globals.cpp
Expand Up @@ -312,7 +312,7 @@ void Globals::clearAll() {
_vm->_linesManager.Ligne[idx].field4 = 0;
_vm->_linesManager.Ligne[idx].field6 = 0;
_vm->_linesManager.Ligne[idx].field8 = 0;
_vm->_linesManager.Ligne[idx].field12 = PTRNUL;
_vm->_linesManager.Ligne[idx].fieldC = PTRNUL;

_vm->_linesManager.LigneZone[idx].field0 = 0;
_vm->_linesManager.LigneZone[idx].field2 = 0;
Expand Down
1 change: 1 addition & 0 deletions engines/hopkins/hopkins.cpp
Expand Up @@ -44,6 +44,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe
_fontManager.setParent(this);
_globals.setParent(this);
_graphicsManager.setParent(this);
_linesManager.setParent(this);
_menuManager.setParent(this);
_objectsManager.setParent(this);
_soundManager.setParent(this);
Expand Down
1 change: 0 additions & 1 deletion engines/hopkins/lines.h
Expand Up @@ -43,7 +43,6 @@ struct LigneItem {
int field6;
int field8;
byte *fieldC;
byte *field12;
};

struct SmoothItem {
Expand Down
18 changes: 10 additions & 8 deletions engines/hopkins/objects.cpp
Expand Up @@ -6462,8 +6462,8 @@ void ObjectsManager::INILINK(const Common::String &file) {
int v23;
int v24;
int v25;
int v27;
int v28;
int16 v27;
int16 v28;
int v29;
int v30;
int v31;
Expand Down Expand Up @@ -6509,13 +6509,15 @@ void ObjectsManager::INILINK(const Common::String &file) {
filename2 = Common::String((const char *)ptr + 1000);
if (!filename2.empty()) {
_vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.RECHERCHE_CAT(filename2, 8);
if (_vm->_globals.CACHE_BANQUE[1]) {

if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == PTRNUL) {
_vm->_globals.CAT_FLAG = 0;
_vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2);
} else {
_vm->_globals.CAT_FLAG = 1;
_vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES");
}

_vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER);
_vm->_globals.CAT_FLAG = 0;
v36 = 60;
Expand Down Expand Up @@ -6560,13 +6562,13 @@ void ObjectsManager::INILINK(const Common::String &file) {
v41 = 0;
if (nbytes) {
do {
if (*(ptr + v41) == 79 && *(ptr + v41 + 1) == 66 && *(ptr + v41 + 2) == 50) {
if (*(ptr + v41) == 'O' && *(ptr + v41 + 1) == 'B' && *(ptr + v41 + 2) == '2') {
v16 = ptr + v41 + 4;
v32 = 0;
v34 = 0;
_vm->_linesManager.TOTAL_LIGNES = 0;
do {
v27 = READ_LE_UINT16(v16 + 2 * v32);
v27 = (int16)READ_LE_UINT16(v16 + 2 * v32);
if (v27 != -1) {
_vm->_linesManager.AJOUTE_LIGNE(
v34,
Expand Down Expand Up @@ -6616,7 +6618,7 @@ void ObjectsManager::INILINK(const Common::String &file) {

v31 = 0;
do {
v28 = READ_LE_UINT16(v17 + 2 * v33);
v28 = (int16)READ_LE_UINT16(v17 + 2 * v33);
if (v28 != -1) {
_vm->_linesManager.AJOUTE_LIGNE_ZONE(
v35,
Expand All @@ -6633,7 +6635,7 @@ void ObjectsManager::INILINK(const Common::String &file) {
} while (v28 != -1);
v20 = 1;
do {
v21 = 20 * v20;
v21 = v20;
_vm->_globals.ZONEP[v21].field0 = READ_LE_UINT16(v17 + 2 * v33);
_vm->_globals.ZONEP[v21].field2 = READ_LE_UINT16(v17 + 2 * v33 + 2);
_vm->_globals.ZONEP[v21].field4 = READ_LE_UINT16(v17 + 2 * v33 + 4);
Expand All @@ -6645,7 +6647,7 @@ void ObjectsManager::INILINK(const Common::String &file) {
v29 = 0;
v23 = 1;
do {
v24 = 20 * v23;
v24 = v23;
_vm->_globals.ZONEP[v24].field6 = *(v29 + v22);
_vm->_globals.ZONEP[v24].field7 = *(v22 + v29 + 1);
_vm->_globals.ZONEP[v24].field8 = *(v22 + v29 + 2);
Expand Down

0 comments on commit 4e0738a

Please sign in to comment.