ASYLUM: Major overhaul of data casting. Converted all uint32 member variables and fields to int32 (and uint16 to int16) and update the associated reads. There may be regressions as a result, but so far everything seems to be working as expected.
Also combed through the source and silenced 99% of the warnings that GCC was generating. git-svn-id: http://asylumengine.googlecode.com/svn/trunk@404 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
parent
9e2855fd81
commit
cc43cc88a3
38 changed files with 955 additions and 957 deletions
|
@ -336,7 +336,7 @@ int ActionList::process() {
|
||||||
|
|
||||||
ScriptEntry *currentCommand = &_currentScript->commands[currentLine];
|
ScriptEntry *currentCommand = &_currentScript->commands[currentLine];
|
||||||
|
|
||||||
uint32 opcode = currentCommand->opcode;
|
int32 opcode = currentCommand->opcode;
|
||||||
|
|
||||||
debugC(kDebugLevelScripts,
|
debugC(kDebugLevelScripts,
|
||||||
"[0x%02d] %s(%d, %d, %d, %d, %d, %d, %d, %d, %d)",
|
"[0x%02d] %s(%d, %d, %d, %d, %d, %d, %d, %d, %d)",
|
||||||
|
@ -397,19 +397,19 @@ int ActionList::process() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionList::load(Common::SeekableReadStream *stream) {
|
void ActionList::load(Common::SeekableReadStream *stream) {
|
||||||
size = stream->readUint32LE();
|
size = stream->readSint32LE();
|
||||||
numEntries = stream->readUint32LE();
|
numEntries = stream->readSint32LE();
|
||||||
|
|
||||||
for (uint32 a = 0; a < numEntries; a++) {
|
for (int32 a = 0; a < numEntries; a++) {
|
||||||
Script action;
|
Script action;
|
||||||
memset(&action, 0, sizeof(Script));
|
memset(&action, 0, sizeof(Script));
|
||||||
|
|
||||||
for (uint32 c = 0; c < MAX_ACTION_COMMANDS; c++) {
|
for (int32 c = 0; c < MAX_ACTION_COMMANDS; c++) {
|
||||||
ScriptEntry command;
|
ScriptEntry command;
|
||||||
memset(&command, 0, sizeof(ScriptEntry));
|
memset(&command, 0, sizeof(ScriptEntry));
|
||||||
|
|
||||||
command.numLines = stream->readUint32LE();
|
command.numLines = stream->readSint32LE();
|
||||||
command.opcode = stream->readUint32LE();
|
command.opcode = stream->readSint32LE();
|
||||||
command.param1 = stream->readSint32LE();
|
command.param1 = stream->readSint32LE();
|
||||||
command.param2 = stream->readSint32LE();
|
command.param2 = stream->readSint32LE();
|
||||||
command.param3 = stream->readSint32LE();
|
command.param3 = stream->readSint32LE();
|
||||||
|
@ -423,9 +423,9 @@ void ActionList::load(Common::SeekableReadStream *stream) {
|
||||||
action.commands[c] = command;
|
action.commands[c] = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
action.field_1BAC = stream->readUint32LE();
|
action.field_1BAC = stream->readSint32LE();
|
||||||
action.field_1BB0 = stream->readUint32LE();
|
action.field_1BB0 = stream->readSint32LE();
|
||||||
action.counter = stream->readUint32LE();
|
action.counter = stream->readSint32LE();
|
||||||
|
|
||||||
entries.push_back(action);
|
entries.push_back(action);
|
||||||
}
|
}
|
||||||
|
@ -674,8 +674,8 @@ int kEnableActor(Script *script, ScriptEntry *cmd, Scene *scn) {
|
||||||
|
|
||||||
int kEnableBarriers(Script *script, ScriptEntry *cmd, Scene *scn) {
|
int kEnableBarriers(Script *script, ScriptEntry *cmd, Scene *scn) {
|
||||||
int barIdx = scn->worldstats()->getBarrierIndexById(cmd->param1);
|
int barIdx = scn->worldstats()->getBarrierIndexById(cmd->param1);
|
||||||
uint32 sndIdx = cmd->param3;
|
int32 sndIdx = cmd->param3;
|
||||||
uint32 v59 = cmd->param2;
|
int32 v59 = cmd->param2;
|
||||||
|
|
||||||
if (!script->counter && scn->getSceneIndex() != 13 && sndIdx != 0) {
|
if (!script->counter && scn->getSceneIndex() != 13 && sndIdx != 0) {
|
||||||
// FIXME: I really don't understand what (sndIdx != 0) & 5 is supposed to be doing here,
|
// FIXME: I really don't understand what (sndIdx != 0) & 5 is supposed to be doing here,
|
||||||
|
@ -957,7 +957,7 @@ int kWaitUntilFramePlayed(Script *script, ScriptEntry *cmd, Scene *scn) {
|
||||||
Barrier *barrier = scn->worldstats()->getBarrierById(cmd->param1);
|
Barrier *barrier = scn->worldstats()->getBarrierById(cmd->param1);
|
||||||
|
|
||||||
if (barrier) {
|
if (barrier) {
|
||||||
uint32 frameNum = cmd->param2;
|
int32 frameNum = cmd->param2;
|
||||||
if (cmd->param2 == -1)
|
if (cmd->param2 == -1)
|
||||||
frameNum = barrier->frameCount - 1;
|
frameNum = barrier->frameCount - 1;
|
||||||
|
|
||||||
|
@ -997,11 +997,11 @@ int k_unk40_SOUND(Script *script, ScriptEntry *cmd, Scene *scn) {
|
||||||
|
|
||||||
int kPlaySpeech(Script *script, ScriptEntry *cmd, Scene *scn) {
|
int kPlaySpeech(Script *script, ScriptEntry *cmd, Scene *scn) {
|
||||||
//TODO - Add support for other param options
|
//TODO - Add support for other param options
|
||||||
uint32 sndIdx = cmd->param1;
|
int32 sndIdx = cmd->param1;
|
||||||
|
|
||||||
if ((int)sndIdx >= 0) {
|
if ((int)sndIdx >= 0) {
|
||||||
if (cmd->param4 != 2) {
|
if (cmd->param4 != 2) {
|
||||||
uint32 resIdx = scn->speech()->play(sndIdx);
|
int32 resIdx = scn->speech()->play(sndIdx);
|
||||||
cmd->param5 = resIdx;
|
cmd->param5 = resIdx;
|
||||||
|
|
||||||
if (cmd->param2) {
|
if (cmd->param2) {
|
||||||
|
|
|
@ -39,41 +39,41 @@ namespace Asylum {
|
||||||
class Scene;
|
class Scene;
|
||||||
|
|
||||||
typedef struct ScriptEntry {
|
typedef struct ScriptEntry {
|
||||||
uint32 numLines; // Only set on the first line of each script
|
int32 numLines; // Only set on the first line of each script
|
||||||
uint32 opcode;
|
int32 opcode;
|
||||||
int param1;
|
int32 param1;
|
||||||
int param2;
|
int32 param2;
|
||||||
int param3;
|
int32 param3;
|
||||||
int param4;
|
int32 param4;
|
||||||
int param5;
|
int32 param5;
|
||||||
int param6;
|
int32 param6;
|
||||||
int param7;
|
int32 param7;
|
||||||
int param8;
|
int32 param8;
|
||||||
int param9;
|
int32 param9;
|
||||||
|
|
||||||
} ScriptEntry;
|
} ScriptEntry;
|
||||||
|
|
||||||
typedef struct Script {
|
typedef struct Script {
|
||||||
ScriptEntry commands[MAX_ACTION_COMMANDS];
|
ScriptEntry commands[MAX_ACTION_COMMANDS];
|
||||||
uint32 field_1BAC;
|
int32 field_1BAC;
|
||||||
uint32 field_1BB0;
|
int32 field_1BB0;
|
||||||
uint32 counter;
|
int32 counter;
|
||||||
} Script;
|
} Script;
|
||||||
|
|
||||||
typedef struct ScriptQueueEntry {
|
typedef struct ScriptQueueEntry {
|
||||||
int actionListIndex;
|
int32 actionListIndex;
|
||||||
//int actionListItemIndex;
|
//int32 actionListItemIndex;
|
||||||
int actorIndex;
|
int32 actorIndex;
|
||||||
//int field_C;
|
//int32 field_C;
|
||||||
//int field_10;
|
//int32 field_10;
|
||||||
|
|
||||||
} ScriptQueueEntry;
|
} ScriptQueueEntry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
typedef struct ScriptQueue {
|
typedef struct ScriptQueue {
|
||||||
ScriptQueueEntry entries[10];
|
ScriptQueueEntry entries[10];
|
||||||
int count;
|
int32 count;
|
||||||
int field_CC;
|
int32 field_CC;
|
||||||
|
|
||||||
} ScriptQueue;
|
} ScriptQueue;
|
||||||
*/
|
*/
|
||||||
|
@ -83,8 +83,8 @@ public:
|
||||||
ActionList(Common::SeekableReadStream *stream, Scene *scene);
|
ActionList(Common::SeekableReadStream *stream, Scene *scene);
|
||||||
virtual ~ActionList();
|
virtual ~ActionList();
|
||||||
|
|
||||||
uint32 size;
|
int32 size;
|
||||||
uint32 numEntries;
|
int32 numEntries;
|
||||||
|
|
||||||
Common::Array<Script> entries;
|
Common::Array<Script> entries;
|
||||||
|
|
||||||
|
@ -92,19 +92,19 @@ public:
|
||||||
// Made all the internal control variables public and removed the getter/setter
|
// Made all the internal control variables public and removed the getter/setter
|
||||||
// pairs for simplicity. This should be refactored later, once the function mapping
|
// pairs for simplicity. This should be refactored later, once the function mapping
|
||||||
// is cleaned up properly
|
// is cleaned up properly
|
||||||
int currentLine;
|
int32 currentLine;
|
||||||
int currentLoops;
|
int32 currentLoops;
|
||||||
int delayedSceneIndex;
|
int32 delayedSceneIndex;
|
||||||
int delayedVideoIndex;
|
int32 delayedVideoIndex;
|
||||||
bool allowInput;
|
bool allowInput;
|
||||||
int lineIncrement;
|
int32 lineIncrement;
|
||||||
bool done;
|
bool done;
|
||||||
bool waitCycle;
|
bool waitCycle;
|
||||||
|
|
||||||
/** .text:00402120
|
/** .text:00402120
|
||||||
* Process the current script
|
* Process the current script
|
||||||
*/
|
*/
|
||||||
int process();
|
int32 process();
|
||||||
/** .text:00401020
|
/** .text:00401020
|
||||||
* Reset the _scripts entries to their default values
|
* Reset the _scripts entries to their default values
|
||||||
*/
|
*/
|
||||||
|
@ -113,19 +113,19 @@ public:
|
||||||
* Initialize the script element at actionIndex to
|
* Initialize the script element at actionIndex to
|
||||||
* the actor at actorIndex
|
* the actor at actorIndex
|
||||||
*/
|
*/
|
||||||
void queueScript(int actionIndex, int actorIndex);
|
void queueScript(int32 actionIndex, int32 actorIndex);
|
||||||
/** .text:00401100
|
/** .text:00401100
|
||||||
* Update the queued scripts
|
* Update the queued scripts
|
||||||
*/
|
*/
|
||||||
//void updateQueue(int queueIndex);
|
//void updateQueue(int32 queueIndex);
|
||||||
/**
|
/**
|
||||||
* Toggle the action queue processing flag
|
* Toggle the action queue processing flag
|
||||||
*/
|
*/
|
||||||
void setActionFlag(bool value) { _actionFlag = value; }
|
void setActionFlag(bool value) { _actionFlag = value; }
|
||||||
|
|
||||||
|
|
||||||
void processActionListSub02(Script* script, ScriptEntry* command, int a4);
|
void processActionListSub02(Script* script, ScriptEntry* command, int32 a4);
|
||||||
void enableActorSub(int actorIndex, int condition);
|
void enableActorSub(int32 actorIndex, int32 condition);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
|
@ -138,106 +138,106 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
// opcode functions
|
// opcode functions
|
||||||
int kReturn0(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kReturn0(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kToggleGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kToggleGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfGameFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kHideCursor(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kHideCursor(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kShowCursor(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kShowCursor(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kPlayAnimation(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kPlayAnimation(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kMoveScenePosition(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kMoveScenePosition(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kHideActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kHideActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kShowActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kShowActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetActorStats(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetActorStats(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetSceneMotionStat(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetSceneMotionStat(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kDisableActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kDisableActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kEnableActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kEnableActor(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kEnableBarriers(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kEnableBarriers(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kReturn(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kReturn(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kDestroyBarrier(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kDestroyBarrier(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk12_JMP_WALK_ACTOR(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk12_JMP_WALK_ACTOR(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk13_JMP_WALK_ACTOR(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk13_JMP_WALK_ACTOR(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk14_JMP_WALK_ACTOR(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk14_JMP_WALK_ACTOR(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk15(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk15(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kResetAnimation(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kResetAnimation(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearFlag1Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearFlag1Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk18_PLAY_SND(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk18_PLAY_SND(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfFlag2Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfFlag2Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetFlag2Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetFlag2Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearFlag2Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearFlag2Bit0(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfFlag2Bit2(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfFlag2Bit2(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetFlag2Bit2(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetFlag2Bit2(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearFlag2Bit2(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearFlag2Bit2(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfFlag2Bit1(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfFlag2Bit1(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetFlag2Bit1(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetFlag2Bit1(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearFlag2Bit1(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearFlag2Bit1(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk22(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk22(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk23(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk23(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk24(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk24(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kRunEncounter(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kRunEncounter(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfFlag2Bit4(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfFlag2Bit4(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetFlag2Bit4(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetFlag2Bit4(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearFlag2Bit4(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearFlag2Bit4(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetActorField638(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetActorField638(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfActorField638(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfActorField638(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kChangeScene(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kChangeScene(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk2C_ActorSub(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk2C_ActorSub(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kPlayMovie(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kPlayMovie(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kStopAllBarriersSounds(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kStopAllBarriersSounds(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetActionFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetActionFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearActionFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearActionFlag(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kResetSceneRect(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kResetSceneRect(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kChangeMusicById(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kChangeMusicById(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kStopMusic(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kStopMusic(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk34_Status(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk34_Status(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk35(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk35(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk36(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk36(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kRunBlowUpPuzzle(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kRunBlowUpPuzzle(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfFlag2Bit3(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfFlag2Bit3(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetFlag2Bit3(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetFlag2Bit3(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearFlag2Bit3(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearFlag2Bit3(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk3B_PALETTE_MOD(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk3B_PALETTE_MOD(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk3C_CMP_VAL(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk3C_CMP_VAL(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kWaitUntilFramePlayed(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kWaitUntilFramePlayed(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kUpdateWideScreen(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kUpdateWideScreen(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk3F(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk3F(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk40_SOUND(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk40_SOUND(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kPlaySpeech(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kPlaySpeech(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk42(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk42(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk43(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk43(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kPaletteFade(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kPaletteFade(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kStartPaletteFadeThread(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kStartPaletteFadeThread(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk46(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk46(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kActorFaceObject(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kActorFaceObject(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk48_MATTE_01(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk48_MATTE_01(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk49_MATTE_90(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk49_MATTE_90(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpIfSoundPlaying(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpIfSoundPlaying(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kChangePlayerCharacterIndex(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kChangePlayerCharacterIndex(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kChangeActorField40(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kChangeActorField40(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kStopSound(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kStopSound(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk4E_RANDOM_COMMAND(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk4E_RANDOM_COMMAND(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kClearScreen(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kClearScreen(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kQuit(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kQuit(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kJumpBarrierFrame(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kJumpBarrierFrame(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk52(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk52(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk53(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk53(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk54_SET_ACTIONLIST_6EC(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk54_SET_ACTIONLIST_6EC(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk55(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk55(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk56(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk56(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetResourcePalette(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetResourcePalette(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetBarrierFrameIdxFlaged(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetBarrierFrameIdxFlaged(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk59(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk59(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk5A(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk5A(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk5B(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk5B(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk5C(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk5C(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk5D(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk5D(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk5E(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk5E(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int kSetBarrierLastFrameIdx(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 kSetBarrierLastFrameIdx(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk60_SET_OR_CLR_ACTIONAREA_FLAG(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk60_SET_OR_CLR_ACTIONAREA_FLAG(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk61(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk61(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk62_SHOW_OPTIONS_SCREEN(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk62_SHOW_OPTIONS_SCREEN(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
int k_unk63(Script *script, ScriptEntry *cmd, Scene *scn);
|
int32 k_unk63(Script *script, ScriptEntry *cmd, Scene *scn);
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ Actor::~Actor() {
|
||||||
// free _resources?
|
// free _resources?
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::setPosition(uint32 targetX, uint32 targetY) {
|
void Actor::setPosition(int32 targetX, int32 targetY) {
|
||||||
//boundingRect.left = targetX;
|
//boundingRect.left = targetX;
|
||||||
//boundingRect.top = targetY;
|
//boundingRect.top = targetY;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ void Actor::visible(bool value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void Actor::setDirection(int dir) {
|
void Actor::setDirection(int32 dir) {
|
||||||
direction = dir;
|
direction = dir;
|
||||||
setActionByIndex(dir);
|
setActionByIndex(dir);
|
||||||
}
|
}
|
||||||
|
@ -69,13 +69,13 @@ void Actor::setDirection(int dir) {
|
||||||
void Actor::setRawResources(uint8 *data) {
|
void Actor::setRawResources(uint8 *data) {
|
||||||
byte *dataPtr = data;
|
byte *dataPtr = data;
|
||||||
|
|
||||||
for (uint32 i = 0; i < 60; i++) {
|
for (int32 i = 0; i < 60; i++) {
|
||||||
_resources[i] = READ_LE_UINT32(dataPtr);
|
_resources[i] = (int32)READ_LE_UINT32(dataPtr);
|
||||||
dataPtr += 4;
|
dataPtr += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::setAction(int action) {
|
void Actor::setAction(int32 action) {
|
||||||
assert(_resPack);
|
assert(_resPack);
|
||||||
|
|
||||||
if (action == currentAction)
|
if (action == currentAction)
|
||||||
|
@ -84,19 +84,19 @@ void Actor::setAction(int action) {
|
||||||
currentAction = action;
|
currentAction = action;
|
||||||
|
|
||||||
delete _graphic;
|
delete _graphic;
|
||||||
int act = (action < 100) ? action : action - 100;
|
int32 act = (action < 100) ? action : action - 100;
|
||||||
|
|
||||||
_graphic = new GraphicResource(_resPack, _resources[act]);
|
_graphic = new GraphicResource(_resPack, _resources[act]);
|
||||||
|
|
||||||
// Flip horizontally if necessary
|
// Flip horizontally if necessary
|
||||||
if (currentAction > 100) {
|
if (currentAction > 100) {
|
||||||
for (uint32 i = 0; i < _graphic->getFrameCount(); i++) {
|
for (int32 i = 0; i < _graphic->getFrameCount(); i++) {
|
||||||
GraphicFrame *frame = _graphic->getFrame(i);
|
GraphicFrame *frame = _graphic->getFrame(i);
|
||||||
byte *buffer = (byte *)frame->surface.pixels;
|
byte *buffer = (byte *)frame->surface.pixels;
|
||||||
|
|
||||||
for (int tmpY = 0; tmpY < frame->surface.h; tmpY++) {
|
for (int32 tmpY = 0; tmpY < frame->surface.h; tmpY++) {
|
||||||
int w = frame->surface.w / 2;
|
int32 w = frame->surface.w / 2;
|
||||||
for (int tmpX = 0; tmpX < w; tmpX++) {
|
for (int32 tmpX = 0; tmpX < w; tmpX++) {
|
||||||
SWAP(buffer[tmpY * frame->surface.pitch + tmpX],
|
SWAP(buffer[tmpY * frame->surface.pitch + tmpX],
|
||||||
buffer[tmpY * frame->surface.pitch + frame->surface.w - 1 - tmpX]);
|
buffer[tmpY * frame->surface.pitch + frame->surface.w - 1 - tmpX]);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ void Actor::setAction(int action) {
|
||||||
frameNum = 0;
|
frameNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::setActionByIndex(int index) {
|
void Actor::setActionByIndex(int32 index) {
|
||||||
setAction(_resources[index] & 0xFFFF);
|
setAction(_resources[index] & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ GraphicFrame *Actor::getFrame() {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::drawActorAt(uint32 curX, uint32 curY) {
|
void Actor::drawActorAt(int32 curX, int32 curY) {
|
||||||
GraphicFrame *frame = getFrame();
|
GraphicFrame *frame = getFrame();
|
||||||
|
|
||||||
WorldStats *ws = _scene->worldstats();
|
WorldStats *ws = _scene->worldstats();
|
||||||
|
@ -168,15 +168,15 @@ void Actor::setWalkArea(ActionArea *target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::walkTo(int32 curX, int32 curY) {
|
void Actor::walkTo(int32 curX, int32 curY) {
|
||||||
int newAction = currentAction;
|
int32 newAction = currentAction;
|
||||||
WorldStats *ws = _scene->worldstats();
|
WorldStats *ws = _scene->worldstats();
|
||||||
|
|
||||||
// step is the increment by which to move the
|
// step is the increment by which to move the
|
||||||
// actor in a given direction
|
// actor in a given direction
|
||||||
int step = 2;
|
int32 step = 2;
|
||||||
|
|
||||||
uint32 newX = x;
|
int32 newX = x;
|
||||||
uint32 newY = y;
|
int32 newY = y;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
// Walking left...
|
// Walking left...
|
||||||
|
@ -220,7 +220,7 @@ void Actor::walkTo(int32 curX, int32 curY) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUGGING
|
// DEBUGGING
|
||||||
// Show registration point from which we're calculating the
|
// Show registration point32 from which we're calculating the
|
||||||
// actor's barrier hit-test
|
// actor's barrier hit-test
|
||||||
Graphics::Surface surface;
|
Graphics::Surface surface;
|
||||||
surface.create(5, 5, 1);
|
surface.create(5, 5, 1);
|
||||||
|
@ -241,12 +241,12 @@ void Actor::walkTo(int32 curX, int32 curY) {
|
||||||
// the actor at the PERFECT spot to be able to intersect a walk region and move to
|
// the actor at the PERFECT spot to be able to intersect a walk region and move to
|
||||||
// the next one.
|
// the next one.
|
||||||
|
|
||||||
int availableAreas[5];
|
int32 availableAreas[5];
|
||||||
int areaPtr = 0;
|
int32 areaPtr = 0;
|
||||||
ActionArea *area;
|
ActionArea *area;
|
||||||
|
|
||||||
// Check what valid walk region(s) is/are currently available
|
// Check what valid walk region(s) is/are currently available
|
||||||
for (uint32 a = 0; a < ws->numActions; a++) {
|
for (int32 a = 0; a < ws->numActions; a++) {
|
||||||
if (ws->actions[a].actionType == 0) {
|
if (ws->actions[a].actionType == 0) {
|
||||||
area = &ws->actions[a];
|
area = &ws->actions[a];
|
||||||
PolyDefinitions poly = _scene->polygons()->entries[area->polyIdx];
|
PolyDefinitions poly = _scene->polygons()->entries[area->polyIdx];
|
||||||
|
@ -265,7 +265,7 @@ void Actor::walkTo(int32 curX, int32 curY) {
|
||||||
|
|
||||||
// Check that we can walk in the current direction within any of the available
|
// Check that we can walk in the current direction within any of the available
|
||||||
// walkable regions
|
// walkable regions
|
||||||
for (int i = 0; i < areaPtr; i++) {
|
for (int32 i = 0; i < areaPtr; i++) {
|
||||||
area = &ws->actions[availableAreas[i]];
|
area = &ws->actions[availableAreas[i]];
|
||||||
PolyDefinitions *region = &_scene->polygons()->entries[area->polyIdx];
|
PolyDefinitions *region = &_scene->polygons()->entries[area->polyIdx];
|
||||||
if (region->contains(newX, newY)) {
|
if (region->contains(newX, newY)) {
|
||||||
|
@ -279,7 +279,7 @@ void Actor::walkTo(int32 curX, int32 curY) {
|
||||||
drawActor();
|
drawActor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::setPosition_40A260(uint32 newX, uint32 newY, int newDirection, int frame) {
|
void Actor::setPosition_40A260(int32 newX, int32 newY, int32 newDirection, int32 frame) {
|
||||||
x1 = newX - x2;
|
x1 = newX - x2;
|
||||||
y1 = newY - y2;
|
y1 = newY - y2;
|
||||||
|
|
||||||
|
@ -291,20 +291,20 @@ void Actor::setPosition_40A260(uint32 newX, uint32 newY, int newDirection, int f
|
||||||
frameNum = frame;
|
frameNum = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::faceTarget(int targetId, int targetType) {
|
void Actor::faceTarget(int32 targetId, int32 targetType) {
|
||||||
int newX2, newY2;
|
int32 newX2, newY2;
|
||||||
|
|
||||||
printf("faceTarget: id %d type %d\n", targetId, targetType);
|
printf("faceTarget: id %d type %d\n", targetId, targetType);
|
||||||
|
|
||||||
if (targetType) {
|
if (targetType) {
|
||||||
if (targetType == 1) {
|
if (targetType == 1) {
|
||||||
int actionIdx = _scene->worldstats()->getActionAreaIndexById(targetId);
|
int32 actionIdx = _scene->worldstats()->getActionAreaIndexById(targetId);
|
||||||
if (actionIdx == -1) {
|
if (actionIdx == -1) {
|
||||||
warning("No ActionArea found for id %d", targetId);
|
warning("No ActionArea found for id %d", targetId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 polyIdx = _scene->worldstats()->actions[actionIdx].polyIdx;
|
int32 polyIdx = _scene->worldstats()->actions[actionIdx].polyIdx;
|
||||||
PolyDefinitions *poly = &_scene->polygons()->entries[polyIdx];
|
PolyDefinitions *poly = &_scene->polygons()->entries[polyIdx];
|
||||||
|
|
||||||
newX2 = poly->boundingRect.left + (poly->boundingRect.right - poly->boundingRect.left) / 2;
|
newX2 = poly->boundingRect.left + (poly->boundingRect.right - poly->boundingRect.left) / 2;
|
||||||
|
@ -318,7 +318,7 @@ void Actor::faceTarget(int targetId, int targetType) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int barrierIdx = _scene->worldstats()->getBarrierIndexById(targetId);
|
int32 barrierIdx = _scene->worldstats()->getBarrierIndexById(targetId);
|
||||||
if (barrierIdx == -1) {
|
if (barrierIdx == -1) {
|
||||||
warning("No Barrier found for id %d", targetId);
|
warning("No Barrier found for id %d", targetId);
|
||||||
return;
|
return;
|
||||||
|
@ -342,7 +342,7 @@ void Actor::faceTarget(int targetId, int targetType) {
|
||||||
newY2 = (fra->surface.h >> 1) + barrier->y; // Check .text:004088A2 for more details
|
newY2 = (fra->surface.h >> 1) + barrier->y; // Check .text:004088A2 for more details
|
||||||
}
|
}
|
||||||
|
|
||||||
int newAngle = getAngle(x2 + x1, y2 + y1, newX2, newY2);
|
int32 newAngle = getAngle(x2 + x1, y2 + y1, newX2, newY2);
|
||||||
|
|
||||||
printf("Angle calculated as %d\n", newAngle);
|
printf("Angle calculated as %d\n", newAngle);
|
||||||
|
|
||||||
|
@ -350,10 +350,10 @@ void Actor::faceTarget(int targetId, int targetType) {
|
||||||
//setDirection(newAngle);
|
//setDirection(newAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Actor::getAngle(int ax1, int ay1, int ax2, int ay2) {
|
int32 Actor::getAngle(int32 ax1, int32 ay1, int32 ax2, int32 ay2) {
|
||||||
int32 v5 = (ax2 << 16) - (ax1 << 16);
|
int32 v5 = (ax2 << 16) - (ax1 << 16);
|
||||||
int v6 = 0;
|
int32 v6 = 0;
|
||||||
int v4 = (ay1 << 16) - (ay2 << 16);
|
int32 v4 = (ay1 << 16) - (ay2 << 16);
|
||||||
|
|
||||||
if (v5 < 0) {
|
if (v5 < 0) {
|
||||||
v6 = 2;
|
v6 = 2;
|
||||||
|
@ -365,8 +365,8 @@ int Actor::getAngle(int ax1, int ay1, int ax2, int ay2) {
|
||||||
v4 = -v4;
|
v4 = -v4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int v7;
|
int32 v7;
|
||||||
int v8 = -1;
|
int32 v8 = -1;
|
||||||
|
|
||||||
if (v5) {
|
if (v5) {
|
||||||
v7 = (v4 << 8) / v5;
|
v7 = (v4 << 8) / v5;
|
||||||
|
@ -396,7 +396,7 @@ int Actor::getAngle(int ax1, int ay1, int ax2, int ay2) {
|
||||||
if (v8 >= 360)
|
if (v8 >= 360)
|
||||||
v8 -= 360;
|
v8 -= 360;
|
||||||
|
|
||||||
int result;
|
int32 result;
|
||||||
|
|
||||||
if (v8 < 157 || v8 >= 202) {
|
if (v8 < 157 || v8 >= 202) {
|
||||||
if (v8 < 112 || v8 >= 157) {
|
if (v8 < 112 || v8 >= 157) {
|
||||||
|
|
|
@ -154,15 +154,15 @@ public:
|
||||||
|
|
||||||
void visible(bool value);
|
void visible(bool value);
|
||||||
|
|
||||||
void setPosition(uint32 targetX, uint32 targetY);
|
void setPosition(int32 targetX, int32 targetY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the x1/y1 values of the actor, update the active animation frame
|
* Initialize the x1/y1 values of the actor, update the active animation frame
|
||||||
* and, if the current direction isn't 8, update the actor's direction
|
* and, if the current direction isn't 8, update the actor's direction
|
||||||
*/
|
*/
|
||||||
void setPosition_40A260(uint32 newX, uint32 newY, int newDirection, int frame);
|
void setPosition_40A260(int32 newX, int32 newY, int32 newDirection, int32 frame);
|
||||||
|
|
||||||
void faceTarget(int targetId, int targetType);
|
void faceTarget(int32 targetId, int32 targetType);
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
// I don't really like how this is used in the scene constructor
|
// I don't really like how this is used in the scene constructor
|
||||||
|
@ -176,86 +176,86 @@ public:
|
||||||
// TODO ALL of these need to be depreciated in favour
|
// TODO ALL of these need to be depreciated in favour
|
||||||
// of the proper functions from the original
|
// of the proper functions from the original
|
||||||
void setWalkArea(ActionArea *target);
|
void setWalkArea(ActionArea *target);
|
||||||
void setAction(int action);
|
void setAction(int32 action);
|
||||||
void setActionByIndex(int index);
|
void setActionByIndex(int32 index);
|
||||||
void drawActorAt(uint32 curX, uint32 curY);
|
void drawActorAt(int32 curX, int32 curY);
|
||||||
void drawActor();
|
void drawActor();
|
||||||
void walkTo(int32 curX, int32 curY);
|
void walkTo(int32 curX, int32 curY);
|
||||||
|
|
||||||
int currentAction; // TODO depreciate
|
int32 currentAction; // TODO depreciate
|
||||||
|
|
||||||
int32 x;
|
int32 x;
|
||||||
int32 y;
|
int32 y;
|
||||||
uint32 grResId;
|
int32 grResId;
|
||||||
uint32 field_C; // BarrierIndex? Mask index?
|
int32 field_C; // BarrierIndex? Mask index?
|
||||||
uint32 frameNum;
|
int32 frameNum;
|
||||||
uint32 frameCount;
|
int32 frameCount;
|
||||||
int32 x1;
|
int32 x1;
|
||||||
int32 y1;
|
int32 y1;
|
||||||
int32 x2;
|
int32 x2;
|
||||||
int32 y2;
|
int32 y2;
|
||||||
Common::Rect boundingRect;
|
Common::Rect boundingRect;
|
||||||
uint32 direction;
|
int32 direction;
|
||||||
uint32 field_3C;
|
int32 field_3C;
|
||||||
uint32 updateType;
|
int32 updateType;
|
||||||
uint32 field_44;
|
int32 field_44;
|
||||||
uint32 priority;
|
int32 priority;
|
||||||
uint32 flags;
|
int32 flags;
|
||||||
uint32 field_50;
|
int32 field_50;
|
||||||
uint32 field_54;
|
int32 field_54;
|
||||||
uint32 field_58;
|
int32 field_58;
|
||||||
uint32 field_5C;
|
int32 field_5C;
|
||||||
uint32 field_60;
|
int32 field_60;
|
||||||
uint32 actionIdx3;
|
int32 actionIdx3;
|
||||||
// TODO field_68 till field_617
|
// TODO field_68 till field_617
|
||||||
uint32 reaction[8];
|
int32 reaction[8];
|
||||||
uint32 field_638;
|
int32 field_638;
|
||||||
uint32 walkingSound1;
|
int32 walkingSound1;
|
||||||
uint32 walkingSound2;
|
int32 walkingSound2;
|
||||||
uint32 walkingSound3;
|
int32 walkingSound3;
|
||||||
uint32 walkingSound4;
|
int32 walkingSound4;
|
||||||
uint32 field_64C;
|
int32 field_64C;
|
||||||
uint32 field_650;
|
int32 field_650;
|
||||||
uint32 grResTable[55];
|
int32 grResTable[55];
|
||||||
char name[256];
|
char name[256];
|
||||||
uint32 field_830[20];
|
int32 field_830[20];
|
||||||
uint32 field_880[20];
|
int32 field_880[20];
|
||||||
uint32 field_8D0[20];
|
int32 field_8D0[20];
|
||||||
uint32 actionIdx2;
|
int32 actionIdx2;
|
||||||
uint32 field_924;
|
int32 field_924;
|
||||||
uint32 tickValue1;
|
int32 tickValue1;
|
||||||
uint32 field_92C;
|
int32 field_92C;
|
||||||
uint32 flags2;
|
int32 flags2;
|
||||||
uint32 field_934;
|
int32 field_934;
|
||||||
uint32 field_938;
|
int32 field_938;
|
||||||
uint32 soundResId; // field_93C
|
int32 soundResId; // field_93C
|
||||||
uint32 field_940;
|
int32 field_940;
|
||||||
uint32 field_944;
|
int32 field_944;
|
||||||
uint32 field_948;
|
int32 field_948;
|
||||||
uint32 field_94C;
|
int32 field_94C;
|
||||||
uint32 field_950;
|
int32 field_950;
|
||||||
uint32 field_954;
|
int32 field_954;
|
||||||
uint32 field_958;
|
int32 field_958;
|
||||||
uint32 field_95C;
|
int32 field_95C;
|
||||||
uint32 field_960;
|
int32 field_960;
|
||||||
uint32 field_964;
|
int32 field_964;
|
||||||
uint32 field_968;
|
int32 field_968;
|
||||||
uint32 field_96C;
|
int32 field_96C;
|
||||||
uint32 field_970;
|
int32 field_970;
|
||||||
uint32 field_974;
|
int32 field_974;
|
||||||
uint32 field_978;
|
int32 field_978;
|
||||||
uint32 actionIdx1;
|
int32 actionIdx1;
|
||||||
// TODO field_980 till field_9A0
|
// TODO field_980 till field_9A0
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
ResourcePack *_resPack;
|
ResourcePack *_resPack;
|
||||||
GraphicResource *_graphic;
|
GraphicResource *_graphic;
|
||||||
uint32 _resources[61];
|
int32 _resources[61];
|
||||||
ActionArea *_currentWalkArea;
|
ActionArea *_currentWalkArea;
|
||||||
|
|
||||||
GraphicFrame *getFrame();
|
GraphicFrame *getFrame();
|
||||||
int getAngle(int ax1, int ay1, int ax2, int ay2);
|
int32 getAngle(int32 ax1, int32 ay1, int32 ax2, int32 ay2);
|
||||||
|
|
||||||
}; // end of class MainActor
|
}; // end of class MainActor
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ Common::Error AsylumEngine::go() {
|
||||||
_mainMenu = new MainMenu(this);
|
_mainMenu = new MainMenu(this);
|
||||||
|
|
||||||
// TODO: if savegame not exists on folder, than start game()
|
// TODO: if savegame not exists on folder, than start game()
|
||||||
if(1) { //SearchMan.hasArchive
|
if(0) { //SearchMan.hasArchive
|
||||||
startGame();
|
startGame();
|
||||||
} else {
|
} else {
|
||||||
_mainMenu->openMenu();
|
_mainMenu->openMenu();
|
||||||
|
@ -179,7 +179,7 @@ void AsylumEngine::playIntro() {
|
||||||
|
|
||||||
_video->playVideo(1, Config.showMovieSubtitles);
|
_video->playVideo(1, Config.showMovieSubtitles);
|
||||||
|
|
||||||
if (_scene->worldstats()->musicCurrentResId != 0xFFFFFD66)
|
if (_scene->worldstats()->musicCurrentResId != -666)
|
||||||
_sound->playMusic(_scene->worldstats()->musicCurrentResId);
|
_sound->playMusic(_scene->worldstats()->musicCurrentResId);
|
||||||
|
|
||||||
_screen->clearScreen();
|
_screen->clearScreen();
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace Asylum {
|
||||||
|
|
||||||
// XXX If defined, this flag will prevent the intro movies
|
// XXX If defined, this flag will prevent the intro movies
|
||||||
// from being played whenever the engine is started
|
// from being played whenever the engine is started
|
||||||
#define SKIP_INTRO
|
// #define SKIP_INTRO
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
// I'm not sure if system endian-ness would have any
|
// I'm not sure if system endian-ness would have any
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Wrapper function to the OSystem getMillis() method
|
* Wrapper function to the OSystem getMillis() method
|
||||||
*/
|
*/
|
||||||
uint32 getTick() { return _system->getMillis(); }
|
int32 getTick() { return (int32)_system->getMillis(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the global tick counter.
|
* This is the global tick counter.
|
||||||
|
|
|
@ -36,11 +36,11 @@ Barrier::~Barrier() {
|
||||||
// TODO Auto-generated destructor stub
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Barrier::getRandomId() {
|
int32 Barrier::getRandomId() {
|
||||||
int numRes = 0;
|
int32 numRes = 0;
|
||||||
uint32 rndResId[5];
|
int32 rndResId[5];
|
||||||
memset(&rndResId, 0, sizeof(rndResId));
|
memset(&rndResId, 0, sizeof(rndResId));
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int32 i = 0; i < 5; i++) {
|
||||||
if (field_68C[i]) {
|
if (field_68C[i]) {
|
||||||
rndResId[numRes] = field_68C[i];
|
rndResId[numRes] = field_68C[i];
|
||||||
numRes++;
|
numRes++;
|
||||||
|
@ -52,12 +52,12 @@ uint32 Barrier::getRandomId() {
|
||||||
return resId;
|
return resId;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Barrier::checkFlags() {
|
int32 Barrier::checkFlags() {
|
||||||
return flags & 1 && (flags & 8 || flags & 0x10000);
|
return flags & 1 && (flags & 8 || flags & 0x10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Barrier::setNextFrame(int targetFlags) {
|
void Barrier::setNextFrame(int32 targetFlags) {
|
||||||
int newFlag = targetFlags | 1 | flags;
|
int32 newFlag = targetFlags | 1 | flags;
|
||||||
flags |= targetFlags | 1;
|
flags |= targetFlags | 1;
|
||||||
|
|
||||||
if (newFlag & 0x10000)
|
if (newFlag & 0x10000)
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
virtual ~Barrier();
|
virtual ~Barrier();
|
||||||
|
|
||||||
bool visible();
|
bool visible();
|
||||||
uint32 getRandomId(); // TODO Give this a better name?
|
int32 getRandomId(); // TODO Give this a better name?
|
||||||
bool onscreen();
|
bool onscreen();
|
||||||
|
|
||||||
// TODO document this function
|
// TODO document this function
|
||||||
|
@ -44,42 +44,42 @@ public:
|
||||||
// TODO document this function
|
// TODO document this function
|
||||||
void setNextFrame(int flags);
|
void setNextFrame(int flags);
|
||||||
|
|
||||||
uint32 id;
|
int32 id;
|
||||||
uint32 resId;
|
int32 resId;
|
||||||
uint32 x;
|
int32 x;
|
||||||
uint32 y;
|
int32 y;
|
||||||
Common::Rect boundingRect;
|
Common::Rect boundingRect;
|
||||||
uint32 field_20;
|
int32 field_20;
|
||||||
uint32 frameIdx;
|
int32 frameIdx;
|
||||||
uint32 frameCount;
|
int32 frameCount;
|
||||||
uint32 field_2C;
|
int32 field_2C;
|
||||||
uint32 field_30;
|
int32 field_30;
|
||||||
uint32 field_34;
|
int32 field_34;
|
||||||
uint32 flags;
|
int32 flags;
|
||||||
uint32 field_3C;
|
int32 field_3C;
|
||||||
uint8 name[52];
|
uint8 name[52];
|
||||||
int32 field_74; // XXX looks like fields
|
int32 field_74; // XXX looks like fields
|
||||||
int32 field_78; // 78 => 80 have something
|
int32 field_78; // 78 => 80 have something
|
||||||
int32 field_7C; // to do with calculating
|
int32 field_7C; // to do with calculating
|
||||||
int32 field_80; // actor intersection
|
int32 field_80; // actor intersection
|
||||||
uint32 polyIdx;
|
int32 polyIdx;
|
||||||
uint32 flags2;
|
int32 flags2;
|
||||||
uint32 gameFlags[10];
|
int32 gameFlags[10];
|
||||||
uint32 field_B4;
|
int32 field_B4;
|
||||||
uint32 tickCount;
|
int32 tickCount;
|
||||||
uint32 tickCount2;
|
int32 tickCount2;
|
||||||
uint32 field_C0;
|
int32 field_C0;
|
||||||
uint32 priority;
|
int32 priority;
|
||||||
uint32 actionListIdx;
|
int32 actionListIdx;
|
||||||
SoundItem soundItems[16];
|
SoundItem soundItems[16];
|
||||||
FrameSoundItem frameSoundItems[50];
|
FrameSoundItem frameSoundItems[50];
|
||||||
uint32 field_67C;
|
int32 field_67C;
|
||||||
uint32 soundX;
|
int32 soundX;
|
||||||
uint32 soundY;
|
int32 soundY;
|
||||||
uint32 field_688;
|
int32 field_688;
|
||||||
uint32 field_68C[5];
|
int32 field_68C[5];
|
||||||
uint32 soundResId;
|
int32 soundResId;
|
||||||
uint32 field_6A4;
|
int32 field_6A4;
|
||||||
|
|
||||||
}; // end of class Barrier
|
}; // end of class Barrier
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ void BlowUpPuzzleVCR::handleEvent(Common::Event *event, bool doUpdate) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlowUpPuzzle::playSound(uint resourceId, bool loop) {
|
void BlowUpPuzzle::playSound(int32 resourceId, bool loop) {
|
||||||
_scene->vm()->sound()->playSound(_scene->getResourcePack(), resourceId, Config.sfxVolume, loop, 0, true);
|
_scene->vm()->sound()->playSound(_scene->getResourcePack(), resourceId, Config.sfxVolume, loop, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,9 +440,9 @@ void BlowUpPuzzleVCR::updateCursorInPolyRegion() {
|
||||||
|| inPolyRegion(_cursor->x(), _cursor->y(), kYellowJack)) {
|
|| inPolyRegion(_cursor->x(), _cursor->y(), kYellowJack)) {
|
||||||
_cursor->animate();
|
_cursor->animate();
|
||||||
} else {
|
} else {
|
||||||
if (inPolyRegion(_cursor->x(), _cursor->y(), kRedHole) && _holesState[kPluggedOnRed-1]
|
if ((inPolyRegion(_cursor->x(), _cursor->y(), kRedHole) && _holesState[kPluggedOnRed-1])
|
||||||
|| inPolyRegion(_cursor->x(), _cursor->y(), kYellowHole) && _holesState[kPluggedOnYellow-1]
|
|| (inPolyRegion(_cursor->x(), _cursor->y(), kYellowHole) && _holesState[kPluggedOnYellow-1])
|
||||||
|| inPolyRegion(_cursor->x(), _cursor->y(), kBlackHole) && _holesState[kPluggedOnBlack-1]) {
|
|| (inPolyRegion(_cursor->x(), _cursor->y(), kBlackHole) && _holesState[kPluggedOnBlack-1])) {
|
||||||
if (_cursor->currentFrame() != 2) { // reset cursor
|
if (_cursor->currentFrame() != 2) { // reset cursor
|
||||||
_cursor->show();
|
_cursor->show();
|
||||||
_cursor->set(2);
|
_cursor->set(2);
|
||||||
|
@ -500,8 +500,8 @@ void BlowUpPuzzleVCR::handleMouseDown() {
|
||||||
|
|
||||||
// Put jacks on table --
|
// Put jacks on table --
|
||||||
if (jackType) {
|
if (jackType) {
|
||||||
if (_cursor->x() >= (uint32)BlowUpPuzzleVCRPolies[kBlackJack].left && _cursor->x() <= (uint32)BlowUpPuzzleVCRPolies[kYellowJack].right &&
|
if (_cursor->x() >= (int32)BlowUpPuzzleVCRPolies[kBlackJack].left && _cursor->x() <= (int32)BlowUpPuzzleVCRPolies[kYellowJack].right &&
|
||||||
_cursor->y() >= (uint32)BlowUpPuzzleVCRPolies[kBlackJack].top && _cursor->y() <= (uint32)BlowUpPuzzleVCRPolies[kYellowJack].bottom) {
|
_cursor->y() >= (int32)BlowUpPuzzleVCRPolies[kBlackJack].top && _cursor->y() <= (int32)BlowUpPuzzleVCRPolies[kYellowJack].bottom) {
|
||||||
_jacksState[jackType-1] = kOnTable;
|
_jacksState[jackType-1] = kOnTable;
|
||||||
playSound(_scene->worldstats()->grResId[50]);
|
playSound(_scene->worldstats()->grResId[50]);
|
||||||
_cursor->show();
|
_cursor->show();
|
||||||
|
|
|
@ -68,7 +68,7 @@ protected:
|
||||||
GraphicResource *_bgResource;
|
GraphicResource *_bgResource;
|
||||||
|
|
||||||
virtual void update() {};
|
virtual void update() {};
|
||||||
void playSound(uint resourceId, bool loop = false);
|
void playSound(int32 resourceId, bool loop = false);
|
||||||
|
|
||||||
}; // end of class BlowUpPuzzle
|
}; // end of class BlowUpPuzzle
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ protected:
|
||||||
// ---- VCR -------------------
|
// ---- VCR -------------------
|
||||||
|
|
||||||
typedef struct VCRDrawInfo {
|
typedef struct VCRDrawInfo {
|
||||||
uint32 resId;
|
int32 resId;
|
||||||
uint32 x;
|
int32 x;
|
||||||
uint32 y;
|
int32 y;
|
||||||
} VCRDrawInfo;
|
} VCRDrawInfo;
|
||||||
|
|
||||||
const Common::Rect BlowUpPuzzleVCRPolies[10] = {
|
const Common::Rect BlowUpPuzzleVCRPolies[10] = {
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
extern int g_debugPolygons;
|
extern int32 g_debugPolygons;
|
||||||
extern int g_debugBarriers;
|
extern int32 g_debugBarriers;
|
||||||
|
|
||||||
Console::Console(AsylumEngine *vm) : GUI::Debugger() {
|
Console::Console(AsylumEngine *vm) : GUI::Debugger() {
|
||||||
_vm = vm;
|
_vm = vm;
|
||||||
|
@ -50,12 +50,12 @@ Console::Console(AsylumEngine *vm) : GUI::Debugger() {
|
||||||
Console::~Console() {
|
Console::~Console() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Console::cmdDumpActionArea(int argc, const char **argv) {
|
bool Console::cmdDumpActionArea(int32 argc, const char **argv) {
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
// TODO Get an action area by index/id
|
// TODO Get an action area by index/id
|
||||||
} else {
|
} else {
|
||||||
for (uint32 i = 0; i < _vm->scene()->worldstats()->numActions; i++) {
|
for (int32 i = 0; i < _vm->scene()->worldstats()->numActions; i++) {
|
||||||
ActionArea *a = &_vm->scene()->worldstats()->actions[i];
|
ActionArea *a = &_vm->scene()->worldstats()->actions[i];
|
||||||
printActionAreaStats(a);
|
printActionAreaStats(a);
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,8 @@ void Console::printActionAreaStats(ActionArea *a) {
|
||||||
a->volume);
|
a->volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Console::cmdShowFlags(int argc, const char **argv) {
|
bool Console::cmdShowFlags(int32 argc, const char **argv) {
|
||||||
for (int i = 0; i < 1512; i++) {
|
for (int32 i = 0; i < 1512; i++) {
|
||||||
if (_vm->isGameFlagSet(i)) {
|
if (_vm->isGameFlagSet(i)) {
|
||||||
DebugPrintf("Game Flag %d is Active\n", i);
|
DebugPrintf("Game Flag %d is Active\n", i);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ bool Console::cmdShowFlags(int argc, const char **argv) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Console::cmdToggleFlag(int argc, const char **argv) {
|
bool Console::cmdToggleFlag(int32 argc, const char **argv) {
|
||||||
if (argc != 2 || atoi(argv[1]) > 1512 || atoi(argv[1]) < 0) {
|
if (argc != 2 || atoi(argv[1]) > 1512 || atoi(argv[1]) < 0) {
|
||||||
DebugPrintf("Enter a value between 0 and 1512\n");
|
DebugPrintf("Enter a value between 0 and 1512\n");
|
||||||
return true;
|
return true;
|
||||||
|
@ -111,7 +111,7 @@ bool Console::cmdToggleFlag(int argc, const char **argv) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Console::cmdPlayVideo(int argc, const char **argv) {
|
bool Console::cmdPlayVideo(int32 argc, const char **argv) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
DebugPrintf("Usage %s <video number>\n", argv[0]);
|
DebugPrintf("Usage %s <video number>\n", argv[0]);
|
||||||
return true;
|
return true;
|
||||||
|
@ -122,7 +122,7 @@ bool Console::cmdPlayVideo(int argc, const char **argv) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Console::cmdRunScript(int argc, const char **argv) {
|
bool Console::cmdRunScript(int32 argc, const char **argv) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
DebugPrintf("Usage %s <script number>\n", argv[0]);
|
DebugPrintf("Usage %s <script number>\n", argv[0]);
|
||||||
return true;
|
return true;
|
||||||
|
@ -133,7 +133,7 @@ bool Console::cmdRunScript(int argc, const char **argv) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Console::cmdChangeScene(int argc, const char **argv) {
|
bool Console::cmdChangeScene(int32 argc, const char **argv) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
DebugPrintf("Usage %s <scene number>\n", argv[0]);
|
DebugPrintf("Usage %s <scene number>\n", argv[0]);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -41,12 +41,12 @@ public:
|
||||||
virtual ~Console(void);
|
virtual ~Console(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool cmdPlayVideo(int argc, const char **argv);
|
bool cmdPlayVideo(int32 argc, const char **argv);
|
||||||
bool cmdRunScript(int argc, const char **argv);
|
bool cmdRunScript(int32 argc, const char **argv);
|
||||||
bool cmdChangeScene(int argc, const char **argv);
|
bool cmdChangeScene(int32 argc, const char **argv);
|
||||||
bool cmdShowFlags(int argc, const char **argv);
|
bool cmdShowFlags(int32 argc, const char **argv);
|
||||||
bool cmdToggleFlag(int argc, const char **argv);
|
bool cmdToggleFlag(int32 argc, const char **argv);
|
||||||
bool cmdDumpActionArea(int argc, const char **argv);
|
bool cmdDumpActionArea(int32 argc, const char **argv);
|
||||||
|
|
||||||
void printActionAreaStats(ActionArea *a);
|
void printActionAreaStats(ActionArea *a);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ Cursor::~Cursor() {
|
||||||
delete _cursorResource;
|
delete _cursorResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor::load(uint32 index) {
|
void Cursor::load(int32 index) {
|
||||||
if (cursorLoaded)
|
if (cursorLoaded)
|
||||||
delete _cursorResource;
|
delete _cursorResource;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void Cursor::set(byte *data, byte width, byte height) {
|
||||||
CursorMan.replaceCursor(data, width, height, 0, 0, 0);
|
CursorMan.replaceCursor(data, width, height, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor::set(int frame) {
|
void Cursor::set(int32 frame) {
|
||||||
if (frame >= 0) {
|
if (frame >= 0) {
|
||||||
GraphicFrame *mouseCursor = _cursorResource->getFrame(frame);
|
GraphicFrame *mouseCursor = _cursorResource->getFrame(frame);
|
||||||
set((byte *)mouseCursor->surface.pixels, mouseCursor->surface.w, mouseCursor->surface.h);
|
set((byte *)mouseCursor->surface.pixels, mouseCursor->surface.w, mouseCursor->surface.h);
|
||||||
|
@ -72,7 +72,7 @@ void Cursor::set(int frame) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor::setCoords(uint32 mouseX, uint32 mouseY) {
|
void Cursor::setCoords(int32 mouseX, int32 mouseY) {
|
||||||
_mouseX = mouseX;
|
_mouseX = mouseX;
|
||||||
_mouseY = mouseY;
|
_mouseY = mouseY;
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ void Cursor::animate() {
|
||||||
set(_curFrame);
|
set(_curFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor::update(CommonResources *cr, int currentAction) {
|
void Cursor::update(CommonResources *cr, int32 currentAction) {
|
||||||
uint32 newCursor = 0;
|
int32 newCursor = 0;
|
||||||
|
|
||||||
// Change cursor
|
// Change cursor
|
||||||
switch (currentAction) {
|
switch (currentAction) {
|
||||||
|
|
|
@ -53,16 +53,16 @@ public:
|
||||||
* Load a GraphicResource at the position specified by
|
* Load a GraphicResource at the position specified by
|
||||||
* index from the buffered ResourcePack
|
* index from the buffered ResourcePack
|
||||||
*/
|
*/
|
||||||
void load(uint32 index);
|
void load(int32 index);
|
||||||
/**
|
/**
|
||||||
* Set the current cursor to a specific frame
|
* Set the current cursor to a specific frame
|
||||||
* within the loaded cursorResource
|
* within the loaded cursorResource
|
||||||
*/
|
*/
|
||||||
void set(int frame);
|
void set(int32 frame);
|
||||||
/**
|
/**
|
||||||
* Set the x/y coordinates of the cursor
|
* Set the x/y coordinates of the cursor
|
||||||
*/
|
*/
|
||||||
void setCoords(uint32 mouseX, uint32 mouseY);
|
void setCoords(int32 mouseX, int32 mouseY);
|
||||||
/**
|
/**
|
||||||
* Scene-based update to the current cursor. This
|
* Scene-based update to the current cursor. This
|
||||||
* checks whether the cursor should be updated depending
|
* checks whether the cursor should be updated depending
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
* TODO this probably doesn't belong here, but on the
|
* TODO this probably doesn't belong here, but on the
|
||||||
* scene, where it originally was
|
* scene, where it originally was
|
||||||
*/
|
*/
|
||||||
void update(CommonResources *cr, int currentAction);
|
void update(CommonResources *cr, int32 currentAction);
|
||||||
/**
|
/**
|
||||||
* Get the next logical frame from the currently loaded
|
* Get the next logical frame from the currently loaded
|
||||||
* cursorResource and draw it
|
* cursorResource and draw it
|
||||||
|
@ -81,20 +81,20 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the X position of the cursor
|
* Get the X position of the cursor
|
||||||
*/
|
*/
|
||||||
uint32 x() {
|
int32 x() {
|
||||||
return _mouseX;
|
return _mouseX;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get the Y position of the cursor
|
* get the Y position of the cursor
|
||||||
*/
|
*/
|
||||||
uint32 y() {
|
int32 y() {
|
||||||
return _mouseY;
|
return _mouseY;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the current frame number of the
|
* Get the current frame number of the
|
||||||
* loaded cursorResource
|
* loaded cursorResource
|
||||||
*/
|
*/
|
||||||
uint32 currentFrame() {
|
int32 currentFrame() {
|
||||||
return _curFrame;
|
return _curFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,10 +104,10 @@ private:
|
||||||
ResourcePack *_resPack;
|
ResourcePack *_resPack;
|
||||||
GraphicResource *_cursorResource;
|
GraphicResource *_cursorResource;
|
||||||
bool cursorLoaded;
|
bool cursorLoaded;
|
||||||
uint32 _curFrame;
|
int32 _curFrame;
|
||||||
int32 _cursorStep;
|
int32 _cursorStep;
|
||||||
uint32 _mouseX;
|
int32 _mouseX;
|
||||||
uint32 _mouseY;
|
int32 _mouseY;
|
||||||
|
|
||||||
}; // end of class Cursor
|
}; // end of class Cursor
|
||||||
|
|
||||||
|
|
|
@ -35,29 +35,29 @@ Encounter::Encounter(Scene *scene) {
|
||||||
// TODO error checks
|
// TODO error checks
|
||||||
file.open("sntrm.dat");
|
file.open("sntrm.dat");
|
||||||
|
|
||||||
uint16 _count = file.readUint16LE();
|
int16 _count = file.readSint16LE();
|
||||||
|
|
||||||
_variables = (uint16*)malloc(_count);
|
_variables = (int16*)malloc(_count);
|
||||||
file.read(_variables, _count);
|
file.read(_variables, _count);
|
||||||
|
|
||||||
file.seek(2 + _count * 2, SEEK_SET);
|
file.seek(2 + _count * 2, SEEK_SET);
|
||||||
|
|
||||||
// TODO assert if true
|
// TODO assert if true
|
||||||
_anvilStyleFlag = file.readUint16LE();
|
_anvilStyleFlag = file.readSint16LE();
|
||||||
|
|
||||||
uint16 _dataCount = file.readUint16LE();
|
int16 _dataCount = file.readSint16LE();
|
||||||
|
|
||||||
for (uint8 i = 0; i < _dataCount; i++) {
|
for (uint8 i = 0; i < _dataCount; i++) {
|
||||||
EncounterItem item;
|
EncounterItem item;
|
||||||
memset(&item, 0, sizeof(EncounterItem));
|
memset(&item, 0, sizeof(EncounterItem));
|
||||||
|
|
||||||
item.keywordIndex = file.readUint32LE();
|
item.keywordIndex = file.readSint32LE();
|
||||||
item.field2 = file.readUint32LE();
|
item.field2 = file.readSint32LE();
|
||||||
item.scriptResId = file.readUint32LE();
|
item.scriptResId = file.readSint32LE();
|
||||||
for (uint8 j = 0; j < 50; j++) {
|
for (uint8 j = 0; j < 50; j++) {
|
||||||
item.array[j] = file.readUint32LE();
|
item.array[j] = file.readSint32LE();
|
||||||
}
|
}
|
||||||
item.value = file.readUint16LE();
|
item.value = file.readSint16LE();
|
||||||
|
|
||||||
_items.push_back(item);
|
_items.push_back(item);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ Encounter::Encounter(Scene *scene) {
|
||||||
_scene = scene;
|
_scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Encounter::run(int encounterIdx, int barrierId1, int barrierId2, int characterIdx) {
|
void Encounter::run(int32 encounterIdx, int32 barrierId1, int32 barrierId2, int32 characterIdx) {
|
||||||
// Line: 12/15 :: 0x25 (1, 1584, 1584, 0, 0, 0, 0, 0, 0) // First Encounter
|
// Line: 12/15 :: 0x25 (1, 1584, 1584, 0, 0, 0, 0, 0, 0) // First Encounter
|
||||||
|
|
||||||
//debugC(kDebugLevelEncounter, "Running Encounter %d", encounterIdx);
|
//debugC(kDebugLevelEncounter, "Running Encounter %d", encounterIdx);
|
||||||
|
@ -78,12 +78,12 @@ void Encounter::run(int encounterIdx, int barrierId1, int barrierId2, int charac
|
||||||
|
|
||||||
//Barrier *b1 = _scene->worldstats()->getBarrierById(barrierId1);
|
//Barrier *b1 = _scene->worldstats()->getBarrierById(barrierId1);
|
||||||
/*
|
/*
|
||||||
int __cdecl runEncounter(int newMessageHandler, int encounterIndex, int objectId1, int objectId2, int characterIndex)
|
int32 __cdecl runEncounter(int32 newMessageHandler, int32 encounterIndex, int32 objectId1, int32 objectId2, int32 characterIndex)
|
||||||
{
|
{
|
||||||
int result; // eax@7
|
int32 result; // eax@7
|
||||||
EncounterItem *v6; // eax@2
|
EncounterItem *v6; // eax@2
|
||||||
int v7; // ST04_4@4
|
int32 v7; // ST04_4@4
|
||||||
int v8; // eax@4
|
int32 v8; // eax@4
|
||||||
|
|
||||||
if ( !encounterKeywordIndex )
|
if ( !encounterKeywordIndex )
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ void Encounter::run(int encounterIdx, int barrierId1, int barrierId2, int charac
|
||||||
character_sub_4072A0(playerCharacterIndex, 5);
|
character_sub_4072A0(playerCharacterIndex, 5);
|
||||||
}
|
}
|
||||||
flag04 = 0;
|
flag04 = 0;
|
||||||
switchMessageHandler((int (__cdecl *)(_DWORD, _DWORD, _DWORD))handleMessageEncounter);
|
switchMessageHandler((int32 (__cdecl *)(_DWORD, _DWORD, _DWORD))handleMessageEncounter);
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -32,22 +32,22 @@
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
typedef struct EncounterItem {
|
typedef struct EncounterItem {
|
||||||
uint32 keywordIndex;
|
int32 keywordIndex;
|
||||||
uint32 field2;
|
int32 field2;
|
||||||
uint32 scriptResId;
|
int32 scriptResId;
|
||||||
uint32 array[50];
|
int32 array[50];
|
||||||
uint16 value;
|
int16 value;
|
||||||
} EncounterItem;
|
} EncounterItem;
|
||||||
|
|
||||||
typedef struct EncounterStruct {
|
typedef struct EncounterStruct {
|
||||||
uint32 x1;
|
int32 x1;
|
||||||
uint32 y1;
|
int32 y1;
|
||||||
uint32 x2;
|
int32 x2;
|
||||||
uint32 y2;
|
int32 y2;
|
||||||
uint32 frameNum;
|
int32 frameNum;
|
||||||
uint32 transTableNum;
|
int32 transTableNum;
|
||||||
uint32 status;
|
int32 status;
|
||||||
uint32 grResId;
|
int32 grResId;
|
||||||
} EncounterStruct;
|
} EncounterStruct;
|
||||||
|
|
||||||
class Encounter {
|
class Encounter {
|
||||||
|
@ -55,14 +55,14 @@ public:
|
||||||
Encounter(Scene *scene);
|
Encounter(Scene *scene);
|
||||||
virtual ~Encounter();
|
virtual ~Encounter();
|
||||||
|
|
||||||
void setVariable(int idx, int value) {
|
void setVariable(int32 idx, int32 value) {
|
||||||
_variables[idx] = value;
|
_variables[idx] = value;
|
||||||
}
|
}
|
||||||
void run(int encounterIdx, int barrierId1, int barrierId2, int characterIdx);
|
void run(int32 encounterIdx, int32 barrierId1, int32 barrierId2, int32 characterIdx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16 *_variables;
|
int16 *_variables;
|
||||||
uint16 _anvilStyleFlag;
|
int16 _anvilStyleFlag;
|
||||||
|
|
||||||
EncounterItem *_currentEncounter;
|
EncounterItem *_currentEncounter;
|
||||||
Common::Array<EncounterItem> _items;
|
Common::Array<EncounterItem> _items;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
GraphicResource::GraphicResource(ResourcePack *resPack, int entry) {
|
GraphicResource::GraphicResource(ResourcePack *resPack, int32 entry) {
|
||||||
ResourceEntry *resEntry = resPack->getResource(entry);
|
ResourceEntry *resEntry = resPack->getResource(entry);
|
||||||
_entryNum = entry;
|
_entryNum = entry;
|
||||||
init(resEntry->data, resEntry->size);
|
init(resEntry->data, resEntry->size);
|
||||||
|
@ -42,19 +42,19 @@ GraphicResource::~GraphicResource() {
|
||||||
_frames.clear();
|
_frames.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicResource::init(byte *data, uint32 size) {
|
void GraphicResource::init(byte *data, int32 size) {
|
||||||
byte *dataPtr = data;
|
byte *dataPtr = data;
|
||||||
uint32 contentOffset = 0;
|
int32 contentOffset = 0;
|
||||||
uint32 frameCount = 0;
|
int16 frameCount = 0;
|
||||||
|
|
||||||
uint32 i = 0;
|
int32 i = 0;
|
||||||
|
|
||||||
dataPtr += 4; // tag value
|
dataPtr += 4; // tag value
|
||||||
|
|
||||||
_flags = READ_LE_UINT32(dataPtr);
|
_flags = (int32)READ_LE_UINT32(dataPtr);
|
||||||
dataPtr += 4;
|
dataPtr += 4;
|
||||||
|
|
||||||
contentOffset = READ_LE_UINT32(dataPtr);
|
contentOffset = (int32)READ_LE_UINT32(dataPtr);
|
||||||
dataPtr += 4;
|
dataPtr += 4;
|
||||||
|
|
||||||
dataPtr += 4; // unknown
|
dataPtr += 4; // unknown
|
||||||
|
@ -69,16 +69,16 @@ void GraphicResource::init(byte *data, uint32 size) {
|
||||||
_frames.resize(frameCount);
|
_frames.resize(frameCount);
|
||||||
|
|
||||||
// Read frame offsets
|
// Read frame offsets
|
||||||
uint32 prevOffset = READ_LE_UINT32(dataPtr) + contentOffset;
|
int32 prevOffset = (int32)READ_LE_UINT32(dataPtr) + contentOffset;
|
||||||
dataPtr += 4;
|
dataPtr += 4;
|
||||||
uint32 nextOffset = 0;
|
int32 nextOffset = 0;
|
||||||
|
|
||||||
for (i = 0; i < frameCount; i++) {
|
for (i = 0; i < frameCount; i++) {
|
||||||
GraphicFrame frame;
|
GraphicFrame frame;
|
||||||
frame.offset = prevOffset;
|
frame.offset = prevOffset;
|
||||||
|
|
||||||
// Read the offset of the next entry to determine the size of this one
|
// Read the offset of the next entry to determine the size of this one
|
||||||
nextOffset = (i < frameCount - 1) ? READ_LE_UINT32(dataPtr) + contentOffset : size;
|
nextOffset = (i < frameCount - 1) ? (int32)READ_LE_UINT32(dataPtr) + contentOffset : size;
|
||||||
dataPtr += 4; // offset
|
dataPtr += 4; // offset
|
||||||
frame.size = (nextOffset > 0) ? nextOffset - prevOffset : size - prevOffset;
|
frame.size = (nextOffset > 0) ? nextOffset - prevOffset : size - prevOffset;
|
||||||
|
|
||||||
|
@ -97,14 +97,14 @@ void GraphicResource::init(byte *data, uint32 size) {
|
||||||
dataPtr += 4; // size
|
dataPtr += 4; // size
|
||||||
dataPtr += 4; // flag
|
dataPtr += 4; // flag
|
||||||
|
|
||||||
_frames[i].x = READ_LE_UINT16(dataPtr);
|
_frames[i].x = (int16)READ_LE_UINT16(dataPtr);
|
||||||
dataPtr += 2;
|
dataPtr += 2;
|
||||||
_frames[i].y = READ_LE_UINT16(dataPtr);
|
_frames[i].y = (int16)READ_LE_UINT16(dataPtr);
|
||||||
dataPtr += 2;
|
dataPtr += 2;
|
||||||
|
|
||||||
uint16 height = READ_LE_UINT16(dataPtr);
|
int16 height = (int16)READ_LE_UINT16(dataPtr);
|
||||||
dataPtr += 2;
|
dataPtr += 2;
|
||||||
uint16 width = READ_LE_UINT16(dataPtr);
|
int16 width = (int16)READ_LE_UINT16(dataPtr);
|
||||||
dataPtr += 2;
|
dataPtr += 2;
|
||||||
|
|
||||||
_frames[i].surface.create(width, height, 1);
|
_frames[i].surface.create(width, height, 1);
|
||||||
|
|
|
@ -33,50 +33,50 @@
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
struct GraphicFrame {
|
struct GraphicFrame {
|
||||||
uint32 size;
|
int32 size;
|
||||||
uint32 offset;
|
int32 offset;
|
||||||
|
|
||||||
uint16 x;
|
int16 x;
|
||||||
uint16 y;
|
int16 y;
|
||||||
Graphics::Surface surface;
|
Graphics::Surface surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Graphic resources can be sprites or images, with multiple frames
|
// Graphic resources can be sprites or images, with multiple frames
|
||||||
class GraphicResource {
|
class GraphicResource {
|
||||||
public:
|
public:
|
||||||
GraphicResource(ResourcePack *resPack, int entry);
|
GraphicResource(ResourcePack *resPack, int32 entry);
|
||||||
~GraphicResource();
|
~GraphicResource();
|
||||||
|
|
||||||
uint32 getFrameCount() {
|
int32 getFrameCount() {
|
||||||
return _frames.size();
|
return _frames.size();
|
||||||
}
|
}
|
||||||
GraphicFrame *getFrame(int frame) {
|
GraphicFrame *getFrame(int32 frame) {
|
||||||
return &_frames[frame];
|
return &_frames[frame];
|
||||||
}
|
}
|
||||||
uint32 getFlags() {
|
int32 getFlags() {
|
||||||
return _flags;
|
return _flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies an animation frame to the target buffer
|
* Copies an animation frame to the target buffer
|
||||||
*/
|
*/
|
||||||
void copyFrameToDest(byte *dest, int frame);
|
void copyFrameToDest(byte *dest, int32 frame);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies a sprite to the target buffer, with transparency
|
* Copies a sprite to the target buffer, with transparency
|
||||||
*/
|
*/
|
||||||
void copySpriteToDest(byte *dest, int frame);
|
void copySpriteToDest(byte *dest, int32 frame);
|
||||||
|
|
||||||
uint32 getEntryNum() {
|
int32 getEntryNum() {
|
||||||
return _entryNum;
|
return _entryNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common::Array <GraphicFrame> _frames;
|
Common::Array <GraphicFrame> _frames;
|
||||||
uint32 _flags;
|
int32 _flags;
|
||||||
uint32 _entryNum;
|
int32 _entryNum;
|
||||||
|
|
||||||
void init(byte *data, uint32 size);
|
void init(byte *data, int32 size);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
|
@ -233,7 +233,7 @@ void MainMenu::update() {
|
||||||
void MainMenu::updateEyesAnimation() {
|
void MainMenu::updateEyesAnimation() {
|
||||||
// Eyes animation
|
// Eyes animation
|
||||||
// Get the appropriate eye resource depending on the mouse position
|
// Get the appropriate eye resource depending on the mouse position
|
||||||
int eyeFrameNum = kEyesFront;
|
int32 eyeFrameNum = kEyesFront;
|
||||||
|
|
||||||
if (_cursor->x() <= 200) {
|
if (_cursor->x() <= 200) {
|
||||||
if (_cursor->y() <= 160)
|
if (_cursor->y() <= 160)
|
||||||
|
@ -264,7 +264,7 @@ void MainMenu::updateEyesAnimation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::updateMainMenu() {
|
void MainMenu::updateMainMenu() {
|
||||||
int rowId = 0;
|
int32 rowId = 0;
|
||||||
|
|
||||||
if (_cursor->y() >= 20 && _cursor->y() <= 20 + 48) {
|
if (_cursor->y() >= 20 && _cursor->y() <= 20 + 48) {
|
||||||
rowId = 0; // Top row
|
rowId = 0; // Top row
|
||||||
|
@ -280,10 +280,10 @@ void MainMenu::updateMainMenu() {
|
||||||
loadFont(kFontYellow);
|
loadFont(kFontYellow);
|
||||||
|
|
||||||
// Icon animation
|
// Icon animation
|
||||||
for (uint32 i = 0; i <= 5; i++) {
|
for (int32 i = 0; i <= 5; i++) {
|
||||||
uint32 curX = 40 + i * 100;
|
int32 curX = 40 + i * 100;
|
||||||
if (_cursor->x() >= curX && _cursor->x() <= curX + 55) {
|
if (_cursor->x() >= curX && _cursor->x() <= curX + 55) {
|
||||||
int iconNum = i + 6 * rowId;
|
int32 iconNum = i + 6 * rowId;
|
||||||
_activeIcon = iconNum;
|
_activeIcon = iconNum;
|
||||||
|
|
||||||
// The last 2 icons are swapped
|
// The last 2 icons are swapped
|
||||||
|
@ -403,7 +403,7 @@ void MainMenu::updateSubMenuNewGame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::updateSubMenuCinematics() {
|
void MainMenu::updateSubMenuCinematics() {
|
||||||
int currentCD = 1; // FIXME: dummy value
|
int32 currentCD = 1; // FIXME: dummy value
|
||||||
_vm->text()->drawResTextWithValueCentered(10, 100, 620, 0x80000548, currentCD);
|
_vm->text()->drawResTextWithValueCentered(10, 100, 620, 0x80000548, currentCD);
|
||||||
_vm->text()->setTextPos(30, 340);
|
_vm->text()->setTextPos(30, 340);
|
||||||
_vm->text()->drawResText(0x80000549); // Prev Page
|
_vm->text()->drawResText(0x80000549); // Prev Page
|
||||||
|
@ -426,9 +426,9 @@ void MainMenu::updateSubMenuCinematics() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::updateSubMenuSettings() {
|
void MainMenu::updateSubMenuSettings() {
|
||||||
uint32 sizeMinus = _vm->text()->getTextWidth("-");
|
int32 sizeMinus = _vm->text()->getTextWidth("-");
|
||||||
uint32 sizePlus = _vm->text()->getTextWidth("+");
|
int32 sizePlus = _vm->text()->getTextWidth("+");
|
||||||
uint32 sizeMainMenu = _vm->text()->getResTextWidth(0x8000059D);
|
int32 sizeMainMenu = _vm->text()->getResTextWidth(0x8000059D);
|
||||||
|
|
||||||
loadFont(kFontYellow);
|
loadFont(kFontYellow);
|
||||||
// Settings
|
// Settings
|
||||||
|
@ -557,11 +557,11 @@ void MainMenu::updateSubMenuQuitGame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::updateSubMenuShowCredits() {
|
void MainMenu::updateSubMenuShowCredits() {
|
||||||
int posY = _creditsTextScroll;
|
int32 posY = _creditsTextScroll;
|
||||||
int resId = 0;
|
int32 resId = 0;
|
||||||
int step = 0;
|
int32 step = 0;
|
||||||
int minBound = 0;
|
int32 minBound = 0;
|
||||||
int maxBound = 0;
|
int32 maxBound = 0;
|
||||||
|
|
||||||
GraphicFrame *creditsFadeFrame = _creditsFadeResource->getFrame(0);
|
GraphicFrame *creditsFadeFrame = _creditsFadeResource->getFrame(0);
|
||||||
_vm->screen()->copyRectToScreenWithTransparency((byte *)creditsFadeFrame->surface.pixels, creditsFadeFrame->surface.w, creditsFadeFrame->x, creditsFadeFrame->y, creditsFadeFrame->surface.w, creditsFadeFrame->surface.h);
|
_vm->screen()->copyRectToScreenWithTransparency((byte *)creditsFadeFrame->surface.pixels, creditsFadeFrame->surface.w, creditsFadeFrame->x, creditsFadeFrame->y, creditsFadeFrame->surface.w, creditsFadeFrame->surface.h);
|
||||||
|
|
|
@ -95,11 +95,11 @@ private:
|
||||||
Cursor *_cursor;
|
Cursor *_cursor;
|
||||||
int32 _activeIcon;
|
int32 _activeIcon;
|
||||||
int32 _previousActiveIcon;
|
int32 _previousActiveIcon;
|
||||||
uint32 _curIconFrame;
|
int32 _curIconFrame;
|
||||||
uint32 _curMouseCursor;
|
int32 _curMouseCursor;
|
||||||
int32 _cursorStep;
|
int32 _cursorStep;
|
||||||
uint32 _creditsBgFrame;
|
int32 _creditsBgFrame;
|
||||||
uint32 _creditsTextScroll;
|
int32 _creditsTextScroll;
|
||||||
bool _leftClick;
|
bool _leftClick;
|
||||||
bool _active;
|
bool _active;
|
||||||
|
|
||||||
|
|
|
@ -32,18 +32,18 @@ Polygons::Polygons(Common::SeekableReadStream *stream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygons::~Polygons() {
|
Polygons::~Polygons() {
|
||||||
for (uint32 i = 0; i < numEntries; i++)
|
for (int32 i = 0; i < numEntries; i++)
|
||||||
delete[] entries[i].points;
|
delete[] entries[i].points;
|
||||||
|
|
||||||
entries.clear();
|
entries.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolyDefinitions::contains(int x, int y) {
|
bool PolyDefinitions::contains(int16 x, int16 y) {
|
||||||
// Copied from backends/vkeybd/polygon.cpp
|
// Copied from backends/vkeybd/polygon.cpp
|
||||||
int yflag0;
|
int32 yflag0;
|
||||||
int yflag1;
|
int32 yflag1;
|
||||||
bool inside_flag = false;
|
bool inside_flag = false;
|
||||||
unsigned int pt;
|
int32 pt;
|
||||||
|
|
||||||
Common::Point *vtx0 = &points[numPoints - 1];
|
Common::Point *vtx0 = &points[numPoints - 1];
|
||||||
Common::Point *vtx1 = &points[0];
|
Common::Point *vtx1 = &points[0];
|
||||||
|
@ -65,28 +65,28 @@ bool PolyDefinitions::contains(int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Polygons::load(Common::SeekableReadStream *stream) {
|
void Polygons::load(Common::SeekableReadStream *stream) {
|
||||||
size = stream->readUint32LE();
|
size = stream->readSint32LE();
|
||||||
numEntries = stream->readUint32LE();
|
numEntries = stream->readSint32LE();
|
||||||
|
|
||||||
for (uint32 g = 0; g < numEntries; g++) {
|
for (int32 g = 0; g < numEntries; g++) {
|
||||||
PolyDefinitions poly;
|
PolyDefinitions poly;
|
||||||
memset(&poly, 0, sizeof(PolyDefinitions));
|
memset(&poly, 0, sizeof(PolyDefinitions));
|
||||||
|
|
||||||
poly.numPoints = stream->readUint32LE();
|
poly.numPoints = stream->readSint32LE();
|
||||||
if (poly.numPoints > 0)
|
if (poly.numPoints > 0)
|
||||||
poly.points = new Common::Point[poly.numPoints];
|
poly.points = new Common::Point[poly.numPoints];
|
||||||
|
|
||||||
for (uint32 i = 0; i < poly.numPoints; i++) {
|
for (int32 i = 0; i < poly.numPoints; i++) {
|
||||||
poly.points[i].x = stream->readUint32LE() & 0xFFFF;
|
poly.points[i].x = stream->readSint32LE() & 0xFFFF;
|
||||||
poly.points[i].y = stream->readUint32LE() & 0xFFFF;
|
poly.points[i].y = stream->readSint32LE() & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream->skip((MAX_POLYGONS - poly.numPoints) * 8);
|
stream->skip((MAX_POLYGONS - poly.numPoints) * 8);
|
||||||
|
|
||||||
poly.boundingRect.left = stream->readUint32LE() & 0xFFFF;
|
poly.boundingRect.left = stream->readSint32LE() & 0xFFFF;
|
||||||
poly.boundingRect.top = stream->readUint32LE() & 0xFFFF;
|
poly.boundingRect.top = stream->readSint32LE() & 0xFFFF;
|
||||||
poly.boundingRect.right = stream->readUint32LE() & 0xFFFF;
|
poly.boundingRect.right = stream->readSint32LE() & 0xFFFF;
|
||||||
poly.boundingRect.bottom = stream->readUint32LE() & 0xFFFF;
|
poly.boundingRect.bottom = stream->readSint32LE() & 0xFFFF;
|
||||||
|
|
||||||
entries.push_back(poly);
|
entries.push_back(poly);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
typedef struct PolyDefinitions {
|
typedef struct PolyDefinitions {
|
||||||
uint32 numPoints;
|
int32 numPoints;
|
||||||
Common::Point *points;
|
Common::Point *points;
|
||||||
Common::Rect boundingRect;
|
Common::Rect boundingRect;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ typedef struct PolyDefinitions {
|
||||||
*
|
*
|
||||||
* (was pointInPoly())
|
* (was pointInPoly())
|
||||||
*/
|
*/
|
||||||
bool contains(int x, int y);
|
bool contains(int16 x, int16 y);
|
||||||
|
|
||||||
} PolyDefinitions;
|
} PolyDefinitions;
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ public:
|
||||||
Polygons(Common::SeekableReadStream *stream);
|
Polygons(Common::SeekableReadStream *stream);
|
||||||
virtual ~Polygons();
|
virtual ~Polygons();
|
||||||
|
|
||||||
uint32 size;
|
int32 size;
|
||||||
uint32 numEntries;
|
int32 numEntries;
|
||||||
|
|
||||||
Common::Array<PolyDefinitions> entries;
|
Common::Array<PolyDefinitions> entries;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ ResourcePack::ResourcePack(const char *resourceFile) {
|
||||||
init(resourceFile);
|
init(resourceFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourcePack::ResourcePack(int resourceIndex) {
|
ResourcePack::ResourcePack(int32 resourceIndex) {
|
||||||
// We don't use the file number part of resource IDs
|
// We don't use the file number part of resource IDs
|
||||||
//uint32 fileNum = (resourceID >> 16) & 0x7FFF;
|
//uint32 fileNum = (resourceID >> 16) & 0x7FFF;
|
||||||
char filename[20];
|
char filename[20];
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct ResourceEntry {
|
||||||
class ResourcePack {
|
class ResourcePack {
|
||||||
public:
|
public:
|
||||||
ResourcePack(const char *resourceFile);
|
ResourcePack(const char *resourceFile);
|
||||||
ResourcePack(int resourceIndex);
|
ResourcePack(int32 resourceIndex);
|
||||||
~ResourcePack();
|
~ResourcePack();
|
||||||
|
|
||||||
ResourceEntry *getResource(uint32 resourceId);
|
ResourceEntry *getResource(uint32 resourceId);
|
||||||
|
|
|
@ -95,7 +95,7 @@ Scene::Scene(uint8 sceneIdx, AsylumEngine *engine): _vm(engine) {
|
||||||
// TODO figure out what field_120 is used for
|
// TODO figure out what field_120 is used for
|
||||||
_ws->field_120 = -1;
|
_ws->field_120 = -1;
|
||||||
|
|
||||||
for (uint32 a = 0; a < _ws->numActors; a++) {
|
for (int32 a = 0; a < _ws->numActors; a++) {
|
||||||
_ws->actors[a].tickValue1 = _vm->getTick();
|
_ws->actors[a].tickValue1 = _vm->getTick();
|
||||||
// FIXME This is a hack just to get the current resource
|
// FIXME This is a hack just to get the current resource
|
||||||
// pack and scene into the actor instance(s)
|
// pack and scene into the actor instance(s)
|
||||||
|
@ -114,8 +114,8 @@ void Scene::initialize() {
|
||||||
_playerActorIdx = 0;
|
_playerActorIdx = 0;
|
||||||
|
|
||||||
if (_ws->numBarriers > 0) {
|
if (_ws->numBarriers > 0) {
|
||||||
uint32 priority = 0x0FFB;
|
int32 priority = 0x0FFB;
|
||||||
for (uint32 b = 0; b < _ws->numBarriers; b++) {
|
for (int32 b = 0; b < _ws->numBarriers; b++) {
|
||||||
Barrier *barrier = &_ws->barriers[b];
|
Barrier *barrier = &_ws->barriers[b];
|
||||||
barrier->priority = priority;
|
barrier->priority = priority;
|
||||||
barrier->flags &= 0xFFFF3FFF;
|
barrier->flags &= 0xFFFF3FFF;
|
||||||
|
@ -143,7 +143,7 @@ void Scene::initialize() {
|
||||||
updateActorDirection(_playerActorIdx, 4);
|
updateActorDirection(_playerActorIdx, 4);
|
||||||
|
|
||||||
if (_ws->numActors > 1) {
|
if (_ws->numActors > 1) {
|
||||||
for (uint32 a = 1; a < _ws->numActors; a++) {
|
for (int32 a = 1; a < _ws->numActors; a++) {
|
||||||
Actor *act = &_ws->actors[a];
|
Actor *act = &_ws->actors[a];
|
||||||
act->flags |= 1;
|
act->flags |= 1;
|
||||||
act->direction = 1;
|
act->direction = 1;
|
||||||
|
@ -155,7 +155,7 @@ void Scene::initialize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 actionIdx = _ws->actionListIdx;
|
int32 actionIdx = _ws->actionListIdx;
|
||||||
if (actionIdx)
|
if (actionIdx)
|
||||||
_actions->queueScript(actionIdx, 0);
|
_actions->queueScript(actionIdx, 0);
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ void Scene::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Scene::updateScene() {
|
int Scene::updateScene() {
|
||||||
uint32 startTick = 0;
|
int32 startTick = 0;
|
||||||
|
|
||||||
// Mouse
|
// Mouse
|
||||||
startTick = _vm->getTick();
|
startTick = _vm->getTick();
|
||||||
|
@ -505,7 +505,7 @@ int Scene::updateScene() {
|
||||||
|
|
||||||
// Actors
|
// Actors
|
||||||
startTick = _vm->getTick();
|
startTick = _vm->getTick();
|
||||||
for (uint32 a = 0; a < _ws->numActors; a++)
|
for (int32 a = 0; a < _ws->numActors; a++)
|
||||||
updateActor(a);
|
updateActor(a);
|
||||||
debugC(kDebugLevelScene, "UpdateActors Time: %d", _vm->getTick() - startTick);
|
debugC(kDebugLevelScene, "UpdateActors Time: %d", _vm->getTick() - startTick);
|
||||||
|
|
||||||
|
@ -553,9 +553,9 @@ void Scene::updateMouse() {
|
||||||
int dir = -1;
|
int dir = -1;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
if (_cursor->x() < (uint32)actorPos.left) {
|
if (_cursor->x() < actorPos.left) {
|
||||||
if (_cursor->y() >= (uint32)actorPos.top) {
|
if (_cursor->y() >= actorPos.top) {
|
||||||
if (_cursor->y() > (uint32)actorPos.bottom) {
|
if (_cursor->y() > actorPos.bottom) {
|
||||||
if (getActor()->direction == 2) {
|
if (getActor()->direction == 2) {
|
||||||
if (_cursor->y() - actorPos.bottom > 10)
|
if (_cursor->y() - actorPos.bottom > 10)
|
||||||
dir = 3;
|
dir = 3;
|
||||||
|
@ -596,9 +596,9 @@ void Scene::updateMouse() {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done && _cursor->x() <= (uint32)actorPos.right) {
|
if (!done && _cursor->x() <= actorPos.right) {
|
||||||
if (_cursor->y() >= (uint32)actorPos.top) {
|
if (_cursor->y() >= actorPos.top) {
|
||||||
if (_cursor->y() > (uint32)actorPos.bottom) {
|
if (_cursor->y() > actorPos.bottom) {
|
||||||
if (getActor()->direction == 3) {
|
if (getActor()->direction == 3) {
|
||||||
if (_cursor->x() - actorPos.left > 10)
|
if (_cursor->x() - actorPos.left > 10)
|
||||||
dir = 4;
|
dir = 4;
|
||||||
|
@ -627,7 +627,7 @@ void Scene::updateMouse() {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done && _cursor->y() < (uint32)actorPos.top) {
|
if (!done && _cursor->y() < actorPos.top) {
|
||||||
if (getActor()->direction) {
|
if (getActor()->direction) {
|
||||||
if (getActor()->direction == 6) {
|
if (getActor()->direction == 6) {
|
||||||
if (actorPos.top - _cursor->y() > 10)
|
if (actorPos.top - _cursor->y() > 10)
|
||||||
|
@ -642,7 +642,7 @@ void Scene::updateMouse() {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done && _cursor->y() <= (uint32)actorPos.bottom) {
|
if (!done && _cursor->y() <= actorPos.bottom) {
|
||||||
if (getActor()->direction == 5) {
|
if (getActor()->direction == 5) {
|
||||||
if (actorPos.bottom - _cursor->y() > 10)
|
if (actorPos.bottom - _cursor->y() > 10)
|
||||||
dir = 6;
|
dir = 6;
|
||||||
|
@ -710,7 +710,7 @@ void Scene::updateActor(int32 actorIdx) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x5: {
|
case 0x5: {
|
||||||
uint32 frameNum = actor->frameNum + 1;
|
int32 frameNum = actor->frameNum + 1;
|
||||||
actor->frameNum = frameNum % actor->frameCount;
|
actor->frameNum = frameNum % actor->frameCount;
|
||||||
|
|
||||||
if (_vm->getTick() - actor->tickValue1 > 300) {
|
if (_vm->getTick() - actor->tickValue1 > 300) {
|
||||||
|
@ -814,17 +814,17 @@ void Scene::updateActorSub01(Actor *act) {
|
||||||
void Scene::updateBarriers() {
|
void Scene::updateBarriers() {
|
||||||
//Screen *screen = _vm->screen();
|
//Screen *screen = _vm->screen();
|
||||||
|
|
||||||
uint barriersCount = _ws->barriers.size();
|
int32 barriersCount = (int32)_ws->barriers.size();
|
||||||
//int startTickCount = 0;
|
//int startTickCount = 0;
|
||||||
bool canPlaySound = false;
|
bool canPlaySound = false;
|
||||||
|
|
||||||
if (barriersCount > 0) {
|
if (barriersCount > 0) {
|
||||||
for (uint32 b = 0; b < barriersCount; b++) {
|
for (int32 b = 0; b < barriersCount; b++) {
|
||||||
Barrier *barrier = &_ws->barriers[b];
|
Barrier *barrier = &_ws->barriers[b];
|
||||||
|
|
||||||
if (barrier->field_3C == 4) {
|
if (barrier->field_3C == 4) {
|
||||||
if (_ws->isBarrierVisible(b)) {
|
if (_ws->isBarrierVisible(b)) {
|
||||||
uint32 flag = barrier->flags;
|
int32 flag = barrier->flags;
|
||||||
if (flag & 0x20) {
|
if (flag & 0x20) {
|
||||||
if (barrier->field_B4 && (_vm->getTick() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
if (barrier->field_B4 && (_vm->getTick() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
||||||
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
barrier->frameIdx = (barrier->frameIdx + 1) % barrier->frameCount;
|
||||||
|
@ -868,7 +868,7 @@ void Scene::updateBarriers() {
|
||||||
} 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 && (_vm->getTick() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
if (barrier->field_B4 && (_vm->getTick() - barrier->tickCount >= 0x3E8 / barrier->field_B4)) {
|
||||||
uint32 frameIdx = barrier->frameIdx + 1;
|
int32 frameIdx = barrier->frameIdx + 1;
|
||||||
if (frameIdx < barrier->frameCount - 1) {
|
if (frameIdx < barrier->frameCount - 1) {
|
||||||
if (barrier->field_688 == 1) {
|
if (barrier->field_688 == 1) {
|
||||||
// TODO: get global x, y positions
|
// TODO: get global x, y positions
|
||||||
|
@ -892,7 +892,7 @@ void Scene::updateBarriers() {
|
||||||
} 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 && (_vm->getTick() - barrier->tickCount >= 0x3E8 / barrier->field_B4) && (flag & 0x10000)) {
|
if (barrier->field_B4 && (_vm->getTick() - barrier->tickCount >= 0x3E8 / barrier->field_B4) && (flag & 0x10000)) {
|
||||||
uint32 frameIdx = barrier->frameIdx - 1;
|
int32 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) {
|
||||||
|
@ -960,9 +960,9 @@ void Scene::updateAmbientSounds() {
|
||||||
|
|
||||||
int panning, volume;
|
int panning, volume;
|
||||||
|
|
||||||
for (uint32 i = 0; i < _ws->numAmbientSound; i++) {
|
for (int32 i = 0; i < _ws->numAmbientSound; i++) {
|
||||||
AmbientSoundItem *snd = &_ws->ambientSounds[i];
|
AmbientSoundItem *snd = &_ws->ambientSounds[i];
|
||||||
for (uint32 f = 0; f < 6; f++) {
|
for (int32 f = 0; f < 6; f++) {
|
||||||
int gameFlag = snd->flagNum[f];
|
int gameFlag = snd->flagNum[f];
|
||||||
if (gameFlag >= 0) {
|
if (gameFlag >= 0) {
|
||||||
if (_vm->isGameFlagNotSet(gameFlag)) {
|
if (_vm->isGameFlagNotSet(gameFlag)) {
|
||||||
|
@ -1069,13 +1069,13 @@ void Scene::updateAdjustScreen() {
|
||||||
}
|
}
|
||||||
if (v1 < 0)
|
if (v1 < 0)
|
||||||
v1 = _ws->xLeft = 0;
|
v1 = _ws->xLeft = 0;
|
||||||
if ((uint32)v1 > _ws->width - 640) {
|
if (v1 > _ws->width - 640) {
|
||||||
v1 = _ws->width - 640;
|
v1 = _ws->width - 640;
|
||||||
_ws->xLeft = v1;
|
_ws->xLeft = v1;
|
||||||
}
|
}
|
||||||
if (v0 < 0)
|
if (v0 < 0)
|
||||||
v0 = _ws->yTop = 0;
|
v0 = _ws->yTop = 0;
|
||||||
if ((uint32)v0 > _ws->height - 480) {
|
if (v0 > _ws->height - 480) {
|
||||||
v0 = _ws->height - 480;
|
v0 = _ws->height - 480;
|
||||||
_ws->yTop = v0;
|
_ws->yTop = v0;
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1180,7 @@ void Scene::OLD_UPDATE() {
|
||||||
|
|
||||||
// DEBUGGING
|
// DEBUGGING
|
||||||
// Check current walk region
|
// Check current walk region
|
||||||
for (uint32 a = 0; a < _ws->numActions; a++) {
|
for (int32 a = 0; a < _ws->numActions; a++) {
|
||||||
if (_ws->actions[a].actionType == 0) {
|
if (_ws->actions[a].actionType == 0) {
|
||||||
ActionArea *area = &_ws->actions[a];
|
ActionArea *area = &_ws->actions[a];
|
||||||
PolyDefinitions poly = _polygons->entries[area->polyIdx];
|
PolyDefinitions poly = _polygons->entries[area->polyIdx];
|
||||||
|
@ -1216,7 +1216,7 @@ void Scene::OLD_UPDATE() {
|
||||||
debugShowBarriers();
|
debugShowBarriers();
|
||||||
|
|
||||||
// Check if we're within a barrier
|
// Check if we're within a barrier
|
||||||
for (uint32 p = 0; p < _ws->numBarriers; p++) {
|
for (int32 p = 0; p < _ws->numBarriers; p++) {
|
||||||
Barrier b = _ws->barriers[p];
|
Barrier b = _ws->barriers[p];
|
||||||
if (b.flags & 0x20) {
|
if (b.flags & 0x20) {
|
||||||
if ((b.boundingRect.left + b.x <= _cursor->x() + _ws->targetX) &&
|
if ((b.boundingRect.left + b.x <= _cursor->x() + _ws->targetX) &&
|
||||||
|
@ -1237,7 +1237,7 @@ void Scene::OLD_UPDATE() {
|
||||||
// of the barrier/polygon action scripts should be processed first
|
// of the barrier/polygon action scripts should be processed first
|
||||||
if (curBarrier < 0) {
|
if (curBarrier < 0) {
|
||||||
// Update cursor if it's in a polygon hotspot
|
// Update cursor if it's in a polygon hotspot
|
||||||
for (uint32 p = 0; p < _polygons->numEntries; p++) {
|
for (int32 p = 0; p < _polygons->numEntries; p++) {
|
||||||
PolyDefinitions poly = _polygons->entries[p];
|
PolyDefinitions poly = _polygons->entries[p];
|
||||||
if (poly.boundingRect.contains(_cursor->x() + _ws->targetX, _cursor->y() + _ws->targetY)) {
|
if (poly.boundingRect.contains(_cursor->x() + _ws->targetX, _cursor->y() + _ws->targetY)) {
|
||||||
if (poly.contains(_cursor->x() + _ws->targetX, _cursor->y() + _ws->targetY)) {
|
if (poly.contains(_cursor->x() + _ws->targetX, _cursor->y() + _ws->targetY)) {
|
||||||
|
@ -1253,8 +1253,8 @@ void Scene::OLD_UPDATE() {
|
||||||
_leftClick = false;
|
_leftClick = false;
|
||||||
|
|
||||||
if (curHotspot >= 0) {
|
if (curHotspot >= 0) {
|
||||||
for (uint32 a = 0; a < _ws->numActions; a++) {
|
for (int32 a = 0; a < _ws->numActions; a++) {
|
||||||
if (_ws->actions[a].polyIdx == (uint32)curHotspot) {
|
if (_ws->actions[a].polyIdx == curHotspot) {
|
||||||
debugC(kDebugLevelScripts, "Hotspot: 0x%X - \"%s\", poly %d, action lists %d/%d, action type %d, sound res %d\n",
|
debugC(kDebugLevelScripts, "Hotspot: 0x%X - \"%s\", poly %d, action lists %d/%d, action type %d, sound res %d\n",
|
||||||
_ws->actions[a].id,
|
_ws->actions[a].id,
|
||||||
_ws->actions[a].name,
|
_ws->actions[a].name,
|
||||||
|
@ -1323,7 +1323,7 @@ void Scene::drawActorsAndBarriers() {
|
||||||
// a collection of CharacterUpdateItems. Since
|
// a collection of CharacterUpdateItems. Since
|
||||||
// we're only on scene 1 atm, and there is only one
|
// we're only on scene 1 atm, and there is only one
|
||||||
// character, this will have to do :P
|
// character, this will have to do :P
|
||||||
for (uint i = 0; i < _ws->numActors; i++) {
|
for (int32 i = 0; i < _ws->numActors; i++) {
|
||||||
int actorRegPt = 0;
|
int actorRegPt = 0;
|
||||||
Actor *act = &_ws->actors[i];
|
Actor *act = &_ws->actors[i];
|
||||||
Common::Point pt;
|
Common::Point pt;
|
||||||
|
@ -1359,7 +1359,7 @@ void Scene::drawActorsAndBarriers() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// XXX from .text:0040a4d1
|
// XXX from .text:0040a4d1
|
||||||
for (uint barIdx = 0; barIdx < _ws->numBarriers; barIdx++) {
|
for (int32 barIdx = 0; barIdx < _ws->numBarriers; barIdx++) {
|
||||||
Barrier *bar = &_ws->barriers[barIdx];
|
Barrier *bar = &_ws->barriers[barIdx];
|
||||||
bool actInBar = bar->boundingRect.contains(act->boundingRect);
|
bool actInBar = bar->boundingRect.contains(act->boundingRect);
|
||||||
bool intersects = false;
|
bool intersects = false;
|
||||||
|
@ -1461,7 +1461,7 @@ void Scene::getActorPosition(Actor *actor, Common::Point *pt) {
|
||||||
int Scene::queueActorUpdates() {
|
int Scene::queueActorUpdates() {
|
||||||
if (_ws->numActors > 0) {
|
if (_ws->numActors > 0) {
|
||||||
Common::Point pt;
|
Common::Point pt;
|
||||||
for (uint32 a = 0; a < _ws->numActors; a++) {
|
for (int32 a = 0; a < _ws->numActors; a++) {
|
||||||
Actor *actor = &_ws->actors[a];
|
Actor *actor = &_ws->actors[a];
|
||||||
|
|
||||||
if ((actor->flags & 0xFF) & 1) { // check this mask
|
if ((actor->flags & 0xFF) & 1) { // check this mask
|
||||||
|
@ -1469,7 +1469,7 @@ int Scene::queueActorUpdates() {
|
||||||
//pt.x += actor->x;
|
//pt.x += actor->x;
|
||||||
//pt.y += actor->y;
|
//pt.y += actor->y;
|
||||||
|
|
||||||
uint32 frameNum = actor->frameNum;
|
int32 frameNum = actor->frameNum;
|
||||||
if (actor->frameNum >= actor->frameCount) {
|
if (actor->frameNum >= actor->frameCount) {
|
||||||
frameNum = 2 * actor->frameCount - actor->frameNum - 1;
|
frameNum = 2 * actor->frameCount - actor->frameNum - 1;
|
||||||
}
|
}
|
||||||
|
@ -1491,10 +1491,10 @@ int Scene::queueActorUpdates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Scene::queueBarrierUpdates() {
|
int Scene::queueBarrierUpdates() {
|
||||||
uint barriersCount = _ws->barriers.size();
|
int32 barriersCount = (int32)_ws->barriers.size();
|
||||||
|
|
||||||
if (barriersCount > 0) {
|
if (barriersCount > 0) {
|
||||||
for (uint32 b = 0; b < barriersCount; b++) {
|
for (int32 b = 0; b < barriersCount; b++) {
|
||||||
Barrier *barrier = &_ws->barriers[b];
|
Barrier *barrier = &_ws->barriers[b];
|
||||||
|
|
||||||
if (!(barrier->flags & 4) && !((barrier->flags & 0xFF) & 0x40)) {
|
if (!(barrier->flags & 4) && !((barrier->flags & 0xFF) & 0x40)) {
|
||||||
|
@ -1576,7 +1576,7 @@ void Scene::debugShowWalkRegion(PolyDefinitions *poly) {
|
||||||
1);
|
1);
|
||||||
|
|
||||||
// Draw all lines in Polygon
|
// Draw all lines in Polygon
|
||||||
for (uint32 i = 0; i < poly->numPoints; i++) {
|
for (int32 i = 0; i < poly->numPoints; i++) {
|
||||||
surface.drawLine(
|
surface.drawLine(
|
||||||
poly->points[i].x - poly->boundingRect.left,
|
poly->points[i].x - poly->boundingRect.left,
|
||||||
poly->points[i].y - poly->boundingRect.top,
|
poly->points[i].y - poly->boundingRect.top,
|
||||||
|
@ -1591,7 +1591,7 @@ void Scene::debugShowWalkRegion(PolyDefinitions *poly) {
|
||||||
|
|
||||||
// POLYGONS DEBUG
|
// POLYGONS DEBUG
|
||||||
void Scene::debugShowPolygons() {
|
void Scene::debugShowPolygons() {
|
||||||
for (uint32 p = 0; p < _polygons->numEntries; p++) {
|
for (int32 p = 0; p < _polygons->numEntries; p++) {
|
||||||
Graphics::Surface surface;
|
Graphics::Surface surface;
|
||||||
PolyDefinitions poly = _polygons->entries[p];
|
PolyDefinitions poly = _polygons->entries[p];
|
||||||
surface.create(poly.boundingRect.right - poly.boundingRect.left + 1,
|
surface.create(poly.boundingRect.right - poly.boundingRect.left + 1,
|
||||||
|
@ -1599,7 +1599,7 @@ void Scene::debugShowPolygons() {
|
||||||
1);
|
1);
|
||||||
|
|
||||||
// Draw all lines in Polygon
|
// Draw all lines in Polygon
|
||||||
for (uint32 i = 0; i < poly.numPoints; i++) {
|
for (int32 i = 0; i < poly.numPoints; i++) {
|
||||||
surface.drawLine(
|
surface.drawLine(
|
||||||
poly.points[i].x - poly.boundingRect.left,
|
poly.points[i].x - poly.boundingRect.left,
|
||||||
poly.points[i].y - poly.boundingRect.top,
|
poly.points[i].y - poly.boundingRect.top,
|
||||||
|
@ -1615,7 +1615,7 @@ void Scene::debugShowPolygons() {
|
||||||
|
|
||||||
// BARRIER DEBUGGING
|
// BARRIER DEBUGGING
|
||||||
void Scene::debugShowBarriers() {
|
void Scene::debugShowBarriers() {
|
||||||
for (uint32 p = 0; p < _ws->numBarriers; p++) {
|
for (int32 p = 0; p < _ws->numBarriers; p++) {
|
||||||
Graphics::Surface surface;
|
Graphics::Surface surface;
|
||||||
Barrier b = _ws->barriers[p];
|
Barrier b = _ws->barriers[p];
|
||||||
|
|
||||||
|
@ -1633,7 +1633,7 @@ void Scene::debugShowBarriers() {
|
||||||
|
|
||||||
// BARRIER DEBUGGING
|
// BARRIER DEBUGGING
|
||||||
void Scene::debugShowActors() {
|
void Scene::debugShowActors() {
|
||||||
for (uint32 p = 0; p < _ws->numActors; p++) {
|
for (int32 p = 0; p < _ws->numActors; p++) {
|
||||||
Graphics::Surface surface;
|
Graphics::Surface surface;
|
||||||
Actor a = _ws->actors[p];
|
Actor a = _ws->actors[p];
|
||||||
|
|
||||||
|
@ -1673,7 +1673,7 @@ SceneTitle::~SceneTitle() {
|
||||||
delete _progress;
|
delete _progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTitle::update(uint32 tick) {
|
void SceneTitle::update(int32 tick) {
|
||||||
|
|
||||||
// XXX This is not from the original. It's just some
|
// XXX This is not from the original. It's just some
|
||||||
// arbitrary math to throttle the progress indicator.
|
// arbitrary math to throttle the progress indicator.
|
||||||
|
@ -1694,8 +1694,8 @@ void SceneTitle::update(uint32 tick) {
|
||||||
bgFrame->surface.w,
|
bgFrame->surface.w,
|
||||||
0, 0, 640, 480);
|
0, 0, 640, 480);
|
||||||
|
|
||||||
uint32 resId = _scene->getSceneIndex() - 4 + 1811;
|
int32 resId = _scene->getSceneIndex() - 4 + 1811;
|
||||||
uint32 resWidth = _scene->vm()->text()->getResTextWidth(resId);
|
int32 resWidth = _scene->vm()->text()->getResTextWidth(resId);
|
||||||
_scene->vm()->text()->drawResTextCentered(320 - resWidth * 24, 30, resWidth, resId);
|
_scene->vm()->text()->drawResTextCentered(320 - resWidth * 24, 30, resWidth, resId);
|
||||||
|
|
||||||
GraphicFrame *frame = _progress->getFrame(_spinnerFrame);
|
GraphicFrame *frame = _progress->getFrame(_spinnerFrame);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
SceneTitle(Scene *scene);
|
SceneTitle(Scene *scene);
|
||||||
~SceneTitle();
|
~SceneTitle();
|
||||||
|
|
||||||
void update(uint32 tick);
|
void update(int32 tick);
|
||||||
bool loadingComplete() { return _done; }
|
bool loadingComplete() { return _done; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -67,11 +67,11 @@ private:
|
||||||
GraphicResource *_bg;
|
GraphicResource *_bg;
|
||||||
GraphicResource *_progress;
|
GraphicResource *_progress;
|
||||||
|
|
||||||
uint32 _start;
|
int32 _start;
|
||||||
uint32 _ticks;
|
int32 _ticks;
|
||||||
bool _done;
|
bool _done;
|
||||||
uint32 _spinnerFrame;
|
int32 _spinnerFrame;
|
||||||
uint32 _spinnerProgress;
|
int32 _spinnerProgress;
|
||||||
|
|
||||||
bool _showMouseState;
|
bool _showMouseState;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
Cursor* getCursor() { return _cursor; }
|
Cursor* getCursor() { return _cursor; }
|
||||||
ResourcePack* getResourcePack() { return _resPack; }
|
ResourcePack* getResourcePack() { return _resPack; }
|
||||||
ResourcePack* getMusicPack() { return _musPack; }
|
ResourcePack* getMusicPack() { return _musPack; }
|
||||||
GraphicResource* getGraphicResource(uint32 entry) { return new GraphicResource(_resPack, entry); }
|
GraphicResource* getGraphicResource(int32 entry) { return new GraphicResource(_resPack, entry); }
|
||||||
BlowUpPuzzle* getBlowUpPuzzle() { return _blowUp;}
|
BlowUpPuzzle* getBlowUpPuzzle() { return _blowUp;}
|
||||||
void setBlowUpPuzzle(BlowUpPuzzle* puzzle) { _blowUp = puzzle; }
|
void setBlowUpPuzzle(BlowUpPuzzle* puzzle) { _blowUp = puzzle; }
|
||||||
void setScenePosition(int x, int y);
|
void setScenePosition(int x, int y);
|
||||||
|
@ -197,7 +197,7 @@ private:
|
||||||
int queueBarrierUpdates();
|
int queueBarrierUpdates();
|
||||||
bool isBarrierVisible(BarrierItem *barrier);
|
bool isBarrierVisible(BarrierItem *barrier);
|
||||||
bool isBarrierOnScreen(BarrierItem *barrier);
|
bool isBarrierOnScreen(BarrierItem *barrier);
|
||||||
uint32 getRandomResId(BarrierItem *barrier);
|
int32 getRandomResId(BarrierItem *barrier);
|
||||||
|
|
||||||
void copyToBackBufferClipped(Graphics::Surface *surface, int x, int y);
|
void copyToBackBufferClipped(Graphics::Surface *surface, int x, int y);
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,9 @@ void Screen::copyBackBufferToScreen() {
|
||||||
_vm->_system->copyRectToScreen((byte *)_backBuffer.pixels, _backBuffer.w, 0, 0, _backBuffer.w, _backBuffer.h);
|
_vm->_system->copyRectToScreen((byte *)_backBuffer.pixels, _backBuffer.w, 0, 0, _backBuffer.w, _backBuffer.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyToBackBuffer(byte *buffer, int pitch, int x, int y, int width, int height) {
|
void Screen::copyToBackBuffer(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height) {
|
||||||
int h = height;
|
int32 h = height;
|
||||||
int w = width;
|
int32 w = width;
|
||||||
byte *dest = (byte *)_backBuffer.pixels;
|
byte *dest = (byte *)_backBuffer.pixels;
|
||||||
|
|
||||||
while (h--) {
|
while (h--) {
|
||||||
|
@ -51,13 +51,13 @@ void Screen::copyToBackBuffer(byte *buffer, int pitch, int x, int y, int width,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyToBackBufferWithTransparency(byte *buffer, int pitch, int x, int y, int width, int height) {
|
void Screen::copyToBackBufferWithTransparency(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height) {
|
||||||
// int h = height;
|
// int32 h = height;
|
||||||
// int w = width;
|
// int32 w = width;
|
||||||
byte *dest = (byte *)_backBuffer.pixels;
|
byte *dest = (byte *)_backBuffer.pixels;
|
||||||
|
|
||||||
for (int curY = 0; curY < height; curY++) {
|
for (int32 curY = 0; curY < height; curY++) {
|
||||||
for (int curX = 0; curX < width; curX++) {
|
for (int32 curX = 0; curX < width; curX++) {
|
||||||
if (buffer[curX + curY * pitch] != 0) {
|
if (buffer[curX + curY * pitch] != 0) {
|
||||||
dest[x + curX + (y + curY) * 640] = buffer[curX + curY * pitch];
|
dest[x + curX + (y + curY) * 640] = buffer[curX + curY * pitch];
|
||||||
}
|
}
|
||||||
|
@ -65,15 +65,15 @@ void Screen::copyToBackBufferWithTransparency(byte *buffer, int pitch, int x, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyRectToScreen(byte *buffer, int pitch, int x, int y, int width, int height) {
|
void Screen::copyRectToScreen(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height) {
|
||||||
_vm->_system->copyRectToScreen(buffer, pitch, x, y, width, height);
|
_vm->_system->copyRectToScreen(buffer, pitch, x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyRectToScreenWithTransparency(byte *buffer, int pitch, int x, int y, int width, int height) {
|
void Screen::copyRectToScreenWithTransparency(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height) {
|
||||||
byte *screenBuffer = (byte *)_vm->_system->lockScreen()->pixels;
|
byte *screenBuffer = (byte *)_vm->_system->lockScreen()->pixels;
|
||||||
|
|
||||||
for (int curY = 0; curY < height; curY++) {
|
for (int32 curY = 0; curY < height; curY++) {
|
||||||
for (int curX = 0; curX < width; curX++) {
|
for (int32 curX = 0; curX < width; curX++) {
|
||||||
if (buffer[curX + curY * pitch] != 0 && (x + curX + (y + curY) * 640 <= 640*480)) {
|
if (buffer[curX + curY * pitch] != 0 && (x + curX + (y + curY) * 640 <= 640*480)) {
|
||||||
screenBuffer[x + curX + (y + curY) * 640] = buffer[curX + curY * pitch];
|
screenBuffer[x + curX + (y + curY) * 640] = buffer[curX + curY * pitch];
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ void Screen::setPalette(byte *rgbPalette) {
|
||||||
memset(palette, 0, 4);
|
memset(palette, 0, 4);
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
for (int i = 1; i < 256; i++) {
|
for (int32 i = 1; i < 256; i++) {
|
||||||
palette[i * 4 + 0] = *p++ << 2;
|
palette[i * 4 + 0] = *p++ << 2;
|
||||||
palette[i * 4 + 1] = *p++ << 2;
|
palette[i * 4 + 1] = *p++ << 2;
|
||||||
palette[i * 4 + 2] = *p++ << 2;
|
palette[i * 4 + 2] = *p++ << 2;
|
||||||
|
@ -115,7 +115,7 @@ void Screen::clearScreen() {
|
||||||
_vm->_system->fillScreen(0);
|
_vm->_system->fillScreen(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::addGraphicToQueue(uint32 resId, uint32 frameIdx, uint32 x, uint32 y, uint32 flags, uint32 transTableNum, uint32 priority) {
|
void Screen::addGraphicToQueue(int32 resId, int32 frameIdx, int32 x, int32 y, int32 flags, int32 transTableNum, int32 priority) {
|
||||||
GraphicQueueItem item;
|
GraphicQueueItem item;
|
||||||
item.resId = resId;
|
item.resId = resId;
|
||||||
item.x = x;
|
item.x = x;
|
||||||
|
@ -128,7 +128,7 @@ void Screen::addGraphicToQueue(uint32 resId, uint32 frameIdx, uint32 x, uint32 y
|
||||||
_queueItems.push_back(item);
|
_queueItems.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::addCrossFadeGraphicToQueue(uint32 resId, uint32 frameIdx, uint32 x, uint32 y, uint32 redId2, uint32 x2, uint32 y2, uint32 flags, uint32 priority) {
|
void Screen::addCrossFadeGraphicToQueue(int32 resId, int32 frameIdx, int32 x, int32 y, int32 redId2, int32 x2, int32 y2, int32 flags, int32 priority) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ void Screen::drawGraphicsInQueue() {
|
||||||
// sort by priority first
|
// sort by priority first
|
||||||
graphicsSelectionSort();
|
graphicsSelectionSort();
|
||||||
|
|
||||||
for (uint i = 0; i < _queueItems.size(); i++) {
|
for (uint32 i = 0; i < _queueItems.size(); i++) {
|
||||||
GraphicResource *grRes = _vm->scene()->getGraphicResource(_queueItems[i].resId);
|
GraphicResource *grRes = _vm->scene()->getGraphicResource(_queueItems[i].resId);
|
||||||
GraphicFrame *fra = grRes->getFrame(_queueItems[i].frameIdx);
|
GraphicFrame *fra = grRes->getFrame(_queueItems[i].frameIdx);
|
||||||
copyRectToScreenWithTransparency((byte *)fra->surface.pixels, fra->surface.w, _queueItems[i].x - ws->targetX, _queueItems[i].y - ws->targetY, fra->surface.w, fra->surface.h);
|
copyRectToScreenWithTransparency((byte *)fra->surface.pixels, fra->surface.w, _queueItems[i].x - ws->targetX, _queueItems[i].y - ws->targetY, fra->surface.w, fra->surface.h);
|
||||||
|
@ -155,12 +155,12 @@ void Screen::clearGraphicsInQueue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::graphicsSelectionSort() {
|
void Screen::graphicsSelectionSort() {
|
||||||
uint minIdx;
|
uint32 minIdx;
|
||||||
|
|
||||||
for (uint i = 0; i < _queueItems.size(); i++) {
|
for (uint32 i = 0; i < _queueItems.size(); i++) {
|
||||||
minIdx = i;
|
minIdx = i;
|
||||||
|
|
||||||
for (uint j = i + 1; j < _queueItems.size(); j++)
|
for (uint32 j = i + 1; j < _queueItems.size(); j++)
|
||||||
if (_queueItems[j].priority > _queueItems[i].priority)
|
if (_queueItems[j].priority > _queueItems[i].priority)
|
||||||
minIdx = j;
|
minIdx = j;
|
||||||
|
|
||||||
|
@ -169,15 +169,15 @@ void Screen::graphicsSelectionSort() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::swapGraphicItem(int item1, int item2) {
|
void Screen::swapGraphicItem(int32 item1, int32 item2) {
|
||||||
GraphicQueueItem temp;
|
GraphicQueueItem temp;
|
||||||
temp = _queueItems[item1];
|
temp = _queueItems[item1];
|
||||||
_queueItems[item1] = _queueItems[item2];
|
_queueItems[item1] = _queueItems[item2];
|
||||||
_queueItems[item2] = temp;
|
_queueItems[item2] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::deleteGraphicFromQueue(uint32 resId) {
|
void Screen::deleteGraphicFromQueue(int32 resId) {
|
||||||
for (uint i = 0; i < _queueItems.size(); i++) {
|
for (uint32 i = 0; i < _queueItems.size(); i++) {
|
||||||
if (_queueItems[i].resId == resId) {
|
if (_queueItems[i].resId == resId) {
|
||||||
_queueItems.remove_at(i);
|
_queueItems.remove_at(i);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
typedef struct GraphicQueueItem {
|
typedef struct GraphicQueueItem {
|
||||||
uint32 resId;
|
int32 resId;
|
||||||
uint32 frameIdx;
|
int32 frameIdx;
|
||||||
uint32 x;
|
int32 x;
|
||||||
uint32 y;
|
int32 y;
|
||||||
uint32 flags;
|
int32 flags;
|
||||||
uint32 transTableNum;
|
int32 transTableNum;
|
||||||
uint32 priority;
|
int32 priority;
|
||||||
|
|
||||||
} GraphicQueueItem;
|
} GraphicQueueItem;
|
||||||
|
|
||||||
|
@ -51,26 +51,26 @@ public:
|
||||||
Screen(AsylumEngine *_vm);
|
Screen(AsylumEngine *_vm);
|
||||||
~Screen();
|
~Screen();
|
||||||
|
|
||||||
void copyToBackBuffer(byte *buffer, int pitch, int x, int y, int width, int height);
|
void copyToBackBuffer(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height);
|
||||||
void copyToBackBufferWithTransparency(byte *buffer, int pitch, int x, int y, int width, int height);
|
void copyToBackBufferWithTransparency(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height);
|
||||||
void copyBackBufferToScreen();
|
void copyBackBufferToScreen();
|
||||||
void copyRectToScreen(byte *buffer, int pitch, int x, int y, int width, int height);
|
void copyRectToScreen(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height);
|
||||||
void copyRectToScreenWithTransparency(byte *buffer, int pitch, int x, int y, int width, int height);
|
void copyRectToScreenWithTransparency(byte *buffer, int32 pitch, int32 x, int32 y, int32 width, int32 height);
|
||||||
void setPalette(byte *rgbPalette);
|
void setPalette(byte *rgbPalette);
|
||||||
void setPalette(ResourcePack *resPack, int entry) {
|
void setPalette(ResourcePack *resPack, int32 entry) {
|
||||||
setPalette(resPack->getResource(entry)->data + 32);
|
setPalette(resPack->getResource(entry)->data + 32);
|
||||||
}
|
}
|
||||||
void drawWideScreen(int16 barSize);
|
void drawWideScreen(int16 barSize);
|
||||||
void clearScreen();
|
void clearScreen();
|
||||||
|
|
||||||
void addGraphicToQueue(uint32 resId, uint32 frameIdx, uint32 x, uint32 y, uint32 flags, uint32 transTableNum, uint32 priority);
|
void addGraphicToQueue(int32 resId, int32 frameIdx, int32 x, int32 y, int32 flags, int32 transTableNum, int32 priority);
|
||||||
void addCrossFadeGraphicToQueue(uint32 resId, uint32 frameIdx, uint32 x, uint32 y, uint32 redId2, uint32 x2, uint32 y2, uint32 flags, uint32 priority);
|
void addCrossFadeGraphicToQueue(int32 resId, int32 frameIdx, int32 x, int32 y, int32 redId2, int32 x2, int32 y2, int32 flags, int32 priority);
|
||||||
void addGraphicToQueue(GraphicQueueItem item);
|
void addGraphicToQueue(GraphicQueueItem item);
|
||||||
void drawGraphicsInQueue();
|
void drawGraphicsInQueue();
|
||||||
void clearGraphicsInQueue();
|
void clearGraphicsInQueue();
|
||||||
void graphicsSelectionSort();
|
void graphicsSelectionSort();
|
||||||
void swapGraphicItem(int item1, int item2);
|
void swapGraphicItem(int32 item1, int32 item2);
|
||||||
void deleteGraphicFromQueue(uint32 resId);
|
void deleteGraphicFromQueue(int32 resId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Graphics::Surface _backBuffer;
|
Graphics::Surface _backBuffer;
|
||||||
|
|
|
@ -48,7 +48,7 @@ Sound::~Sound() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// from engines/agos/sound.cpp
|
// from engines/agos/sound.cpp
|
||||||
void convertVolume(int &vol) {
|
void convertVolume(int32 &vol) {
|
||||||
// DirectSound was orginally used, which specifies volume
|
// DirectSound was orginally used, which specifies volume
|
||||||
// and panning differently than ScummVM does, using a logarithmic scale
|
// and panning differently than ScummVM does, using a logarithmic scale
|
||||||
// rather than a linear one.
|
// rather than a linear one.
|
||||||
|
@ -61,7 +61,7 @@ void convertVolume(int &vol) {
|
||||||
// affecting the right speaker. Thus -10,000 means the left speaker is
|
// affecting the right speaker. Thus -10,000 means the left speaker is
|
||||||
// silent.
|
// silent.
|
||||||
|
|
||||||
int v = CLIP(vol, -10000, 0);
|
int32 v = CLIP(vol, -10000, 0);
|
||||||
if (v) {
|
if (v) {
|
||||||
vol = (int)((double)Audio::Mixer::kMaxChannelVolume * pow(10.0, (double)v / 2000.0) + 0.5);
|
vol = (int)((double)Audio::Mixer::kMaxChannelVolume * pow(10.0, (double)v / 2000.0) + 0.5);
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,7 +70,7 @@ void convertVolume(int &vol) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// from engines/agos/sound.cpp
|
// from engines/agos/sound.cpp
|
||||||
void convertPan(int &pan) {
|
void convertPan(int32 &pan) {
|
||||||
// DirectSound was orginally used, which specifies volume
|
// DirectSound was orginally used, which specifies volume
|
||||||
// and panning differently than ScummVM does, using a logarithmic scale
|
// and panning differently than ScummVM does, using a logarithmic scale
|
||||||
// rather than a linear one.
|
// rather than a linear one.
|
||||||
|
@ -83,7 +83,7 @@ void convertPan(int &pan) {
|
||||||
// affecting the right speaker. Thus -10,000 means the left speaker is
|
// affecting the right speaker. Thus -10,000 means the left speaker is
|
||||||
// silent.
|
// silent.
|
||||||
|
|
||||||
int p = CLIP(pan, -10000, 10000);
|
int32 p = CLIP(pan, -10000, 10000);
|
||||||
if (p < 0) {
|
if (p < 0) {
|
||||||
pan = (int)(255.0 * pow(10.0, (double)p / 2000.0) + 127.5);
|
pan = (int)(255.0 * pow(10.0, (double)p / 2000.0) + 127.5);
|
||||||
} else if (p > 0) {
|
} else if (p > 0) {
|
||||||
|
@ -93,10 +93,10 @@ void convertPan(int &pan) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sound::getBufferPosition(uint32 resId) {
|
int32 Sound::getBufferPosition(int32 resId) {
|
||||||
int pos = -1;
|
int32 pos = -1;
|
||||||
|
|
||||||
for (uint i = 0; i < _soundBuffer.size(); i++) {
|
for (uint32 i = 0; i < _soundBuffer.size(); i++) {
|
||||||
if (resId == _soundBuffer[i].resId) {
|
if (resId == _soundBuffer[i].resId) {
|
||||||
pos = i;
|
pos = i;
|
||||||
break;
|
break;
|
||||||
|
@ -106,8 +106,8 @@ int Sound::getBufferPosition(uint32 resId) {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sound::addToSoundBuffer(uint resId) {
|
bool Sound::addToSoundBuffer(int32 resId) {
|
||||||
int exists = getBufferPosition(resId);
|
int32 exists = getBufferPosition(resId);
|
||||||
|
|
||||||
if (exists < 0) {
|
if (exists < 0) {
|
||||||
SoundBufferItem sound;
|
SoundBufferItem sound;
|
||||||
|
@ -119,8 +119,8 @@ bool Sound::addToSoundBuffer(uint resId) {
|
||||||
return (exists < 0) ? true : false;
|
return (exists < 0) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::removeFromSoundBuffer(uint resId) {
|
void Sound::removeFromSoundBuffer(int32 resId) {
|
||||||
int pos = getBufferPosition(resId);
|
int32 pos = getBufferPosition(resId);
|
||||||
|
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
_soundBuffer.remove_at(pos);
|
_soundBuffer.remove_at(pos);
|
||||||
|
@ -131,8 +131,8 @@ void Sound::clearSoundBuffer() {
|
||||||
_soundBuffer.clear();
|
_soundBuffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sound::isPlaying(uint resId) {
|
bool Sound::isPlaying(int32 resId) {
|
||||||
int pos = getBufferPosition(resId);
|
int32 pos = getBufferPosition(resId);
|
||||||
|
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
warning("isPlaying: resId %d not currently bufferred", resId);
|
warning("isPlaying: resId %d not currently bufferred", resId);
|
||||||
|
@ -148,7 +148,7 @@ bool Sound::isPlaying(uint resId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playSound(ResourcePack *pack, uint resId, int volume, bool looping, int panning, bool overwrite) {
|
void Sound::playSound(ResourcePack *pack, int32 resId, int32 volume, bool looping, int32 panning, bool overwrite) {
|
||||||
ResourceEntry *resource = pack->getResource(resId);
|
ResourceEntry *resource = pack->getResource(resId);
|
||||||
if (_mixer->isSoundHandleActive(_soundHandle)) {
|
if (_mixer->isSoundHandleActive(_soundHandle)) {
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
|
@ -161,12 +161,12 @@ void Sound::playSound(ResourcePack *pack, uint resId, int volume, bool looping,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playSound(ResourceEntry *resource, bool looping, int volume, int panning) {
|
void Sound::playSound(ResourceEntry *resource, bool looping, int32 volume, int32 panning) {
|
||||||
playSoundData(&_soundHandle, resource->data, resource->size, looping, volume, panning);
|
playSoundData(&_soundHandle, resource->data, resource->size, looping, volume, panning);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playSound(ResourcePack *pack, uint resId, bool looping, int volume, int panning) {
|
void Sound::playSound(ResourcePack *pack, int32 resId, bool looping, int32 volume, int32 panning) {
|
||||||
int pos = getBufferPosition(resId);
|
int32 pos = getBufferPosition(resId);
|
||||||
|
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
warning("playSound: resId %d not currently bufferred", resId);
|
warning("playSound: resId %d not currently bufferred", resId);
|
||||||
|
@ -183,7 +183,7 @@ void Sound::playSound(ResourcePack *pack, uint resId, bool looping, int volume,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playSound(uint resId, bool looping, int volume, int panning, bool fromBuffer) {
|
void Sound::playSound(int32 resId, bool looping, int32 volume, int32 panning, bool fromBuffer) {
|
||||||
if (fromBuffer) {
|
if (fromBuffer) {
|
||||||
playSound(_soundPack, resId, looping, volume, panning);
|
playSound(_soundPack, resId, looping, volume, panning);
|
||||||
} else {
|
} else {
|
||||||
|
@ -202,8 +202,8 @@ void Sound::stopSound() {
|
||||||
_mixer->stopHandle(_soundHandle);
|
_mixer->stopHandle(_soundHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::stopSound(uint resId) {
|
void Sound::stopSound(int32 resId) {
|
||||||
int pos = getBufferPosition(resId);
|
int32 pos = getBufferPosition(resId);
|
||||||
|
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
warning("stopSound: resId %d not currently bufferred", resId);
|
warning("stopSound: resId %d not currently bufferred", resId);
|
||||||
|
@ -220,24 +220,24 @@ void Sound::stopAllSounds(bool stopSpeechAndMusic) {
|
||||||
_mixer->stopHandle(_musicHandle);
|
_mixer->stopHandle(_musicHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = 0; i < _soundBuffer.size(); i++)
|
for (uint32 i = 0; i < _soundBuffer.size(); i++)
|
||||||
_mixer->stopHandle(_soundBuffer[i].handle);
|
_mixer->stopHandle(_soundBuffer[i].handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playSpeech(uint resId) {
|
void Sound::playSpeech(int32 resId) {
|
||||||
ResourceEntry *ent = _speechPack->getResource(resId);
|
ResourceEntry *ent = _speechPack->getResource(resId);
|
||||||
|
|
||||||
_mixer->stopHandle(_speechHandle);
|
_mixer->stopHandle(_speechHandle);
|
||||||
playSoundData(&_speechHandle, ent->data, ent->size, false, 0, 0);
|
playSoundData(&_speechHandle, ent->data, ent->size, false, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playMusic(uint resId) {
|
void Sound::playMusic(int32 resId) {
|
||||||
stopMusic();
|
stopMusic();
|
||||||
|
|
||||||
// TODO Play music :P
|
// TODO Play music :P
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playMusic(ResourcePack *pack, uint resId) {
|
void Sound::playMusic(ResourcePack *pack, int32 resId) {
|
||||||
stopMusic();
|
stopMusic();
|
||||||
|
|
||||||
ResourceEntry *resource = pack->getResource(resId);
|
ResourceEntry *resource = pack->getResource(resId);
|
||||||
|
@ -249,13 +249,13 @@ void Sound::stopMusic() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// from engines/agos/sound.cpp
|
// from engines/agos/sound.cpp
|
||||||
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soundDataLength, bool loop, int vol, int pan) {
|
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, int32 soundDataLength, bool loop, int32 vol, int32 pan) {
|
||||||
byte *buffer, flags;
|
byte *buffer, flags;
|
||||||
uint16 compType;
|
uint16 compType;
|
||||||
int blockAlign, rate;
|
int32 blockAlign, rate;
|
||||||
|
|
||||||
// TODO: Use makeWAVStream() in future, when makeADPCMStream() allows sound looping
|
// TODO: Use makeWAVStream() in future, when makeADPCMStream() allows sound looping
|
||||||
int size = soundDataLength;
|
int32 size = soundDataLength;
|
||||||
Common::MemoryReadStream stream(soundData, size);
|
Common::MemoryReadStream stream(soundData, size);
|
||||||
if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign))
|
if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign))
|
||||||
error("playSoundData: Not valid WAV data");
|
error("playSoundData: Not valid WAV data");
|
||||||
|
|
|
@ -33,40 +33,40 @@
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
typedef struct SoundItem {
|
typedef struct SoundItem {
|
||||||
uint32 resId;
|
int32 resId;
|
||||||
uint32 field_4;
|
int32 field_4;
|
||||||
uint32 field_8;
|
int32 field_8;
|
||||||
uint32 field_C;
|
int32 field_C;
|
||||||
|
|
||||||
} SoundItem;
|
} SoundItem;
|
||||||
|
|
||||||
typedef struct FrameSoundItem {
|
typedef struct FrameSoundItem {
|
||||||
uint32 resId;
|
int32 resId;
|
||||||
uint32 frameIdx;
|
int32 frameIdx;
|
||||||
uint32 index;
|
int32 index;
|
||||||
uint32 field_C;
|
int32 field_C;
|
||||||
uint32 field_10;
|
int32 field_10;
|
||||||
uint32 field_14;
|
int32 field_14;
|
||||||
|
|
||||||
} FrameSoundItem;
|
} FrameSoundItem;
|
||||||
|
|
||||||
typedef struct AmbientSoundItem {
|
typedef struct AmbientSoundItem {
|
||||||
uint32 field_0;
|
int32 field_0;
|
||||||
uint32 flags;
|
int32 flags;
|
||||||
uint32 resId;
|
int32 resId;
|
||||||
uint32 field_C;
|
int32 field_C;
|
||||||
uint32 field_10;
|
int32 field_10;
|
||||||
uint32 field_14;
|
int32 field_14;
|
||||||
int flagNum[6];
|
int32 flagNum[6];
|
||||||
uint32 x;
|
int32 x;
|
||||||
uint32 y;
|
int32 y;
|
||||||
|
|
||||||
} AmbientSoundItem;
|
} AmbientSoundItem;
|
||||||
|
|
||||||
typedef struct SoundBufferItem {
|
typedef struct SoundBufferItem {
|
||||||
uint32 resId;
|
int32 resId;
|
||||||
Audio::SoundHandle handle;
|
Audio::SoundHandle handle;
|
||||||
uint32 unknown;
|
int32 unknown;
|
||||||
} SoundBufferItem;
|
} SoundBufferItem;
|
||||||
|
|
||||||
class Sound {
|
class Sound {
|
||||||
|
@ -74,8 +74,8 @@ public:
|
||||||
Sound(Audio::Mixer *mixer);
|
Sound(Audio::Mixer *mixer);
|
||||||
~Sound();
|
~Sound();
|
||||||
|
|
||||||
bool addToSoundBuffer(uint resId);
|
bool addToSoundBuffer(int32 resId);
|
||||||
void removeFromSoundBuffer(uint resId);
|
void removeFromSoundBuffer(int32 resId);
|
||||||
void clearSoundBuffer();
|
void clearSoundBuffer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,18 +83,18 @@ public:
|
||||||
*
|
*
|
||||||
* @param overwrite determine if _soundHandle should be overwritten if still active
|
* @param overwrite determine if _soundHandle should be overwritten if still active
|
||||||
*/
|
*/
|
||||||
void playSound(ResourcePack *pack, uint resId, int volume, bool looping = false, int panning = 0, bool overwrite = false);
|
void playSound(ResourcePack *pack, int32 resId, int32 volume, bool looping = false, int32 panning = 0, bool overwrite = false);
|
||||||
void playSound(ResourcePack *pack, uint resId, bool looping, int volume, int panning);
|
void playSound(ResourcePack *pack, int32 resId, bool looping, int32 volume, int32 panning);
|
||||||
void playSound(ResourceEntry *resource, bool looping, int volume, int panning);
|
void playSound(ResourceEntry *resource, bool looping, int32 volume, int32 panning);
|
||||||
void playSound(uint resId, bool looping, int volume, int panning, bool fromBuffer = false);
|
void playSound(int32 resId, bool looping, int32 volume, int32 panning, bool fromBuffer = false);
|
||||||
void stopSound(uint resId);
|
void stopSound(int32 resId);
|
||||||
void stopSound();
|
void stopSound();
|
||||||
void stopAllSounds(bool stopSpeechAndMusic = false);
|
void stopAllSounds(bool stopSpeechAndMusic = false);
|
||||||
|
|
||||||
void playSpeech(uint resId);
|
void playSpeech(int32 resId);
|
||||||
|
|
||||||
void playMusic(ResourcePack *pack, uint resId);
|
void playMusic(ResourcePack *pack, int32 resId);
|
||||||
void playMusic(uint resId);
|
void playMusic(int32 resId);
|
||||||
void stopMusic();
|
void stopMusic();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
* music or speech, as those resources aren't managed beyond simple
|
* music or speech, as those resources aren't managed beyond simple
|
||||||
* start/stop requests.
|
* start/stop requests.
|
||||||
*/
|
*/
|
||||||
bool isPlaying(uint resId);
|
bool isPlaying(int32 resId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the unmanaged sound handle is in use
|
* Check if the unmanaged sound handle is in use
|
||||||
|
@ -113,9 +113,7 @@ public:
|
||||||
* This is useful for checking the active state of a sound
|
* This is useful for checking the active state of a sound
|
||||||
* in a blowuppuzzle
|
* in a blowuppuzzle
|
||||||
*/
|
*/
|
||||||
bool isPlaying() {
|
bool isPlaying() { return _mixer->isSoundHandleActive(_soundHandle); }
|
||||||
return _mixer->isSoundHandleActive(_soundHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Audio::Mixer *_mixer;
|
Audio::Mixer *_mixer;
|
||||||
|
@ -135,14 +133,14 @@ private:
|
||||||
* to track it uniquely, as this doesn't involve initializing the
|
* to track it uniquely, as this doesn't involve initializing the
|
||||||
* scene just to set a single variable
|
* scene just to set a single variable
|
||||||
*/
|
*/
|
||||||
int _currentMusicResIndex;
|
int32 _currentMusicResIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the index within the _soundBuffer array of the
|
* Find the index within the _soundBuffer array of the
|
||||||
* sound sample with provided id.
|
* sound sample with provided id.
|
||||||
*/
|
*/
|
||||||
int getBufferPosition(uint32 resId);
|
int32 getBufferPosition(int32 resId);
|
||||||
void playSoundData(Audio::SoundHandle *handle, byte *soundData, uint32 soundDataLength, bool loop = false, int vol = 0, int pan = 0);
|
void playSoundData(Audio::SoundHandle *handle, byte *soundData, int32 soundDataLength, bool loop = false, int32 vol = 0, int32 pan = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
|
@ -40,13 +40,13 @@ Speech::~Speech() {
|
||||||
// TODO Auto-generated destructor stub
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Speech::play(uint32 speechIdx) {
|
int32 Speech::play(int32 speechIdx) {
|
||||||
uint32 soundResIdx = 0;
|
int32 soundResIdx = 0;
|
||||||
|
|
||||||
switch (_scene->worldstats()->actorType) {
|
switch (_scene->worldstats()->actorType) {
|
||||||
case kMax: {
|
case kMax: {
|
||||||
uint32 soundResIdx2 = speechIdx;
|
int32 soundResIdx2 = speechIdx;
|
||||||
uint32 textResIdx = speechIdx;
|
int32 textResIdx = speechIdx;
|
||||||
|
|
||||||
if (speechIdx >= 259) {
|
if (speechIdx >= 259) {
|
||||||
soundResIdx2 -= 9;
|
soundResIdx2 -= 9;
|
||||||
|
@ -82,7 +82,7 @@ uint32 Speech::play(uint32 speechIdx) {
|
||||||
return soundResIdx;
|
return soundResIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Speech::setPlayerSpeech(uint32 soundResIdx, uint32 textResIdx) {
|
void Speech::setPlayerSpeech(int32 soundResIdx, int32 textResIdx) {
|
||||||
if (soundResIdx) {
|
if (soundResIdx) {
|
||||||
if (_scene->vm()->sound()->isPlaying(soundResIdx)) {
|
if (_scene->vm()->sound()->isPlaying(soundResIdx)) {
|
||||||
_scene->vm()->sound()->stopSound(soundResIdx);
|
_scene->vm()->sound()->stopSound(soundResIdx);
|
||||||
|
@ -96,7 +96,7 @@ void Speech::setPlayerSpeech(uint32 soundResIdx, uint32 textResIdx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Speech::prepareSpeech() {
|
void Speech::prepareSpeech() {
|
||||||
uint32 startTick = _scene->vm()->getTick();
|
//int32 startTick = _scene->vm()->getTick();
|
||||||
|
|
||||||
if (_soundResIdx) {
|
if (_soundResIdx) {
|
||||||
if (!_scene->vm()->sound()->isPlaying(_soundResIdx)/* || _tick && startTick >= _tick*/) {
|
if (!_scene->vm()->sound()->isPlaying(_soundResIdx)/* || _tick && startTick >= _tick*/) {
|
||||||
|
@ -110,7 +110,7 @@ void Speech::prepareSpeech() {
|
||||||
|
|
||||||
check = pt->y < 240;
|
check = pt->y < 240;
|
||||||
check = pt->y >= 240;*/
|
check = pt->y >= 240;*/
|
||||||
uint32 posY = ((check - 1) & 0x118) + 40;
|
int32 posY = ((check - 1) & 0x118) + 40;
|
||||||
|
|
||||||
_scene->vm()->text()->loadFont(_scene->getResourcePack(), _scene->worldstats()->commonRes.font3);
|
_scene->vm()->text()->loadFont(_scene->getResourcePack(), _scene->worldstats()->commonRes.font3);
|
||||||
_scene->vm()->text()->drawText(20, posY, _textDataPos);
|
_scene->vm()->text()->drawText(20, posY, _textDataPos);
|
||||||
|
|
|
@ -36,22 +36,22 @@ public:
|
||||||
Speech(Scene *scene);
|
Speech(Scene *scene);
|
||||||
virtual ~Speech();
|
virtual ~Speech();
|
||||||
|
|
||||||
uint32 _soundResIdx;
|
int32 _soundResIdx;
|
||||||
uint32 _textResIdx;
|
int32 _textResIdx;
|
||||||
|
|
||||||
/** .text:00414810
|
/** .text:00414810
|
||||||
* Play player speech
|
* Play player speech
|
||||||
* @param speechIdx speech index (used for sound and text resources)
|
* @param speechIdx speech index (used for sound and text resources)
|
||||||
* @return correct resourceId
|
* @return correct resourceId
|
||||||
*/
|
*/
|
||||||
uint32 play(uint32 speechIdx);
|
int32 play(int32 speechIdx);
|
||||||
|
|
||||||
/** .text:004146D0
|
/** .text:004146D0
|
||||||
* Set speech for different player type
|
* Set speech for different player type
|
||||||
* @param soundResIdx sound resource id
|
* @param soundResIdx sound resource id
|
||||||
* @param textResIdx text resource id
|
* @param textResIdx text resource id
|
||||||
*/
|
*/
|
||||||
void setPlayerSpeech(uint32 soundResIdx, uint32 textResIdx);
|
void setPlayerSpeech(int32 soundResIdx, int32 textResIdx);
|
||||||
|
|
||||||
/** .text:004144C0
|
/** .text:004144C0
|
||||||
* Prepare speech to play
|
* Prepare speech to play
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
private:
|
private:
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
|
|
||||||
uint32 _tick;
|
int32 _tick;
|
||||||
|
|
||||||
char * _textData;
|
char * _textData;
|
||||||
char * _textDataPos;
|
char * _textDataPos;
|
||||||
|
@ -71,7 +71,7 @@ private:
|
||||||
void processSpeech();
|
void processSpeech();
|
||||||
|
|
||||||
// This function was cutoff since it doesn't make any sence using it. Its here for address information only
|
// This function was cutoff since it doesn't make any sence using it. Its here for address information only
|
||||||
/** .text:00414630 void playSpeech(uint32 textResIdx, uint32 fontResIdx); */
|
/** .text:00414630 void playSpeech(int32 textResIdx, int32 fontResIdx); */
|
||||||
|
|
||||||
}; // end of class Speech
|
}; // end of class Speech
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ Text::~Text() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadFont at address 00435640
|
// loadFont at address 00435640
|
||||||
void Text::loadFont(ResourcePack *resPack, uint32 resId) {
|
void Text::loadFont(ResourcePack *resPack, int32 resId) {
|
||||||
if (_fontResource && resId == _fontResource->getEntryNum())
|
if (_fontResource && resId == _fontResource->getEntryNum())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -57,16 +57,16 @@ void Text::loadFont(ResourcePack *resPack, uint32 resId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::setTextPos(uint32 x, uint32 y) {
|
void Text::setTextPos(int32 x, int32 y) {
|
||||||
_posX = x;
|
_posX = x;
|
||||||
_posY = y;
|
_posY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getTextWidth at address 004357C0
|
// getTextWidth at address 004357C0
|
||||||
uint32 Text::getTextWidth(char *text) {
|
int32 Text::getTextWidth(const char *text) {
|
||||||
assert(_fontResource);
|
assert(_fontResource);
|
||||||
|
|
||||||
int width = 0;
|
int32 width = 0;
|
||||||
uint8 character = *text;
|
uint8 character = *text;
|
||||||
while (character) {
|
while (character) {
|
||||||
GraphicFrame *font = _fontResource->getFrame(character);
|
GraphicFrame *font = _fontResource->getFrame(character);
|
||||||
|
@ -78,12 +78,12 @@ uint32 Text::getTextWidth(char *text) {
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Text::getResTextWidth(uint32 resId) {
|
int32 Text::getResTextWidth(int32 resId) {
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
return getTextWidth((char*)textRes->data);
|
return getTextWidth((char*)textRes->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Text::getResText(uint32 resId) {
|
char* Text::getResText(int32 resId) {
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
return (char*)textRes->data;
|
return (char*)textRes->data;
|
||||||
}
|
}
|
||||||
|
@ -96,25 +96,25 @@ void Text::drawChar(char character) {
|
||||||
_posX += fontLetter->surface.w + fontLetter->x - _curFontFlags;
|
_posX += fontLetter->surface.w + fontLetter->x - _curFontFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawText(char *text) {
|
void Text::drawText(const char *text) {
|
||||||
while (*text) {
|
while (*text) {
|
||||||
drawChar(*text);
|
drawChar(*text);
|
||||||
text++;
|
text++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawResText(uint32 resId) {
|
void Text::drawResText(int32 resId) {
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
drawText((char*)textRes->data);
|
drawText((char*)textRes->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawTextCentered(uint32 x, uint32 y, uint32 width, char *text) {
|
void Text::drawTextCentered(int32 x, int32 y, int32 width, const char *text) {
|
||||||
int textWidth = getTextWidth(text);
|
int32 textWidth = getTextWidth(text);
|
||||||
setTextPos(x + (width - textWidth) / 2, y);
|
setTextPos(x + (width - textWidth) / 2, y);
|
||||||
drawText(text);
|
drawText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawResTextWithValueCentered(uint32 x, uint32 y, uint32 width, uint32 resId, uint32 value) {
|
void Text::drawResTextWithValueCentered(int32 x, int32 y, int32 width, int32 resId, int32 value) {
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
char *text = (char *)textRes->data;
|
char *text = (char *)textRes->data;
|
||||||
char txt[100];
|
char txt[100];
|
||||||
|
@ -122,31 +122,31 @@ void Text::drawResTextWithValueCentered(uint32 x, uint32 y, uint32 width, uint32
|
||||||
drawTextCentered(x, y, width, txt);
|
drawTextCentered(x, y, width, txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawResTextCentered(uint32 x, uint32 y, uint32 width, uint32 resId) {
|
void Text::drawResTextCentered(int32 x, int32 y, int32 width, int32 resId) {
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
drawTextCentered(x, y, width, (char *)textRes->data);
|
drawTextCentered(x, y, width, (char *)textRes->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawText(uint32 x, uint32 y, char *text) {
|
void Text::drawText(int32 x, int32 y, const char *text) {
|
||||||
if (text) {
|
if (text) {
|
||||||
int textWidth = getTextWidth(text);
|
int32 textWidth = getTextWidth(text);
|
||||||
setTextPos(x - textWidth, y);
|
setTextPos(x - textWidth, y);
|
||||||
drawText(text);
|
drawText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawResText(uint32 x, uint32 y, uint32 resId) {
|
void Text::drawResText(int32 x, int32 y, int32 resId) {
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
drawText(x, y, (char *)textRes->data);
|
drawText(x, y, (char *)textRes->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawTextAlignRight(uint32 x, uint32 y, char *text) {
|
void Text::drawTextAlignRight(int32 x, int32 y, const char *text) {
|
||||||
int textWidth = getTextWidth(text);
|
int32 textWidth = getTextWidth(text);
|
||||||
setTextPos(x - textWidth, y);
|
setTextPos(x - textWidth, y);
|
||||||
drawText(text);
|
drawText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::drawResTextAlignRight(uint32 x, uint32 y, uint32 resId) {
|
void Text::drawResTextAlignRight(int32 x, int32 y, int32 resId) {
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
drawTextAlignRight(x, y, (char *)textRes->data);
|
drawTextAlignRight(x, y, (char *)textRes->data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,33 +38,33 @@ public:
|
||||||
Text(Screen *screen);
|
Text(Screen *screen);
|
||||||
~Text();
|
~Text();
|
||||||
|
|
||||||
void loadFont(ResourcePack *resPack, uint32 resId);
|
void loadFont(ResourcePack *resPack, int32 resId);
|
||||||
|
|
||||||
void setTextPos(uint32 x, uint32 y);
|
void setTextPos(int32 x, int32 y);
|
||||||
uint32 getTextWidth(char *text);
|
int32 getTextWidth(const char *text);
|
||||||
uint32 getResTextWidth(uint32 resId);
|
int32 getResTextWidth(int32 resId);
|
||||||
char * getResText(uint32 resId);
|
char * getResText(int32 resId);
|
||||||
|
|
||||||
void drawChar(char character);
|
void drawChar(const char character);
|
||||||
void drawText(char *text);
|
void drawText(const char *text);
|
||||||
void drawText(uint32 x, uint32 y, char *text);
|
void drawText(int32 x, int32 y, const char *text);
|
||||||
void drawResText(uint32 resId);
|
void drawResText(int32 resId);
|
||||||
void drawResText(uint32 x, uint32 y, uint32 resId);
|
void drawResText(int32 x, int32 y, int32 resId);
|
||||||
|
|
||||||
void drawTextCentered(uint32 x, uint32 y, uint32 width, char *text);
|
void drawTextCentered(int32 x, int32 y, int32 width, const char *text);
|
||||||
void drawResTextCentered(uint32 x, uint32 y, uint32 width, uint32 resId);
|
void drawResTextCentered(int32 x, int32 y, int32 width, int32 resId);
|
||||||
void drawResTextWithValueCentered(uint32 x, uint32 y, uint32 width, uint32 resId, uint32 value);
|
void drawResTextWithValueCentered(int32 x, int32 y, int32 width, int32 resId, int32 value);
|
||||||
|
|
||||||
void drawTextAlignRight(uint32 x, uint32 y, char *text);
|
void drawTextAlignRight(int32 x, int32 y, const char *text);
|
||||||
void drawResTextAlignRight(uint32 x, uint32 y, uint32 resId);
|
void drawResTextAlignRight(int32 x, int32 y, int32 resId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Screen *_screen;
|
Screen *_screen;
|
||||||
GraphicResource *_fontResource;
|
GraphicResource *_fontResource;
|
||||||
ResourcePack *_textPack;
|
ResourcePack *_textPack;
|
||||||
|
|
||||||
uint32 _posX;
|
int32 _posX;
|
||||||
uint32 _posY;
|
int32 _posY;
|
||||||
uint8 _curFontFlags;
|
uint8 _curFontFlags;
|
||||||
|
|
||||||
}; // end of class Text
|
}; // end of class Text
|
||||||
|
|
|
@ -39,7 +39,7 @@ VideoPlayer::~VideoPlayer() {
|
||||||
delete _text;
|
delete _text;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoPlayer::playVideoWithSubtitles(Common::List<Common::Event> &stopEvents, int videoNumber) {
|
bool VideoPlayer::playVideoWithSubtitles(Common::List<Common::Event> &stopEvents, int32 videoNumber) {
|
||||||
// Read vids.cap
|
// Read vids.cap
|
||||||
char movieToken[10];
|
char movieToken[10];
|
||||||
sprintf(movieToken, "[MOV%03d]", videoNumber);
|
sprintf(movieToken, "[MOV%03d]", videoNumber);
|
||||||
|
@ -59,7 +59,7 @@ bool VideoPlayer::playVideoWithSubtitles(Common::List<Common::Event> &stopEvents
|
||||||
// -1 means that the video has no subtitles, -2 that it doesn't exist
|
// -1 means that the video has no subtitles, -2 that it doesn't exist
|
||||||
// The negative values aren't used in the code, they just make the table easier to
|
// The negative values aren't used in the code, they just make the table easier to
|
||||||
// understand.
|
// understand.
|
||||||
int textRes[49] = { -1, 1088, 1279, 1122, 1286, 1132, 1133, 1134, 1135, 1136, // 0 - 9
|
int32 textRes[49] = { -1, 1088, 1279, 1122, 1286, 1132, 1133, 1134, 1135, 1136, // 0 - 9
|
||||||
-1, -2, 1140, 1141, -2, -1, 1142, -1, -2, 1155, // 10 - 19
|
-1, -2, 1140, 1141, -2, -1, 1142, -1, -2, 1155, // 10 - 19
|
||||||
1157, 1159, 1162, 1164, -2, 1171, 1177, 1184, 1190, 1201, // 20 - 29
|
1157, 1159, 1162, 1164, -2, 1171, 1177, 1184, 1190, 1201, // 20 - 29
|
||||||
-2, -2, -2, 1207, 1213, 1217, 1223, 1227, -2, 1228, // 30 - 39
|
-2, -2, -2, 1207, 1213, 1217, 1223, 1227, -2, 1228, // 30 - 39
|
||||||
|
@ -69,7 +69,7 @@ bool VideoPlayer::playVideoWithSubtitles(Common::List<Common::Event> &stopEvents
|
||||||
if (start) {
|
if (start) {
|
||||||
start += 20; // skip token, newline and "CAPTION = "
|
start += 20; // skip token, newline and "CAPTION = "
|
||||||
|
|
||||||
int count = strcspn(start, "\r\n");
|
int32 count = strcspn(start, "\r\n");
|
||||||
line = new char[count + 1];
|
line = new char[count + 1];
|
||||||
|
|
||||||
strncpy(line, start, count);
|
strncpy(line, start, count);
|
||||||
|
@ -98,7 +98,7 @@ bool VideoPlayer::playVideoWithSubtitles(Common::List<Common::Event> &stopEvents
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoPlayer::performPostProcessing(byte *screen) {
|
void VideoPlayer::performPostProcessing(byte *screen) {
|
||||||
int curFrame = _decoder->getCurFrame();
|
int32 curFrame = _decoder->getCurFrame();
|
||||||
|
|
||||||
// Reset subtitle area, by filling it with zeroes
|
// Reset subtitle area, by filling it with zeroes
|
||||||
memset(screen + 640 * 400, 0, 640 * 80);
|
memset(screen + 640 * 400, 0, 640 * 80);
|
||||||
|
@ -130,7 +130,7 @@ Video::~Video() {
|
||||||
delete _smkDecoder;
|
delete _smkDecoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Video::playVideo(int number, VideoSubtitles subtitles) {
|
bool Video::playVideo(int32 number, VideoSubtitles subtitles) {
|
||||||
bool lastMouseState = false;
|
bool lastMouseState = false;
|
||||||
char filename[20];
|
char filename[20];
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ VideoText::~VideoText() {
|
||||||
delete _fontResource;
|
delete _fontResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoText::loadFont(ResourcePack *resPack, uint32 resId) {
|
void VideoText::loadFont(ResourcePack *resPack, int32 resId) {
|
||||||
delete _fontResource;
|
delete _fontResource;
|
||||||
|
|
||||||
_fontResource = new GraphicResource(resPack, resId);
|
_fontResource = new GraphicResource(resPack, resId);
|
||||||
|
@ -174,15 +174,15 @@ void VideoText::loadFont(ResourcePack *resPack, uint32 resId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoText::drawMovieSubtitle(byte *screenBuffer, uint32 resId) {
|
void VideoText::drawMovieSubtitle(byte *screenBuffer, int32 resId) {
|
||||||
Common::String textLine[4];
|
Common::String textLine[4];
|
||||||
Common::String tmpLine;
|
Common::String tmpLine;
|
||||||
int curLine = 0;
|
int32 curLine = 0;
|
||||||
ResourceEntry *textRes = _textPack->getResource(resId);
|
ResourceEntry *textRes = _textPack->getResource(resId);
|
||||||
char *text = strdup((const char *)textRes->data); // for strtok
|
char *text = strdup((const char *)textRes->data); // for strtok
|
||||||
char *tok = strtok(text, " ");
|
char *tok = strtok(text, " ");
|
||||||
int startY = 420; // starting y for up to 2 subtitles
|
int32 startY = 420; // starting y for up to 2 subtitles
|
||||||
int spacing = 30; // spacing for up to 2 subtitles
|
int32 spacing = 30; // spacing for up to 2 subtitles
|
||||||
|
|
||||||
// Videos can have up to 4 lines of text
|
// Videos can have up to 4 lines of text
|
||||||
while (tok) {
|
while (tok) {
|
||||||
|
@ -204,18 +204,18 @@ void VideoText::drawMovieSubtitle(byte *screenBuffer, uint32 resId) {
|
||||||
tok = strtok(NULL, " ");
|
tok = strtok(NULL, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < curLine + 1; i++) {
|
for (int32 i = 0; i < curLine + 1; i++) {
|
||||||
int textWidth = getTextWidth(textLine[i].c_str());
|
int32 textWidth = getTextWidth(textLine[i].c_str());
|
||||||
drawText(screenBuffer, 0 + (640 - textWidth) / 2, startY + i * spacing, textLine[i].c_str());
|
drawText(screenBuffer, 0 + (640 - textWidth) / 2, startY + i * spacing, textLine[i].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
free(text);
|
free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 VideoText::getTextWidth(const char *text) {
|
int32 VideoText::getTextWidth(const char *text) {
|
||||||
assert(_fontResource);
|
assert(_fontResource);
|
||||||
|
|
||||||
int width = 0;
|
int32 width = 0;
|
||||||
uint8 character = *text;
|
uint8 character = *text;
|
||||||
const char *curChar = text;
|
const char *curChar = text;
|
||||||
while (character) {
|
while (character) {
|
||||||
|
@ -228,10 +228,10 @@ uint32 VideoText::getTextWidth(const char *text) {
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoText::drawText(byte *screenBuffer, int x, int y, const char *text) {
|
void VideoText::drawText(byte *screenBuffer, int16 x, int16 y, const char *text) {
|
||||||
assert(_fontResource);
|
assert(_fontResource);
|
||||||
const byte *curChar = (byte *)text;
|
const byte *curChar = (byte *)text;
|
||||||
int curX = x;
|
int16 curX = x;
|
||||||
|
|
||||||
while (*curChar) {
|
while (*curChar) {
|
||||||
GraphicFrame *fontLetter = _fontResource->getFrame(*curChar);
|
GraphicFrame *fontLetter = _fontResource->getFrame(*curChar);
|
||||||
|
@ -241,10 +241,10 @@ void VideoText::drawText(byte *screenBuffer, int x, int y, const char *text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoText::copyToVideoFrame(byte *screenBuffer, GraphicFrame *frame, int x, int y) {
|
void VideoText::copyToVideoFrame(byte *screenBuffer, GraphicFrame *frame, int32 x, int32 y) {
|
||||||
int h = frame->surface.h;
|
uint16 h = frame->surface.h;
|
||||||
int w = frame->surface.w;
|
uint16 w = frame->surface.w;
|
||||||
int screenBufferPitch = 640;
|
int32 screenBufferPitch = 640;
|
||||||
byte *buffer = (byte *)frame->surface.pixels;
|
byte *buffer = (byte *)frame->surface.pixels;
|
||||||
byte *dest = screenBuffer + y * screenBufferPitch + x;
|
byte *dest = screenBuffer + y * screenBufferPitch + x;
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,13 @@ public:
|
||||||
VideoText();
|
VideoText();
|
||||||
~VideoText();
|
~VideoText();
|
||||||
|
|
||||||
void loadFont(ResourcePack *resPack, uint32 resId);
|
void loadFont(ResourcePack *resPack, int32 resId);
|
||||||
void drawMovieSubtitle(byte *screenBuffer, uint32 resId);
|
void drawMovieSubtitle(byte *screenBuffer, int32 resId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 getTextWidth(const char *text);
|
int32 getTextWidth(const char *text);
|
||||||
|
|
||||||
void drawText(byte *screenBuffer, int x, int y, const char *text);
|
void drawText(byte *screenBuffer, int16 x, int16 y, const char *text);
|
||||||
void copyToVideoFrame(byte *screenBuffer, GraphicFrame *frame, int x, int y);
|
void copyToVideoFrame(byte *screenBuffer, GraphicFrame *frame, int x, int y);
|
||||||
|
|
||||||
GraphicResource *_fontResource;
|
GraphicResource *_fontResource;
|
||||||
|
|
|
@ -38,8 +38,8 @@ WorldStats::~WorldStats() {
|
||||||
actions.clear();
|
actions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int WorldStats::getActionAreaIndexById(uint32 id) {
|
int32 WorldStats::getActionAreaIndexById(int32 id) {
|
||||||
for (uint32 i = 0; i < numActions; i++) {
|
for (int32 i = 0; i < numActions; i++) {
|
||||||
if (actions[i].id == id)
|
if (actions[i].id == id)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,12 @@ int WorldStats::getActionAreaIndexById(uint32 id) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionArea* WorldStats::getActionAreaById(uint32 id) {
|
ActionArea* WorldStats::getActionAreaById(int32 id) {
|
||||||
return &actions[getActionAreaIndexById(id)];
|
return &actions[getActionAreaIndexById(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
int WorldStats::getBarrierIndexById(uint32 id) {
|
int32 WorldStats::getBarrierIndexById(int32 id) {
|
||||||
for (uint32 i = 0; i < numBarriers; i++) {
|
for (int32 i = 0; i < numBarriers; i++) {
|
||||||
if (barriers[i].id == id)
|
if (barriers[i].id == id)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -60,15 +60,15 @@ int WorldStats::getBarrierIndexById(uint32 id) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Barrier* WorldStats::getBarrierById(uint32 id) {
|
Barrier* WorldStats::getBarrierById(int32 id) {
|
||||||
return &barriers[getBarrierIndexById(id)];
|
return &barriers[getBarrierIndexById(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
Barrier* WorldStats::getBarrierByIndex(uint32 idx) {
|
Barrier* WorldStats::getBarrierByIndex(int32 idx) {
|
||||||
return &barriers[idx];
|
return &barriers[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorldStats::isBarrierOnScreen(uint32 idx) {
|
bool WorldStats::isBarrierOnScreen(int32 idx) {
|
||||||
Barrier *b = getBarrierByIndex(idx);
|
Barrier *b = getBarrierByIndex(idx);
|
||||||
|
|
||||||
Common::Rect screenRect = Common::Rect(xLeft, yTop, xLeft + 640, yTop + 480);
|
Common::Rect screenRect = Common::Rect(xLeft, yTop, xLeft + 640, yTop + 480);
|
||||||
|
@ -77,13 +77,13 @@ bool WorldStats::isBarrierOnScreen(uint32 idx) {
|
||||||
return isBarrierVisible(idx) && (b->flags & 1) && screenRect.intersects(barrierRect);
|
return isBarrierVisible(idx) && (b->flags & 1) && screenRect.intersects(barrierRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorldStats::isBarrierVisible(uint32 idx) {
|
bool WorldStats::isBarrierVisible(int32 idx) {
|
||||||
Barrier *b = getBarrierByIndex(idx);
|
Barrier *b = getBarrierByIndex(idx);
|
||||||
|
|
||||||
if ((b->flags & 0xFF) & 1) {
|
if ((b->flags & 0xFF) & 1) {
|
||||||
for (int f = 0; f < 10; f++) {
|
for (int32 f = 0; f < 10; f++) {
|
||||||
bool isSet = false;
|
bool isSet = false;
|
||||||
uint32 flag = b->gameFlags[f];
|
int32 flag = b->gameFlags[f];
|
||||||
|
|
||||||
if (flag <= 0)
|
if (flag <= 0)
|
||||||
isSet = _scene->vm()->isGameFlagNotSet(flag); // -flag
|
isSet = _scene->vm()->isGameFlagNotSet(flag); // -flag
|
||||||
|
@ -98,12 +98,12 @@ bool WorldStats::isBarrierVisible(uint32 idx) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorldStats::checkBarrierFlagsCondition(uint32 idx) {
|
bool WorldStats::checkBarrierFlagsCondition(int32 idx) {
|
||||||
Barrier *b = getBarrierByIndex(idx);
|
Barrier *b = getBarrierByIndex(idx);
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
if (LOBYTE(b->flags) & 1) {
|
if (LOBYTE(b->flags) & 1) {
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int32 i = 0; i < 10; i++) {
|
||||||
result = _scene->vm()->isGameFlagSet(b->gameFlags[i]);
|
result = _scene->vm()->isGameFlagSet(b->gameFlags[i]);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
@ -118,177 +118,177 @@ bool WorldStats::checkBarrierFlagsCondition(uint32 idx) {
|
||||||
|
|
||||||
// FIXME: load necessary World Stats content
|
// FIXME: load necessary World Stats content
|
||||||
void WorldStats::load(Common::SeekableReadStream *stream) {
|
void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
size = stream->readUint32LE();
|
size = stream->readSint32LE();
|
||||||
numEntries = stream->readUint32LE();
|
numEntries = stream->readSint32LE();
|
||||||
|
|
||||||
numChapter = stream->readSint32LE();
|
numChapter = stream->readSint32LE();
|
||||||
xLeft = stream->readUint32LE();
|
xLeft = stream->readSint32LE();
|
||||||
yTop = stream->readUint32LE();
|
yTop = stream->readSint32LE();
|
||||||
|
|
||||||
boundingRect.left = stream->readUint32LE() & 0xFFFF;
|
boundingRect.left = stream->readSint32LE() & 0xFFFF;
|
||||||
boundingRect.top = stream->readUint32LE() & 0xFFFF;
|
boundingRect.top = stream->readSint32LE() & 0xFFFF;
|
||||||
boundingRect.right = stream->readUint32LE() & 0xFFFF;
|
boundingRect.right = stream->readSint32LE() & 0xFFFF;
|
||||||
boundingRect.bottom = stream->readUint32LE() & 0xFFFF;
|
boundingRect.bottom = stream->readSint32LE() & 0xFFFF;
|
||||||
|
|
||||||
// read common graphic resources
|
// read common graphic resources
|
||||||
commonRes.backgroundImage = stream->readUint32LE();
|
commonRes.backgroundImage = stream->readSint32LE();
|
||||||
commonRes.curScrollUp = stream->readUint32LE();
|
commonRes.curScrollUp = stream->readSint32LE();
|
||||||
commonRes.curScrollUpLeft = stream->readUint32LE();
|
commonRes.curScrollUpLeft = stream->readSint32LE();
|
||||||
commonRes.curScrollLeft = stream->readUint32LE();
|
commonRes.curScrollLeft = stream->readSint32LE();
|
||||||
commonRes.curScrollDownLeft = stream->readUint32LE();
|
commonRes.curScrollDownLeft = stream->readSint32LE();
|
||||||
commonRes.curScrollDown = stream->readUint32LE();
|
commonRes.curScrollDown = stream->readSint32LE();
|
||||||
commonRes.curScrollDownRight = stream->readUint32LE();
|
commonRes.curScrollDownRight = stream->readSint32LE();
|
||||||
commonRes.curScrollRight = stream->readUint32LE();
|
commonRes.curScrollRight = stream->readSint32LE();
|
||||||
commonRes.curScrollUpRight = stream->readUint32LE();
|
commonRes.curScrollUpRight = stream->readSint32LE();
|
||||||
commonRes.curHand = stream->readUint32LE();
|
commonRes.curHand = stream->readSint32LE();
|
||||||
commonRes.curMagnifyingGlass = stream->readUint32LE();
|
commonRes.curMagnifyingGlass = stream->readSint32LE();
|
||||||
commonRes.curTalkNCP = stream->readUint32LE();
|
commonRes.curTalkNCP = stream->readSint32LE();
|
||||||
commonRes.curGrabPointer = stream->readUint32LE();
|
commonRes.curGrabPointer = stream->readSint32LE();
|
||||||
commonRes.curTalkNCP2 = stream->readUint32LE();
|
commonRes.curTalkNCP2 = stream->readSint32LE();
|
||||||
commonRes.font1 = stream->readUint32LE();
|
commonRes.font1 = stream->readSint32LE();
|
||||||
commonRes.font2 = stream->readUint32LE();
|
commonRes.font2 = stream->readSint32LE();
|
||||||
commonRes.font3 = stream->readUint32LE();
|
commonRes.font3 = stream->readSint32LE();
|
||||||
commonRes.palette = stream->readUint32LE();
|
commonRes.palette = stream->readSint32LE();
|
||||||
commonRes.cellShadeMask1 = stream->readUint32LE();
|
commonRes.cellShadeMask1 = stream->readSint32LE();
|
||||||
commonRes.cellShadeMask2 = stream->readUint32LE();
|
commonRes.cellShadeMask2 = stream->readSint32LE();
|
||||||
commonRes.cellShadeMask3 = stream->readUint32LE();
|
commonRes.cellShadeMask3 = stream->readSint32LE();
|
||||||
commonRes.unused = stream->readUint32LE();
|
commonRes.unused = stream->readSint32LE();
|
||||||
commonRes.smallCurUp = stream->readUint32LE();
|
commonRes.smallCurUp = stream->readSint32LE();
|
||||||
commonRes.smallCurDown = stream->readUint32LE();
|
commonRes.smallCurDown = stream->readSint32LE();
|
||||||
commonRes.encounterFrameBg = stream->readUint32LE();
|
commonRes.encounterFrameBg = stream->readSint32LE();
|
||||||
|
|
||||||
width = stream->readUint32LE();
|
width = stream->readSint32LE();
|
||||||
height = stream->readUint32LE();
|
height = stream->readSint32LE();
|
||||||
motionStatus = stream->readUint32LE();
|
motionStatus = stream->readSint32LE();
|
||||||
field_8C = stream->readUint32LE();
|
field_8C = stream->readSint32LE();
|
||||||
numActions = stream->readUint32LE();
|
numActions = stream->readSint32LE();
|
||||||
numBarriers = stream->readUint32LE();
|
numBarriers = stream->readSint32LE();
|
||||||
targetX = stream->readUint32LE();
|
targetX = stream->readSint32LE();
|
||||||
targetY = stream->readUint32LE();
|
targetY = stream->readSint32LE();
|
||||||
field_A0 = stream->readUint32LE();
|
field_A0 = stream->readSint32LE();
|
||||||
field_A4 = stream->readUint32LE();
|
field_A4 = stream->readSint32LE();
|
||||||
field_A8 = stream->readUint32LE();
|
field_A8 = stream->readSint32LE();
|
||||||
field_AC = stream->readUint32LE();
|
field_AC = stream->readSint32LE();
|
||||||
field_B0 = stream->readUint32LE();
|
field_B0 = stream->readSint32LE();
|
||||||
numActors = stream->readUint32LE();
|
numActors = stream->readSint32LE();
|
||||||
|
|
||||||
stereoReversedFlag = stream->readUint32LE();
|
stereoReversedFlag = stream->readSint32LE();
|
||||||
|
|
||||||
for (int r = 0; r < 6; r++) {
|
for (int32 r = 0; r < 6; r++) {
|
||||||
sceneRects[r].left = stream->readUint32LE() & 0xFFFF;
|
sceneRects[r].left = stream->readSint32LE() & 0xFFFF;
|
||||||
sceneRects[r].top = stream->readUint32LE() & 0xFFFF;
|
sceneRects[r].top = stream->readSint32LE() & 0xFFFF;
|
||||||
sceneRects[r].right = stream->readUint32LE() & 0xFFFF;
|
sceneRects[r].right = stream->readSint32LE() & 0xFFFF;
|
||||||
sceneRects[r].bottom = stream->readUint32LE() & 0xFFFF;
|
sceneRects[r].bottom = stream->readSint32LE() & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
sceneRectIdx = stream->readByte();
|
sceneRectIdx = stream->readByte();
|
||||||
field_11D[0] = stream->readByte();
|
field_11D[0] = stream->readByte();
|
||||||
field_11D[1] = stream->readByte();
|
field_11D[1] = stream->readByte();
|
||||||
field_11D[2] = stream->readByte();
|
field_11D[2] = stream->readByte();
|
||||||
field_120 = stream->readUint32LE();
|
field_120 = stream->readSint32LE();
|
||||||
actionListIdx = stream->readUint32LE();
|
actionListIdx = stream->readSint32LE();
|
||||||
|
|
||||||
for (int gr = 0; gr < 100; gr++)
|
for (int32 gr = 0; gr < 100; gr++)
|
||||||
grResId[gr] = stream->readUint32LE();
|
grResId[gr] = stream->readSint32LE();
|
||||||
|
|
||||||
sceneTitleGrResId = stream->readUint32LE();
|
sceneTitleGrResId = stream->readSint32LE();
|
||||||
sceneTitlePalResId = stream->readUint32LE();
|
sceneTitlePalResId = stream->readSint32LE();
|
||||||
actorType = stream->readUint32LE();
|
actorType = stream->readSint32LE();
|
||||||
|
|
||||||
for (int s = 0; s < 50; s++)
|
for (int32 s = 0; s < 50; s++)
|
||||||
soundResId[s] = stream->readUint32LE();
|
soundResId[s] = stream->readSint32LE();
|
||||||
|
|
||||||
for (int s = 0; s < 15; s++) {
|
for (int32 s = 0; s < 15; s++) {
|
||||||
ambientSounds[s].field_0 = stream->readUint32LE();
|
ambientSounds[s].field_0 = stream->readSint32LE();
|
||||||
ambientSounds[s].flags = stream->readUint32LE();
|
ambientSounds[s].flags = stream->readSint32LE();
|
||||||
ambientSounds[s].resId = stream->readUint32LE();
|
ambientSounds[s].resId = stream->readSint32LE();
|
||||||
ambientSounds[s].field_C = stream->readUint32LE();
|
ambientSounds[s].field_C = stream->readSint32LE();
|
||||||
ambientSounds[s].field_10 = stream->readUint32LE();
|
ambientSounds[s].field_10 = stream->readSint32LE();
|
||||||
ambientSounds[s].field_14 = stream->readUint32LE();
|
ambientSounds[s].field_14 = stream->readSint32LE();
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int32 i = 0; i < 6; i++)
|
||||||
ambientSounds[s].flagNum[i] = stream->readUint32LE();
|
ambientSounds[s].flagNum[i] = stream->readSint32LE();
|
||||||
|
|
||||||
ambientSounds[s].x = stream->readUint32LE();
|
ambientSounds[s].x = stream->readSint32LE();
|
||||||
ambientSounds[s].y = stream->readUint32LE();
|
ambientSounds[s].y = stream->readSint32LE();
|
||||||
}
|
}
|
||||||
|
|
||||||
numAmbientSound = stream->readUint32LE();
|
numAmbientSound = stream->readSint32LE();
|
||||||
musicStatus = stream->readUint32LE();
|
musicStatus = stream->readSint32LE();
|
||||||
musicCurrentResId = stream->readSint32LE();
|
musicCurrentResId = stream->readSint32LE();
|
||||||
musicFlag = stream->readUint32LE();
|
musicFlag = stream->readSint32LE();
|
||||||
musicResId = stream->readSint32LE();
|
musicResId = stream->readSint32LE();
|
||||||
musicStatusExt = stream->readUint32LE();
|
musicStatusExt = stream->readSint32LE();
|
||||||
|
|
||||||
for (uint32 a = 0; a < numBarriers; a++) {
|
for (int32 a = 0; a < numBarriers; a++) {
|
||||||
int i;
|
int32 i;
|
||||||
Barrier barrier;
|
Barrier barrier;
|
||||||
|
|
||||||
barrier.id = stream->readUint32LE();
|
barrier.id = stream->readSint32LE();
|
||||||
barrier.resId = stream->readUint32LE();
|
barrier.resId = stream->readSint32LE();
|
||||||
barrier.x = stream->readUint32LE();
|
barrier.x = stream->readSint32LE();
|
||||||
barrier.y = stream->readUint32LE();
|
barrier.y = stream->readSint32LE();
|
||||||
|
|
||||||
barrier.boundingRect.left = stream->readUint32LE() & 0xFFFF;
|
barrier.boundingRect.left = stream->readSint32LE() & 0xFFFF;
|
||||||
barrier.boundingRect.top = stream->readUint32LE() & 0xFFFF;
|
barrier.boundingRect.top = stream->readSint32LE() & 0xFFFF;
|
||||||
barrier.boundingRect.right = stream->readUint32LE() & 0xFFFF;
|
barrier.boundingRect.right = stream->readSint32LE() & 0xFFFF;
|
||||||
barrier.boundingRect.bottom = stream->readUint32LE() & 0xFFFF;
|
barrier.boundingRect.bottom = stream->readSint32LE() & 0xFFFF;
|
||||||
|
|
||||||
barrier.field_20 = stream->readUint32LE();
|
barrier.field_20 = stream->readSint32LE();
|
||||||
barrier.frameIdx = stream->readUint32LE();
|
barrier.frameIdx = stream->readSint32LE();
|
||||||
barrier.frameCount = stream->readUint32LE();
|
barrier.frameCount = stream->readSint32LE();
|
||||||
barrier.field_2C = stream->readUint32LE();
|
barrier.field_2C = stream->readSint32LE();
|
||||||
barrier.field_30 = stream->readUint32LE();
|
barrier.field_30 = stream->readSint32LE();
|
||||||
barrier.field_34 = stream->readUint32LE();
|
barrier.field_34 = stream->readSint32LE();
|
||||||
barrier.flags = stream->readUint32LE();
|
barrier.flags = stream->readSint32LE();
|
||||||
barrier.field_3C = stream->readUint32LE();
|
barrier.field_3C = stream->readSint32LE();
|
||||||
|
|
||||||
stream->read(barrier.name, sizeof(barrier.name));
|
stream->read(barrier.name, sizeof(barrier.name));
|
||||||
|
|
||||||
barrier.field_74 = stream->readUint32LE();
|
barrier.field_74 = stream->readSint32LE();
|
||||||
barrier.field_78 = stream->readUint32LE();
|
barrier.field_78 = stream->readSint32LE();
|
||||||
barrier.field_7C = stream->readUint32LE();
|
barrier.field_7C = stream->readSint32LE();
|
||||||
barrier.field_80 = stream->readUint32LE();
|
barrier.field_80 = stream->readSint32LE();
|
||||||
barrier.polyIdx = stream->readUint32LE();
|
barrier.polyIdx = stream->readSint32LE();
|
||||||
barrier.flags2 = stream->readUint32LE();
|
barrier.flags2 = stream->readSint32LE();
|
||||||
|
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
barrier.gameFlags[i] = stream->readUint32LE();
|
barrier.gameFlags[i] = stream->readSint32LE();
|
||||||
|
|
||||||
barrier.field_B4 = stream->readUint32LE();
|
barrier.field_B4 = stream->readSint32LE();
|
||||||
barrier.tickCount = stream->readUint32LE();
|
barrier.tickCount = stream->readSint32LE();
|
||||||
barrier.tickCount2 = stream->readUint32LE();
|
barrier.tickCount2 = stream->readSint32LE();
|
||||||
barrier.field_C0 = stream->readUint32LE();
|
barrier.field_C0 = stream->readSint32LE();
|
||||||
barrier.priority = stream->readUint32LE();
|
barrier.priority = stream->readSint32LE();
|
||||||
barrier.actionListIdx = stream->readUint32LE();
|
barrier.actionListIdx = stream->readSint32LE();
|
||||||
|
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
barrier.soundItems[i].resId = stream->readUint32LE();
|
barrier.soundItems[i].resId = stream->readSint32LE();
|
||||||
barrier.soundItems[i].field_4 = stream->readUint32LE();
|
barrier.soundItems[i].field_4 = stream->readSint32LE();
|
||||||
barrier.soundItems[i].field_8 = stream->readUint32LE();
|
barrier.soundItems[i].field_8 = stream->readSint32LE();
|
||||||
barrier.soundItems[i].field_C = stream->readUint32LE();
|
barrier.soundItems[i].field_C = stream->readSint32LE();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 50; i++) {
|
for (i = 0; i < 50; i++) {
|
||||||
barrier.frameSoundItems[i].resId = stream->readUint32LE();
|
barrier.frameSoundItems[i].resId = stream->readSint32LE();
|
||||||
barrier.frameSoundItems[i].frameIdx = stream->readUint32LE();
|
barrier.frameSoundItems[i].frameIdx = stream->readSint32LE();
|
||||||
barrier.frameSoundItems[i].index = stream->readUint32LE();
|
barrier.frameSoundItems[i].index = stream->readSint32LE();
|
||||||
barrier.frameSoundItems[i].field_C = stream->readUint32LE();
|
barrier.frameSoundItems[i].field_C = stream->readSint32LE();
|
||||||
barrier.frameSoundItems[i].field_10 = stream->readUint32LE();
|
barrier.frameSoundItems[i].field_10 = stream->readSint32LE();
|
||||||
barrier.frameSoundItems[i].field_14 = stream->readUint32LE();
|
barrier.frameSoundItems[i].field_14 = stream->readSint32LE();
|
||||||
}
|
}
|
||||||
|
|
||||||
barrier.field_67C = stream->readUint32LE();
|
barrier.field_67C = stream->readSint32LE();
|
||||||
barrier.soundX = stream->readUint32LE();
|
barrier.soundX = stream->readSint32LE();
|
||||||
barrier.soundY = stream->readUint32LE();
|
barrier.soundY = stream->readSint32LE();
|
||||||
barrier.field_688 = stream->readUint32LE();
|
barrier.field_688 = stream->readSint32LE();
|
||||||
|
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
barrier.field_68C[i] = stream->readUint32LE();
|
barrier.field_68C[i] = stream->readSint32LE();
|
||||||
|
|
||||||
barrier.soundResId = stream->readUint32LE();
|
barrier.soundResId = stream->readSint32LE();
|
||||||
barrier.field_6A4 = stream->readUint32LE();
|
barrier.field_6A4 = stream->readSint32LE();
|
||||||
|
|
||||||
barriers.push_back(barrier);
|
barriers.push_back(barrier);
|
||||||
}
|
}
|
||||||
|
@ -296,91 +296,91 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
// need to jump all unused barriers data to where actors data start
|
// need to jump all unused barriers data to where actors data start
|
||||||
stream->seek(0xA6D7A);
|
stream->seek(0xA6D7A);
|
||||||
|
|
||||||
for (uint32 a = 0; a < numActors; a++) {
|
for (int32 a = 0; a < numActors; a++) {
|
||||||
int i;
|
int32 i;
|
||||||
Actor actor;
|
Actor actor;
|
||||||
|
|
||||||
actor.x = stream->readSint32LE();
|
actor.x = stream->readSint32LE();
|
||||||
actor.y = stream->readSint32LE();
|
actor.y = stream->readSint32LE();
|
||||||
actor.grResId = stream->readUint32LE();
|
actor.grResId = stream->readSint32LE();
|
||||||
actor.field_C = stream->readUint32LE();
|
actor.field_C = stream->readSint32LE();
|
||||||
actor.frameNum = stream->readUint32LE();
|
actor.frameNum = stream->readSint32LE();
|
||||||
actor.frameCount = stream->readUint32LE();
|
actor.frameCount = stream->readSint32LE();
|
||||||
actor.x1 = stream->readSint32LE();
|
actor.x1 = stream->readSint32LE();
|
||||||
actor.y1 = stream->readSint32LE();
|
actor.y1 = stream->readSint32LE();
|
||||||
actor.x2 = stream->readSint32LE();
|
actor.x2 = stream->readSint32LE();
|
||||||
actor.y2 = stream->readSint32LE();
|
actor.y2 = stream->readSint32LE();
|
||||||
|
|
||||||
actor.boundingRect.left = stream->readUint32LE() & 0xFFFF;
|
actor.boundingRect.left = stream->readSint32LE() & 0xFFFF;
|
||||||
actor.boundingRect.top = stream->readUint32LE() & 0xFFFF;
|
actor.boundingRect.top = stream->readSint32LE() & 0xFFFF;
|
||||||
actor.boundingRect.right = stream->readUint32LE() & 0xFFFF;
|
actor.boundingRect.right = stream->readSint32LE() & 0xFFFF;
|
||||||
actor.boundingRect.bottom = stream->readUint32LE() & 0xFFFF;
|
actor.boundingRect.bottom = stream->readSint32LE() & 0xFFFF;
|
||||||
|
|
||||||
actor.direction = stream->readUint32LE();
|
actor.direction = stream->readSint32LE();
|
||||||
actor.field_3C = stream->readUint32LE();
|
actor.field_3C = stream->readSint32LE();
|
||||||
actor.updateType = stream->readUint32LE();
|
actor.updateType = stream->readSint32LE();
|
||||||
actor.field_44 = stream->readUint32LE();
|
actor.field_44 = stream->readSint32LE();
|
||||||
actor.priority = stream->readUint32LE();
|
actor.priority = stream->readSint32LE();
|
||||||
actor.flags = stream->readUint32LE();
|
actor.flags = stream->readSint32LE();
|
||||||
actor.field_50 = stream->readUint32LE();
|
actor.field_50 = stream->readSint32LE();
|
||||||
actor.field_54 = stream->readUint32LE();
|
actor.field_54 = stream->readSint32LE();
|
||||||
actor.field_58 = stream->readUint32LE();
|
actor.field_58 = stream->readSint32LE();
|
||||||
actor.field_5C = stream->readUint32LE();
|
actor.field_5C = stream->readSint32LE();
|
||||||
actor.field_60 = stream->readUint32LE();
|
actor.field_60 = stream->readSint32LE();
|
||||||
actor.actionIdx3 = stream->readUint32LE();
|
actor.actionIdx3 = stream->readSint32LE();
|
||||||
|
|
||||||
// TODO skip field_68 till field_617
|
// TODO skip field_68 till field_617
|
||||||
stream->skip(0x5B0);
|
stream->skip(0x5B0);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
actor.reaction[i] = stream->readUint32LE();
|
actor.reaction[i] = stream->readSint32LE();
|
||||||
|
|
||||||
actor.field_638 = stream->readUint32LE();
|
actor.field_638 = stream->readSint32LE();
|
||||||
actor.walkingSound1 = stream->readUint32LE();
|
actor.walkingSound1 = stream->readSint32LE();
|
||||||
actor.walkingSound2 = stream->readUint32LE();
|
actor.walkingSound2 = stream->readSint32LE();
|
||||||
actor.walkingSound3 = stream->readUint32LE();
|
actor.walkingSound3 = stream->readSint32LE();
|
||||||
actor.walkingSound4 = stream->readUint32LE();
|
actor.walkingSound4 = stream->readSint32LE();
|
||||||
actor.field_64C = stream->readUint32LE();
|
actor.field_64C = stream->readSint32LE();
|
||||||
actor.field_650 = stream->readUint32LE();
|
actor.field_650 = stream->readSint32LE();
|
||||||
|
|
||||||
for (i = 0; i < 55; i++)
|
for (i = 0; i < 55; i++)
|
||||||
actor.grResTable[i] = stream->readUint32LE();
|
actor.grResTable[i] = stream->readSint32LE();
|
||||||
|
|
||||||
stream->read(actor.name, sizeof(actor.name));
|
stream->read(actor.name, sizeof(actor.name));
|
||||||
|
|
||||||
for (i = 0; i < 20; i++)
|
for (i = 0; i < 20; i++)
|
||||||
actor.field_830[i] = stream->readUint32LE();
|
actor.field_830[i] = stream->readSint32LE();
|
||||||
|
|
||||||
for (i = 0; i < 20; i++)
|
for (i = 0; i < 20; i++)
|
||||||
actor.field_880[i] = stream->readUint32LE();
|
actor.field_880[i] = stream->readSint32LE();
|
||||||
|
|
||||||
for (i = 0; i < 20; i++)
|
for (i = 0; i < 20; i++)
|
||||||
actor.field_8D0[i] = stream->readUint32LE();
|
actor.field_8D0[i] = stream->readSint32LE();
|
||||||
|
|
||||||
actor.actionIdx2 = stream->readUint32LE();
|
actor.actionIdx2 = stream->readSint32LE();
|
||||||
actor.field_924 = stream->readUint32LE();
|
actor.field_924 = stream->readSint32LE();
|
||||||
actor.tickValue1 = stream->readUint32LE();
|
actor.tickValue1 = stream->readSint32LE();
|
||||||
actor.field_92C = stream->readUint32LE();
|
actor.field_92C = stream->readSint32LE();
|
||||||
actor.flags2 = stream->readUint32LE();
|
actor.flags2 = stream->readSint32LE();
|
||||||
actor.field_934 = stream->readUint32LE();
|
actor.field_934 = stream->readSint32LE();
|
||||||
actor.field_938 = stream->readUint32LE();
|
actor.field_938 = stream->readSint32LE();
|
||||||
actor.soundResId = stream->readUint32LE();
|
actor.soundResId = stream->readSint32LE();
|
||||||
actor.field_940 = stream->readUint32LE();
|
actor.field_940 = stream->readSint32LE();
|
||||||
actor.field_944 = stream->readUint32LE();
|
actor.field_944 = stream->readSint32LE();
|
||||||
actor.field_948 = stream->readUint32LE();
|
actor.field_948 = stream->readSint32LE();
|
||||||
actor.field_94C = stream->readUint32LE();
|
actor.field_94C = stream->readSint32LE();
|
||||||
actor.field_950 = stream->readUint32LE();
|
actor.field_950 = stream->readSint32LE();
|
||||||
actor.field_954 = stream->readUint32LE();
|
actor.field_954 = stream->readSint32LE();
|
||||||
actor.field_958 = stream->readUint32LE();
|
actor.field_958 = stream->readSint32LE();
|
||||||
actor.field_95C = stream->readUint32LE();
|
actor.field_95C = stream->readSint32LE();
|
||||||
actor.field_960 = stream->readUint32LE();
|
actor.field_960 = stream->readSint32LE();
|
||||||
actor.field_964 = stream->readUint32LE();
|
actor.field_964 = stream->readSint32LE();
|
||||||
actor.field_968 = stream->readUint32LE();
|
actor.field_968 = stream->readSint32LE();
|
||||||
actor.field_96C = stream->readUint32LE();
|
actor.field_96C = stream->readSint32LE();
|
||||||
actor.field_970 = stream->readUint32LE();
|
actor.field_970 = stream->readSint32LE();
|
||||||
actor.field_974 = stream->readUint32LE();
|
actor.field_974 = stream->readSint32LE();
|
||||||
actor.field_978 = stream->readUint32LE();
|
actor.field_978 = stream->readSint32LE();
|
||||||
actor.actionIdx1 = stream->readUint32LE();
|
actor.actionIdx1 = stream->readSint32LE();
|
||||||
|
|
||||||
// TODO skip field_980 till field_9A0
|
// TODO skip field_980 till field_9A0
|
||||||
stream->skip(0x24);
|
stream->skip(0x24);
|
||||||
|
@ -402,36 +402,36 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
stream->seek(0xD6B5A); // where action items start
|
stream->seek(0xD6B5A); // where action items start
|
||||||
|
|
||||||
// FIXME Figure out all the actions items
|
// FIXME Figure out all the actions items
|
||||||
for (uint32 a = 0; a < numActions; a++) {
|
for (int32 a = 0; a < numActions; a++) {
|
||||||
ActionArea action;
|
ActionArea action;
|
||||||
memset(&action, 0, sizeof(ActionArea));
|
memset(&action, 0, sizeof(ActionArea));
|
||||||
|
|
||||||
stream->read(action.name, 52);
|
stream->read(action.name, 52);
|
||||||
action.id = stream->readUint32LE();
|
action.id = stream->readSint32LE();
|
||||||
action.field01 = stream->readUint32LE();
|
action.field01 = stream->readSint32LE();
|
||||||
action.field02 = stream->readUint32LE();
|
action.field02 = stream->readSint32LE();
|
||||||
action.field_40 = stream->readUint32LE();
|
action.field_40 = stream->readSint32LE();
|
||||||
action.field_44 = stream->readUint32LE();
|
action.field_44 = stream->readSint32LE();
|
||||||
action.flags = stream->readUint32LE();
|
action.flags = stream->readSint32LE();
|
||||||
action.actionListIdx1 = stream->readUint32LE();
|
action.actionListIdx1 = stream->readSint32LE();
|
||||||
action.actionListIdx2 = stream->readUint32LE();
|
action.actionListIdx2 = stream->readSint32LE();
|
||||||
action.actionType = stream->readUint32LE();
|
action.actionType = stream->readSint32LE();
|
||||||
|
|
||||||
for (int aa1 = 0; aa1 < 10; aa1++)
|
for (int32 aa1 = 0; aa1 < 10; aa1++)
|
||||||
action.flagNums[aa1] = stream->readUint32LE();
|
action.flagNums[aa1] = stream->readSint32LE();
|
||||||
|
|
||||||
action.field_7C = stream->readUint32LE();
|
action.field_7C = stream->readSint32LE();
|
||||||
action.polyIdx = stream->readUint32LE();
|
action.polyIdx = stream->readSint32LE();
|
||||||
action.field_84 = stream->readUint32LE();
|
action.field_84 = stream->readSint32LE();
|
||||||
action.field_88 = stream->readUint32LE();
|
action.field_88 = stream->readSint32LE();
|
||||||
action.soundResId = stream->readUint32LE();
|
action.soundResId = stream->readSint32LE();
|
||||||
action.field_90 = stream->readUint32LE();
|
action.field_90 = stream->readSint32LE();
|
||||||
action.paletteValue = stream->readUint32LE();
|
action.paletteValue = stream->readSint32LE();
|
||||||
|
|
||||||
for (int aa2 = 0; aa2 < 5; aa2++)
|
for (int32 aa2 = 0; aa2 < 5; aa2++)
|
||||||
action.array[aa2] = stream->readUint32LE();
|
action.array[aa2] = stream->readSint32LE();
|
||||||
|
|
||||||
action.volume = stream->readUint32LE();
|
action.volume = stream->readSint32LE();
|
||||||
|
|
||||||
actions.push_back(action);
|
actions.push_back(action);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,55 +37,55 @@
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
typedef struct CommonResources {
|
typedef struct CommonResources {
|
||||||
uint32 backgroundImage;
|
int32 backgroundImage;
|
||||||
uint32 curScrollUp;
|
int32 curScrollUp;
|
||||||
uint32 curScrollUpLeft;
|
int32 curScrollUpLeft;
|
||||||
uint32 curScrollLeft;
|
int32 curScrollLeft;
|
||||||
uint32 curScrollDownLeft;
|
int32 curScrollDownLeft;
|
||||||
uint32 curScrollDown;
|
int32 curScrollDown;
|
||||||
uint32 curScrollDownRight;
|
int32 curScrollDownRight;
|
||||||
uint32 curScrollRight;
|
int32 curScrollRight;
|
||||||
uint32 curScrollUpRight;
|
int32 curScrollUpRight;
|
||||||
uint32 curHand;
|
int32 curHand;
|
||||||
uint32 curMagnifyingGlass;
|
int32 curMagnifyingGlass;
|
||||||
uint32 curTalkNCP;
|
int32 curTalkNCP;
|
||||||
uint32 curGrabPointer;
|
int32 curGrabPointer;
|
||||||
uint32 curTalkNCP2;
|
int32 curTalkNCP2;
|
||||||
uint32 font1;
|
int32 font1;
|
||||||
uint32 font2;
|
int32 font2;
|
||||||
uint32 font3;
|
int32 font3;
|
||||||
uint32 palette;
|
int32 palette;
|
||||||
uint32 cellShadeMask1;
|
int32 cellShadeMask1;
|
||||||
uint32 cellShadeMask2;
|
int32 cellShadeMask2;
|
||||||
uint32 cellShadeMask3;
|
int32 cellShadeMask3;
|
||||||
uint32 unused;
|
int32 unused;
|
||||||
uint32 smallCurUp;
|
int32 smallCurUp;
|
||||||
uint32 smallCurDown;
|
int32 smallCurDown;
|
||||||
uint32 encounterFrameBg;
|
int32 encounterFrameBg;
|
||||||
|
|
||||||
} CommonResources;
|
} CommonResources;
|
||||||
|
|
||||||
typedef struct ActionArea {
|
typedef struct ActionArea {
|
||||||
char name[52];
|
char name[52];
|
||||||
uint32 id;
|
int32 id;
|
||||||
uint32 field01;
|
int32 field01;
|
||||||
uint32 field02;
|
int32 field02;
|
||||||
uint32 field_40;
|
int32 field_40;
|
||||||
uint32 field_44;
|
int32 field_44;
|
||||||
uint32 flags;
|
int32 flags;
|
||||||
uint32 actionListIdx1;
|
int32 actionListIdx1;
|
||||||
uint32 actionListIdx2;
|
int32 actionListIdx2;
|
||||||
uint32 actionType; // aka flags2: 0-none, 1-findwhat, 2-talk, 3-findwhat??, 4-grab
|
int32 actionType; // aka flags2: 0-none, 1-findwhat, 2-talk, 3-findwhat??, 4-grab
|
||||||
uint32 flagNums[10];
|
int32 flagNums[10];
|
||||||
uint32 field_7C;
|
int32 field_7C;
|
||||||
uint32 polyIdx;
|
int32 polyIdx;
|
||||||
uint32 field_84;
|
int32 field_84;
|
||||||
uint32 field_88;
|
int32 field_88;
|
||||||
uint32 soundResId;
|
int32 soundResId;
|
||||||
uint32 field_90;
|
int32 field_90;
|
||||||
uint32 paletteValue;
|
int32 paletteValue;
|
||||||
uint32 array[5];
|
int32 array[5];
|
||||||
uint32 volume;
|
int32 volume;
|
||||||
|
|
||||||
} ActionArea;
|
} ActionArea;
|
||||||
|
|
||||||
|
@ -94,45 +94,45 @@ public:
|
||||||
WorldStats(Common::SeekableReadStream *stream, Scene *scene);
|
WorldStats(Common::SeekableReadStream *stream, Scene *scene);
|
||||||
virtual ~WorldStats();
|
virtual ~WorldStats();
|
||||||
|
|
||||||
uint32 size;
|
int32 size;
|
||||||
uint32 numEntries;
|
int32 numEntries;
|
||||||
int numChapter;
|
int32 numChapter;
|
||||||
uint32 xLeft; // scene start x position
|
int32 xLeft; // scene start x position
|
||||||
uint32 yTop; // scene start y position
|
int32 yTop; // scene start y position
|
||||||
Common::Rect boundingRect;
|
Common::Rect boundingRect;
|
||||||
CommonResources commonRes; // field_1C till field_7C
|
CommonResources commonRes; // field_1C till field_7C
|
||||||
uint32 width; // field_80
|
int32 width; // field_80
|
||||||
uint32 height;
|
int32 height;
|
||||||
uint32 motionStatus;
|
int32 motionStatus;
|
||||||
uint32 field_8C;
|
int32 field_8C;
|
||||||
uint32 numActions; // field_90
|
int32 numActions; // field_90
|
||||||
uint32 numBarriers;
|
int32 numBarriers;
|
||||||
int targetX;
|
int32 targetX;
|
||||||
int targetY;
|
int32 targetY;
|
||||||
uint32 field_A0;
|
int32 field_A0;
|
||||||
uint32 field_A4;
|
int32 field_A4;
|
||||||
uint32 field_A8;
|
int32 field_A8;
|
||||||
uint32 field_AC;
|
int32 field_AC;
|
||||||
uint32 field_B0;
|
int32 field_B0;
|
||||||
uint32 numActors;
|
int32 numActors;
|
||||||
uint32 stereoReversedFlag;
|
int32 stereoReversedFlag;
|
||||||
Common::Rect sceneRects[6]; // including scene size rect
|
Common::Rect sceneRects[6]; // including scene size rect
|
||||||
uint8 sceneRectIdx;
|
uint8 sceneRectIdx;
|
||||||
uint8 field_11D[3];
|
uint8 field_11D[3];
|
||||||
int32 field_120;
|
int32 field_120;
|
||||||
uint32 actionListIdx; // actionList start index
|
int32 actionListIdx; // actionList start index
|
||||||
uint32 grResId[100];
|
int32 grResId[100];
|
||||||
uint32 sceneTitleGrResId;
|
int32 sceneTitleGrResId;
|
||||||
uint32 sceneTitlePalResId;
|
int32 sceneTitlePalResId;
|
||||||
uint32 actorType;
|
int32 actorType;
|
||||||
uint32 soundResId[50];
|
int32 soundResId[50];
|
||||||
AmbientSoundItem ambientSounds[15];
|
AmbientSoundItem ambientSounds[15];
|
||||||
uint32 numAmbientSound;
|
int32 numAmbientSound;
|
||||||
uint32 musicStatus;
|
int32 musicStatus;
|
||||||
int musicCurrentResId;
|
int32 musicCurrentResId;
|
||||||
uint32 musicFlag;
|
int32 musicFlag;
|
||||||
int musicResId;
|
int32 musicResId;
|
||||||
uint32 musicStatusExt;
|
int32 musicStatusExt;
|
||||||
|
|
||||||
// FIXME: Investigate if we need to actually reserve maxsize for this arrays.
|
// FIXME: Investigate if we need to actually reserve maxsize for this arrays.
|
||||||
// It always have that size under scene file and they are always save in savegames.
|
// It always have that size under scene file and they are always save in savegames.
|
||||||
|
@ -141,20 +141,20 @@ public:
|
||||||
// TODO add rest fields
|
// TODO add rest fields
|
||||||
Common::Array<ActionArea> actions; // maxsize 400
|
Common::Array<ActionArea> actions; // maxsize 400
|
||||||
// TODO add rest fields
|
// TODO add rest fields
|
||||||
int field_E860C;
|
int32 field_E860C;
|
||||||
// TODO add rest fields
|
// TODO add rest fields
|
||||||
|
|
||||||
int getActionAreaIndexById(uint32 id);
|
int32 getActionAreaIndexById(int32 id);
|
||||||
ActionArea* getActionAreaById(uint32 id);
|
ActionArea* getActionAreaById(int32 id);
|
||||||
|
|
||||||
int getBarrierIndexById(uint32 id);
|
int32 getBarrierIndexById(int32 id);
|
||||||
Barrier* getBarrierById(uint32 id);
|
Barrier* getBarrierById(int32 id);
|
||||||
Barrier* getBarrierByIndex(uint32 idx);
|
Barrier* getBarrierByIndex(int32 idx);
|
||||||
|
|
||||||
bool isBarrierOnScreen(uint32 idx);
|
bool isBarrierOnScreen(int32 idx);
|
||||||
bool isBarrierVisible(uint32 idx);
|
bool isBarrierVisible(int32 idx);
|
||||||
// TODO this needs a better name
|
// TODO this needs a better name
|
||||||
bool checkBarrierFlagsCondition(uint32 idx);
|
bool checkBarrierFlagsCondition(int32 idx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue