ASYLUM: Moved the gameflags from SharedResources to the AsylumEngine. Also removed the OSystem member from the SharedResources (slowly phasing out the last singleton)
git-svn-id: http://asylumengine.googlecode.com/svn/trunk@351 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
parent
4c01ffb9e3
commit
badb49ed6d
9 changed files with 88 additions and 86 deletions
|
@ -303,7 +303,7 @@ int ActionList::process() {
|
||||||
// XXX
|
// XXX
|
||||||
// gameFlag 183 is the same as the
|
// gameFlag 183 is the same as the
|
||||||
// processing flag, but is not being used
|
// processing flag, but is not being used
|
||||||
Shared.clearGameFlag(183);
|
_scene->vm()->clearGameFlag(183);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ int kSetGameFlag(ActionCommand *cmd, Scene *scn) {
|
||||||
int flagNum = cmd->param1;
|
int flagNum = cmd->param1;
|
||||||
|
|
||||||
if (flagNum >= 0)
|
if (flagNum >= 0)
|
||||||
Shared.setGameFlag(flagNum);
|
scn->vm()->setGameFlag(flagNum);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ int kClearGameFlag(ActionCommand *cmd, Scene *scn) {
|
||||||
int flagNum = cmd->param1;
|
int flagNum = cmd->param1;
|
||||||
|
|
||||||
if (flagNum >= 0)
|
if (flagNum >= 0)
|
||||||
Shared.clearGameFlag(flagNum);
|
scn->vm()->clearGameFlag(flagNum);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ int kToggleGameFlag(ActionCommand *cmd, Scene *scn) {
|
||||||
int flagNum = cmd->param1;
|
int flagNum = cmd->param1;
|
||||||
|
|
||||||
if (flagNum >= 0)
|
if (flagNum >= 0)
|
||||||
Shared.toggleGameFlag(flagNum);
|
scn->vm()->toggleGameFlag(flagNum);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -386,9 +386,9 @@ int kJumpIfGameFlag(ActionCommand *cmd, Scene *scn) {
|
||||||
int flagNum = cmd->param1;
|
int flagNum = cmd->param1;
|
||||||
|
|
||||||
if (flagNum) {
|
if (flagNum) {
|
||||||
bool doJump = Shared.isGameFlagSet(flagNum);
|
bool doJump = scn->vm()->isGameFlagSet(flagNum);
|
||||||
if (cmd->param2)
|
if (cmd->param2)
|
||||||
doJump = Shared.isGameFlagNotSet(flagNum);
|
doJump = scn->vm()->isGameFlagNotSet(flagNum);
|
||||||
if (doJump)
|
if (doJump)
|
||||||
scn->actions()->currentLine = cmd->param3;
|
scn->actions()->currentLine = cmd->param3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ AsylumEngine::AsylumEngine(OSystem *system, Common::Language language)
|
||||||
Common::File::addDefaultDirectory(_gameDataDir.getChild("Music"));
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("Music"));
|
||||||
|
|
||||||
g_eventRec.registerRandomSource(_rnd, "asylum");
|
g_eventRec.registerRandomSource(_rnd, "asylum");
|
||||||
|
|
||||||
|
memset(_gameFlags, 0, 1512);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsylumEngine::~AsylumEngine() {
|
AsylumEngine::~AsylumEngine() {
|
||||||
|
@ -65,6 +67,8 @@ AsylumEngine::~AsylumEngine() {
|
||||||
delete _sound;
|
delete _sound;
|
||||||
delete _screen;
|
delete _screen;
|
||||||
delete _encounter;
|
delete _encounter;
|
||||||
|
|
||||||
|
free(_gameFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error AsylumEngine::run() {
|
Common::Error AsylumEngine::run() {
|
||||||
|
@ -86,7 +90,6 @@ Common::Error AsylumEngine::init() {
|
||||||
_mainMenu = 0;
|
_mainMenu = 0;
|
||||||
_scene = 0;
|
_scene = 0;
|
||||||
|
|
||||||
Shared.setOSystem(_system);
|
|
||||||
Shared.setScreen(_screen);
|
Shared.setScreen(_screen);
|
||||||
Shared.setSound(_sound);
|
Shared.setSound(_sound);
|
||||||
Shared.setVideo(_video);
|
Shared.setVideo(_video);
|
||||||
|
@ -103,7 +106,7 @@ Common::Error AsylumEngine::go() {
|
||||||
// TODO: if savegame exists on folder, than start NewGame()
|
// TODO: if savegame exists on folder, than start NewGame()
|
||||||
|
|
||||||
// Set up the game's main scene
|
// Set up the game's main scene
|
||||||
_scene = new Scene(5);
|
_scene = new Scene(5, this);
|
||||||
Shared.setScene(_scene);
|
Shared.setScene(_scene);
|
||||||
|
|
||||||
// XXX This is just here for testing purposes. It is also defined
|
// XXX This is just here for testing purposes. It is also defined
|
||||||
|
@ -130,8 +133,8 @@ Common::Error AsylumEngine::go() {
|
||||||
//playIntro();
|
//playIntro();
|
||||||
|
|
||||||
// Enter first scene
|
// Enter first scene
|
||||||
Shared.setGameFlag(4);
|
setGameFlag(4);
|
||||||
Shared.setGameFlag(12);
|
setGameFlag(12);
|
||||||
_scene->enterScene();
|
_scene->enterScene();
|
||||||
|
|
||||||
while (!shouldQuit()) {
|
while (!shouldQuit()) {
|
||||||
|
@ -160,8 +163,8 @@ void AsylumEngine::playIntro() {
|
||||||
|
|
||||||
_screen->clearScreen();
|
_screen->clearScreen();
|
||||||
|
|
||||||
Shared.setGameFlag(4);
|
setGameFlag(4);
|
||||||
Shared.setGameFlag(12);
|
setGameFlag(12);
|
||||||
|
|
||||||
ResourcePack *introRes = new ResourcePack(18);
|
ResourcePack *introRes = new ResourcePack(18);
|
||||||
|
|
||||||
|
@ -282,7 +285,7 @@ void AsylumEngine::processDelayedEvents() {
|
||||||
if (_scene)
|
if (_scene)
|
||||||
delete _scene;
|
delete _scene;
|
||||||
|
|
||||||
_scene = new Scene(sceneIdx);
|
_scene = new Scene(sceneIdx, this);
|
||||||
Shared.setScene(_scene);
|
Shared.setScene(_scene);
|
||||||
_scene->enterScene();
|
_scene->enterScene();
|
||||||
|
|
||||||
|
@ -291,4 +294,25 @@ void AsylumEngine::processDelayedEvents() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsylumEngine::setGameFlag(int flag) {
|
||||||
|
_gameFlags[flag / 32] |= 1 << flag % -32;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsylumEngine::clearGameFlag(int flag) {
|
||||||
|
_gameFlags[flag / 32] &= ~(1 << flag % -32);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsylumEngine::toggleGameFlag(int flag) {
|
||||||
|
_gameFlags[flag / 32] ^= 1 << flag % -32;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsylumEngine::isGameFlagSet(int flag) {
|
||||||
|
return ((1 << flag % -32) & (unsigned int)_gameFlags[flag / 32]) >> flag % -32 != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsylumEngine::isGameFlagNotSet(int flag) {
|
||||||
|
return ((1 << flag % -32) & (unsigned int)_gameFlags[flag / 32]) >> flag % -32 == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Asylum
|
} // namespace Asylum
|
||||||
|
|
|
@ -72,6 +72,12 @@ public:
|
||||||
virtual Common::Error run();
|
virtual Common::Error run();
|
||||||
virtual bool hasFeature(EngineFeature f) const;
|
virtual bool hasFeature(EngineFeature f) const;
|
||||||
|
|
||||||
|
void setGameFlag(int flag);
|
||||||
|
void clearGameFlag(int flag);
|
||||||
|
void toggleGameFlag(int flag);
|
||||||
|
bool isGameFlagSet(int flag);
|
||||||
|
bool isGameFlagNotSet(int flag);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkForEvent(bool doUpdate);
|
void checkForEvent(bool doUpdate);
|
||||||
void waitForTimer(int msec_delay);
|
void waitForTimer(int msec_delay);
|
||||||
|
@ -92,6 +98,8 @@ private:
|
||||||
Video *_video;
|
Video *_video;
|
||||||
Encounter *_encounter;
|
Encounter *_encounter;
|
||||||
|
|
||||||
|
int _gameFlags[1512];
|
||||||
|
|
||||||
friend class Console;
|
friend class Console;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,9 @@ bool Barrier::visible() {
|
||||||
uint32 flag = gameFlags[f];
|
uint32 flag = gameFlags[f];
|
||||||
|
|
||||||
if (flag <= 0)
|
if (flag <= 0)
|
||||||
isSet = Shared.isGameFlagNotSet(flag); // -flag
|
isSet = Shared.getScene()->vm()->isGameFlagNotSet(flag); // -flag
|
||||||
else
|
else
|
||||||
isSet = Shared.isGameFlagSet(flag);
|
isSet = Shared.getScene()->vm()->isGameFlagSet(flag);
|
||||||
|
|
||||||
if(!isSet)
|
if(!isSet)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -93,7 +93,7 @@ void Console::printActionAreaStats(ActionArea *a) {
|
||||||
|
|
||||||
bool Console::cmdShowFlags(int argc, const char **argv) {
|
bool Console::cmdShowFlags(int argc, const char **argv) {
|
||||||
for (int i = 0; i < 1512; i++) {
|
for (int i = 0; i < 1512; i++) {
|
||||||
if (Shared.isGameFlagSet(i)) {
|
if (_vm->isGameFlagSet(i)) {
|
||||||
DebugPrintf("Game Flag %d is Active\n", i);
|
DebugPrintf("Game Flag %d is Active\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,8 @@ bool Console::cmdToggleFlag(int argc, const char **argv) {
|
||||||
DebugPrintf("Enter a value between 0 and 1512\n");
|
DebugPrintf("Enter a value between 0 and 1512\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Shared.toggleGameFlag(atoi(argv[1]));
|
_vm->toggleGameFlag(atoi(argv[1]));
|
||||||
DebugPrintf("Flag %d == %d\n", atoi(argv[1]), Shared.isGameFlagSet(atoi(argv[1])));
|
DebugPrintf("Flag %d == %d\n", atoi(argv[1]), _vm->isGameFlagSet(atoi(argv[1])));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Asylum {
|
||||||
int g_debugPolygons;
|
int g_debugPolygons;
|
||||||
int g_debugBarriers;
|
int g_debugBarriers;
|
||||||
|
|
||||||
Scene::Scene(uint8 sceneIdx) {
|
Scene::Scene(uint8 sceneIdx, AsylumEngine *vm): _vm(vm) {
|
||||||
_sceneIdx = sceneIdx;
|
_sceneIdx = sceneIdx;
|
||||||
|
|
||||||
char filename[10];
|
char filename[10];
|
||||||
|
@ -228,39 +228,39 @@ int Scene::updateScene() {
|
||||||
WorldStats *worldStats = _ws;
|
WorldStats *worldStats = _ws;
|
||||||
|
|
||||||
// Mouse
|
// Mouse
|
||||||
startTick = Shared.getMillis();
|
startTick = _vm->_system->getMillis();
|
||||||
updateMouse();
|
updateMouse();
|
||||||
debugC(kDebugLevelScene, "UpdateMouse Time: %d", Shared.getMillis() - startTick);
|
debugC(kDebugLevelScene, "UpdateMouse Time: %d", _vm->_system->getMillis() - startTick);
|
||||||
|
|
||||||
// Actors
|
// Actors
|
||||||
startTick = Shared.getMillis();
|
startTick = _vm->_system->getMillis();
|
||||||
for (uint32 a = 0; a < worldStats->numActors; a++)
|
for (uint32 a = 0; a < worldStats->numActors; a++)
|
||||||
updateActor(a);
|
updateActor(a);
|
||||||
debugC(kDebugLevelScene, "UpdateActors Time: %d", Shared.getMillis() - startTick);
|
debugC(kDebugLevelScene, "UpdateActors Time: %d", _vm->_system->getMillis() - startTick);
|
||||||
|
|
||||||
// Barriers
|
// Barriers
|
||||||
startTick = Shared.getMillis();
|
startTick = _vm->_system->getMillis();
|
||||||
updateBarriers(worldStats);
|
updateBarriers(worldStats);
|
||||||
debugC(kDebugLevelScene, "UpdateBarriers Time: %d", Shared.getMillis() - startTick);
|
debugC(kDebugLevelScene, "UpdateBarriers Time: %d", _vm->_system->getMillis() - startTick);
|
||||||
|
|
||||||
// Ambient Sounds
|
// Ambient Sounds
|
||||||
startTick = Shared.getMillis();
|
startTick = _vm->_system->getMillis();
|
||||||
updateAmbientSounds();
|
updateAmbientSounds();
|
||||||
debugC(kDebugLevelScene, "UpdateAmbientSounds Time: %d", Shared.getMillis() - startTick);
|
debugC(kDebugLevelScene, "UpdateAmbientSounds Time: %d", _vm->_system->getMillis() - startTick);
|
||||||
|
|
||||||
// Music
|
// Music
|
||||||
startTick = Shared.getMillis();
|
startTick = _vm->_system->getMillis();
|
||||||
updateMusic();
|
updateMusic();
|
||||||
debugC(kDebugLevelScene, "UpdateMusic Time: %d", Shared.getMillis() - startTick);
|
debugC(kDebugLevelScene, "UpdateMusic Time: %d", _vm->_system->getMillis() - startTick);
|
||||||
|
|
||||||
// Adjust Screen
|
// Adjust Screen
|
||||||
//startTick = Shared.getMillis();
|
//startTick = _vm->_system->getMillis();
|
||||||
// FIXME
|
// FIXME
|
||||||
// Commented out the (incomplete) update screen code because once the
|
// Commented out the (incomplete) update screen code because once the
|
||||||
// actor's x1/y1 values are properly set, the temp code causes a crash
|
// actor's x1/y1 values are properly set, the temp code causes a crash
|
||||||
// Have to finish implementing the method I guess :P
|
// Have to finish implementing the method I guess :P
|
||||||
//updateAdjustScreen();
|
//updateAdjustScreen();
|
||||||
//debugC(kDebugLevelScene, "AdjustScreenStart Time: %d", Shared.getMillis() - startTick);
|
//debugC(kDebugLevelScene, "AdjustScreenStart Time: %d", _vm->_system->getMillis() - startTick);
|
||||||
|
|
||||||
if(_actions->process())
|
if(_actions->process())
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -447,11 +447,11 @@ void Scene::updateActor(uint32 actorIdx) {
|
||||||
uint32 frameNum = actor->frameNum + 1;
|
uint32 frameNum = actor->frameNum + 1;
|
||||||
actor->frameNum = frameNum % actor->frameCount;
|
actor->frameNum = frameNum % actor->frameCount;
|
||||||
|
|
||||||
if (Shared.getMillis() - actor->tickValue1 > 300) {
|
if (_vm->_system->getMillis() - actor->tickValue1 > 300) {
|
||||||
if (rand() % 100 < 50) {
|
if (rand() % 100 < 50) {
|
||||||
// TODO: check sound playing
|
// TODO: check sound playing
|
||||||
}
|
}
|
||||||
actor->tickValue1 = Shared.getMillis();
|
actor->tickValue1 = _vm->_system->getMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -517,9 +517,9 @@ void Scene::updateBarriers(WorldStats *worldStats) {
|
||||||
if (barrier->visible()) {
|
if (barrier->visible()) {
|
||||||
uint32 flag = barrier->flags;
|
uint32 flag = barrier->flags;
|
||||||
if (flag & 0x20) {
|
if (flag & 0x20) {
|
||||||
if (barrier->field_B4 && (Shared.getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
if (barrier->field_B4 && (_vm->_system->getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
||||||
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
||||||
barrier->tickCount = Shared.getMillis();
|
barrier->tickCount = _vm->_system->getMillis();
|
||||||
canPlaySound = true;
|
canPlaySound = true;
|
||||||
}
|
}
|
||||||
} else if (flag & 0x10) {
|
} else if (flag & 0x10) {
|
||||||
|
@ -527,7 +527,7 @@ void Scene::updateBarriers(WorldStats *worldStats) {
|
||||||
char equalZero = frameIdx == 0;
|
char equalZero = frameIdx == 0;
|
||||||
char lessZero = frameIdx < 0;
|
char lessZero = frameIdx < 0;
|
||||||
if (!frameIdx) {
|
if (!frameIdx) {
|
||||||
if (Shared.getMillis() - barrier->tickCount >= 1000 * barrier->tickCount2) {
|
if (_vm->_system->getMillis() - barrier->tickCount >= 1000 * barrier->tickCount2) {
|
||||||
if (rand() % barrier->field_C0 == 1) {
|
if (rand() % barrier->field_C0 == 1) {
|
||||||
if (barrier->field_68C[0]) {
|
if (barrier->field_68C[0]) {
|
||||||
// TODO: fix this, and find a better way to get frame count
|
// TODO: fix this, and find a better way to get frame count
|
||||||
|
@ -540,7 +540,7 @@ void Scene::updateBarriers(WorldStats *worldStats) {
|
||||||
}
|
}
|
||||||
barrier->frameIdx++;
|
barrier->frameIdx++;
|
||||||
}
|
}
|
||||||
barrier->tickCount = Shared.getMillis();
|
barrier->tickCount = _vm->_system->getMillis();
|
||||||
canPlaySound = true;
|
canPlaySound = true;
|
||||||
}
|
}
|
||||||
frameIdx = barrier->frameIdx;
|
frameIdx = barrier->frameIdx;
|
||||||
|
@ -550,15 +550,15 @@ void Scene::updateBarriers(WorldStats *worldStats) {
|
||||||
|
|
||||||
if (!(lessZero ^ 0 | equalZero)) {
|
if (!(lessZero ^ 0 | equalZero)) {
|
||||||
// FIXME: we shouldn't increment field_B4 (check why this value came zero sometimes)
|
// FIXME: we shouldn't increment field_B4 (check why this value came zero sometimes)
|
||||||
if (barrier->field_B4 && (Shared.getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
if (barrier->field_B4 && (_vm->_system->getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
||||||
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
||||||
barrier->tickCount = Shared.getMillis();
|
barrier->tickCount = _vm->_system->getMillis();
|
||||||
canPlaySound = true;
|
canPlaySound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (flag & 8) {
|
} else if (flag & 8) {
|
||||||
// FIXME: we shouldn't increment field_B4 (check why this value came zero sometimes)
|
// FIXME: we shouldn't increment field_B4 (check why this value came zero sometimes)
|
||||||
if (barrier->field_B4 && (Shared.getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
if (barrier->field_B4 && (_vm->_system->getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
||||||
uint32 frameIdx = barrier->frameIdx + 1;
|
uint32 frameIdx = barrier->frameIdx + 1;
|
||||||
if (frameIdx < barrier->frameCount - 1) {
|
if (frameIdx < barrier->frameCount - 1) {
|
||||||
if (barrier->field_688 == 1) {
|
if (barrier->field_688 == 1) {
|
||||||
|
@ -573,30 +573,30 @@ void Scene::updateBarriers(WorldStats *worldStats) {
|
||||||
barrier->frameIdx = frameIdx;
|
barrier->frameIdx = frameIdx;
|
||||||
}
|
}
|
||||||
} else if ((flag & 0xFF) & 8) { // check this
|
} else if ((flag & 0xFF) & 8) { // check this
|
||||||
if (Shared.getMillis() - barrier->tickCount >= 1000 * barrier->tickCount2) {
|
if (_vm->_system->getMillis() - barrier->tickCount >= 1000 * barrier->tickCount2) {
|
||||||
if (rand() % barrier->field_C0 == 1) { // TODO: THIS ISNT WORKING
|
if (rand() % barrier->field_C0 == 1) { // TODO: THIS ISNT WORKING
|
||||||
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
||||||
barrier->tickCount = Shared.getMillis();
|
barrier->tickCount = _vm->_system->getMillis();
|
||||||
canPlaySound = true;
|
canPlaySound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!((flag & 0xFFFF) & 6)) {
|
} else if (!((flag & 0xFFFF) & 6)) {
|
||||||
// FIXME: we shouldn't increment field_B4 (check why this value came zero sometimes)
|
// FIXME: we shouldn't increment field_B4 (check why this value came zero sometimes)
|
||||||
if (barrier->field_B4 && (Shared.getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4) && (flag & 0x10000)) {
|
if (barrier->field_B4 && (_vm->_system->getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4) && (flag & 0x10000)) {
|
||||||
uint32 frameIdx = barrier->frameIdx - 1;
|
uint32 frameIdx = barrier->frameIdx - 1;
|
||||||
if (frameIdx <= 0) {
|
if (frameIdx <= 0) {
|
||||||
barrier->flags &= 0xFFFEFFFF;
|
barrier->flags &= 0xFFFEFFFF;
|
||||||
if (barrier->field_688 == 1) {
|
if (barrier->field_688 == 1) {
|
||||||
// TODO: reset global x, y positions
|
// TODO: reset global x, y positions
|
||||||
}
|
}
|
||||||
barrier->tickCount = Shared.getMillis();
|
barrier->tickCount = _vm->_system->getMillis();
|
||||||
canPlaySound = true;
|
canPlaySound = true;
|
||||||
}
|
}
|
||||||
if (barrier->field_688 == 1) {
|
if (barrier->field_688 == 1) {
|
||||||
// TODO: get global x, y positions
|
// TODO: get global x, y positions
|
||||||
}
|
}
|
||||||
barrier->frameIdx = frameIdx;
|
barrier->frameIdx = frameIdx;
|
||||||
} else if (barrier->field_B4 && (Shared.getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
} else if (barrier->field_B4 && (_vm->_system->getMillis() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
||||||
if ((flag & 0xFF) & 2) {
|
if ((flag & 0xFF) & 2) {
|
||||||
if (barrier->frameIdx == barrier->frameCount - 1) {
|
if (barrier->frameIdx == barrier->frameCount - 1) {
|
||||||
barrier->frameIdx--;
|
barrier->frameIdx--;
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct BarrierItem;
|
||||||
|
|
||||||
class Scene {
|
class Scene {
|
||||||
public:
|
public:
|
||||||
Scene(uint8 sceneIdx);
|
Scene(uint8 sceneIdx, AsylumEngine *vm);
|
||||||
~Scene();
|
~Scene();
|
||||||
|
|
||||||
void handleEvent(Common::Event *event, bool doUpdate);
|
void handleEvent(Common::Event *event, bool doUpdate);
|
||||||
|
@ -75,11 +75,13 @@ public:
|
||||||
void setBlowUpPuzzle(BlowUpPuzzle* puzzle) { _blowUp = puzzle; }
|
void setBlowUpPuzzle(BlowUpPuzzle* puzzle) { _blowUp = puzzle; }
|
||||||
void setScenePosition(int x, int y);
|
void setScenePosition(int x, int y);
|
||||||
|
|
||||||
|
AsylumEngine* vm() { return _vm; }
|
||||||
WorldStats* worldstats() { return _ws; }
|
WorldStats* worldstats() { return _ws; }
|
||||||
Polygons* polygons() { return _polygons; }
|
Polygons* polygons() { return _polygons; }
|
||||||
ActionList* actions() { return _actions; }
|
ActionList* actions() { return _actions; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
AsylumEngine *_vm;
|
||||||
uint8 _sceneIdx;
|
uint8 _sceneIdx;
|
||||||
WorldStats *_ws;
|
WorldStats *_ws;
|
||||||
Polygons *_polygons;
|
Polygons *_polygons;
|
||||||
|
|
|
@ -37,7 +37,7 @@ SharedResources::SharedResources() {
|
||||||
if (!g_initialized) {
|
if (!g_initialized) {
|
||||||
g_initialized = true;
|
g_initialized = true;
|
||||||
}
|
}
|
||||||
memset(_gameFlags, 0, 1512);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedResources::~SharedResources() {
|
SharedResources::~SharedResources() {
|
||||||
|
@ -130,24 +130,4 @@ int SharedResources::getAngle(int x1, int y1, int x2, int y2) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedResources::setGameFlag(int flag) {
|
|
||||||
_gameFlags[flag / 32] |= 1 << flag % -32;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SharedResources::clearGameFlag(int flag) {
|
|
||||||
_gameFlags[flag / 32] &= ~(1 << flag % -32);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SharedResources::toggleGameFlag(int flag) {
|
|
||||||
_gameFlags[flag / 32] ^= 1 << flag % -32;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SharedResources::isGameFlagSet(int flag) {
|
|
||||||
return ((1 << flag % -32) & (unsigned int)_gameFlags[flag / 32]) >> flag % -32 != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SharedResources::isGameFlagNotSet(int flag) {
|
|
||||||
return ((1 << flag % -32) & (unsigned int)_gameFlags[flag / 32]) >> flag % -32 == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
|
@ -51,9 +51,6 @@ class Sound;
|
||||||
class SharedResources: public Common::Singleton<SharedResources> {
|
class SharedResources: public Common::Singleton<SharedResources> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void setOSystem(OSystem* system) { _system = system; }
|
|
||||||
uint32 getMillis() { return _system->getMillis(); }
|
|
||||||
|
|
||||||
void setVideo(Video* video) { _video = video; }
|
void setVideo(Video* video) { _video = video; }
|
||||||
Video* getVideo() { return _video; }
|
Video* getVideo() { return _video; }
|
||||||
|
|
||||||
|
@ -68,25 +65,16 @@ public:
|
||||||
|
|
||||||
int getAngle(int x1, int y1, int x2, int y2);
|
int getAngle(int x1, int y1, int x2, int y2);
|
||||||
|
|
||||||
void setGameFlag(int flag);
|
|
||||||
void clearGameFlag(int flag);
|
|
||||||
void toggleGameFlag(int flag);
|
|
||||||
bool isGameFlagSet(int flag);
|
|
||||||
bool isGameFlagNotSet(int flag);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
SharedResources();
|
SharedResources();
|
||||||
~SharedResources();
|
~SharedResources();
|
||||||
|
|
||||||
OSystem *_system;
|
|
||||||
Video *_video;
|
Video *_video;
|
||||||
Screen *_screen;
|
Screen *_screen;
|
||||||
Sound *_sound;
|
Sound *_sound;
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
|
|
||||||
int _gameFlags[1512];
|
|
||||||
|
|
||||||
}; // end of class SharedResources
|
}; // end of class SharedResources
|
||||||
|
|
||||||
// Angle Tables used by getAngle()
|
// Angle Tables used by getAngle()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue