Skip to content

Commit

Permalink
HOPKINS: Implemented more object manager methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 30, 2012
1 parent 9231321 commit 8fa33e7
Show file tree
Hide file tree
Showing 16 changed files with 3,790 additions and 71 deletions.
8 changes: 6 additions & 2 deletions engines/hopkins/anim.cpp
Expand Up @@ -87,12 +87,12 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui
if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) {
doneFlag = 1;
screenCopy = GLOBALS.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT);
memcpy((void *)screenCopy, screenP, SCREEN_WIDTH * SCREEN_HEIGHT);
memcpy(screenCopy, screenP, SCREEN_WIDTH * SCREEN_HEIGHT);
}

if (NO_SEQ) {
if (doneFlag == 1)
memcpy((void *)screenCopy, _vm->_graphicsManager.VESA_BUFFER, SCREEN_WIDTH * SCREEN_HEIGHT);
memcpy(screenCopy, _vm->_graphicsManager.VESA_BUFFER, SCREEN_WIDTH * SCREEN_HEIGHT);
_vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette);
} else {
_vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette);
Expand Down Expand Up @@ -285,6 +285,10 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui
_vm->_graphicsManager.NOLOCK = false;
}

void AnimationManager::PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4) {
warning("TODO: PLAY_ANM2");
}

bool AnimationManager::REDRAW_ANIM() {
return false;
}
Expand Down
1 change: 1 addition & 0 deletions engines/hopkins/anim.h
Expand Up @@ -44,6 +44,7 @@ class AnimationManager {
void setParent(HopkinsEngine *vm) { _vm = vm; }

void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3);
void PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4);
bool REDRAW_ANIM();
void BOBANIM_ON(int idx);
void BOBANIM_OFF(int idx);
Expand Down
1 change: 1 addition & 0 deletions engines/hopkins/events.h
Expand Up @@ -55,6 +55,7 @@ class EventsManager {
uint32 lItCounter;
uint32 _priorFrameTime;
bool ESC_KEY;
bool NOESC;
int btsouris;
public:
EventsManager();
Expand Down
17 changes: 15 additions & 2 deletions engines/hopkins/files.cpp
Expand Up @@ -117,6 +117,19 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) {
return data;
}

void FileManager::CHARGE_FICHIER2(const Common::String &file, byte *buf) {
Common::File f;
size_t filesize;

DMESS1();
if (!f.open(file))
error("Error opening file - %s", file.c_str());

filesize = f.size();
FileManager::bload_it(f, buf, filesize);
f.close();
}

void FileManager::DMESS() {
// No implementation in original
}
Expand Down Expand Up @@ -334,8 +347,8 @@ uint32 FileManager::FLONG(const Common::String &filename) {
return size;
}

void FileManager::CONSTRUIT_LINUX(const Common::String &file) {
warning("TODO: CONSTRUIT_LINUX");
Common::String FileManager::CONSTRUIT_LINUX(const Common::String &file) {
return file;
}

} // End of namespace Hopkins
3 changes: 2 additions & 1 deletion engines/hopkins/files.h
Expand Up @@ -37,6 +37,7 @@ class FileManager {
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 CHARGE_FICHIER2(const Common::String &file, byte *a2);
static void DMESS();
static void DMESS1();
static void bload(const Common::String &file, byte *buf);
Expand All @@ -46,7 +47,7 @@ class FileManager {
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);
static Common::String CONSTRUIT_LINUX(const Common::String &file);

/**
* Returns the size of a file. Throws an error if the file can't be found
Expand Down
4 changes: 2 additions & 2 deletions engines/hopkins/globals.cpp
Expand Up @@ -761,8 +761,8 @@ void Globals::RESET_CACHE() {
void Globals::CACHE_ON() {
CACHEFLAG = 1;
}

void Globals::CACHE_OFF() {
// TODO: Find why some calls have a parameter value
void Globals::CACHE_OFF(int v1) {
CACHEFLAG = 0;
}

Expand Down
87 changes: 74 additions & 13 deletions engines/hopkins/globals.h
Expand Up @@ -52,6 +52,7 @@ struct LigneItem {
int field4;
int field6;
int field8;
byte *fieldC;
byte *field12;
};

Expand Down Expand Up @@ -193,22 +194,73 @@ struct CacheItem {
int field14;
};

// Note: Fields decimal based for now
struct Sauvegarde {
struct Sauvegarde1 {
int field0;
int field1;
int field2;
int field3;
int field4;
int field13;
int field80;
int field170;
int field171;
int field172;
int field353;
int field354;
int field355;
int field356;
int field357;
};

enum SauvegardeOffset {
svField1
, svField2
, svField3
, svField4
, svField5
, svField6
, svField8
, svField9
, svField13
, svField80
, svField94
, svField95
, svField121
, svField122
, svField133
, svField170
, svField171
, svField172
, svField176
, svField180
, svField181
, svField182
, svField183
, svField184
, svField185
, svField186
, svField187
, svField188
, svField189
, svField190
, svField191
, svField192
, svField193
, svField194
, svField228
, svField253
, svField231
, svField270
, svField338
, svField339
, svField340
, svField341
, svField349
, svField352
, svField353
, svField354
, svField355
, svField356
, svField357
, svField399
, svField401
};

struct Sauvegarde {
byte data[999]; // TODO: GET CORRECT SIZE
Sauvegarde1 field360;
Sauvegarde1 field370;
Sauvegarde1 field380;
};

class HopkinsEngine;
Expand Down Expand Up @@ -281,6 +333,9 @@ class Globals {
CacheItem Cache[25];
int BOBZONE[105];
bool BOBZONE_FLAG[105];
int STAILLE[500];
int super_parcours[32002];
int Param[2100];
byte *Winventaire;
byte *texte_tmp;
int texte_long;
Expand Down Expand Up @@ -360,12 +415,18 @@ class Globals {
int NECESSAIRE;
int Compteur;
int ACTION_SENS;
int STOP_BUG;

int force_to_data_0;
int old_x1_65;
int old_y1_66;
int old_x2_67;
int old_zone_68;
int old_x_69, old_y_70;
int compteur_71;
int zozo_73;
int old_y2_68;
int old_z_69;

Globals();
~Globals();
Expand All @@ -384,7 +445,7 @@ class Globals {

void RESET_CACHE();
void CACHE_ON();
void CACHE_OFF();
void CACHE_OFF(int v1 = 0);
void CACHE_SUB(int idx);
void CACHE_ADD(int idx);
void CHARGE_CACHE(const Common::String &file);
Expand Down
97 changes: 93 additions & 4 deletions engines/hopkins/graphics.cpp
Expand Up @@ -326,7 +326,17 @@ void GraphicsManager::Trans_bloc(byte *destP, byte *srcP, int count, int param1,
}

void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) {
warning("TODO: Trans_bloc2");
byte *dataP;
int count;
byte dataVal;

dataP = surface;
count = size - 1;
do {
dataVal = *dataP++;
*(dataP - 1) = *(dataVal + col);
--count;
} while (count);
}

// TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder
Expand Down Expand Up @@ -2279,11 +2289,85 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x
}

void GraphicsManager::INI_ECRAN(const Common::String &file) {
warning("TODO: INI_ECRAN");
OPTI_INI(file, 0);
}

void GraphicsManager::INI_ECRAN2(const Common::String &file) {
warning("TODO: INI_ECRAN2");
OPTI_INI(file, 2);
}

void GraphicsManager::OPTI_INI(const Common::String &file, int a2) {
int v2;
unsigned int v3;
int v6;
unsigned int v9;
signed int v11;
byte *ptr;
Common::String v13;

v2 = 1;
v3 = 0;
v9 = 0;
// TODO: Set extension as text
v13 = file + ".XXX"; // + #105#110#105;

ptr = FileManager::RECHERCHE_CAT(v13, 1);
if (PTRNUL == ptr) {
FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13);
ptr = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER);
}
if (!a2) {
// 5ODO: Set extension as text
v13 = file + ".XXX"; //#115#112#114;
if (PTRNUL != _vm->_globals.SPRITE_ECRAN)
_vm->_globals.SPRITE_ECRAN = FileManager::LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN);
if (!_vm->_globals.NOSPRECRAN) {
_vm->_globals.SPRITE_ECRAN = FileManager::RECHERCHE_CAT(v13, 8);
if (_vm->_globals.SPRITE_ECRAN) {
_vm->_globals.CAT_FLAG = 0;
FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13);
} else {
_vm->_globals.CAT_FLAG = 1;
FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES");
}
_vm->_globals.SPRITE_ECRAN = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER);
_vm->_globals.CAT_FLAG = 0;
}
}
if (*ptr != 73 || *(ptr + 1) != 78 || *(ptr + 2) != 73) {
error("Erreur, fichier non INI");
} else {
v11 = 0;
do {
v6 = _vm->_objectsManager.Traduction(ptr + 20 * v2);
if (v6 == 2)
v2 = _vm->_objectsManager.Control_Goto((ptr + 20 * v2));
if (v6 == 3)
v2 = _vm->_objectsManager.Control_If(ptr, v2);
if (v2 == -1)
error("fonction IFF d‚fectueuse");
if (v6 == 1 || v6 == 4)
++v2;
if (!v6 || v6 == 5)
v11 = 1;
} while (v11 != 1);
}
_vm->_globals.dos_free2(ptr);
if (a2 != 1) {
if (PTRNUL != _vm->_globals.COUCOU)
_vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU);

v13 = file + ".XXX"; // #114#101#112
byte *dataP = FileManager::RECHERCHE_CAT(v13, 2);
_vm->_globals.COUCOU = dataP;
if (PTRNUL == dataP) {
FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13);
dataP = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER);
_vm->_globals.COUCOU = dataP;
}
}
_vm->_objectsManager.FORCEZONE = 1;
_vm->_objectsManager.CHANGEVERBE = 0;
}

void GraphicsManager::NB_SCREEN() {
Expand Down Expand Up @@ -2320,5 +2404,10 @@ void GraphicsManager::NB_SCREEN() {
*(v0 + 2) = *(v1 + 2);
DD_VBL();
}

/*
int GraphicsManager::colision2_ligne(int a1, int a2, int a3, int a4, int a5, int a6) {
warning("TODO: colision2_ligne");
return 0;
}
*/
} // End of namespace Hopkins
3 changes: 3 additions & 0 deletions engines/hopkins/graphics.h
Expand Up @@ -64,6 +64,7 @@ class GraphicsManager {
byte TABLE_COUL[PALETTE_SIZE];
byte cmap[PALETTE_BLOCK_SIZE];
byte Palette[PALETTE_EXT_BLOCK_SIZE];
byte OLD_PAL[PALETTE_EXT_BLOCK_SIZE];
bool Linear;
Graphics::Surface *VideoPtr;
byte *VESA_SCREEN;
Expand Down Expand Up @@ -174,7 +175,9 @@ class GraphicsManager {
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 OPTI_INI(const Common::String &file, int a2);
void NB_SCREEN();
int colision2_ligne(int a1, int a2, int a3, int a4, int a5, int a6);
};

} // End of namespace Hopkins
Expand Down
4 changes: 4 additions & 0 deletions engines/hopkins/menu.cpp
Expand Up @@ -236,4 +236,8 @@ void MenuManager::CHARGE_PARTIE() {
warning("CHARGE_PARTIE");
}

void MenuManager::SAUVE_PARTIE() {
warning("SAUVE_PARTIE");
}

} // End of namespace Hopkins
1 change: 1 addition & 0 deletions engines/hopkins/menu.h
Expand Up @@ -39,6 +39,7 @@ class MenuManager {

int MENU();
void CHARGE_PARTIE();
void SAUVE_PARTIE();
};

} // End of namespace Hopkins
Expand Down

0 comments on commit 8fa33e7

Please sign in to comment.