Skip to content

Commit

Permalink
HOPKINS: Implemented some BOB methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 20, 2012
1 parent 06f83a0 commit 3d91711
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 2 deletions.
31 changes: 31 additions & 0 deletions engines/hopkins/globals.h
Expand Up @@ -84,11 +84,41 @@ struct BankItem {
};

struct BobItem {
int field0;
byte *field4;
int field8;
int fieldA;
int fieldC;
int fieldE;
int field10;
int field12;
int field14;
int field16;
byte *field18;
int field1A;
int field1C;
int field1E;
int field20;
int field22;
int field24;
int field26;
int field28;
int field2A;
int field2C;
byte *field30;
int field34;
int field36;
int field38;
int field3A;
int field46;
};

struct Liste2Item {
int field0;
int field2;
int field4;
int field6;
int field8;
};

struct BlAnimItem {
Expand Down Expand Up @@ -181,6 +211,7 @@ class Globals {
BqeAnimItem Bqe_Anim[35];
BankItem Bank[8];
BobItem Bob[36];
Liste2Item Liste2[35];
BlAnimItem BL_ANIM[30];
VBobItem VBob[35];
ObjetWItem ObjetW[300];
Expand Down
26 changes: 24 additions & 2 deletions engines/hopkins/graphics.cpp
Expand Up @@ -1297,11 +1297,33 @@ void GraphicsManager::Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5) {
}

void GraphicsManager::FIN_VISU() {
warning("TODO: FIN_VISU");
for (int idx = 1; idx <= 20; ++idx) {
if (_vm->_globals.Bqe_Anim[idx].field4 == 1)
_vm->_objectsManager.BOB_OFF(idx);
}

_vm->_eventsManager.VBL();
_vm->_eventsManager.VBL();

for (int idx = 1; idx <= 20; ++idx) {
if (_vm->_globals.Bqe_Anim[idx].field4 == 1)
_vm->_objectsManager.BOB_ZERO(idx);
}

for (int idx = 1; idx <= 29; ++idx) {
_vm->_globals.BL_ANIM[idx].v1 = 0;
}

for (int idx = 1; idx <= 20; ++idx) {
_vm->_globals.Bqe_Anim[idx].field4 = 0;
}
}

void GraphicsManager::VISU_ALL() {
warning("TODO: VISU_ALL");
for (int idx = 1; idx <= 20; ++idx) {
if (_vm->_globals.Bqe_Anim[idx].field4 == 1)
_vm->_objectsManager.BOB_VISU(idx);
}
}

void GraphicsManager::RESET_SEGMENT_VESA() {
Expand Down
104 changes: 104 additions & 0 deletions engines/hopkins/objects.cpp
Expand Up @@ -31,6 +31,10 @@

namespace Hopkins {

ObjectsManager::ObjectsManager() {
PRIORITY = 0;
}

void ObjectsManager::setParent(HopkinsEngine *vm) {
_vm = vm;
}
Expand Down Expand Up @@ -185,4 +189,104 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) {
return arrIndex;
}

void ObjectsManager::INIT_BOB() {
for (int idx = 0; idx < 35; ++idx) {
BOB_ZERO(idx);
}
}

void ObjectsManager::BOB_ZERO(int idx) {
BobItem &bob = _vm->_globals.Bob[idx];
Liste2Item &item = _vm->_globals.Liste2[idx];

bob.field0 = 0;
bob.field4 = PTRNUL;
bob.field8 = 0;
bob.fieldA = 0;
bob.fieldC = 0;
bob.fieldE = 0;
bob.field10 = 0;
bob.field12 = 0;
bob.field14 = 0;
bob.field16 = 0;
bob.field18 = PTRNUL;
bob.field1A = 0;
bob.field1C = 0;
bob.field1E = 0;
bob.field20 = 0;
bob.field22 = 0;
bob.field24 = 0;
bob.field26 = 0;
bob.field28 = 0;
bob.field2A = 0;
bob.field2C = 0;
bob.field30 = PTRNUL;
bob.field34 = 0;
bob.field36 = 0;
bob.field38 = 0;
bob.field46 = 0;

item.field0 = 0;
item.field2 = 0;
item.field4 = 0;
item.field6 = 0;
item.field8 = 0;
}

void ObjectsManager::BOB_VISU(int idx) {
int v1;
const byte *data;
int16 v6;
int16 v7;
int16 v8;
int16 v9;

PRIORITY = 1;

if (!_vm->_globals.Bob[idx].field0) {
BOB_ZERO(idx);

data = _vm->_globals.Bqe_Anim[idx].data;
v1 = READ_LE_UINT16(data);
v9 = READ_LE_UINT16(data + 2);
v8 = READ_LE_UINT16(data + 4);
v7 = READ_LE_UINT16(data + 6);
v6 = READ_LE_UINT16(data + 8);
if (READ_LE_UINT16(data)) {
if (_vm->_globals.Bank[idx].field4) {
if (!v9)
v9 = 1;
if (!v6)
v6 = -1;

if (READ_LE_UINT16(data + 24)) {
_vm->_globals.Bob[idx].field3A = 0;

if (_vm->_globals.Bank[idx].fileHeader == 1) {
_vm->_globals.Bob[idx].field3A = 1;
_vm->_globals.Bob[idx].field36 = 0;
_vm->_globals.Bob[idx].field38 = 0;
}

_vm->_globals.Bob[idx].field18 = _vm->_globals.Bqe_Anim[idx].data;
_vm->_globals.Bob[idx].field0 = 10;
_vm->_globals.Bob[idx].field4 = _vm->_globals.Bank[idx].data;

_vm->_globals.Bob[idx].field1E = v9;
_vm->_globals.Bob[idx].field20 = v6;
_vm->_globals.Bob[idx].field22 = v8;
_vm->_globals.Bob[idx].field24 = v7;
}
}
}
}
}

void ObjectsManager::BOB_OFF(int idx) {
if (_vm->_globals.Bob[idx].field0 == 3)
_vm->_globals.Bob[idx].field0 = 4;
else if (_vm->_globals.Bob[idx].field0 == 10)
_vm->_globals.Bob[idx].field0 = 11;
}

} // End of namespace Hopkins
8 changes: 8 additions & 0 deletions engines/hopkins/objects.h
Expand Up @@ -34,7 +34,10 @@ class HopkinsEngine;
class ObjectsManager {
private:
HopkinsEngine *_vm;

int PRIORITY;
public:
ObjectsManager();
void setParent(HopkinsEngine *vm);

byte *CHANGE_OBJET(int objIndex);
Expand All @@ -50,6 +53,11 @@ class ObjectsManager {

int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex);
int AJOUTE_OBJET(int objIndex);

void INIT_BOB();
void BOB_ZERO(int idx);
void BOB_VISU(int idx);
void BOB_OFF(int idx);
};

} // End of namespace Hopkins
Expand Down

0 comments on commit 3d91711

Please sign in to comment.