ASYLUM: * changed some variable casting from uint32 to int

* force kDebugFlagScripts to be on by default (for now)

git-svn-id: http://asylumengine.googlecode.com/svn/trunk@378 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
Alex Bevilacqua 2009-11-11 09:51:36 +00:00 committed by Eugene Sandulenko
parent fc33509d62
commit 005cfdcf5a
No known key found for this signature in database
GPG key ID: 014D387312D34F08
8 changed files with 30 additions and 50 deletions

View file

@ -53,6 +53,9 @@ struct AsylumFunction {
#define MAPFUNC(name, func) {name, func}
// TODO I don't know that we're clearing this out
// when the engine is disposed. Need to look into this
// as a possible memory leak.
static const AsylumFunction function_map[] = {
/*0x00*/ MAPFUNC("kReturn0", kReturn0),
/*0x01*/ MAPFUNC("kSetGameFlag", kSetGameFlag),
@ -587,6 +590,7 @@ int kDisableActor(ActionCommand *cmd, Scene *scn) {
actorIndex = cmd->param1;
// TODO Finish implementing this function
//scn->getActor()->update_4072A0(actorIndex);
return -1;

View file

@ -40,15 +40,15 @@ class Scene;
typedef struct ActionCommand {
uint32 numLines; // Only set on the first line of each script
uint32 opcode;
uint32 param1;
uint32 param2;
uint32 param3;
uint32 param4;
uint32 param5;
uint32 param6;
uint32 param7;
uint32 param8;
uint32 param9;
int param1;
int param2;
int param3;
int param4;
int param5;
int param6;
int param7;
int param8;
int param9;
} ActionCommand;

View file

@ -280,7 +280,6 @@ void Actor::update_4072A0(int param) {
int newDir = 0;
switch (param) {
case 4:
case 6:
case 14:
@ -298,7 +297,9 @@ void Actor::update_4072A0(int param) {
setAction(newDir + 5);
break;
default:
warning ("[update_4072A0] unimplemented case: %d", param);
break;
}
this->grResId = newGrId;
@ -308,6 +309,11 @@ void Actor::update_4072A0(int param) {
this->frameNum = 0;
delete gra;
// TODO
// The update type can be different than the provided parameter
// depending on the switch case. Change this once a case handler
// is implemented that requires this ... namely:
// if (!v34) v3 = 4; // so updateType = 4
this->updateType = param;
}

View file

@ -52,6 +52,8 @@ AsylumEngine::AsylumEngine(OSystem *system, Common::Language language)
SearchMan.addSubDirectoryMatching(_gameDataDir, "vids");
SearchMan.addSubDirectoryMatching(_gameDataDir, "music");
Common::enableDebugChannel("Scripts");
g_eventRec.registerRandomSource(_rnd, "asylum");
memset(_gameFlags, 0, 1512);

View file

@ -44,7 +44,7 @@ namespace Asylum {
// progress before the scene is entered. This is
// just a convenience, as there's no need for the type
// of pre-loading that was performed in the original
#define SHOW_SCENE_LOADING
//#define SHOW_SCENE_LOADING
// XXX
// I'm not sure if system endian-ness would have any

View file

@ -85,7 +85,7 @@ Scene::Scene(uint8 sceneIdx, AsylumEngine *vm): _vm(vm) {
_vm->text()->loadFont(_resPack, _ws->commonRes.font1);
char musPackFileName[10];
sprintf(musPackFileName, "mus.%03d", sceneIdx);
sprintf(musPackFileName, MUSIC_FILE_MASK, sceneIdx);
_musPack = new ResourcePack(musPackFileName);
_bgResource = new GraphicResource(_resPack, _ws->commonRes.backgroundImage);
@ -299,7 +299,7 @@ int Scene::updateScene() {
// Barriers
startTick = _vm->_system->getMillis();
updateBarriers2();
updateBarriers();
debugC(kDebugLevelScene, "UpdateBarriers Time: %d", _vm->_system->getMillis() - startTick);
// Ambient Sounds
@ -560,38 +560,7 @@ void Scene::updateActor(uint32 actorIdx) {
}
}
// XXX WIP
void Scene::updateBarriers() {
int v1, v0, v32, v33, v34, tickVal, tickVal05, tickVal06;
v1 = v0 = v32 = v33 = v34 = tickVal = tickVal05 = tickVal06 = 0;
uint32 start, v2, v31;
bool done = false;
//if (_ws->barriers.size() > 0);
v2 = _ws->barriers[0].tickCount2;
for (uint32 idx = 0; idx < _ws->numBarriers; idx++) {
//Barrier *b = &_ws->barriers[idx];
start = _vm->_system->getMillis();
if (v2 - 32 != 4)
done = true;
if (!done && !_ws->checkBarrierFlagsCondition(idx)) {
v31 = _vm->_system->getMillis();
}
/*
* TODO
*/
v2 += 426;
v1 = 0;
done = false;
}
}
void Scene::updateBarriers2() {
//Screen *screen = _vm->screen();
uint barriersCount = _ws->barriers.size();
@ -732,6 +701,7 @@ void Scene::updateBarriers2() {
}
void Scene::updateAmbientSounds() {
// TODO
// if (cfgGameQualityValue > 3)
int v2 = 1;
@ -742,15 +712,13 @@ void Scene::updateAmbientSounds() {
for (uint32 i = 0; i < _ws->numAmbientSound; i++) {
AmbientSoundItem *snd = &_ws->ambientSounds[i];
for (uint32 f = 0; f < 6; f++) {
uint gameFlag = snd->flagNum[f];
int gameFlag = snd->flagNum[f];
if (gameFlag >= 0) {
if (_vm->isGameFlagNotSet(gameFlag)) {
v2 = 0;
break;
}
} else {
// FIXME: Applying the minus operator to an unsigned type results
// in an unsigned type again. Casting gameFlag to int for now
if (_vm->isGameFlagSet(-(int)gameFlag)) {
// XXX Looks like this just jumps back to
// the top of the loop, so not sure if this

View file

@ -38,6 +38,7 @@
#include "asylum/cursor.h"
#define SCENE_FILE_MASK "scn.%03d"
#define MUSIC_FILE_MASK "mus.%03d"
namespace Asylum {
@ -161,7 +162,6 @@ private:
void updateMouse();
void updateActor(uint32 actorIdx);
void updateBarriers();
void updateBarriers2(); // XXX Alexandre's version
void updateAmbientSounds();
void updateMusic();
void updateAdjustScreen();

View file

@ -57,7 +57,7 @@ typedef struct AmbientSoundItem {
uint32 field_C;
uint32 field_10;
uint32 field_14;
uint32 flagNum[6];
int flagNum[6];
uint32 x;
uint32 y;