Some more stubs and rearrangings

svn-id: r21847
This commit is contained in:
Sven Hesse 2006-04-13 20:56:22 +00:00
parent e21f99c7ba
commit 3bed2d377e
8 changed files with 203 additions and 56 deletions

View File

@ -87,6 +87,22 @@ Game::Game(GobEngine *vm) : _vm(vm) {
_curImaFile[0] = 0;
_soundFromExt[0] = 0;
_collStr[0] = 0;
_backupedCount = 0;
_curBackupPos = 0;
for (i = 0; i < 5; i++) {
_cursorXDeltaArray[i] = 0;
_cursorYDeltaArray[i] = 0;
_totTextDataArray[i] = 0;
_totFileDataArray[i] = 0;
_totResourceTableArray[i] = 0;
_extTableArray[i] = 0;
_extHandleArray[i] = 0;
_imFileDataArray[i] = 0;
_variablesArray[i] = 0;
_curTotFileArray[i][0] = 0;
}
}
char *Game::loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight) {
@ -1929,4 +1945,73 @@ void Game::start(void) {
_vm->_video->freeSurfDesc(_vm->_draw->_backSurface);
}
// flagbits: 0 = freeInterVariables, 1 = skipPlay
void Game::totSub(int8 flags, char *newTotFile) {
int8 curBackupPos;
warning("totSub(%d, \"%s\");", flags, newTotFile);
if (_backupedCount >= 5)
return;
_cursorXDeltaArray[_backupedCount] = _vm->_draw->_cursorXDeltaVar;
_cursorYDeltaArray[_backupedCount] = _vm->_draw->_cursorYDeltaVar;
_totTextDataArray[_backupedCount] = _totTextData;
_totFileDataArray[_backupedCount] = _totFileData;
_totResourceTableArray[_backupedCount] = _totResourceTable;
_extTableArray[_backupedCount] = _extTable;
_extHandleArray[_backupedCount] = _extHandle;
_imFileDataArray[_backupedCount] = _imFileData;
_variablesArray[_backupedCount] = _vm->_global->_inter_variables;
strcpy(_curTotFileArray[_backupedCount], _curTotFile);
curBackupPos = _curBackupPos;
_backupedCount++;
_curBackupPos = _backupedCount;
_totTextData = 0;
_totFileData = 0;
_totResourceTable = 0;
if (flags & 1)
_vm->_global->_inter_variables = 0;
strcpy(_curTotFile, newTotFile);
strcat(_curTotFile, ".TOT");
if (_vm->_inter->_terminate != 0)
return;
pushCollisions(0);
if (flags & 2)
playTot(-1);
else
playTot(0);
if (_vm->_inter->_terminate != 2)
_vm->_inter->_terminate = 0;
warning("GOB2 Stub! sub_18072");
if ((flags & 1) && (_vm->_global->_inter_variables != 0))
delete[] _vm->_global->_inter_variables;
_backupedCount--;
_curBackupPos = curBackupPos;
_vm->_draw->_cursorXDeltaVar = _cursorXDeltaArray[_backupedCount];
_vm->_draw->_cursorYDeltaVar = _cursorYDeltaArray[_backupedCount];
_totTextData = _totTextDataArray[_backupedCount];
_totFileData = _totFileDataArray[_backupedCount];
_totResourceTable = _totResourceTableArray[_backupedCount];
_extTable = _extTableArray[_backupedCount];
_extHandle = _extHandleArray[_backupedCount];
_imFileData = _imFileDataArray[_backupedCount];
_vm->_global->_inter_variables = _variablesArray[_backupedCount];
strcpy(_curTotFile, _curTotFileArray[_backupedCount]);
strcpy(_curExtFile, _curTotFile);
_curExtFile[strlen(_curExtFile)-4] = '\0';
strcat(_curExtFile, ".EXT");
}
} // End of namespace Gob

View File

@ -117,6 +117,20 @@ public:
char _soundFromExt[20];
// For totSub()
int8 _backupedCount;
int8 _curBackupPos;
int16 _cursorXDeltaArray[5];
int16 _cursorYDeltaArray[5];
TotTextTable *_totTextDataArray[5];
char *_totFileDataArray[5];
TotResTable *_totResourceTableArray[5];
ExtTable *_extTableArray[5];
int16 _extHandleArray[5];
char *_imFileDataArray[5];
char *_variablesArray[5];
char _curTotFileArray[5][14];
Game(GobEngine *vm);
char *loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight);
@ -148,6 +162,7 @@ public:
void loadImFile(void);
void playTot(int16 skipPlay);
void start(void);
void totSub(int8 flags, char *newTotFile);
protected:

View File

@ -76,6 +76,7 @@ protected:
virtual const char *getOpcodeDrawDesc(byte i) = 0;
virtual const char *getOpcodeFuncDesc(byte i, byte j) = 0;
virtual const char *getOpcodeGoblinDesc(int i) = 0;
virtual void loadMult(void) = 0;
};
class Inter_v1 : public Inter {
@ -112,6 +113,7 @@ protected:
virtual const char *getOpcodeDrawDesc(byte i);
virtual const char *getOpcodeFuncDesc(byte i, byte j);
virtual const char *getOpcodeGoblinDesc(int i);
virtual void loadMult(void);
void o1_loadMult(void);
void o1_playMult(void);
@ -301,9 +303,11 @@ protected:
virtual const char *getOpcodeDrawDesc(byte i);
virtual const char *getOpcodeFuncDesc(byte i, byte j);
virtual const char *getOpcodeGoblinDesc(int i);
virtual void loadMult(void);
void o2_drawStub(void) { warning("Gob2 stub"); }
void o2_stub0x40(void);
void o2_totSub(void);
void o2_stub0x56(void);
void o2_stub0x80(void);
bool o2_evaluateStore(char &cmdCount, int16 &counter, int16 &retFlag);
bool o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag);

View File

@ -1323,6 +1323,9 @@ bool Inter_v1::o1_keyFunc(char &cmdCount, int16 &counter, int16 &retFlag) {
int16 flag;
int16 key;
// Gob2 busy-waits here, so add a delay
_vm->_util->longDelay(1);
flag = load16();
animPalette();
_vm->_draw->blitInvalidated();
@ -1562,7 +1565,7 @@ void Inter_v1::o1_animate(void) {
}
void Inter_v1::o1_multLoadMult(void) {
_vm->_mult->interLoadMult();
loadMult();
}
void Inter_v1::o1_storeParams(void) {
@ -2725,4 +2728,29 @@ int16 Inter_v1::loadSound(int16 slot) {
return 0;
}
void Inter_v1::loadMult(void) {
int16 val;
int16 objIndex;
int16 i;
char *lmultData;
debugC(4, DEBUG_GAMEFLOW, "Inter_v1::loadMult(): Loading...");
evalExpr(&objIndex);
evalExpr(&val);
*_vm->_mult->_objects[objIndex].pPosX = val;
evalExpr(&val);
*_vm->_mult->_objects[objIndex].pPosY = val;
lmultData = (char *)_vm->_mult->_objects[objIndex].pAnimData;
for (i = 0; i < 11; i++) {
if ((char)READ_LE_UINT16(_vm->_global->_inter_execPtr) == (char)99) {
evalExpr(&val);
lmultData[i] = val;
} else {
_vm->_global->_inter_execPtr++;
}
}
}
} // End of namespace Gob

View File

@ -20,6 +20,10 @@
* $Id$
*
*/
#include "common/stdafx.h"
#include "common/endian.h"
#include "gob/gob.h"
#include "gob/global.h"
#include "gob/inter.h"
@ -199,7 +203,7 @@ void Inter_v2::setupOpcodes(void) {
{NULL, ""},
{NULL, ""},
/* 40 */
OPCODE(o2_stub0x40),
OPCODE(o2_totSub),
OPCODE(o2_drawStub),
OPCODE(o2_drawStub),
OPCODE(o2_drawStub),
@ -226,7 +230,7 @@ void Inter_v2::setupOpcodes(void) {
/* 54 */
OPCODE(o2_drawStub),
OPCODE(o2_drawStub),
OPCODE(o2_drawStub),
OPCODE(o2_stub0x56),
{NULL, ""},
/* 58 */
{NULL, ""},
@ -706,29 +710,13 @@ const char *Inter_v2::getOpcodeGoblinDesc(int i) {
return "";
}
void Inter_v2::o2_stub0x40(void) {
char str[18];
int i;
int length;
void Inter_v2::o2_stub0x56(void) {
int16 expr1 = _vm->_parse->parseValExpr();
int16 expr2 = _vm->_parse->parseValExpr();
int16 expr3 = _vm->_parse->parseValExpr();
int16 expr4 = _vm->_parse->parseValExpr();
warning("STUB: Gob2 drawOperation 0x40");
length = *_vm->_global->_inter_execPtr++;
if (length > 17)
error("Length in o2_stub0x40 is greater than 17 (%d)", length);
if (length & 0x80) {
evalExpr(0);
strcpy(str, _vm->_global->_inter_resStr);
} else { // loc_E8CE
for (i = 0; i < length; i++) // loc_E8E3
str[i] = *_vm->_global->_inter_execPtr++;
str[i] = 0;
}
// loc_E910
_vm->_global->_inter_execPtr++;
warning("GOB2 Stub! sub_A6EB(%d, \"%s\");", *_vm->_global->_inter_execPtr, str);
warning("STUB: Gob2 drawOperation 0x56 (%d %d %d %d)", expr1, expr2, expr3, expr4);
}
void Inter_v2::o2_stub0x80(void) {
@ -892,6 +880,32 @@ int16 Inter_v2::loadSound(int16 search) {
_vm->_game->loadSound(slot, dataPtr);*/
}
void Inter_v2::loadMult(void) {
int16 val;
int16 objIndex;
int16 i;
char *lmultData;
debugC(4, DEBUG_GAMEFLOW, "Inter_v2::loadMult(): Loading...");
objIndex = _vm->_parse->parseValExpr();
val = _vm->_parse->parseValExpr();
*_vm->_mult->_objects[objIndex].pPosX = val;
val = _vm->_parse->parseValExpr();
*_vm->_mult->_objects[objIndex].pPosY = val;
lmultData = (char *)_vm->_mult->_objects[objIndex].pAnimData;
for (i = 0; i < 11; i++) {
if (*_vm->_global->_inter_execPtr != 99) {
val = _vm->_parse->parseValExpr();
lmultData[i] = val;
} else
_vm->_global->_inter_execPtr++;
}
warning("GOB2 Stub! Inter_v2::loadMult()");
}
bool Inter_v2::o2_evaluateStore(char &cmdCount, int16 &counter, int16 &retFlag) {
char *savedPos;
int16 varOff;
@ -1345,4 +1359,29 @@ void Inter_v2::o2_playMult(void) {
_vm->_mult->playMult(VAR(57), -1, checkEscape & 0x1, 0);
}
void Inter_v2::o2_totSub(void) {
char totFile[14];
int flags;
int length;
int i;
length = *_vm->_global->_inter_execPtr++;
if (length > 13)
error("Length in o2_totSub is greater than 13 (%d)", length);
if (length & 0x80) {
evalExpr(0);
strcpy(totFile, _vm->_global->_inter_resStr);
} else { // loc_E8CE
for (i = 0; i < length; i++) // loc_E8E3
totFile[i] = *_vm->_global->_inter_execPtr++;
totFile[i] = 0;
}
// loc_E910
_vm->_global->_inter_execPtr++;
flags = *_vm->_global->_inter_execPtr;
_vm->_game->totSub(flags, totFile);
}
} // End of namespace Gob

View File

@ -120,6 +120,7 @@ Mult::Mult(GobEngine *vm) : _vm(vm) {
}
_orderArray = 0;
_word_2CC88 = -1;
}
void Mult::interGetObjAnimSize(void) {
@ -151,31 +152,6 @@ void Mult::freeMult(void) {
_vm->_anim->_animSurf = 0;
}
void Mult::interLoadMult(void) {
int16 val;
int16 objIndex;
int16 i;
char *lmultData;
debugC(4, DEBUG_GAMEFLOW, "interLoadMult: Loading...");
_vm->_inter->evalExpr(&objIndex);
_vm->_inter->evalExpr(&val);
*_objects[objIndex].pPosX = val;
_vm->_inter->evalExpr(&val);
*_objects[objIndex].pPosY = val;
lmultData = (char *)_objects[objIndex].pAnimData;
for (i = 0; i < 11; i++) {
if ((char)READ_LE_UINT16(_vm->_global->_inter_execPtr) == (char)99) {
_vm->_inter->evalExpr(&val);
lmultData[i] = val;
} else {
_vm->_global->_inter_execPtr++;
}
}
}
void Mult::freeAll(void) {
int16 i;

View File

@ -186,11 +186,12 @@ public:
int8 *_orderArray;
int16 _word_2CC88;
void zeroMultData(void);
void checkFreeMult(void);
void interGetObjAnimSize(void);
void freeMult(void);
void interLoadMult(void);
void freeAll(void);
void initAll(void);

View File

@ -864,7 +864,6 @@ void Mult_v2::animate(void) {
int numAnims = 0; // di
// .-----
int off_2CE67 = 1000;
int word_2CC88 = 1;
// '-----
if (_objects == 0)
@ -987,8 +986,8 @@ void Mult_v2::animate(void) {
}
}
warning("GOB2 Stub! word_2CC88");
if (word_2CC88 >= 0) {
warning("GOB2 Stub! _word_2CC88");
if (_word_2CC88 >= 0) {
for (i = 0; i < orderArrayPos; i++) {
animObj1 = _renderData2[orderArray[i]];
for (j = i+1; j < orderArrayPos; j++) {
@ -1061,7 +1060,7 @@ void Mult_v2::animate(void) {
if (animData1->maxTick == animObj1->tick) {
animObj1->tick = 0;
if ((animData1->animType < 100) || (word_2CC88 < 0)) {
if ((animData1->animType < 100) || (_word_2CC88 < 0)) {
if (animData1->animType == 4) {
animData1->frame = 0;
animData1->isPaused = 1;