HOPKINS: Commit of lots more initialisation code

This commit is contained in:
Paul Gilbert 2012-09-08 18:45:22 +10:00
parent 578b1601fe
commit b8086aabc5
9 changed files with 922 additions and 50 deletions

View File

@ -0,0 +1,62 @@
/* 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 "hopkins/events.h"
namespace Hopkins {
void Mouse::INSTALL_SOURIS() {
// No implementation in original
}
void Mouse::souris_on() {
bool result; // eax@5
souris_flag = true;
if (mouse_linux) {
souris_sizex = 52;
souris_sizey = 32;
} else {
souris_sizex = 34;
souris_sizey = 20;
}
ofset_souris_x = 0;
ofset_souris_y = 0;
if (!CASSE)
souris_xy(300, 200);
else
souris_xy(150, 100);
}
void Mouse::souris_xy(int xp, int yp) {
g_system->warpMouse(xp, yp);
}
void Mouse::souris_max() {
// No implementation in original
}
} // End of namespace Hopkins

53
engines/hopkins/events.h Normal file
View File

@ -0,0 +1,53 @@
/* 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_EVENTS_H
#define HOPKINS_EVENTS_H
#include "common/scummsys.h"
#include "common/str.h"
namespace Hopkins {
class Mouse {
public:
bool souris_flag;
bool mouse_linux;
int souris_sizex;
int souris_sizey;
int ofset_souris_x;
int ofset_souris_y;
bool CASSE;
int souris_n;
int souris_bb;
int souris_b;
void *pointeur_souris;
public:
void INSTALL_SOURIS();
void souris_on();
void souris_xy(int xp, int yp);
void souris_max();
};
} // End of namespace Hopkins
#endif /* HOPKINS_EVENTS_H */

View File

@ -98,7 +98,7 @@ void FileManager::Chage_Inifile(Common::StringMap &iniParams) {
free(iniData);
}
void *FileManager::CHARGE_FICHIER(const Common::String &file) {
byte *FileManager::CHARGE_FICHIER(const Common::String &file) {
DMESS1();
Common::File f;
@ -107,7 +107,7 @@ void *FileManager::CHARGE_FICHIER(const Common::String &file) {
// Allocate space for the file contents
size_t filesize = f.size();
void *data = malloc(filesize);
byte *data = (byte *)malloc(filesize);
if (!data)
error("Error allocating space for file being loaded - %s", file.c_str());
@ -124,4 +124,38 @@ int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes)
return stream.read(buf, nbytes);
}
void FileManager::F_Censure() {
GLOBALS.CENSURE = false;
CONSTRUIT_SYSTEM("BLOOD.DAT");
char *data = (char *)CHARGE_FICHIER(GLOBALS.NFICHIER);
if (*(data + 6) == 'f' && *(data + 7) == 'r')
GLOBALS.CENSURE = false;
if (*(data + 6) == 'F' && *(data + 7) == 'R')
GLOBALS.CENSURE = false;
if (*(data + 6) == 'u' && *(data + 7) == 'k')
GLOBALS.CENSURE = true;
if (*(data + 6) == 'U' && *(data + 7) == 'K')
GLOBALS.CENSURE = true;
free(data);
}
int FileManager::CONSTRUIT_SYSTEM(const Common::String &file) {
GLOBALS.NFICHIER = Common::String::format("system/%s", file.c_str());
return GLOBALS.NFICHIER.size();
}
void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file) {
// At this point, the original program did a big switch statement to determine
// whether to preprend the CD or installed directory path into REPJEU
if (hop[0] == 'A' && hop[1] == 'N' && hop[2] == 'N') {
error("TODO: CONSTRUIT_FICHIER");
}
GLOBALS.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str());
}
} // End of namespace Hopkins

View File

@ -36,9 +36,12 @@ public:
static bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n);
static bool bsave(const Common::String &file, const void *buf, size_t n);
static void Chage_Inifile(Common::StringMap &iniParams);
static void *CHARGE_FICHIER(const Common::String &file);
static byte *CHARGE_FICHIER(const Common::String &file);
static void DMESS1();
static int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes);
static void F_Censure();
static int CONSTRUIT_SYSTEM(const Common::String &file);
static void CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file);
};
} // End of namespace Hopkins

View File

@ -20,6 +20,7 @@
*
*/
#include "common/textconsole.h"
#include "hopkins/globals.h"
namespace Hopkins {
@ -40,6 +41,51 @@ Globals::Globals() {
MUSICOFF = false;
SOUNDOFF = false;
VOICEOFF = false;
// Initialise pointers
ICONE = NULL;
BUF_ZONE = NULL;
CACHE_BANQUE[6] = NULL;
Winventaire = NULL;
texte_tmp = NULL;
SPRITE_ECRAN = NULL;
SAUVEGARDE = NULL;
BUFFERTAPE = NULL;
essai0 = NULL;
essai1 = NULL;
essai2 = NULL;
Bufferobjet = NULL;
inventaire2 = NULL;
GESTE = NULL;
INVENTAIRE_OBJET = NULL;
FORETSPR = NULL;
COUCOU = NULL;
chemin = NULL;
cache_souris = NULL;
BufLig = NULL;
Bufferdecor = NULL;
ADR_FICHIER_OBJ = NULL;
}
Globals::~Globals() {
free(ICONE);
free(BUF_ZONE);
free(CACHE_BANQUE[6]);
free(Winventaire);
free(texte_tmp);
free(SPRITE_ECRAN);
free(SAUVEGARDE);
free(BUFFERTAPE);
free(Bufferobjet);
free(inventaire2);
free(GESTE);
free(INVENTAIRE_OBJET);
free(FORETSPR);
free(COUCOU);
free(chemin);
free(cache_souris);
free(Bufferdecor);
free(ADR_FICHIER_OBJ);
}
void Globals::setConfig() {
@ -69,4 +115,507 @@ void Globals::setConfig() {
}
}
void Globals::clearAll() {
// TODO: The original allocated an explicit memory block for the null pointer
// to point to. For now, we're seeing if the NULL value will do as well
for (int idx = 0; idx < 6; ++idx)
CACHE_BANQUE[idx] = PTRNUL;
nbrligne = 80;
INIT_ANIM();
texte_tmp = PTRNUL;
texte_long = 0;
police = (void *)PTRNUL;
police_h = 0;
police_l = 0;
hauteur_boite = 0;
largeur_boite = 0;
for (int idx = 0; idx < 11; ++idx) {
Txt[idx].field0 = 0;
Txt[idx].field12 = 0;
Txt[idx].field3FC = 0;
Txt[idx].field3FE = 0;
Txt[idx].field400 = 0;
Txt[idx].field404 = 0;
Txt[idx].field406 = 0;
Txt[idx].field408 = 0;
ListeTxt[idx].field0 = 0;
}
INIT_VBOB();
ADR_FICHIER_OBJ = PTRNUL;
NUM_FICHIER_OBJ = 0;
Bufferdecor = PTRNUL;
Bufferobjet = PTRNUL;
Winventaire = PTRNUL;
inventaire2 = PTRNUL;
COUCOU = PTRNUL;
SPRITE_ECRAN = PTRNUL;
SAUVEGARDE = PTRNUL;
OBJET_EN_COURS = 0;
for (int idx = 0; idx < 105; ++idx) {
ZoneP[idx].field0 = 0;
ZoneP[idx].field2 = 0;
ZoneP[idx].field4 = 0;
}
essai0 = PTRNUL;
essai1 = PTRNUL;
essai2 = PTRNUL;
BufLig = PTRNUL;
chemin = PTRNUL;
for (int idx = 0; idx < 400; ++idx) {
Ligne[idx].field0 = 0;
Ligne[idx].field2 = 0;
Ligne[idx].field4 = 0;
Ligne[idx].field6 = 0;
Ligne[idx].field8 = 0;
Ligne[idx].field12 = PTRNUL;
LigneZone[idx].field0 = 0;
LigneZone[idx].field2 = 0;
LigneZone[idx].field4 = PTRNUL;
}
for (int idx = 0; idx < 100; ++idx) {
CarreZone[idx].field0 = 0;
}
texte_long = 0;
texte_tmp = PTRNUL;
BUFFERTAPE = (byte *)malloc(85000);
SAUVEGARDE = (byte *)malloc(2050);
memset(SAUVEGARDE, 0, 1999);
essai0 = BUFFERTAPE;
essai1 = BUFFERTAPE + 25000;
essai2 = BUFFERTAPE + 50000;
BufLig = (BUFFERTAPE + 75000);
largeur_boite = 240;
TEXTE_FORMATE = 300;
Bufferobjet = (byte *)malloc(2500);
INVENTAIRE_OBJET = (byte *)malloc(2500);
ADR_FICHIER_OBJ = PTRNUL;
FORETSPR = PTRNUL;
FORET = 0;
cache_souris = (byte *)malloc(2500);
GESTE = PTRNUL;
GESTE_FLAG = false;
}
void Globals::HOPKINS_DATA() {
// TODO: Replace all the '/ 2' with constant values
switch (PERSO_TYPE) {
case 0:
HopkinsArr[0 / 2] = 0;
HopkinsArr[2 / 2] = -2;
HopkinsArr[4 / 2] = 0;
HopkinsArr[6 / 2] = -3;
HopkinsArr[8 / 2] = 0;
HopkinsArr[10 / 2] = -6;
HopkinsArr[12 / 2] = 0;
HopkinsArr[14 / 2] = -1;
HopkinsArr[16 / 2] = 0;
HopkinsArr[18 / 2] = -3;
HopkinsArr[20 / 2] = 0;
HopkinsArr[22 / 2] = -3;
HopkinsArr[24 / 2] = 0;
HopkinsArr[26 / 2] = -5;
HopkinsArr[28 / 2] = 0;
HopkinsArr[30 / 2] = -3;
HopkinsArr[32 / 2] = 0;
HopkinsArr[34 / 2] = -6;
HopkinsArr[36 / 2] = 0;
HopkinsArr[38 / 2] = -3;
HopkinsArr[40 / 2] = 0;
HopkinsArr[42 / 2] = -3;
HopkinsArr[44 / 2] = 0;
HopkinsArr[46 / 2] = -3;
HopkinsArr[48 / 2] = 9;
HopkinsArr[50 / 2] = -4;
HopkinsArr[52 / 2] = 8;
HopkinsArr[54 / 2] = -4;
HopkinsArr[56 / 2] = 6;
HopkinsArr[58 / 2] = -2;
HopkinsArr[60 / 2] = 9;
HopkinsArr[62 / 2] = -2;
HopkinsArr[64 / 2] = 9;
HopkinsArr[66 / 2] = -3;
HopkinsArr[68 / 2] = 9;
HopkinsArr[70 / 2] = -3;
HopkinsArr[72 / 2] = 9;
HopkinsArr[74 / 2] = -4;
HopkinsArr[76 / 2] = 9;
HopkinsArr[78 / 2] = -2;
HopkinsArr[80 / 2] = 9;
HopkinsArr[82 / 2] = -2;
HopkinsArr[84 / 2] = 8;
HopkinsArr[86 / 2] = -2;
HopkinsArr[88 / 2] = 9;
HopkinsArr[90 / 2] = -3;
HopkinsArr[92 / 2] = 9;
HopkinsArr[94 / 2] = -2;
HopkinsArr[96 / 2] = 13;
HopkinsArr[98 / 2] = 0;
HopkinsArr[100 / 2] = 13;
HopkinsArr[102 / 2] = 0;
HopkinsArr[104 / 2] = 13;
HopkinsArr[106 / 2] = 0;
HopkinsArr[108 / 2] = 13;
HopkinsArr[110 / 2] = 0;
HopkinsArr[112 / 2] = 14;
HopkinsArr[114 / 2] = 0;
HopkinsArr[116 / 2] = 13;
HopkinsArr[118 / 2] = 0;
HopkinsArr[120 / 2] = 13;
HopkinsArr[122 / 2] = 0;
HopkinsArr[124 / 2] = 12;
HopkinsArr[126 / 2] = 0;
HopkinsArr[128 / 2] = 12;
HopkinsArr[130 / 2] = 0;
HopkinsArr[132 / 2] = 14;
HopkinsArr[134 / 2] = 0;
HopkinsArr[136 / 2] = 13;
HopkinsArr[138 / 2] = 0;
HopkinsArr[140 / 2] = 14;
HopkinsArr[142 / 2] = 0;
HopkinsArr[144 / 2] = 10;
HopkinsArr[146 / 2] = 3;
HopkinsArr[148 / 2] = 9;
HopkinsArr[150 / 2] = 3;
HopkinsArr[152 / 2] = 10;
HopkinsArr[154 / 2] = 4;
HopkinsArr[156 / 2] = 8;
HopkinsArr[158 / 2] = 2;
HopkinsArr[160 / 2] = 7;
HopkinsArr[162 / 2] = 1;
HopkinsArr[164 / 2] = 10;
HopkinsArr[166 / 2] = 2;
HopkinsArr[168 / 2] = 9;
HopkinsArr[170 / 2] = 2;
HopkinsArr[172 / 2] = 7;
HopkinsArr[174 / 2] = 4;
HopkinsArr[176 / 2] = 7;
HopkinsArr[178 / 2] = 3;
HopkinsArr[180 / 2] = 8;
HopkinsArr[182 / 2] = 0;
HopkinsArr[184 / 2] = 9;
HopkinsArr[186 / 2] = 1;
HopkinsArr[188 / 2] = 9;
HopkinsArr[190 / 2] = 1;
HopkinsArr[192 / 2] = 0;
HopkinsArr[194 / 2] = 4;
HopkinsArr[196 / 2] = 0;
HopkinsArr[198 / 2] = 4;
HopkinsArr[200 / 2] = 0;
HopkinsArr[202 / 2] = 6;
HopkinsArr[204 / 2] = 0;
HopkinsArr[206 / 2] = 3;
HopkinsArr[208 / 2] = 0;
HopkinsArr[210 / 2] = 4;
HopkinsArr[212 / 2] = 0;
HopkinsArr[214 / 2] = 3;
HopkinsArr[216 / 2] = 0;
HopkinsArr[218 / 2] = 4;
HopkinsArr[220 / 2] = 0;
HopkinsArr[222 / 2] = 4;
HopkinsArr[224 / 2] = 0;
HopkinsArr[226 / 2] = 6;
HopkinsArr[228 / 2] = 0;
HopkinsArr[230 / 2] = 3;
HopkinsArr[232 / 2] = 0;
HopkinsArr[234 / 2] = 3;
HopkinsArr[236 / 2] = 0;
HopkinsArr[238 / 2] = 3;
break;
case 1:
HopkinsArr[0] = 0;
HopkinsArr[2 / 2] = -2;
HopkinsArr[4 / 2] = 0;
HopkinsArr[6 / 2] = -2;
HopkinsArr[8 / 2] = 0;
HopkinsArr[10 / 2] = -5;
HopkinsArr[12 / 2] = 0;
HopkinsArr[14 / 2] = -1;
HopkinsArr[16 / 2] = 0;
HopkinsArr[18 / 2] = -2;
HopkinsArr[20 / 2] = 0;
HopkinsArr[22 / 2] = -2;
HopkinsArr[24 / 2] = 0;
HopkinsArr[26 / 2] = -4;
HopkinsArr[28 / 2] = 0;
HopkinsArr[30 / 2] = -2;
HopkinsArr[32 / 2] = 0;
HopkinsArr[34 / 2] = -5;
HopkinsArr[36 / 2] = 0;
HopkinsArr[38 / 2] = -2;
HopkinsArr[40 / 2] = 0;
HopkinsArr[42 / 2] = -2;
HopkinsArr[44 / 2] = 0;
HopkinsArr[46 / 2] = -2;
HopkinsArr[48 / 2] = 11;
HopkinsArr[50 / 2] = 0;
HopkinsArr[52 / 2] = 10;
HopkinsArr[54 / 2] = 0;
HopkinsArr[56 / 2] = 11;
HopkinsArr[58 / 2] = 0;
HopkinsArr[60 / 2] = 11;
HopkinsArr[62 / 2] = 0;
HopkinsArr[64 / 2] = 11;
HopkinsArr[66 / 2] = 0;
HopkinsArr[68 / 2] = 11;
HopkinsArr[70 / 2] = 0;
HopkinsArr[72 / 2] = 12;
HopkinsArr[74 / 2] = 0;
HopkinsArr[76 / 2] = 11;
HopkinsArr[78 / 2] = 0;
HopkinsArr[80 / 2] = 9;
HopkinsArr[82 / 2] = 0;
HopkinsArr[84 / 2] = 10;
HopkinsArr[86 / 2] = 0;
HopkinsArr[88 / 2] = 11;
HopkinsArr[90 / 2] = 0;
HopkinsArr[92 / 2] = 11;
HopkinsArr[94 / 2] = 0;
HopkinsArr[96 / 2] = 11;
HopkinsArr[98 / 2] = 0;
HopkinsArr[100 / 2] = 10;
HopkinsArr[102 / 2] = 0;
HopkinsArr[104 / 2] = 11;
HopkinsArr[106 / 2] = 0;
HopkinsArr[108 / 2] = 11;
HopkinsArr[110 / 2] = 0;
HopkinsArr[112 / 2] = 11;
HopkinsArr[114 / 2] = 0;
HopkinsArr[116 / 2] = 11;
HopkinsArr[118 / 2] = 0;
HopkinsArr[120 / 2] = 12;
HopkinsArr[122 / 2] = 0;
HopkinsArr[124 / 2] = 11;
HopkinsArr[126 / 2] = 0;
HopkinsArr[128 / 2] = 9;
HopkinsArr[130 / 2] = 0;
HopkinsArr[132 / 2] = 10;
HopkinsArr[134 / 2] = 0;
HopkinsArr[136 / 2] = 11;
HopkinsArr[138 / 2] = 0;
HopkinsArr[140 / 2] = 11;
HopkinsArr[142 / 2] = 0;
HopkinsArr[144 / 2] = 11;
HopkinsArr[146 / 2] = 0;
HopkinsArr[148 / 2] = 10;
HopkinsArr[150 / 2] = 0;
HopkinsArr[152 / 2] = 11;
HopkinsArr[154 / 2] = 0;
HopkinsArr[156 / 2] = 11;
HopkinsArr[158 / 2] = 0;
HopkinsArr[160 / 2] = 11;
HopkinsArr[162 / 2] = 0;
HopkinsArr[164 / 2] = 11;
HopkinsArr[166 / 2] = 0;
HopkinsArr[168 / 2] = 12;
HopkinsArr[170 / 2] = 0;
HopkinsArr[172 / 2] = 11;
HopkinsArr[174 / 2] = 0;
HopkinsArr[176 / 2] = 9;
HopkinsArr[178 / 2] = 0;
HopkinsArr[180 / 2] = 10;
HopkinsArr[182 / 2] = 0;
HopkinsArr[184 / 2] = 11;
HopkinsArr[186 / 2] = 0;
HopkinsArr[188 / 2] = 11;
HopkinsArr[190 / 2] = 0;
HopkinsArr[192 / 2] = 0;
HopkinsArr[194 / 2] = 3;
HopkinsArr[196 / 2] = 0;
HopkinsArr[198 / 2] = 3;
HopkinsArr[200 / 2] = 0;
HopkinsArr[202 / 2] = 5;
HopkinsArr[204 / 2] = 0;
HopkinsArr[206 / 2] = 3;
HopkinsArr[208 / 2] = 0;
HopkinsArr[210 / 2] = 3;
HopkinsArr[212 / 2] = 0;
HopkinsArr[214 / 2] = 3;
HopkinsArr[216 / 2] = 0;
HopkinsArr[218 / 2] = 3;
HopkinsArr[220 / 2] = 0;
HopkinsArr[222 / 2] = 3;
HopkinsArr[224 / 2] = 0;
HopkinsArr[226 / 2] = 5;
HopkinsArr[228 / 2] = 0;
HopkinsArr[230 / 2] = 3;
HopkinsArr[232 / 2] = 0;
HopkinsArr[234 / 2] = 3;
HopkinsArr[236 / 2] = 0;
HopkinsArr[238 / 2] = 3;
break;
case 2:
HopkinsArr[0] = 0;
HopkinsArr[2 / 2] = -2;
HopkinsArr[4 / 2] = 0;
HopkinsArr[6 / 2] = 0;
HopkinsArr[8 / 2] = 0;
HopkinsArr[10 / 2] = -3;
HopkinsArr[12 / 2] = 0;
HopkinsArr[14 / 2] = -2;
HopkinsArr[16 / 2] = 0;
HopkinsArr[18 / 2] = -2;
HopkinsArr[20 / 2] = 0;
HopkinsArr[22 / 2] = -1;
HopkinsArr[24 / 2] = 0;
HopkinsArr[26 / 2] = -2;
HopkinsArr[28 / 2] = 0;
HopkinsArr[30 / 2] = -1;
HopkinsArr[32 / 2] = 0;
HopkinsArr[34 / 2] = -3;
HopkinsArr[36 / 2] = 0;
HopkinsArr[38 / 2] = -2;
HopkinsArr[40 / 2] = 0;
HopkinsArr[42 / 2] = -2;
HopkinsArr[44 / 2] = 0;
HopkinsArr[46 / 2] = -2;
HopkinsArr[48 / 2] = 8;
HopkinsArr[50 / 2] = 0;
HopkinsArr[52 / 2] = 9;
HopkinsArr[54 / 2] = 0;
HopkinsArr[56 / 2] = 5;
HopkinsArr[58 / 2] = 0;
HopkinsArr[60 / 2] = 9;
HopkinsArr[62 / 2] = 0;
HopkinsArr[64 / 2] = 7;
HopkinsArr[66 / 2] = 0;
HopkinsArr[68 / 2] = 7;
HopkinsArr[70 / 2] = 0;
HopkinsArr[72 / 2] = 7;
HopkinsArr[74 / 2] = 0;
HopkinsArr[76 / 2] = 7;
HopkinsArr[78 / 2] = 0;
HopkinsArr[80 / 2] = 6;
HopkinsArr[82 / 2] = 0;
HopkinsArr[84 / 2] = 7;
HopkinsArr[86 / 2] = 0;
HopkinsArr[88 / 2] = 6;
HopkinsArr[90 / 2] = 0;
HopkinsArr[92 / 2] = 9;
HopkinsArr[94 / 2] = 0;
HopkinsArr[96 / 2] = 8;
HopkinsArr[98 / 2] = 0;
HopkinsArr[100 / 2] = 9;
HopkinsArr[102 / 2] = 0;
HopkinsArr[104 / 2] = 5;
HopkinsArr[106 / 2] = 0;
HopkinsArr[108 / 2] = 9;
HopkinsArr[110 / 2] = 0;
HopkinsArr[112 / 2] = 7;
HopkinsArr[114 / 2] = 0;
HopkinsArr[116 / 2] = 7;
HopkinsArr[118 / 2] = 0;
HopkinsArr[120 / 2] = 7;
HopkinsArr[122 / 2] = 0;
HopkinsArr[124 / 2] = 7;
HopkinsArr[126 / 2] = 0;
HopkinsArr[128 / 2] = 6;
HopkinsArr[130 / 2] = 0;
HopkinsArr[132 / 2] = 7;
HopkinsArr[134 / 2] = 0;
HopkinsArr[136 / 2] = 6;
HopkinsArr[138 / 2] = 0;
HopkinsArr[140 / 2] = 9;
HopkinsArr[142 / 2] = 0;
HopkinsArr[144 / 2] = 8;
HopkinsArr[146 / 2] = 0;
HopkinsArr[148 / 2] = 9;
HopkinsArr[150 / 2] = 0;
HopkinsArr[152 / 2] = 5;
HopkinsArr[154 / 2] = 0;
HopkinsArr[156 / 2] = 9;
HopkinsArr[158 / 2] = 0;
HopkinsArr[160 / 2] = 7;
HopkinsArr[162 / 2] = 0;
HopkinsArr[164 / 2] = 7;
HopkinsArr[166 / 2] = 0;
HopkinsArr[168 / 2] = 7;
HopkinsArr[170 / 2] = 0;
HopkinsArr[172 / 2] = 7;
HopkinsArr[174 / 2] = 0;
HopkinsArr[176 / 2] = 6;
HopkinsArr[178 / 2] = 0;
HopkinsArr[180 / 2] = 7;
HopkinsArr[182 / 2] = 0;
HopkinsArr[184 / 2] = 6;
HopkinsArr[186 / 2] = 0;
HopkinsArr[188 / 2] = 9;
HopkinsArr[190 / 2] = 0;
HopkinsArr[192 / 2] = 0;
HopkinsArr[194 / 2] = 2;
HopkinsArr[196 / 2] = 0;
HopkinsArr[198 / 2] = 0;
HopkinsArr[200 / 2] = 0;
HopkinsArr[202 / 2] = 2;
HopkinsArr[204 / 2] = 0;
HopkinsArr[206 / 2] = 1;
HopkinsArr[208 / 2] = 0;
HopkinsArr[210 / 2] = 2;
HopkinsArr[212 / 2] = 0;
HopkinsArr[214 / 2] = 2;
HopkinsArr[216 / 2] = 0;
HopkinsArr[218 / 2] = 2;
HopkinsArr[220 / 2] = 0;
HopkinsArr[222 / 2] = 2;
HopkinsArr[224 / 2] = 0;
HopkinsArr[226 / 2] = 2;
HopkinsArr[228 / 2] = 0;
HopkinsArr[230 / 2] = 1;
HopkinsArr[232 / 2] = 0;
HopkinsArr[234 / 2] = 2;
HopkinsArr[236 / 2] = 0;
HopkinsArr[238 / 2] = 2;
break;
default:
break;
}
g_old_anim = -1;
g_old_sens = -1;
}
void Globals::INIT_ANIM() {
for (int idx = 0; idx < 35; ++idx) {
Bge_Anim[idx].field0 = PTRNUL;
Bge_Anim[idx].field4 = 0;
}
for (int idx = 0; idx < 8; ++idx) {
Bank[idx].field0 = PTRNUL;
Bank[idx].field4 = 0;
Bank[idx].field5 = 0;
Bank[idx].field19 = 0;
Bank[idx].field1C = 0;
}
}
void Globals::INIT_VBOB() {
for (int idx = 0; idx < 30; ++idx) {
VBob[idx].field4 = 0;
VBob[idx].field6 = 0;
VBob[idx].field8 = 0;
VBob[idx].fieldA = 0;
VBob[idx].fieldC = 0;
VBob[idx].field10 = PTRNUL;
VBob[idx].field0 = PTRNUL;
VBob[idx].field1C = PTRNUL;
}
}
} // End of namespace Hopkins

View File

@ -28,6 +28,70 @@
namespace Hopkins {
struct TxtItem {
int field0;
int field12;
int field3FC;
int field3FE;
int field400;
int field404;
int field406;
int field408;
};
struct ListeTxtItem {
int field0;
};
struct ZonePItem {
int field0;
int field2;
int field4;
};
struct LigneItem {
int field0;
int field2;
int field4;
int field6;
int field8;
byte *field12;
};
struct LigneZoneItem {
int field0;
int field2;
byte *field4;
};
struct CarreZoneItem {
int field0;
};
struct BgeAnimItem {
byte *field0;
int field4;
};
struct BankItem {
byte *field0;
int8 field4;
int8 field5;
int8 field19;
uint32 field1C;
};
struct VBobItem {
byte *field0;
int field4;
int field6;
int field8;
int fieldA;
int fieldC;
byte *field10;
byte *field1C;
};
/**
* Engine Globals
*/
@ -46,6 +110,7 @@ public:
bool XFORCE16;
bool XFORCE8;
bool CARD_SB;
int PERSO_TYPE;
int vitesse;
int INSTALL_TYPE;
Common::String HOPIMAGE;
@ -59,17 +124,80 @@ public:
Common::String HOPSEQ;
Common::String FICH_ZONE;
Common::String FICH_TEXTE;
Common::String NFICHIER;
int SOUNDVOL;
int MUSICVOL;
int VOICEVOL;
bool SOUNDOFF;
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;
int g_old_sens;
int HopkinsArr[140];
void *police;
int police_l;
int police_h;
byte *TETE;
byte *ICONE;
byte *BUF_ZONE;
byte *CACHE_BANQUE[6];
TxtItem Txt[11];
ListeTxtItem ListeTxt[11];
ZonePItem ZoneP[105];
LigneItem Ligne[400];
LigneZoneItem LigneZone[400];
CarreZoneItem CarreZone[100];
BgeAnimItem Bge_Anim[35];
BankItem Bank[8];
VBobItem VBob[35];
byte *Winventaire;
byte *texte_tmp;
int texte_long;
int TEXTE_FORMATE;
byte *SPRITE_ECRAN;
byte *SAUVEGARDE;
byte *BUFFERTAPE;
byte *essai0;
byte *essai1;
byte *essai2;
byte *Bufferobjet;
byte *inventaire2;
byte *GESTE;
int OBJET_EN_COURS;
int NUM_FICHIER_OBJ;
int nbrligne;
int largeur_boite;
byte *INVENTAIRE_OBJET;
int hauteur_boite;
bool GESTE_FLAG;
byte *FORETSPR;
int FORET;
byte *COUCOU;
byte *chemin;
byte *cache_souris;
byte *BufLig;
byte *Bufferdecor;
byte *ADR_FICHIER_OBJ;
Globals();
~Globals();
void setConfig();
void clearAll();
void HOPKINS_DATA();
void INIT_ANIM();
void INIT_VBOB();
};
#define PTRNUL (byte *)NULL
} // End of namespace Hopkins
#endif /* HOPKINS_GLOBALS_H */

View File

@ -25,6 +25,7 @@
#include "common/debug-channels.h"
#include "common/events.h"
#include "common/file.h"
#include "engines/util.h"
#include "hopkins/hopkins.h"
#include "hopkins/files.h"
@ -50,53 +51,11 @@ Common::Error HopkinsEngine::run() {
FileManager::Chage_Inifile(iniParams);
processIniParams(iniParams);
GLOBALS.setConfig();
FileManager::F_Censure();
INIT_SYSTEM();
/*
if ( FR == 1 )
{
*(_DWORD *)FICH_ZONE = dword_807B6E6;
*(_DWORD *)&FICH_ZONE[4] = dword_807B6EA;
*(_WORD *)&FICH_ZONE[8] = word_807B6EE;
FICH_ZONE[10] = byte_807B6F0;
*(_DWORD *)FICH_TEXTE = dword_807B6F1;
*(_DWORD *)&FICH_TEXTE[4] = dword_807B6F5;
*(_DWORD *)&FICH_TEXTE[8] = dword_807B6F9;
}
if ( !FR )
{
*(_DWORD *)FICH_ZONE = dword_807B6FD;
*(_DWORD *)&FICH_ZONE[4] = dword_807B701;
*(_WORD *)&FICH_ZONE[8] = word_807B705;
FICH_ZONE[10] = byte_807B707;
*(_DWORD *)FICH_TEXTE = dword_807B708;
*(_DWORD *)&FICH_TEXTE[4] = dword_807B70C;
*(_DWORD *)&FICH_TEXTE[8] = dword_807B710;
}
if ( FR == 2 )
{
*(_DWORD *)FICH_ZONE = dword_807B714;
*(_DWORD *)&FICH_ZONE[4] = dword_807B718;
*(_WORD *)&FICH_ZONE[8] = word_807B71C;
FICH_ZONE[10] = byte_807B71E;
*(_DWORD *)FICH_TEXTE = dword_807B71F;
*(_DWORD *)&FICH_TEXTE[4] = dword_807B723;
*(_DWORD *)&FICH_TEXTE[8] = dword_807B727;
}
*(_DWORD *)HOPSOUND = dword_807B72B;
*(_WORD *)&HOPSOUND[4] = word_807B72F;
*(_DWORD *)HOPMUSIC = dword_807B731;
*(_WORD *)&HOPMUSIC[4] = word_807B735;
*(_DWORD *)HOPVOICE = dword_807B737;
*(_WORD *)&HOPVOICE[4] = word_807B73B;
*(_DWORD *)HOPANM = dword_807B73D;
*(_DWORD *)HOPSEQ = dword_807B741;
MUSICVOL = 6;
SOUNDVOL = 6;
VOICEVOL = 6;
MUSICOFF = 0;
SOUNDOFF = 0;
VOICEOFF = 0;
F_Censure();
INIT_SYSTEM();
REDRAW = 0;
SDL_WM_SetCaption("Hopkins FBI for Linux ", "LINUX");
Init_Interrupt();
@ -126,7 +85,7 @@ Common::Error HopkinsEngine::run() {
INTRORUN(a1);
iRegul = 0;
CONSTRUIT_SYSTEM("PERSO.SPR");
PERSO = CHARGE_FICHIER(NFICHIER);
PERSO = CHARGE_FICHIER(GLOBALS.NFICHIER);
PERSO_TYPE = 0;
PLANX = 0;
PLANY = 0;
@ -538,4 +497,80 @@ void HopkinsEngine::processIniParams(Common::StringMap &iniParams) {
GLOBALS.CARD_SB = iniParams["SOUND"] == "YES";
}
void HopkinsEngine::INIT_SYSTEM() {
initGraphics(640, 480, true);
// TODO: init surfaces
//VESA_SCREEN = dos_malloc2(0x96000u);
//VESA_BUFFER = dos_malloc2(0x96000u);
_mouse.mouse_linux = true;
switch (GLOBALS.FR) {
case 0:
if (!_mouse.mouse_linux)
FileManager::CONSTRUIT_SYSTEM("SOUAN.SPR");
if (!GLOBALS.FR && _mouse.mouse_linux)
FileManager::CONSTRUIT_SYSTEM("LSOUAN.SPR");
break;
case 1:
FileManager::CONSTRUIT_SYSTEM("LSOUFR.SPR");
break;
case 2:
FileManager::CONSTRUIT_SYSTEM("SOUES.SPR");
break;
}
if (_mouse.mouse_linux) {
_mouse.souris_sizex = 52;
_mouse.souris_sizey = 32;
} else {
_mouse.souris_sizex = 34;
_mouse.souris_sizey = 20;
}
_mouse.pointeur_souris = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
GLOBALS.clearAll();
FileManager::CONSTRUIT_SYSTEM("FONTE3.SPR");
GLOBALS.police = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
GLOBALS.police_l = 12;
GLOBALS.police_h = 21;
FileManager::CONSTRUIT_SYSTEM("ICONE.SPR");
GLOBALS.ICONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
FileManager::CONSTRUIT_SYSTEM("TETE.SPR");
GLOBALS.TETE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
switch (GLOBALS.FR) {
case 0:
FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONEAN.TXT");
GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
break;
case 1:
FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONE01.TXT");
GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
break;
case 2:
FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONEES.TXT");
GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
break;
}
GLOBALS.min_x = 0;
GLOBALS.min_y = 20;
GLOBALS.max_x = 1280;
GLOBALS.max_y = 460;
_mouse.INSTALL_SOURIS();
_mouse.souris_on();
_mouse.souris_flag = false;
_mouse.souris_max();
GLOBALS.HOPKINS_DATA();
_mouse.ofset_souris_x = 0;
_mouse.ofset_souris_y = 0;
GLOBALS.lItCounter = 0;
GLOBALS.lOldItCounter = 0;
}
} // End of namespace Hopkins

View File

@ -30,6 +30,8 @@
#include "common/hash-str.h"
#include "common/util.h"
#include "engines/engine.h"
#include "graphics/surface.h"
#include "hopkins/events.h"
#include "hopkins/globals.h"
/**
@ -60,11 +62,16 @@ class HopkinsEngine : public Engine {
private:
const HopkinsGameDescription *_gameDescription;
Common::RandomSource _randomSource;
Graphics::Surface VESA_SCREEN;
Graphics::Surface VESA_BUFFER;
Mouse _mouse;
/**
* Processes the loaded list of ini file parameters
*/
void processIniParams(Common::StringMap &iniParams);
void INIT_SYSTEM();
protected:
// Engine APIs
virtual Common::Error run();

View File

@ -2,6 +2,7 @@ MODULE := engines/hopkins
MODULE_OBJS := \
detection.o \
events.o \
files.o \
globals.o \
hopkins.o