HOPKINS: Implemented many of the previously stubbed methods

This commit is contained in:
Paul Gilbert 2012-09-28 22:15:59 +10:00
parent 221050f39f
commit 7c9ad56aac
14 changed files with 920 additions and 219 deletions

View File

@ -36,7 +36,7 @@ EventsManager::EventsManager() {
mouse_linux = false;
souris_sizex = souris_sizey = 0;
ofset_souris_x = ofset_souris_y = 0;
start_x = start_y = 0;
_vm->_eventsManager.start_x = start_y = 0;
CASSE = false;
souris_n = 0;
souris_bb = 0;
@ -85,14 +85,14 @@ void EventsManager::souris_max() {
}
int EventsManager::XMOUSE() {
souris_x = start_x + g_system->getEventManager()->getMousePos().x;
souris_x = _vm->_eventsManager.start_x + g_system->getEventManager()->getMousePos().x;
souris_y = g_system->getEventManager()->getMousePos().y;
return souris_x + ofset_souris_x;
}
int EventsManager::YMOUSE() {
souris_x = start_x + g_system->getEventManager()->getMousePos().x;
souris_x = _vm->_eventsManager.start_x + g_system->getEventManager()->getMousePos().x;
souris_y = g_system->getEventManager()->getMousePos().y;
return souris_y + ofset_souris_y;
@ -446,13 +446,13 @@ LABEL_65:
}
_vm->_globals.NBBLOC = 0;
start_x = v4;
_vm->_eventsManager.start_x = v4;
ofscroll = v4;
SCROLL = v4;
}
OLD_SCROLL = v4;
start_x = v4;
_vm->_eventsManager.start_x = v4;
ofscroll = v4;
}

View File

@ -125,6 +125,15 @@ void FileManager::DMESS1() {
// No implementation in original
}
void FileManager::bload(const Common::String &file, byte *buf) {
Common::File f;
if (!f.open(file))
error("Error openinig file - %s", file.c_str());
int32 filesize = f.size();
FileManager::bload_it(f, buf, filesize);
f.close();
}
int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) {
return stream.read(buf, nbytes);
}
@ -325,4 +334,8 @@ uint32 FileManager::FLONG(const Common::String &filename) {
return size;
}
void FileManager::CONSTRUIT_LINUX(const Common::String &file) {
warning("TODO: CONSTRUIT_LINUX");
}
} // End of namespace Hopkins

View File

@ -39,12 +39,14 @@ public:
static byte *CHARGE_FICHIER(const Common::String &file);
static void DMESS();
static void DMESS1();
static void bload(const Common::String &file, byte *buf);
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);
static byte *LIBERE_FICHIER(byte *ptr);
static byte *RECHERCHE_CAT(const Common::String &file, int a2);
static void CONSTRUIT_LINUX(const Common::String &file);
/**
* Returns the size of a file. Throws an error if the file can't be found

View File

@ -330,7 +330,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename,
if (v17 < 0)
v17 = -v17;
*Txt[idx].field8 = 320 - v17;
v73 = start_x + 320 - v17;
v73 = _vm->_eventsManager.start_x + 320 - v17;
v58 = 1;
v18 = 0;
@ -432,10 +432,10 @@ LABEL_57:
} while (v68 <= 19);
if ((unsigned __int16)(Txt[idx].field3FC - 2) > 1u) {
for (i = xp - start_x; largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC]; i -= 2)
for (i = xp - _vm->_eventsManager.start_x; largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC]; i -= 2)
;
Txt[idx].field8 = i;
v73 = start_x + i;
v73 = _vm->_eventsManager.start_x + i;
} else {
if (nbrligne == 639) {
while (largeur_boite + v73 > 638 && v73 > -2)
@ -462,8 +462,8 @@ LABEL_57:
v27 = -v27;
Txt[v26].field8 = 315 - v27;
v28 = start_x + 315 - v27;
v73 = start_x + 315 - v27;
v28 = _vm->_eventsManager.start_x + 315 - v27;
v73 = _vm->_eventsManager.start_x + 315 - v27;
Txt[v26].fieldA = 50;
v70 = 50;
v55 = 50;

View File

@ -21,6 +21,7 @@
*/
#include "common/textconsole.h"
#include "common/file.h"
#include "hopkins/globals.h"
#include "hopkins/files.h"
#include "hopkins/font.h"
@ -718,4 +719,110 @@ byte *Globals::LIBERE_FICHIER(byte *p) {
return PTRNUL;
}
void Globals::RESET_CACHE() {
byte *dataP;
for (int idx = 1; idx <= 5; ++idx) {
dataP = CACHE_BANQUE[idx];
if (dataP != PTRNUL && dataP)
CACHE_BANQUE[idx] = dos_free2(CACHE_BANQUE[idx]);
CACHE_BANQUE[idx] = PTRNUL;
}
for (int idx = 0; idx <= 20; ++idx) {
Cache[idx].fieldC = PTRNUL;
Cache[idx].field0 = 0;
Cache[idx].field4 = 0;
Cache[idx].field2 = 0;
Cache[idx].fieldA = 0;
Cache[idx].field6 = 0;
Cache[idx].field8 = 0;
Cache[idx].field10 = 0;
Cache[idx].field12 = 0;
Cache[idx].field14 = 0;
}
CACHEFLAG = 0;
}
void Globals::CACHE_ON() {
CACHEFLAG = 1;
}
void Globals::CACHE_OFF() {
CACHEFLAG = 0;
}
void Globals::CACHE_SUB(int idx) {
Cache[idx].fieldA = 0;
}
void Globals::CACHE_ADD(int idx) {
Cache[idx].fieldA = 1;
}
void Globals::CHARGE_CACHE(const Common::String &file) {
byte *v2;
int v4;
int v5;
int v6;
int v8;
int v9;
int v11;
byte *spriteData;
byte *ptr;
int v14;
int v15;
Common::String v16;
Common::File f;
RESET_CACHE();
FileManager::CONSTRUIT_FICHIER(HOPLINK, file);
ptr = FileManager::CHARGE_FICHIER(NFICHIER);
v16 = Common::String((const char *)ptr);
FileManager::CONSTRUIT_FICHIER(HOPLINK, v16);
if (!f.exists(NFICHIER)) {
spriteData = FileManager::CHARGE_FICHIER(NFICHIER);
CACHE_BANQUE[1] = spriteData;
v15 = 60;
v14 = 0;
do {
v11 = READ_LE_UINT16((uint16 *)ptr + v15);
v4 = READ_LE_UINT16((uint16 *)ptr + v15 + 1);
v5 = READ_LE_UINT16((uint16 *)ptr + v15 + 2);
v6 = v14;
Cache[v6].field14 = READ_LE_UINT16((uint16 *)ptr + v15 + 4);
Cache[v6].field2 = v11;
Cache[v6].field0 = v4;
Cache[v6].field4 = v5;
Cache[v6].field12 = 1;
if (spriteData == PTRNUL) {
Cache[v14].fieldA = 0;
} else {
v8 = _vm->_objectsManager.Get_Largeur(spriteData, v11);
v9 = _vm->_objectsManager.Get_Hauteur(spriteData, v11);
Cache[v14].fieldC = spriteData;
Cache[v14].field6 = v8;
Cache[v14].field8 = v9;
Cache[v14].fieldA = 1;
}
if ( !Cache[v14].field0 && !Cache[v14].field4 && !Cache[v14].field2)
Cache[v14].fieldA = 0;
v15 += 5;
++v14;
} while (v14 <= 21);
CACHE_ON();
v2 = ptr;
}
dos_free2(v2);
}
void Globals::B_CACHE_OFF(int idx) {
Bob[idx].field34 = 1;
}
} // End of namespace Hopkins

View File

@ -72,8 +72,17 @@ struct ListeItem {
int field0;
int field2;
int field4;
int x2;
int y2;
int width;
int height;
int fieldA;
};
struct Liste2Item {
int field0;
int field2;
int field4;
int width;
int height;
};
struct BobItem {
@ -113,14 +122,6 @@ struct BobItem {
int field4A;
};
struct Liste2Item {
int field0;
int field2;
int field4;
int field6;
int field8;
};
struct BlAnimItem {
uint32 v1;
uint32 v2;
@ -174,13 +175,19 @@ struct CacheItem {
int field6;
int field8;
int fieldA;
byte *fieldC;
int field10;
int field12;
int field14;
};
// Note: Fields decimal based for now
struct Sauvegarde {
int field4;
int field80;
int field170;
int field171;
int field172;
int field353;
int field354;
int field355;
@ -249,12 +256,12 @@ public:
BqeAnimItem Bqe_Anim[35];
BankItem Bank[8];
BobItem Bob[36];
ListeItem Liste[6];
Liste2Item Liste2[35];
BlAnimItem BL_ANIM[30];
VBobItem VBob[35];
ObjetWItem ObjetW[300];
BlocItem BLOC[250];
ListeItem Liste[7];
CacheItem Cache[25];
byte *Winventaire;
byte *texte_tmp;
@ -293,10 +300,12 @@ public:
int HELICO;
uint32 CAT_POSI;
uint32 CAT_TAILLE;
bool CAT_FLAG;
int iRegul;
bool BPP_NOAFF;
int SORTIE;
int PLANX, PLANY;
int PLANI;
int PASSWORD;
int NOSPRECRAN;
int ECRAN;
@ -322,9 +331,15 @@ public:
int opt_music;
int opt_txt;
int NBTRI;
int AFFLI;
int AFFIVBL;
int NOT_VERIF;
bool CACHEFLAG;
int AFFINVEN;
bool NOPARLE;
bool PLAN_FLAG;
int GOACTION;
int NECESSAIRE;
Globals();
~Globals();
@ -339,6 +354,14 @@ public:
byte *dos_malloc2(int count);
byte *dos_free2(byte *p);
byte *LIBERE_FICHIER(byte *p);
void RESET_CACHE();
void CACHE_ON();
void CACHE_OFF();
void CACHE_SUB(int idx);
void CACHE_ADD(int idx);
void CHARGE_CACHE(const Common::String &file);
void B_CACHE_OFF(int idx);
};
#define PTRNUL (byte *)NULL

View File

@ -43,7 +43,7 @@ GraphicsManager::GraphicsManager() {
nbrligne = 0;
Linear = false;
VideoPtr = NULL;
start_x = 0;
_vm->_eventsManager.start_x = 0;
ofscroll = 0;
SCROLL = 0;
PCX_L = PCX_H = 0;
@ -262,7 +262,7 @@ void GraphicsManager::INIT_TABLE(int a1, int a2, byte *palette) {
int GraphicsManager::SCROLL_ECRAN(int amount) {
int result = CLIP(amount, 0, SCREEN_WIDTH);
start_x = result;
_vm->_eventsManager.start_x = result;
ofscroll = result;
SCROLL = result;
return result;
@ -325,6 +325,10 @@ void GraphicsManager::Trans_bloc(byte *destP, byte *srcP, int count, int param1,
} while ( !breakFlag);
}
void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) {
warning("TODO: Trans_bloc2");
}
// TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder
void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) {
int filesize;
@ -811,9 +815,9 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface
setpal_vga256(palData2);
if (Winbpp == 2) {
if (SDL_ECHELLE)
m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
DD_VBL();
}
}
@ -824,9 +828,9 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface
// Refresh the screen
if (Winbpp == 2) {
if (SDL_ECHELLE)
m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
DD_VBL();
}
}
@ -859,9 +863,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac
setpal_vga256(palData);
if (Winbpp == 2) {
if (SDL_ECHELLE)
m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
DD_VBL();
}
@ -880,9 +884,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac
setpal_vga256(palData);
if (Winbpp == 2) {
if (SDL_ECHELLE)
m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
DD_VBL();
}
@ -899,7 +903,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac
if (Winbpp == 2) {
if (!SDL_ECHELLE) {
m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
return DD_VBL();
}
goto LABEL_28;
@ -913,12 +917,12 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac
setpal_vga256(palData);
if (Winbpp == 2) {
if (!SDL_ECHELLE) {
m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
return DD_VBL();
}
LABEL_28:
m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
return DD_VBL();
}
}
@ -953,9 +957,9 @@ void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surfa
if (Winbpp == 2) {
if (SDL_ECHELLE)
m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
DD_VBL();
}
@ -1494,17 +1498,17 @@ void GraphicsManager::Affiche_Segment_Vesa() {
dstRect.top = bloc.y1 * 2 + 30;
dstRect.setWidth((bloc.x2 - bloc.x1) * 2);
dstRect.setHeight((bloc.y2 - bloc.y1) * 2);
} else if (bloc.x2 > start_x && bloc.x1 < (start_x + SCREEN_WIDTH)) {
if (bloc.x1 < start_x)
bloc.x1 = start_x;
if (bloc.x2 > (start_x + SCREEN_WIDTH))
bloc.x2 = start_x + SCREEN_WIDTH;
} else if (bloc.x2 > _vm->_eventsManager.start_x && bloc.x1 < (_vm->_eventsManager.start_x + SCREEN_WIDTH)) {
if (bloc.x1 < _vm->_eventsManager.start_x)
bloc.x1 = _vm->_eventsManager.start_x;
if (bloc.x2 > (_vm->_eventsManager.start_x + SCREEN_WIDTH))
bloc.x2 = _vm->_eventsManager.start_x + SCREEN_WIDTH;
if (!SDL_ECHELLE) {
// Calculate the bounds
int xp = Magic_Number(bloc.x1) - 4;
if (xp < start_x)
xp = start_x;
if (xp < _vm->_eventsManager.start_x)
xp = _vm->_eventsManager.start_x;
int yp = Magic_Number(bloc.y1) - 4;
if (yp < 0)
yp = 0;
@ -1515,30 +1519,30 @@ void GraphicsManager::Affiche_Segment_Vesa() {
if (height < 4)
height = 4;
if ((xp - start_x + width) > SCREEN_WIDTH)
if ((xp - _vm->_eventsManager.start_x + width) > SCREEN_WIDTH)
xp -= 4;
if ((height - yp) > (SCREEN_HEIGHT - 40))
yp -= 4;
if (Winbpp == 2) {
m_scroll16A(VESA_BUFFER, xp, yp, width, height,
Reel_Zoom(xp - start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE));
Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE));
} else {
m_scroll2A(VESA_BUFFER, xp, yp, width, height,
Reel_Zoom(xp - start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE));
Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE));
}
dstRect.left = Reel_Zoom(xp - start_x, SDL_ECHELLE);
dstRect.left = Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE);
dstRect.top = Reel_Zoom(yp, SDL_ECHELLE);
dstRect.setWidth(Reel_Zoom(width, SDL_ECHELLE));
dstRect.setHeight(Reel_Zoom(height, SDL_ECHELLE));
} else {
if (Winbpp == 2) {
m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1,
bloc.x1 - start_x, bloc.y1);
bloc.x1 - _vm->_eventsManager.start_x, bloc.y1);
} else {
m_scroll(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1,
bloc.x1 - start_x, bloc.y1);
bloc.x1 - _vm->_eventsManager.start_x, bloc.y1);
}
}
}
@ -2131,10 +2135,10 @@ void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int
Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height);
}
void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY) {
void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) {
int top;
int width;
int height;
int croppedWidth;
int croppedHeight;
int v11;
int height2;
int top2;
@ -2142,28 +2146,28 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int x2, int y2,
left = x1;
top = y1;
width = x2;
height = y2;
croppedWidth = width;
croppedHeight = height;
if (x1 < min_x) {
width = x2 - (min_x - x1);
croppedWidth = width - (min_x - x1);
left = min_x;
}
if (y1 < min_y) {
height = y2 - (min_y - y1);
croppedHeight = height - (min_y - y1);
top = min_y;
}
top2 = top;
if (top + height > max_y)
height = max_y - top;
v11 = left + width;
if (top + croppedHeight > max_y)
croppedHeight = max_y - top;
v11 = left + croppedWidth;
if (v11 > max_x)
width = max_x - left;
croppedWidth = max_x - left;
if (width > 0 && height > 0) {
height2 = height;
Copy_Mem(surface, left, top2, width, height, destSurface, destX, destY);
Ajoute_Segment_Vesa(left, top2, left + width, top2 + height2);
if (croppedWidth > 0 && croppedHeight > 0) {
height2 = croppedHeight;
Copy_Mem(surface, left, top2, croppedWidth, croppedHeight, destSurface, destX, destY);
Ajoute_Segment_Vesa(left, top2, left + croppedWidth, top2 + height2);
}
}
@ -2241,4 +2245,47 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x
} while (v16 != 1);
}
void GraphicsManager::INI_ECRAN(const Common::String &file) {
warning("TODO: INI_ECRAN");
}
void GraphicsManager::INI_ECRAN2(const Common::String &file) {
warning("TODO: INI_ECRAN2");
}
void GraphicsManager::NB_SCREEN() {
byte *v0;
const byte *v1;
if (!_vm->_globals.NECESSAIRE)
INIT_TABLE(50, 65, Palette);
if (nbrligne == SCREEN_WIDTH)
Trans_bloc2(VESA_BUFFER, TABLE_COUL, 307200);
if (nbrligne == 1280)
Trans_bloc2(VESA_BUFFER, TABLE_COUL, 614400);
_vm->_graphicsManager.DD_Lock();
if (Winbpp == 2) {
if (SDL_ECHELLE)
m_scroll16A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
m_scroll16(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
}
if (Winbpp == 1) {
if (SDL_ECHELLE)
m_scroll2A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
m_scroll2(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
}
_vm->_graphicsManager.DD_Unlock();
v0 = VESA_SCREEN;
v1 = VESA_BUFFER;
memcpy(VESA_SCREEN, VESA_BUFFER, 0x95FFCu);
v1 = v1 + 614396;
v0 = v0 + 614396;
*v0 = *v1;
*(v0 + 2) = *(v1 + 2);
DD_VBL();
}
} // End of namespace Hopkins

View File

@ -68,7 +68,6 @@ public:
Graphics::Surface *VideoPtr;
byte *VESA_SCREEN;
byte *VESA_BUFFER;
int start_x;
int ofscroll;
int SCROLL;
byte HEADER_PCX[128];
@ -98,6 +97,7 @@ public:
int Largeur;
int Compteur_y;
int spec_largeur;
bool NOFADE;
public:
GraphicsManager();
~GraphicsManager();
@ -113,6 +113,7 @@ public:
void INIT_TABLE(int a1, int a2, byte *a3);
int SCROLL_ECRAN(int amount);
void Trans_bloc(byte *destP, byte *srcP, int count, int param1, int param2);
void Trans_bloc2(byte *surface, byte *col, int size);
void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag);
void Cls_Pal();
void souris_max();
@ -165,9 +166,12 @@ public:
int Reel_Reduc(int v, int percentage);
void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8);
void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex);
void SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY);
void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY);
void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY);
void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int transColour);
void INI_ECRAN(const Common::String &file);
void INI_ECRAN2(const Common::String &file);
void NB_SCREEN();
};
} // End of namespace Hopkins

View File

@ -197,7 +197,7 @@ LABEL_13:
if (GLOBALS.SORTIE != 4)
break;
_globals.DESACTIVE_INVENT = true;
PLAN_BETA();
_objectsManager.PLAN_BETA();
_globals.DESACTIVE_INVENT = false;
}
@ -925,10 +925,6 @@ void HopkinsEngine::REST_SYSTEM() {
_eventsManager.CONTROLE_MES();
}
void HopkinsEngine::PLAN_BETA() {
warning("PLAN_BETA");
}
void HopkinsEngine::PUBQUIT() {
_globals.PUBEXIT = 1;
_graphicsManager.RESET_SEGMENT_VESA();

View File

@ -82,7 +82,6 @@ private:
void PASS();
void REST_SYSTEM();
void PLAN_BETA();
void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3,
const Common::String &s4, int v);
void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3,

View File

@ -233,17 +233,17 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) {
void ObjectsManager::AFF_SPRITES() {
int v0;
__int16 v1;
__int16 v2;
__int16 destX;
__int16 destY;
int v1;
int v2;
int destX;
int destY;
int v5;
__int16 v6;
__int16 v7;
__int16 v8;
__int16 v9;
int v6;
int v7;
int v8;
int v9;
int v10;
__int16 v11;
int v11;
uint16 *v12;
int v13;
int v14;
@ -252,24 +252,24 @@ void ObjectsManager::AFF_SPRITES() {
int v17;
int v18;
int v19;
__int16 v20;
__int16 v21;
__int16 v23;
__int16 v24;
__int16 v25;
__int16 v26;
__int16 v27;
__int16 v28;
__int16 v29;
__int16 v30;
__int16 v31;
__int16 v32;
__int16 v33;
signed __int16 v34;
signed __int16 v35;
signed __int16 v36;
__int16 v37;
__int16 v38;
int v20;
int v21;
int v23;
int v24;
int v25;
int v26;
int v27;
int v28;
int v29;
int v30;
int v31;
int v32;
int v33;
signed int v34;
signed int v35;
signed int v36;
int v37;
int v38;
uint16 arr[50];
_vm->_globals.NBTRI = 0;
@ -323,8 +323,9 @@ void ObjectsManager::AFF_SPRITES() {
if (v9 < _vm->_graphicsManager.min_y)
v9 = _vm->_graphicsManager.min_y;
_vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v29, v24, _vm->_globals.Liste[v31].x2 + 4,
_vm->_globals.Liste[v31].y2 + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9);
_vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v29, v24,
_vm->_globals.Liste[v31].width + 4, _vm->_globals.Liste[v31].height + 4,
_vm->_graphicsManager.VESA_BUFFER, v8, v9);
_vm->_globals.Liste[v5].field0 = 0;
}
++v31;
@ -544,23 +545,23 @@ void ObjectsManager::BOB_ZERO(int idx) {
item.field0 = 0;
item.field2 = 0;
item.field4 = 0;
item.field6 = 0;
item.field8 = 0;
item.width = 0;
item.height = 0;
}
void ObjectsManager::DEF_BOB(int idx) {
int v2;
int v3;
int v4;
__int16 v5;
__int16 v6;
__int16 v7;
__int16 v8;
__int16 v9;
__int16 v10;
int v5;
int v6;
int v7;
int v8;
int v9;
int v10;
int v11;
__int16 v12;
__int16 v13;
int v12;
int v13;
v2 = idx;
if (_vm->_globals.Bob[v2].field40) {
@ -582,31 +583,31 @@ void ObjectsManager::DEF_BOB(int idx) {
_vm->_globals.Liste2[v3].field4 = v13;
v4 = idx;
_vm->_globals.Liste2[v3].field6 = _vm->_globals.Bob[v4].field46;
_vm->_globals.Liste2[v3].field8 = _vm->_globals.Bob[v4].field48;
_vm->_globals.Liste2[v3].width = _vm->_globals.Bob[v4].field46;
_vm->_globals.Liste2[v3].height = _vm->_globals.Bob[v4].field48;
v5 = _vm->_globals.Liste2[v3].field2;
v6 = _vm->_graphicsManager.min_x;
if (v5 < _vm->_graphicsManager.min_x) {
_vm->_globals.Liste2[v3].field6 -= _vm->_graphicsManager.min_x - v5;
_vm->_globals.Liste2[v3].width -= _vm->_graphicsManager.min_x - v5;
_vm->_globals.Liste2[v3].field2 = v6;
}
v7 = _vm->_globals.Liste2[v3].field4;
v8 = _vm->_graphicsManager.min_y;
if (v7 < _vm->_graphicsManager.min_y) {
_vm->_globals.Liste2[v3].field8 -= _vm->_graphicsManager.min_y - v7;
_vm->_globals.Liste2[v3].height -= _vm->_graphicsManager.min_y - v7;
_vm->_globals.Liste2[v3].field4 = v8;
}
v9 = _vm->_globals.Liste2[v3].field2;
if (_vm->_globals.Liste2[v3].field6 + v9 > _vm->_graphicsManager.max_x)
_vm->_globals.Liste2[v3].field6 = _vm->_graphicsManager.max_x - v9;
if (_vm->_globals.Liste2[v3].width + v9 > _vm->_graphicsManager.max_x)
_vm->_globals.Liste2[v3].width = _vm->_graphicsManager.max_x - v9;
v10 = _vm->_globals.Liste2[v3].field4;
if (_vm->_globals.Liste2[v3].field8 + v10 > _vm->_graphicsManager.max_y)
_vm->_globals.Liste2[v3].field8 = _vm->_graphicsManager.max_y - v10;
if (_vm->_globals.Liste2[v3].height + v10 > _vm->_graphicsManager.max_y)
_vm->_globals.Liste2[v3].height = _vm->_graphicsManager.max_y - v10;
if (_vm->_globals.Liste2[v3].field6 <= 0 || _vm->_globals.Liste2[v3].field8 <= 0)
if (_vm->_globals.Liste2[v3].width <= 0 || _vm->_globals.Liste2[v3].height <= 0)
_vm->_globals.Liste2[v3].field0 = 0;
v11 = idx;
@ -614,8 +615,8 @@ void ObjectsManager::DEF_BOB(int idx) {
_vm->_graphicsManager.Ajoute_Segment_Vesa(
_vm->_globals.Liste2[v11].field2,
_vm->_globals.Liste2[v11].field4,
_vm->_globals.Liste2[v11].field2 + _vm->_globals.Liste2[v11].field6,
_vm->_globals.Liste2[v11].field4 + _vm->_globals.Liste2[v11].field8);
_vm->_globals.Liste2[v11].field2 + _vm->_globals.Liste2[v11].width,
_vm->_globals.Liste2[v11].field4 + _vm->_globals.Liste2[v11].height);
}
}
@ -677,13 +678,13 @@ void ObjectsManager::BOB_OFF(int idx) {
void ObjectsManager::SCBOB(int idx) {
int v1;
signed __int16 v2;
signed __int16 v3;
signed __int16 v4;
signed __int16 v6;
signed __int16 v7;
__int16 v8;
signed __int16 v9;
signed int v2;
signed int v3;
signed int v4;
signed int v6;
signed int v7;
int v8;
signed int v9;
v1 = idx;
if (_vm->_globals.Cache[idx].fieldA > 0) {
@ -703,9 +704,9 @@ void ObjectsManager::SCBOB(int idx) {
v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4;
if (v6 > v4) {
if (v6 < (signed __int16)v1) {
if (v6 < (signed int)v1) {
v1 = 0;
if (v9 >= v3 && v9 <= (signed __int16)(_vm->_globals.Cache[idx].field6 + v3)) {
if (v9 >= v3 && v9 <= (signed int)(_vm->_globals.Cache[idx].field6 + v3)) {
++_vm->_globals.Cache[idx].fieldA;
v1 = 1;
}
@ -742,23 +743,23 @@ void ObjectsManager::SCBOB(int idx) {
}
void ObjectsManager::CALCUL_BOB(int idx) {
__int16 result;
__int16 v3;
__int16 v4;
__int16 v5;
__int16 v6;
int result;
int v3;
int v4;
int v5;
int v6;
int v7;
int v8;
int v9;
int v10;
int v11;
__int16 v13;
__int16 v14;
__int16 v15;
__int16 v17;
signed __int16 v20;
__int16 v21;
__int16 v22;
int v13;
int v14;
int v15;
int v17;
signed int v20;
int v21;
int v22;
_vm->_globals.Bob[idx].field3C = 0;
if (_vm->_globals.Bob[idx].field3A == 1) {
@ -786,12 +787,12 @@ void ObjectsManager::CALCUL_BOB(int idx) {
v20 = 0;
v7 = _vm->_globals.Bob[idx].field36;
if ((signed __int16)v7 < 0) {
v7 = (signed __int16)v7;
if ((signed __int16)v7 < 0)
if ((signed int)v7 < 0) {
v7 = (signed int)v7;
if ((signed int)v7 < 0)
v7 = -v7;
v20 = v7;
if ((signed __int16)v7 > 95)
if ((signed int)v7 > 95)
v20 = 95;
}
if (_vm->_globals.Bob[idx].field36 > 0)
@ -804,7 +805,7 @@ void ObjectsManager::CALCUL_BOB(int idx) {
if (v15 < 0)
v8 = -v15;
v15 = v8;
v22 = -(signed __int16)_vm->_graphicsManager.Reel_Zoom((signed __int16)v8, v21);
v22 = -(signed int)_vm->_graphicsManager.Reel_Zoom((signed int)v8, v21);
}
if (v6 >= 0) {
v17 = _vm->_graphicsManager.Reel_Zoom(v6, v21);
@ -813,7 +814,7 @@ void ObjectsManager::CALCUL_BOB(int idx) {
if (v15 < 0)
v9 = -v15;
v6 = v9;
v17 = -(signed __int16)_vm->_graphicsManager.Reel_Zoom((signed __int16)v9, v21);
v17 = -(signed int)_vm->_graphicsManager.Reel_Zoom((signed int)v9, v21);
}
}
@ -825,7 +826,7 @@ void ObjectsManager::CALCUL_BOB(int idx) {
if (v15 < 0)
v10 = -v15;
v15 = v10;
v22 = -(signed __int16)_vm->_graphicsManager.Reel_Reduc((signed __int16)v10, v20);
v22 = -(signed int)_vm->_graphicsManager.Reel_Reduc((signed int)v10, v20);
}
if (v6 >= 0) {
v17 = _vm->_graphicsManager.Reel_Reduc(v6, v20);
@ -833,7 +834,7 @@ void ObjectsManager::CALCUL_BOB(int idx) {
v11 = v15;
if (v15 < 0)
v11 = -v15;
v17 = -(signed __int16)_vm->_graphicsManager.Reel_Reduc((signed __int16)v11, v20);
v17 = -(signed int)_vm->_graphicsManager.Reel_Reduc((signed int)v11, v20);
}
}
@ -862,25 +863,25 @@ void ObjectsManager::CALCUL_BOB(int idx) {
width = _vm->_graphicsManager.Reel_Reduc(width, v20);
}
_vm->_globals.Liste2[idx].field6 = width;
_vm->_globals.Liste2[idx].field8 = height;
_vm->_globals.Liste2[idx].width = width;
_vm->_globals.Liste2[idx].height = height;
_vm->_globals.Bob[idx].field42 = width;
_vm->_globals.Bob[idx].field44 = height;
}
}
void ObjectsManager::VERIFCACHE() {
__int16 v1;
signed __int16 v2;
signed __int16 v3;
signed __int16 v4;
__int16 v5;
__int16 v6;
__int16 v7;
__int16 v8;
__int16 v9;
__int16 v10;
__int16 v11;
int v1;
signed int v2;
signed int v3;
signed int v4;
int v5;
int v6;
int v7;
int v8;
int v9;
int v10;
int v11;
v8 = 0;
do {
@ -954,7 +955,7 @@ void ObjectsManager::VERIFCACHE() {
}
void ObjectsManager::INVENT_ANIM() {
__int16 v0;
int v0;
signed int v1;
if (!DESACTIVE_INVENT) {
@ -1001,16 +1002,16 @@ void ObjectsManager::INVENT_ANIM() {
void ObjectsManager::DEF_SPRITE(int idx) {
int v2;
__int16 v3;
__int16 v4;
int v3;
int v4;
int v5;
int v6;
__int16 v7;
__int16 v8;
__int16 v9;
__int16 v10;
__int16 v11;
__int16 v12;
int v7;
int v8;
int v9;
int v10;
int v11;
int v12;
int v13;
v2 = idx;
@ -1026,29 +1027,29 @@ void ObjectsManager::DEF_SPRITE(int idx) {
v5 = idx;
v6 = idx;
_vm->_globals.Liste[v5].x2 = Sprite[v6].field30;
_vm->_globals.Liste[v5].y2 = Sprite[v6].field32;
_vm->_globals.Liste[v5].width = Sprite[v6].field30;
_vm->_globals.Liste[v5].height = Sprite[v6].field32;
v7 = _vm->_globals.Liste[v5].field2;
v8 = _vm->_graphicsManager.min_x;
if (v7 < _vm->_graphicsManager.min_x) {
_vm->_globals.Liste[v5].x2 -= _vm->_graphicsManager.min_x - v7;
_vm->_globals.Liste[v5].width -= _vm->_graphicsManager.min_x - v7;
_vm->_globals.Liste[v5].field2 = v8;
}
v9 = _vm->_globals.Liste[v5].field4;
v10 = _vm->_graphicsManager.min_y;
if (v9 < _vm->_graphicsManager.min_y) {
_vm->_globals.Liste[v5].y2 -= _vm->_graphicsManager.min_y - v9;
_vm->_globals.Liste[v5].height -= _vm->_graphicsManager.min_y - v9;
_vm->_globals.Liste[v5].field4 = v10;
}
v11 = _vm->_globals.Liste[v5].field2;
if (_vm->_globals.Liste[v5].x2 + v11 > _vm->_graphicsManager.max_x)
_vm->_globals.Liste[v5].x2 = _vm->_graphicsManager.max_x - v11;
if (_vm->_globals.Liste[v5].width + v11 > _vm->_graphicsManager.max_x)
_vm->_globals.Liste[v5].width = _vm->_graphicsManager.max_x - v11;
v12 = _vm->_globals.Liste[v5].field4;
if ( _vm->_globals.Liste[v5].y2 + v12 > _vm->_graphicsManager.max_y)
_vm->_globals.Liste[v5].y2 = _vm->_graphicsManager.max_y - v12;
if ( _vm->_globals.Liste[v5].x2 <= 0 || _vm->_globals.Liste[v5].y2 <= 0)
if ( _vm->_globals.Liste[v5].height + v12 > _vm->_graphicsManager.max_y)
_vm->_globals.Liste[v5].height = _vm->_graphicsManager.max_y - v12;
if ( _vm->_globals.Liste[v5].width <= 0 || _vm->_globals.Liste[v5].height <= 0)
_vm->_globals.Liste[v5].field0 = 0;
v13 = idx;
@ -1056,8 +1057,8 @@ void ObjectsManager::DEF_SPRITE(int idx) {
_vm->_graphicsManager.Ajoute_Segment_Vesa(
_vm->_globals.Liste[v13].field2,
_vm->_globals.Liste[v13].field4,
_vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13].x2,
_vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13].y2);
_vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13].width,
_vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13].height);
}
}
@ -1074,21 +1075,21 @@ void ObjectsManager::DEF_CACHE(int idx) {
void ObjectsManager::CALCUL_SPRITE(int idx) {
int width, height;
__int16 v3;
__int16 v4;
__int16 v5;
__int16 v6;
__int16 v7;
__int16 v8;
int v3;
int v4;
int v5;
int v6;
int v7;
int v8;
int v9;
int v10;
int v11;
int v12;
int v13;
__int16 v15;
__int16 v16;
int v15;
int v16;
int v17;
__int16 v22;
int v22;
Sprite[idx + 42].field2A = 0;
int v0 = Sprite[idx].field10;
@ -1112,12 +1113,12 @@ void ObjectsManager::CALCUL_SPRITE(int idx) {
int reducePercent = 0;
v9 = Sprite[idx].fieldC;
if ((signed __int16)v9 < 0) {
v9 = (signed __int16)v9;
if ((signed __int16)v9 < 0)
if ((signed int)v9 < 0) {
v9 = (signed int)v9;
if ((signed int)v9 < 0)
v9 = -v9;
reducePercent = v9;
if ((signed __int16)v9 > 95)
if ((signed int)v9 > 95)
reducePercent = 95;
}
if (Sprite[idx].fieldC > 0)
@ -1132,7 +1133,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) {
if (v4 < 0)
v10 = -v4;
v4 = v10;
v22 = -_vm->_graphicsManager.Reel_Zoom((signed __int16)v10, zoomPercent);
v22 = -_vm->_graphicsManager.Reel_Zoom((signed int)v10, zoomPercent);
}
if (v8 >= 0) {
@ -1142,7 +1143,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) {
if (v4 < 0)
v11 = -v4;
v8 = v11;
v7 = -_vm->_graphicsManager.Reel_Zoom((signed __int16)v11, zoomPercent);
v7 = -_vm->_graphicsManager.Reel_Zoom((signed int)v11, zoomPercent);
}
}
if (reducePercent) {
@ -1153,7 +1154,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) {
if (v4 < 0)
v12 = -v4;
v4 = v12;
v22 = -_vm->_graphicsManager.Reel_Reduc((signed __int16)v12, reducePercent);
v22 = -_vm->_graphicsManager.Reel_Reduc((signed int)v12, reducePercent);
}
if (v8 >= 0) {
v7 = _vm->_graphicsManager.Reel_Reduc(v8, reducePercent);
@ -1161,7 +1162,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) {
v13 = v4;
if (v4 < 0)
v13 = -v4;
v7 = -_vm->_graphicsManager.Reel_Reduc((signed __int16)v13, reducePercent);
v7 = -_vm->_graphicsManager.Reel_Reduc((signed int)v13, reducePercent);
}
}
@ -1212,25 +1213,25 @@ int ObjectsManager::AvantTri(int a1, int a2, int a3) {
void ObjectsManager::AFF_BOB_ANIM() {
signed int v1;
__int16 v2;
signed __int16 v5;
__int16 v6;
__int16 v7;
__int16 v8;
signed __int16 v10;
__int16 v11;
int v2;
signed int v5;
int v6;
int v7;
int v8;
signed int v10;
int v11;
int v12;
int v13;
__int16 v14;
int v14;
int v18;
int v19;
byte *v20;
byte *v21;
int v22;
__int16 v24;
__int16 v26;
__int16 v27;
__int16 v28;
int v24;
int v26;
int v27;
int v28;
int idx = 0;
do {
@ -1265,7 +1266,7 @@ void ObjectsManager::AFF_BOB_ANIM() {
if (_vm->_globals.BL_ANIM[idx].v1 == 1)
_vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2;
if ( PERSO_ON == 1 && idx > 20 )
_vm->_globals.Bob[idx].field8 += _vm->_graphicsManager.start_x;
_vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x;
_vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2);
_vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v20 + 2 * v24 + 4);
@ -1284,7 +1285,7 @@ LABEL_37:
LABEL_38:
v12 = idx;
if ((unsigned __int16)(_vm->_globals.Bob[v12].field1E - 1) <= 1u)
if ((unsigned int)(_vm->_globals.Bob[v12].field1E - 1) <= 1u)
_vm->_globals.Bob[v12].field1C = 1;
continue;
}
@ -1306,7 +1307,7 @@ LABEL_38:
if (_vm->_globals.BL_ANIM[idx].v1 == 1)
_vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2;
if (PERSO_ON == 1 && idx > 20)
_vm->_globals.Bob[idx].field8 += _vm->_graphicsManager.start_x;
_vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x;
_vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2);
_vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v21 + 4);
@ -1354,7 +1355,7 @@ LABEL_38:
if (_vm->_globals.Liste2[v27].field0) {
_vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN,
_vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4,
_vm->_globals.Liste2[v27].field6, _vm->_globals.Liste2[v27].field8,
_vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height,
_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27].field2,
_vm->_globals.Liste2[v27].field4);
_vm->_globals.Liste2[v27].field0 = 0;
@ -1369,7 +1370,7 @@ LABEL_38:
if (_vm->_globals.Liste2[v27].field0) {
_vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN,
_vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4,
_vm->_globals.Liste2[v27].field6, _vm->_globals.Liste2[v27].field8,
_vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height,
_vm->_graphicsManager.VESA_BUFFER,
_vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4);
_vm->_globals.Liste2[v27].field0 = 0;
@ -1512,4 +1513,319 @@ void ObjectsManager::AFF_VBOB() {
} while ( idx <= 29 );
}
int ObjectsManager::XSPR(int idx) {
if (idx > 5)
error("request of the Coord. x a sprite > MAX_SPRITE.");
return Sprite[idx].field8;
}
int ObjectsManager::YSPR(int idx) {
if (idx > 5)
error("request of the Coord. y a sprite > MAX_SPRITE.");
return Sprite[idx].fieldA;
}
void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) {
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, spriteData, a2, a3, a5, a6, a7, a8);
}
void ObjectsManager::CLEAR_SPR() {
int idx;
idx = 0;
do {
Sprite[idx].field1C = PTRNUL;
Sprite[idx].spriteData = PTRNUL;
Sprite[idx].field0 = 0;
++idx;
} while (idx <= 4);
idx = 0;
do {
_vm->_globals.Liste[idx].field0 = 0;
_vm->_globals.Liste[idx].field2 = 0;
_vm->_globals.Liste[idx].field4 = 0;
_vm->_globals.Liste[idx].width = 0;
_vm->_globals.Liste[idx].height = 0;
_vm->_globals.Liste[idx].fieldA = 0;
++idx;
} while (idx <= 4);
}
void ObjectsManager::SPRITE_ON(int idx) {
if (idx > 5)
error("Tentative d'affichage d'un sprite > MAX_SPRITE.");
Sprite[idx].field0 = 1;
}
void ObjectsManager::SPRITE(const byte *spriteData, int a2, int a3, int idx, int a5, int a6, int a7, int a8, int a9) {
if (idx > 5 )
(8, (int)"Tentative d'affichage d'un sprite > MAX_SPRITE.");
Sprite[idx].spriteData = spriteData;
Sprite[idx].field8 = a2;
Sprite[idx].fieldA = a3;
Sprite[idx].field10 = a5;
Sprite[idx].fieldC = a6;
Sprite[idx].field12 = a8;
Sprite[idx].field14 = a9;
Sprite[idx].field1C = PTRNUL;
Sprite[idx].field20 = 0;
Sprite[idx].field24 = 0;
Sprite[idx].field26 = 0;
Sprite[idx].field22 = 0;
Sprite[idx].field0 = 0;
Sprite[idx].field28 = 0;
Sprite[idx].fieldE = a7;
if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E')
Sprite[idx].field28 = 1;
if (Sprite[idx].field28 == 1) {
Sprite[idx].fieldC = 0;
Sprite[idx].fieldE = 0;
}
}
void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5) {
Sprite[idx].spriteData = spriteData;
Sprite[idx].field1C = a3;
Sprite[idx].field20 = a4;
Sprite[idx].field24 = 0;
Sprite[idx].field26 = 0;
Sprite[idx].fieldC = 0;
Sprite[idx].fieldE = 0;
Sprite[idx].field0 = 1;
Sprite[idx].field22 = 0;
Sprite[idx].field14 = a5;
if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E')
Sprite[idx].field28 = 1;
if (Sprite[idx].field28 == 1) {
Sprite[idx].fieldC = 0;
Sprite[idx].fieldE = 0;
}
}
void ObjectsManager::SPRITE_OFF(int idx) {
Sprite[idx].field0 = 3;
if (Sprite[idx].field1C != PTRNUL)
_vm->_globals.dos_free2(Sprite[idx].field1C);
Sprite[idx].field1C = PTRNUL;
}
void ObjectsManager::SPRITE_GEL(int idx) {
Sprite[idx].field0 = 3;
}
int ObjectsManager::SXSPR(int idx) {
if (idx > 5)
error("request of the size of a sprite x > MAX_SPRITE.");
return Get_Largeur(Sprite[idx].spriteData, Sprite[idx].field10);
}
int ObjectsManager::SYSPR(int idx) {
if (idx > 5)
error("request of the size of a sprite y > MAX_SPRITE.");
return Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].field10);
}
int ObjectsManager::POSISPR(int idx) {
return Sprite[idx].field22 / 6;
}
void ObjectsManager::SETPOSISPR(int idx, int a2) {
Sprite[idx].field22 = 6 * a2;
Sprite[idx].field24 = 0;
Sprite[idx].field26 = 0;
}
void ObjectsManager::SETXSPR(int idx, int xp) {
if (idx > 5)
error("Set the Coord. x a sprite> MAX_SPRITE.");
Sprite[idx].field8 = xp;
}
void ObjectsManager::SETANISPR(int idx, int a2) {
if (idx > 5)
error("Set the Coord. x a sprite> MAX_SPRITE.");
Sprite[idx].field10 = a2;
}
void ObjectsManager::SETYSPR(int idx, int yp) {
if ( idx > 5 )
error("Set the Coord. y a sprite> MAX_SPRITE.");
Sprite[idx].fieldA = yp;
}
void ObjectsManager::SETTAILLESPR(int idx, int a2) {
if (idx > 5)
error("Set the Coord. there a sprite> MAX_SPRITE.");
if (Sprite[idx].field28 != 1)
Sprite[idx].fieldC = a2;
}
void ObjectsManager::SETFLIPSPR(int idx, int a2) {
if (Sprite[idx].field28 != 1) {
if (idx > 5)
error("Set the Coord. there a sprite> MAX_SPRITE.");
Sprite[idx].fieldE = a2;
}
}
void ObjectsManager::VERIFZONE() {
warning("VERIFZONE");
}
void ObjectsManager::GOHOME2() {
warning("GOHOME2");
}
void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) {
warning("CHARGE_OBSTACLE");
}
void ObjectsManager::CHARGE_CACHE(const Common::String &file) {
warning("CHARGE_CACHE");
}
void ObjectsManager::CHARGE_ZONE(const Common::String &file) {
warning("CHARGE_ZONE");
}
void ObjectsManager::PLAN_BETA() {
int v1;
int v2;
int v3;
int v4;
int v5;
v1 = 0;
INVENTFLAG = false;
KEY_INVENT = 0;
_vm->_globals.Max_Propre = 1;
_vm->_globals.Max_Ligne_Long = 1;
_vm->_globals.Max_Propre_Gen = 1;
_vm->_globals.Max_Perso_Y = 440;
_vm->_globals.NOSPRECRAN = 1;
_vm->_globals.PLAN_FLAG = 1;
_vm->_graphicsManager.NOFADE = false;
_vm->_globals.NOMARCHE = 0;
sprite_ptr = PTRNUL;
_vm->_globals.SORTIE = 0;
_vm->_globals.AFFLI = 0;
_vm->_globals.AFFIVBL = 0;
_vm->_globals.NOT_VERIF = 1;
_vm->_soundManager.WSOUND(31);
_vm->_globals.iRegul = 1;
_vm->_graphicsManager.LOAD_IMAGE("PLAN");
CHARGE_OBSTACLE("PLAN.OB2");
CHARGE_CACHE("PLAN.CA2");
CHARGE_ZONE("PLAN.ZO2");
FileManager::CONSTRUIT_SYSTEM("VOITURE.SPR");
sprite_ptr = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER);
_vm->_animationManager.CHARGE_ANIM("PLAN");
_vm->_graphicsManager.VISU_ALL();
_vm->_graphicsManager.INI_ECRAN2("PLAN");
v2 = 0;
do {
_vm->_globals.B_CACHE_OFF(v2++);
} while (v2 <= 15);
_vm->_globals.B_CACHE_OFF(19);
_vm->_globals.B_CACHE_OFF(20);
_vm->_globals.CACHE_ON();
if (!_vm->_globals.PLANX && !_vm->_globals.PLANY) {
_vm->_globals.PLANX = 900;
_vm->_globals.PLANY = 319;
_vm->_globals.PLANI = 1;
}
SPRITE(sprite_ptr, _vm->_globals.PLANX, _vm->_globals.PLANY, 0, _vm->_globals.PLANI, 0, 0, 5, 5);
_vm->_eventsManager.souris_xy(_vm->_globals.PLANX, _vm->_globals.PLANY);
my_anim = 0;
_vm->_eventsManager.MOUSE_ON();
v3 = XSPR(0);
_vm->_graphicsManager.SCROLL_ECRAN(v3 - 320);
_vm->_graphicsManager.ofscroll = XSPR(0) - 320;
SPRITE_ON(0);
_vm->_globals.chemin = PTRNUL;
_vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0);
_vm->_globals.BPP_NOAFF = 1;
v4 = 0;
do {
_vm->_eventsManager.VBL();
++v4;
} while (v4 <= 4);
_vm->_globals.BPP_NOAFF = 0;
_vm->_globals.iRegul = 1;
_vm->_graphicsManager.FADE_INW();
_vm->_eventsManager.CHANGE_MOUSE(4);
_vm->_graphicsManager.NOFADE = false;
do {
v5 = _vm->_eventsManager.BMOUSE();
if (v5) {
if (_vm->_globals.SAUVEGARDE->field170 == 1 && !_vm->_globals.SAUVEGARDE->field171) {
_vm->_globals.SAUVEGARDE->field171 = 1;
_vm->_globals.NOPARLE = true;
_vm->_talkManager.PARLER_PERSO("APPEL1.pe2");
_vm->_globals.NOPARLE = false;
v5 = 0;
}
if (_vm->_globals.SAUVEGARDE->field80 == 1 && !_vm->_globals.SAUVEGARDE->field172) {
_vm->_globals.SAUVEGARDE->field172 = 1;
_vm->_globals.NOPARLE = 1;
_vm->_talkManager.PARLER_PERSO("APPEL2.pe2");
_vm->_globals.NOPARLE = 0;
v5 = 0;
_vm->_eventsManager.souris_bb = false;
}
if (v5 == 1)
BTGAUCHE();
}
VERIFZONE();
GOHOME2();
if (_vm->_globals.chemin == PTRNUL && _vm->_globals.GOACTION == 1)
PARADISE();
_vm->_eventsManager.VBL();
if (_vm->_globals.SORTIE)
v1 = 1;
} while (v1 != 1);
if (!_vm->_graphicsManager.NOFADE)
_vm->_graphicsManager.FADE_OUTW();
_vm->_globals.iRegul = 0;
_vm->_graphicsManager.NOFADE = false;
_vm->_globals.PLANX = XSPR(0);
_vm->_globals.PLANY = YSPR(0);
_vm->_globals.PLANI = 1;
SPRITE_OFF(0);
_vm->_globals.AFFLI = 0;
sprite_ptr = _vm->_globals.LIBERE_FICHIER(sprite_ptr);
CLEAR_ECRAN();
_vm->_globals.NOSPRECRAN = 0;
_vm->_globals.PLAN_FLAG = 0;
}
void ObjectsManager::BTGAUCHE() {
warning("TODO: BTGAUCHE");
}
void ObjectsManager::PARADISE() {
warning("TODO: PARADISE");
}
void ObjectsManager::CLEAR_ECRAN() {
warning("TODO: CLEAR_ECRAN");
}
} // End of namespace Hopkins

View File

@ -31,7 +31,7 @@ namespace Hopkins {
struct SpriteItem {
int field0;
byte *spriteData;
const byte *spriteData;
int field8;
int fieldA;
int fieldC;
@ -39,6 +39,11 @@ struct SpriteItem {
int field10;
int field12;
int field14;
byte *field1C;
int field20;
int field22;
int field24;
int field26;
int field28;
int field2A;
int field2C;
@ -68,6 +73,7 @@ public:
byte *inventaire2;
byte *SL_SPR;
byte *SL_SPR2;
byte *sprite_ptr;
bool PERSO_ON;
bool SL_FLAG;
bool FLAG_VISIBLE;
@ -75,6 +81,9 @@ public:
int DESACTIVE_CURSOR;
bool BOBTOUS;
SpriteItem Sprite[6];
bool INVENTFLAG;
int KEY_INVENT;
int my_anim;
public:
ObjectsManager();
void setParent(HopkinsEngine *vm);
@ -112,6 +121,36 @@ public:
int AvantTri(int a1, int a2, int a3);
void AFF_BOB_ANIM();
void AFF_VBOB();
int XSPR(int idx);
int YSPR(int idx);
void SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
void CLEAR_SPR();
void SPRITE_ON(int idx);
void SPRITE(const byte *spriteData, int a2, int a3, int idx, int a5, int a6, int a7, int a8, int a9);
void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5);
void SPRITE_OFF(int idx);
void SPRITE_GEL(int idx);
int SXSPR(int idx);
int SYSPR(int idx);
int POSISPR(int idx);
void SETPOSISPR(int idx, int a2);
void SETXSPR(int idx, int xp);
void SETANISPR(int idx, int a2);
void SETYSPR(int idx, int yp);
void SETTAILLESPR(int idx, int a2);
void SETFLIPSPR(int idx, int a2);
void VERIFZONE();
void GOHOME2();
void CHARGE_OBSTACLE(const Common::String &file);
void CHARGE_CACHE(const Common::String &file);
void CHARGE_ZONE(const Common::String &file);
void PLAN_BETA();
void BTGAUCHE();
void PARADISE();
void CLEAR_ECRAN();
};
} // End of namespace Hopkins

View File

@ -37,6 +37,145 @@ void TalkManager::setParent(HopkinsEngine *vm) {
_vm = vm;
}
void TalkManager::PARLER_PERSO(const Common::String &filename) {
int v2;
int v3;
int v4;
int v5;
int v6;
int v7;
byte *v8;
byte *v9;
byte *v10;
int v11;
byte v13;
int v14;
int v15;
Common::String v16;
v15 = 0;
_vm->_fontManager.TEXTE_OFF(5);
_vm->_fontManager.TEXTE_OFF(9);
_vm->_eventsManager.VBL();
_vm->_graphicsManager.no_scroll = 1;
v13 = _vm->_globals.DESACTIVE_INVENT;
_vm->_globals.DESACTIVE_INVENT = 1;
BUFFERPERSO = FileManager::RECHERCHE_CAT(filename, 5);
TAILLEPERSO = _vm->_globals.CAT_TAILLE;
if (BUFFERPERSO == PTRNUL) {
FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename);
BUFFERPERSO = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER);
TAILLEPERSO = FileManager::FLONG(_vm->_globals.NFICHIER);
}
_vm->_globals.SAUVEGARDE->field4 = 0;
RENVOIE_FICHIER(40, v16, (const char *)BUFFERPERSO);
RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO);
RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO);
if (_vm->_globals.FR == 1) {
FREPON = FQUEST = "RUE.TXT";
} else if (!_vm->_globals.FR) {
FREPON = FQUEST = "RUEAN.TXT";
} else if (_vm->_globals.FR == 2) {
FREPON = FQUEST = "RUEES.TXT";
}
v2 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 40);
v3 = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110;
PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110;
PERSOSPR = FileManager::RECHERCHE_CAT(v16, 7);
if (PERSOSPR) {
_vm->_globals.CAT_FLAG = 0;
FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v16);
} else {
_vm->_globals.CAT_FLAG = 1;
FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES");
}
PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER);
_vm->_globals.CAT_FLAG = 0;
FileManager::CONSTRUIT_LINUX("TEMP.SCR");
if (_vm->_graphicsManager.nbrligne == 640)
FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u);
if (_vm->_graphicsManager.nbrligne == 1280)
FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u);
if (!_vm->_graphicsManager.nbrligne)
_vm->_graphicsManager.ofscroll = 0;
_vm->_graphicsManager.NB_SCREEN();
_vm->_objectsManager.PERSO_ON = 1;
CHERCHE_PAL(v3, 0);
CHERCHE_ANIM0(v3, 0);
ANIM_PERSO_INIT();
PLIGNE1 = v2;
PLIGNE2 = v2 + 1;
PLIGNE3 = v2 + 2;
PLIGNE4 = v2 + 3;
v14 = _vm->_eventsManager.btsouris;
_vm->_eventsManager.btsouris = 4;
_vm->_eventsManager.CHANGE_MOUSE(0);
if (!_vm->_globals.NOPARLE) {
v4 = v2 + 3;
do {
v5 = DIALOGUE();
if ((signed __int16)v5 != v4)
v15 = DIALOGUE_REP(v5);
if (v15 == -1)
v5 = v2 + 3;
_vm->_eventsManager.VBL();
} while ((signed __int16)v5 != v4);
}
if (_vm->_globals.NOPARLE == 1) {
v6 = 1;
do
v7 = DIALOGUE_REP(v6++);
while (v7 != -1);
}
CLEAR_ANIM_PERSO();
_vm->_globals.NOPARLE = 0;
_vm->_globals.NECESSAIRE = 1;
BUFFERPERSO = FileManager::LIBERE_FICHIER(BUFFERPERSO);
PERSOSPR = FileManager::LIBERE_FICHIER(PERSOSPR);
_vm->_graphicsManager.NB_SCREEN();
_vm->_globals.NECESSAIRE = 0;
FileManager::CONSTRUIT_LINUX("TEMP.SCR");
FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN);
_vm->_objectsManager.PERSO_ON = 0;
_vm->_eventsManager.btsouris = v14;
_vm->_eventsManager.CHANGE_MOUSE(v14);
_vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette);
_vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette);
_vm->_graphicsManager.DD_LOCK();
if (_vm->_graphicsManager.Winbpp == 2) {
if (_vm->_graphicsManager.SDL_ECHELLE)
_vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0);
else
_vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0);
}
if (_vm->_graphicsManager.Winbpp == 1) {
if (_vm->_graphicsManager.SDL_ECHELLE)
_vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0);
else
_vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0);
}
_vm->_graphicsManager.DD_UNLOCK();
v8 = _vm->_graphicsManager.VESA_BUFFER;
v9 = _vm->_graphicsManager.VESA_SCREEN;
memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu);
v9 = v9 + 614396;
v8 = v8 + 614396;
*v8 = *v9;
v8 = v8 + 2;
*v8 = *(v9 + 2);
v10 = v8 + 1;
_vm->_globals.DESACTIVE_INVENT = v13;
_vm->_graphicsManager.DD_VBL();
v11 = 0;
do {
_vm->_eventsManager.VBL();
++v11;
} while (v11 <= 4);
_vm->_graphicsManager.no_scroll = 0;
}
void TalkManager::PARLER_PERSO2(const Common::String &filename) {
int v1;
int v2;
@ -598,4 +737,16 @@ void TalkManager::BOB_VISU_PARLE(int idx) {
}
}
void TalkManager::CHERCHE_ANIM0(int a1, int a2) {
warning("TODO: CHERCHE_ANIM0");
}
void TalkManager::ANIM_PERSO_INIT() {
warning("TODO: ANIM_PERSO_INIT");
}
void TalkManager::CLEAR_ANIM_PERSO() {
warning("TODO: CLEAR_ANIM_PERSO");
}
} // End of namespace Hopkins

View File

@ -48,6 +48,7 @@ public:
void setParent(HopkinsEngine *vm);
void PARLER_PERSO2(const Common::String &filename);
void PARLER_PERSO(const Common::String &filename);
void RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData);
int DIALOGUE();
int DIALOGUE_REP(int idx);
@ -58,6 +59,9 @@ public:
int VERIF_BOITE(__int16 a1, const Common::String &a2, __int16 a3);
void VISU_PARLE();
void BOB_VISU_PARLE(int idx);
void CHERCHE_ANIM0(int a1, int a2);
void ANIM_PERSO_INIT();
void CLEAR_ANIM_PERSO();
};
} // End of namespace Hopkins