DRAGONS: Compile fixes + formatting

This commit is contained in:
Eric Fry 2020-02-07 08:34:58 +11:00 committed by Eugene Sandulenko
parent b792c8bd13
commit 8301d0dbb1
25 changed files with 91 additions and 91 deletions

View file

@ -41,7 +41,7 @@ ActorManager::ActorManager(ActorResourceLoader *actorResourceLoader) : _actorRes
Actor *ActorManager::loadActor(uint32 resourceId, uint32 sequenceId, int16 x, int16 y, uint16 priorityLayer) { Actor *ActorManager::loadActor(uint32 resourceId, uint32 sequenceId, int16 x, int16 y, uint16 priorityLayer) {
Actor *actor = loadActor(resourceId, sequenceId, x, y); Actor *actor = loadActor(resourceId, sequenceId, x, y);
if(actor) { if (actor) {
actor->priorityLayer = priorityLayer; actor->priorityLayer = priorityLayer;
} }
return actor; return actor;
@ -82,7 +82,7 @@ Actor *ActorManager::getActor(uint16 actorId) {
void ActorManager::clearActorFlags(uint16 startingActorId) { void ActorManager::clearActorFlags(uint16 startingActorId) {
assert(startingActorId < DRAGONS_ENGINE_NUM_ACTORS); assert(startingActorId < DRAGONS_ENGINE_NUM_ACTORS);
for(uint16 i = startingActorId; i < DRAGONS_ENGINE_NUM_ACTORS; i++) { for (uint16 i = startingActorId; i < DRAGONS_ENGINE_NUM_ACTORS; i++) {
_actors[i]._flags = 0; _actors[i]._flags = 0;
} }
} }
@ -100,7 +100,7 @@ ActorResource *ActorManager::getActorResource(uint32 resourceId) {
void ActorManager::updateActorDisplayOrder() { void ActorManager::updateActorDisplayOrder() {
bool shouldContinue = true; bool shouldContinue = true;
while(shouldContinue) { while (shouldContinue) {
shouldContinue = false; shouldContinue = false;
for (int i = 0; i < DRAGONS_ENGINE_NUM_ACTORS - 1; i++) { for (int i = 0; i < DRAGONS_ENGINE_NUM_ACTORS - 1; i++) {
Actor *curActor = getActor(_displayOrder[i]); Actor *curActor = getActor(_displayOrder[i]);
@ -482,7 +482,7 @@ void Actor::stopWalk() {
} }
void Actor::waitUntilFlag4IsSet() { void Actor::waitUntilFlag4IsSet() {
while(!isFlagSet(ACTOR_FLAG_4)) { while (!isFlagSet(ACTOR_FLAG_4)) {
getEngine()->waitForFrames(1); getEngine()->waitForFrames(1);
} }
} }
@ -492,7 +492,7 @@ void Actor::waitUntilFlag8IsSet() {
return; return;
} }
while(!(_flags & Dragons::ACTOR_FLAG_8)) { while (!(_flags & Dragons::ACTOR_FLAG_8)) {
getEngine()->waitForFrames(1); getEngine()->waitForFrames(1);
} }
} }
@ -586,7 +586,7 @@ uint16 Actor::canWalkLine(int16 actor_x, int16 actor_y, int16 target_x, int16 ta
// 0x80034d28 // 0x80034d28
int32 x = actor_x << 0x10; int32 x = actor_x << 0x10;
int32 y = actor_y << 0x10; int32 y = actor_y << 0x10;
for(;;) { for (;;) {
if ((x+0x8000) >> 0x10 == target_x && (y+0x8000) >> 0x10 == target_y) { if ((x+0x8000) >> 0x10 == target_x && (y+0x8000) >> 0x10 == target_y) {
return 1; return 1;
} }
@ -728,7 +728,7 @@ int Actor::startMoveToPoint(int destX, int destY) {
} }
// 0x8001bcc8 // 0x8001bcc8
int direction = startMoveToPoint(_walkDestX, _walkDestY); int direction = startMoveToPoint(_walkDestX, _walkDestY);
if(direction != -1 && !isFlagSet(ACTOR_FLAG_800)) { if (direction != -1 && !isFlagSet(ACTOR_FLAG_800)) {
_sequenceID2 = direction; _sequenceID2 = direction;
} }
if (_sequenceID != _sequenceID2 + 8 && _sequenceID2 != -1 && !isFlagSet(ACTOR_FLAG_800)) { if (_sequenceID != _sequenceID2 + 8 && _sequenceID2 != -1 && !isFlagSet(ACTOR_FLAG_800)) {
@ -767,7 +767,7 @@ bool Actor::actorSetSequenceAndWaitAllowSkip(uint16 newSequenceID) {
} }
bool Actor::waitUntilFlag4IsSetAllowSkip() { bool Actor::waitUntilFlag4IsSetAllowSkip() {
while(!isFlagSet(ACTOR_FLAG_4)) { while (!isFlagSet(ACTOR_FLAG_4)) {
getEngine()->waitForFrames(1); getEngine()->waitForFrames(1);
if (getEngine()->checkForActionButtonRelease()) { if (getEngine()->checkForActionButtonRelease()) {
return true; return true;

View file

@ -110,7 +110,7 @@ Graphics::Surface *ActorResource::loadFrame(ActorFrame &actorFrame, byte *palett
byte *data = actorFrame.frameDataOffset; byte *data = actorFrame.frameDataOffset;
while(blockSize > 0) { while (blockSize > 0) {
int32 size = READ_BE_INT32(data); int32 size = READ_BE_INT32(data);
data += 4; data += 4;
if (size >= 0) { if (size >= 0) {
@ -131,7 +131,7 @@ Graphics::Surface *ActorResource::loadFrame(ActorFrame &actorFrame, byte *palett
} }
blockSize -= size; blockSize -= size;
if (size != 0) { if (size != 0) {
for(int32 i = size; i != 0; i--) { for (int32 i = size; i != 0; i--) {
memcpy(pixels, data, 4); memcpy(pixels, data, 4);
pixels += 4; pixels += 4;
} }

View file

@ -97,7 +97,7 @@ Background::Background() : _priorityLayer(0), _points2(0), _data(0) {
} }
Background::~Background() { Background::~Background() {
if(_data) { if (_data) {
delete _data; delete _data;
} }
@ -125,7 +125,7 @@ bool Background::load(byte *dataStart, uint32 size) {
stream.seek(0x308); stream.seek(0x308);
uint32 tilemapOffset = 0x324; uint32 tilemapOffset = 0x324;
for(int i=0;i< 3;i++) { for (int i=0;i< 3;i++) {
_tileMap[i].w = stream.readUint16LE(); _tileMap[i].w = stream.readUint16LE();
_tileMap[i].h = stream.readUint16LE(); _tileMap[i].h = stream.readUint16LE();
_tileMap[i].size = stream.readUint32LE(); _tileMap[i].size = stream.readUint32LE();
@ -156,7 +156,7 @@ bool Background::load(byte *dataStart, uint32 size) {
debug("Tiles: %X", tilesOffset); debug("Tiles: %X", tilesOffset);
debug("tileIndexOffset: %d", _tileMap[0].tileIndexOffset); debug("tileIndexOffset: %d", _tileMap[0].tileIndexOffset);
for(int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
_layerSurface[i] = initGfxLayer(_tileMap[i]); _layerSurface[i] = initGfxLayer(_tileMap[i]);
loadGfxLayer(_layerSurface[i], _tileMap[i], _tileDataOffset); loadGfxLayer(_layerSurface[i], _tileMap[i], _tileDataOffset);
} }
@ -186,8 +186,8 @@ Graphics::Surface *Background::initGfxLayer(TileMap &tileMap) {
} }
void Background::loadGfxLayer(Graphics::Surface *surface, TileMap &tileMap, byte *tiles) { void Background::loadGfxLayer(Graphics::Surface *surface, TileMap &tileMap, byte *tiles) {
for(int y = 0; y < tileMap.h; y++) { for (int y = 0; y < tileMap.h; y++) {
for(int x = 0; x < tileMap.w; x++) { for (int x = 0; x < tileMap.w; x++) {
uint16 idx = READ_LE_UINT16(&tileMap.map[(y * tileMap.w + x) * 2]) + tileMap.tileIndexOffset; uint16 idx = READ_LE_UINT16(&tileMap.map[(y * tileMap.w + x) * 2]) + tileMap.tileIndexOffset;
//debug("tileIdx: %d", idx); //debug("tileIdx: %d", idx);
drawTileToSurface(surface, _palette, tiles + idx * 0x100, x * TILE_WIDTH, y * TILE_HEIGHT); drawTileToSurface(surface, _palette, tiles + idx * 0x100, x * TILE_WIDTH, y * TILE_HEIGHT);
@ -198,8 +198,8 @@ void Background::loadGfxLayer(Graphics::Surface *surface, TileMap &tileMap, byte
void drawTileToSurface(Graphics::Surface *surface, byte *palette, byte *tile, uint32 x, uint32 y) { void drawTileToSurface(Graphics::Surface *surface, byte *palette, byte *tile, uint32 x, uint32 y) {
byte *pixels = (byte *)surface->getPixels(); byte *pixels = (byte *)surface->getPixels();
if (surface->format.bpp() == 16) { if (surface->format.bpp() == 16) {
for(int ty = 0; ty < TILE_HEIGHT; ty++) { for (int ty = 0; ty < TILE_HEIGHT; ty++) {
for(int tx = 0; tx < TILE_WIDTH; tx++) { for (int tx = 0; tx < TILE_WIDTH; tx++) {
uint32 cidx = *tile; uint32 cidx = *tile;
uint32 offset = (y + ty) * surface->pitch + (x + tx) * 2; uint32 offset = (y + ty) * surface->pitch + (x + tx) * 2;
pixels[offset] = palette[cidx * 2]; pixels[offset] = palette[cidx * 2];
@ -239,8 +239,8 @@ int16 Background::getPriorityAtPoint(Common::Point pos) {
} }
void Background::overlayImage(uint16 layerNum, byte *data, int16 x, int16 y, int16 w, int16 h) { void Background::overlayImage(uint16 layerNum, byte *data, int16 x, int16 y, int16 w, int16 h) {
for(int i = 0; i < h; i++ ) { for (int i = 0; i < h; i++ ) {
for(int j = 0; j < w; j++ ) { for (int j = 0; j < w; j++ ) {
int16 idx = READ_LE_UINT16(data) + _tileMap[layerNum].tileIndexOffset; int16 idx = READ_LE_UINT16(data) + _tileMap[layerNum].tileIndexOffset;
drawTileToSurface(_layerSurface[layerNum], drawTileToSurface(_layerSurface[layerNum],
_palette, _palette,
@ -255,8 +255,8 @@ void Background::overlayImage(uint16 layerNum, byte *data, int16 x, int16 y, int
void Background::restoreTiles(uint16 layerNum, int16 x, int16 y, int16 w, int16 h) { void Background::restoreTiles(uint16 layerNum, int16 x, int16 y, int16 w, int16 h) {
int16 tmw = x + w; int16 tmw = x + w;
int16 tmh = y + h; int16 tmh = y + h;
for(int y = 0; y < tmh; y++) { for (int y = 0; y < tmh; y++) {
for(int x = 0; x < tmw; x++) { for (int x = 0; x < tmw; x++) {
uint16 idx = READ_LE_UINT16(&_tileMap[layerNum].map[(y * _tileMap[layerNum].w + x) * 2]) + _tileMap[layerNum].tileIndexOffset; uint16 idx = READ_LE_UINT16(&_tileMap[layerNum].map[(y * _tileMap[layerNum].w + x) * 2]) + _tileMap[layerNum].tileIndexOffset;
//debug("tileIdx: %d", idx); //debug("tileIdx: %d", idx);
drawTileToSurface(_layerSurface[layerNum], _palette, _tileDataOffset + idx * 0x100, x * TILE_WIDTH, y * TILE_HEIGHT); drawTileToSurface(_layerSurface[layerNum], _palette, _tileDataOffset + idx * 0x100, x * TILE_WIDTH, y * TILE_HEIGHT);

View file

@ -87,8 +87,8 @@ void Bag::load(BigfileArchive *bigFileArchive) {
Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 1, 10, 5, 0, 15); //TODO move this to a better location. Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 1, 10, 5, 0, 15); //TODO move this to a better location.
_surface->create(320, 200, pixelFormat16); _surface->create(320, 200, pixelFormat16);
for(int y = 0; y < TILEMAP_HEIGHT; y++) { for (int y = 0; y < TILEMAP_HEIGHT; y++) {
for(int x = 0; x < TILEMAP_WIDTH; x++) { for (int x = 0; x < TILEMAP_WIDTH; x++) {
uint16 idx = READ_LE_UINT16(&tilemap[(y * TILEMAP_WIDTH + x) * 2]); uint16 idx = READ_LE_UINT16(&tilemap[(y * TILEMAP_WIDTH + x) * 2]);
//debug("tileIdx: %d", idx); //debug("tileIdx: %d", idx);
drawTileToSurface(_surface, pal, tiles + idx * 0x100, x * 32, y * 8); drawTileToSurface(_surface, pal, tiles + idx * 0x100, x * 32, y * 8);

View file

@ -610,7 +610,7 @@ FileInfo fileInfo[TOTAL_FILES] = {
}; };
uint32 getResourceId(const char *filename) { uint32 getResourceId(const char *filename) {
for(uint32 i=0; i < TOTAL_FILES; i++) { for (uint32 i=0; i < TOTAL_FILES; i++) {
if (scumm_stricmp(fileInfo[i].filename, filename) == 0) { if (scumm_stricmp(fileInfo[i].filename, filename) == 0) {
return i; return i;
} }

View file

@ -57,7 +57,7 @@ bool Credits::isRunning() {
} }
void Credits::draw() { void Credits::draw() {
if(_running) { if (_running) {
_vm->_screen->copyRectToSurface8bppWrappedY(*_surface, _vm->_screen->getPalette(2), _yOffset); _vm->_screen->copyRectToSurface8bppWrappedY(*_surface, _vm->_screen->getPalette(2), _yOffset);
} }
} }

View file

@ -205,7 +205,7 @@ int16 Cursor::updateIniFromScene() {
int16 cursorTileY = cursorY / 8; int16 cursorTileY = cursorY / 8;
int16 data_80072890_orig = data_80072890; int16 data_80072890_orig = data_80072890;
int16 data_800728b0_cursor_seqID_orig = data_800728b0_cursor_seqID; int16 data_800728b0_cursor_seqID_orig = data_800728b0_cursor_seqID;
for(int i=0;i <_vm->_dragonINIResource->totalRecords(); i++) { for (int i=0;i <_vm->_dragonINIResource->totalRecords(); i++) {
DragonINI *ini = _vm->_dragonINIResource->getRecord(i); DragonINI *ini = _vm->_dragonINIResource->getRecord(i);
if (ini->sceneId != _vm->_scene->getSceneId()) { if (ini->sceneId != _vm->_scene->getSceneId()) {
// 0x80028be4 // 0x80028be4
@ -246,7 +246,7 @@ int16 Cursor::updateIniFromScene() {
if (ini->field_1a_flags_maybe & 0x800) { if (ini->field_1a_flags_maybe & 0x800) {
data_80072890 = cursorOverIni; data_80072890 = cursorOverIni;
uint32 newSeqId = 1; uint32 newSeqId = 1;
for(int idx=0; idx < 5; idx++) { for (int idx=0; idx < 5; idx++) {
data_800728b0_cursor_seqID = idx; data_800728b0_cursor_seqID = idx;
byte *obd = _vm->_dragonOBD->getFromOpt(cursorOverIni - 1); //_dragonRMS->getObdDataFieldC(sceneId); byte *obd = _vm->_dragonOBD->getFromOpt(cursorOverIni - 1); //_dragonRMS->getObdDataFieldC(sceneId);
ScriptOpCall scriptOpCall(obd + 8, READ_LE_UINT32(obd)); ScriptOpCall scriptOpCall(obd + 8, READ_LE_UINT32(obd));
@ -281,7 +281,7 @@ int16 Cursor::updateIniFromScene() {
// local_48 = dragon_Obd_Offset + *(int *)(uVar16 * 8 + dragon_Opt_Offset + -8) + 8; // local_48 = dragon_Obd_Offset + *(int *)(uVar16 * 8 + dragon_Opt_Offset + -8) + 8;
// local_44 = read_int32(); // local_44 = read_int32();
// local_44 = local_44 + local_48; // local_44 = local_44 + local_48;
if(executeScript(scriptOpCall, 0)) { if (executeScript(scriptOpCall, 0)) {
_iniUnderCursor = cursorOverIni; _iniUnderCursor = cursorOverIni;
data_80072890 = data_80072890_orig; data_80072890 = data_80072890_orig;
data_800728b0_cursor_seqID = data_800728b0_cursor_seqID_orig; data_800728b0_cursor_seqID = data_800728b0_cursor_seqID_orig;

View file

@ -641,7 +641,7 @@ void CutScene::knightsSavedBackAtCastle() {
//DisableVSyncEvent(); //DisableVSyncEvent();
// file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary); // file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary);
//EnableVSyncEvent(); //EnableVSyncEvent();
if(isFlag0x10Set) { if (isFlag0x10Set) {
_vm->setFlags(ENGINE_FLAG_10); _vm->setFlags(ENGINE_FLAG_10);
} }
_vm->clearFlags(ENGINE_FLAG_20000); _vm->clearFlags(ENGINE_FLAG_20000);
@ -731,7 +731,7 @@ void CutScene::flameReturnsCutScene() {
// file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary); // file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary);
// EnableVSyncEvent(); // EnableVSyncEvent();
_vm->clearFlags(ENGINE_FLAG_20000); _vm->clearFlags(ENGINE_FLAG_20000);
if(engineFlag10Set) { if (engineFlag10Set) {
_vm->setFlags(ENGINE_FLAG_10); _vm->setFlags(ENGINE_FLAG_10);
} }
_vm->_dragonINIResource->setFlickerRecord(uVar1); _vm->_dragonINIResource->setFlickerRecord(uVar1);
@ -811,7 +811,7 @@ void CutScene::knightsSavedAgain() {
// file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary); // file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary);
// EnableVSyncEvent(); // EnableVSyncEvent();
_vm->clearFlags(ENGINE_FLAG_20000); _vm->clearFlags(ENGINE_FLAG_20000);
if(engineFlag10Set) { if (engineFlag10Set) {
_vm->setFlags(ENGINE_FLAG_10); _vm->setFlags(ENGINE_FLAG_10);
} }
_vm->_dragonINIResource->setFlickerRecord(flicker); _vm->_dragonINIResource->setFlickerRecord(flicker);

View file

@ -31,7 +31,7 @@ namespace Dragons {
Properties::Properties(uint count) Properties::Properties(uint count)
: _count(count) { : _count(count) {
_properties = (byte *)malloc(getSize()); _properties = (byte *)malloc(getSize());
if(!_properties) { if (!_properties) {
error("Failed to allocate mem for properties"); error("Failed to allocate mem for properties");
} }
memset(_properties, 0, getSize()); memset(_properties, 0, getSize());
@ -89,7 +89,7 @@ void Properties::save(uint numberToWrite, Common::WriteStream *out) {
void Properties::print(char *prefix) { void Properties::print(char *prefix) {
char *str = new char[_count + 1]; char *str = new char[_count + 1];
int i = 0; int i = 0;
for(; i < _count; i++) { for (; i < _count; i++) {
str[i] = get(i) ? '1' : '0'; str[i] = get(i) ? '1' : '0';
} }
str[i] = 0; str[i] = 0;

View file

@ -38,7 +38,7 @@ DragonIMG::DragonIMG(BigfileArchive *bigfileArchive) {
_imgObjects = new IMG[_count]; _imgObjects = new IMG[_count];
for(int i=0; i < _count; i++) { for (int i=0; i < _count; i++) {
imgReadStream->seek(iptReadStream->readUint32LE()); imgReadStream->seek(iptReadStream->readUint32LE());
_imgObjects[i].x = imgReadStream->readUint16LE(); _imgObjects[i].x = imgReadStream->readUint16LE();
_imgObjects[i].y = imgReadStream->readUint16LE(); _imgObjects[i].y = imgReadStream->readUint16LE();

View file

@ -40,7 +40,7 @@ void DragonINIResource::reset() {
_dragonINI = new DragonINI[_count]; _dragonINI = new DragonINI[_count];
} }
for(int i=0; i < _count; i++) { for (int i=0; i < _count; i++) {
_dragonINI[i].id = (uint16)i; _dragonINI[i].id = (uint16)i;
_dragonINI[i].iptIndex_maybe = readStream->readSint16LE(); _dragonINI[i].iptIndex_maybe = readStream->readSint16LE();
_dragonINI[i].field_2 = readStream->readSint16LE(); _dragonINI[i].field_2 = readStream->readSint16LE();

View file

@ -37,7 +37,7 @@ DragonRMS::DragonRMS(BigfileArchive *bigfileArchive, DragonOBD *dragonOBD) : _dr
_rmsObjects = new RMS[_count]; _rmsObjects = new RMS[_count];
for(int i=0; i < _count; i++) { for (int i=0; i < _count; i++) {
_rmsObjects[i]._field0 = readStream->readSint32LE(); _rmsObjects[i]._field0 = readStream->readSint32LE();
readStream->read(_rmsObjects[i]._sceneName, 4); readStream->read(_rmsObjects[i]._sceneName, 4);
_rmsObjects[i]._obdOffset = readStream->readSint32LE(); _rmsObjects[i]._obdOffset = readStream->readSint32LE();

View file

@ -133,53 +133,53 @@ void DragonsEngine::updateEvents() {
_rightMouseButtonUp = true; _rightMouseButtonUp = true;
break; break;
case Common::EVENT_KEYUP: case Common::EVENT_KEYUP:
if (event.kbd.keycode == Common::KeyCode::KEYCODE_i) { if (event.kbd.keycode == Common::KEYCODE_i) {
_iKeyUp = true; _iKeyUp = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_DOWN) { } else if (event.kbd.keycode == Common::KEYCODE_DOWN) {
_downKeyUp = true; _downKeyUp = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_UP) { } else if (event.kbd.keycode == Common::KEYCODE_UP) {
_upKeyUp = true; _upKeyUp = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_RETURN || } else if (event.kbd.keycode == Common::KEYCODE_RETURN ||
event.kbd.keycode == Common::KeyCode::KEYCODE_KP_ENTER) { event.kbd.keycode == Common::KEYCODE_KP_ENTER) {
_enterKeyUp = true; _enterKeyUp = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_LEFT) { } else if (event.kbd.keycode == Common::KEYCODE_LEFT) {
_leftKeyUp = true; _leftKeyUp = true;
_leftKeyDown = false; _leftKeyDown = false;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_RIGHT) { } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
_rightKeyUp = true; _rightKeyUp = true;
_rightKeyDown = false; _rightKeyDown = false;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_w) { } else if (event.kbd.keycode == Common::KEYCODE_w) {
_wKeyDown = false; _wKeyDown = false;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_a) { } else if (event.kbd.keycode == Common::KEYCODE_a) {
_aKeyDown = false; _aKeyDown = false;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_s) { } else if (event.kbd.keycode == Common::KEYCODE_s) {
_sKeyDown = false; _sKeyDown = false;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_d) { } else if (event.kbd.keycode == Common::KEYCODE_d) {
_dKeyDown = false; _dKeyDown = false;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_o) { } else if (event.kbd.keycode == Common::KEYCODE_o) {
_oKeyDown = false; _oKeyDown = false;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_p) { } else if (event.kbd.keycode == Common::KEYCODE_p) {
_pKeyDown = false; _pKeyDown = false;
} }
break; break;
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KeyCode::KEYCODE_LEFT) { if (event.kbd.keycode == Common::KEYCODE_LEFT) {
_leftKeyDown = true; _leftKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_RIGHT) { } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
_rightKeyDown = true; _rightKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_w) { } else if (event.kbd.keycode == Common::KEYCODE_w) {
_wKeyDown = true; _wKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_a) { } else if (event.kbd.keycode == Common::KEYCODE_a) {
_aKeyDown = true; _aKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_s) { } else if (event.kbd.keycode == Common::KEYCODE_s) {
_sKeyDown = true; _sKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_d) { } else if (event.kbd.keycode == Common::KEYCODE_d) {
_dKeyDown = true; _dKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_o) { } else if (event.kbd.keycode == Common::KEYCODE_o) {
_oKeyDown = true; _oKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_p) { } else if (event.kbd.keycode == Common::KEYCODE_p) {
_pKeyDown = true; _pKeyDown = true;
} else if (event.kbd.keycode == Common::KeyCode::KEYCODE_TAB) { } else if (event.kbd.keycode == Common::KEYCODE_TAB) {
_debugMode = !_debugMode; _debugMode = !_debugMode;
} }
break; break;
@ -191,7 +191,7 @@ void DragonsEngine::updateEvents() {
Common::Error DragonsEngine::run() { Common::Error DragonsEngine::run() {
_screen = new Screen(); _screen = new Screen();
_bigfileArchive = new BigfileArchive("bigfile.dat", Common::Language::EN_ANY); _bigfileArchive = new BigfileArchive("bigfile.dat", Common::EN_ANY);
_talk = new Talk(this, _bigfileArchive); _talk = new Talk(this, _bigfileArchive);
_dragonFLG = new DragonFLG(_bigfileArchive); _dragonFLG = new DragonFLG(_bigfileArchive);
_dragonIMG = new DragonIMG(_bigfileArchive); _dragonIMG = new DragonIMG(_bigfileArchive);
@ -245,7 +245,7 @@ uint16 DragonsEngine::ipt_img_file_related()
int16 tileX = flicker->actor->x_pos / 32; int16 tileX = flicker->actor->x_pos / 32;
int16 tileY = flicker->actor->y_pos / 8; int16 tileY = flicker->actor->y_pos / 8;
for(int i=0;i < _dragonINIResource->totalRecords(); i++) { for (int i=0;i < _dragonINIResource->totalRecords(); i++) {
ini = getINI(i); ini = getINI(i);
if ((ini->sceneId == getCurrentSceneId()) && (ini->field_1a_flags_maybe == 0)) { if ((ini->sceneId == getCurrentSceneId()) && (ini->field_1a_flags_maybe == 0)) {
IMG *img = _dragonIMG->getIMG(ini->field_2); IMG *img = _dragonIMG->getIMG(ini->field_2);
@ -273,7 +273,7 @@ void DragonsEngine::gameLoop()
setFlags(ENGINE_FLAG_8); setFlags(ENGINE_FLAG_8);
actorId = 0; actorId = 0;
while(!shouldQuit()) { while (!shouldQuit()) {
_scene->draw(); _scene->draw();
_screen->updateScreen(); _screen->updateScreen();
wait(); wait();
@ -318,7 +318,7 @@ void DragonsEngine::gameLoop()
byte *obd = _dragonOBD->getFromOpt(actorId_00 - 1); byte *obd = _dragonOBD->getFromOpt(actorId_00 - 1);
ScriptOpCall scriptOpCall(obd + 8, READ_LE_UINT32(obd)); ScriptOpCall scriptOpCall(obd + 8, READ_LE_UINT32(obd));
if(_scriptOpcodes->runScript4(scriptOpCall)) { if (_scriptOpcodes->runScript4(scriptOpCall)) {
scriptOpCall._codeEnd = scriptOpCall._code + 4 + READ_LE_UINT16(scriptOpCall._code + 2); scriptOpCall._codeEnd = scriptOpCall._code + 4 + READ_LE_UINT16(scriptOpCall._code + 2);
scriptOpCall._code += 4; scriptOpCall._code += 4;
_scriptOpcodes->runScript(scriptOpCall); _scriptOpcodes->runScript(scriptOpCall);
@ -444,7 +444,7 @@ void DragonsEngine::gameLoop()
} }
} }
else { else {
if(_inventory->addItem(_cursor->iniItemInHand)) { if (_inventory->addItem(_cursor->iniItemInHand)) {
_cursor->_sequenceID = 1; _cursor->_sequenceID = 1;
waitForFrames(1); waitForFrames(1);
_cursor->iniItemInHand = 0; _cursor->iniItemInHand = 0;
@ -1273,7 +1273,7 @@ void DragonsEngine::loadScene(uint16 sceneId) {
_inventory->loadInventoryItemsFromSave(); _inventory->loadInventoryItemsFromSave();
if(getINI(0)->sceneId == 0) { if (getINI(0)->sceneId == 0) {
getINI(0)->sceneId = sceneId; //TODO getINI(0)->sceneId = sceneId; //TODO
} else { } else {
_scene->setSceneId(getINI(0)->sceneId); _scene->setSceneId(getINI(0)->sceneId);
@ -1291,7 +1291,7 @@ void DragonsEngine::reset() {
videoFlags = 0; videoFlags = 0;
data_800633fa = 0; data_800633fa = 0;
for(int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
_paletteCyclingTbl[i].paletteType = 0; _paletteCyclingTbl[i].paletteType = 0;
_paletteCyclingTbl[i].startOffset = 0; _paletteCyclingTbl[i].startOffset = 0;
_paletteCyclingTbl[i].endOffset = 0; _paletteCyclingTbl[i].endOffset = 0;

View file

@ -205,7 +205,7 @@ void FontManager::updatePalette() {
// if (( != 0 && ((engine_flags_maybe & 0x200) != 0))) { // if (( != 0 && ((engine_flags_maybe & 0x200) != 0))) {
uint16 *palette_f2_font_maybe = (uint16 *)_screen->getPalette(2); uint16 *palette_f2_font_maybe = (uint16 *)_screen->getPalette(2);
uint16 cursor3 = 0x14a5 | 0x8000; uint16 cursor3 = 0x14a5 | 0x8000;
if(_vm->isFlagSet(ENGINE_FLAG_200)) { if (_vm->isFlagSet(ENGINE_FLAG_200)) {
if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1)) { if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1)) {
updatePalEntry(palette_f2_font_maybe, 16, cursor3); updatePalEntry(palette_f2_font_maybe, 16, cursor3);
} else { } else {

View file

@ -90,7 +90,7 @@ void Inventory::init(ActorManager *actorManager, BackgroundResourceLoader *backg
_old_showing_value = 0; _old_showing_value = 0;
_bag = bag; _bag = bag;
for(int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) {
actorManager->loadActor(0, i + ACTOR_INVENTORY_OFFSET); // TODO need to share resource between inventory item actors. actorManager->loadActor(0, i + ACTOR_INVENTORY_OFFSET); // TODO need to share resource between inventory item actors.
} }
@ -166,7 +166,7 @@ void Inventory::openInventory() {
//TODO 0x800310e0 update cursor position. //TODO 0x800310e0 update cursor position.
for(int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) {
Actor *item = _vm->_actorManager->getActor(i + ACTOR_INVENTORY_OFFSET); Actor *item = _vm->_actorManager->getActor(i + ACTOR_INVENTORY_OFFSET);
item->x_pos = item->_walkDestX = invXPosTable[i] + 0x10; item->x_pos = item->_walkDestX = invXPosTable[i] + 0x10;
@ -252,7 +252,7 @@ void Inventory::closeInventory() {
} }
void Inventory::draw() { void Inventory::draw() {
if(_bag) { if (_bag) {
_bag->draw(); _bag->draw();
} }
} }
@ -390,7 +390,7 @@ bool Inventory::addItemIfPositionIsEmpty(uint16 iniId, uint16 x, uint16 y) {
bool Inventory::clearItem(uint16 iniId) { bool Inventory::clearItem(uint16 iniId) {
for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) {
if(inventoryItemTbl[i] == iniId) { if (inventoryItemTbl[i] == iniId) {
inventoryItemTbl[i] = 0; inventoryItemTbl[i] = 0;
} }
} }

View file

@ -886,7 +886,7 @@ void Minigame1::run() {
_vm->getINI(DAT_80063a40 - 1)->actor->clearFlag(ACTOR_FLAG_100); _vm->getINI(DAT_80063a40 - 1)->actor->clearFlag(ACTOR_FLAG_100);
break; break;
} }
} while( true ); } while ( true );
//TODO callMaybeResetData(); //TODO callMaybeResetData();
flickerActor->updateSequence(0x15); flickerActor->updateSequence(0x15);

View file

@ -765,7 +765,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
} }
} }
} while( true ); } while ( true );
} }

View file

@ -351,7 +351,7 @@ void Minigame3::run() {
tearBlinkActorTbl[0]->updateSequence(0); tearBlinkActorTbl[0]->updateSequence(0);
tearBlinkActorTbl[1]->updateSequence(1); tearBlinkActorTbl[1]->updateSequence(1);
local_1c2 = 0; local_1c2 = 0;
while( true ) { while ( true ) {
_vm->waitForFrames(1); _vm->waitForFrames(1);
switch(currentState) { switch(currentState) {
case 1: case 1:

View file

@ -198,7 +198,7 @@ uint16 Minigame4::runDanceBattle() {
resetActors(); resetActors();
actorTalk(bruteActor,0x3321, 0x4B6A); actorTalk(bruteActor,0x3321, 0x4B6A);
currentStep = 0; currentStep = 0;
while( true ) { while ( true ) {
if (0x11 < currentStep) { if (0x11 < currentStep) {
_vm->_talk->loadText(0x4C0C, auStack2192, 1000); _vm->_talk->loadText(0x4C0C, auStack2192, 1000);
_vm->_talk->displayDialogAroundPoint(auStack2192, 0x27,0xc,0x3321,0,0x4C0C); _vm->_talk->displayDialogAroundPoint(auStack2192, 0x27,0xc,0x3321,0,0x4C0C);

View file

@ -166,8 +166,8 @@ void Minigame5::run() {
currentState = 1; currentState = 1;
local_66 = 0; local_66 = 0;
local_50 = 0; local_50 = 0;
while( true ) { while ( true ) {
while( true ) { while ( true ) {
do { do {
_vm->waitForFrames(1); _vm->waitForFrames(1);
if ((uint)currentState - 1 < 8) { if ((uint)currentState - 1 < 8) {

View file

@ -87,7 +87,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) {
_vm->setUnkFlags(Dragons::ENGINE_UNK1_FLAG_2 | Dragons::ENGINE_UNK1_FLAG_8); _vm->setUnkFlags(Dragons::ENGINE_UNK1_FLAG_2 | Dragons::ENGINE_UNK1_FLAG_8);
for(int i=0;i < _dragonINIResource->totalRecords(); i++) { for (int i=0;i < _dragonINIResource->totalRecords(); i++) {
DragonINI *ini = _dragonINIResource->getRecord(i); DragonINI *ini = _dragonINIResource->getRecord(i);
ini->field_10 = -1; ini->field_10 = -1;
ini->field_1a_flags_maybe &= ~Dragons::INI_FLAG_10; ini->field_1a_flags_maybe &= ~Dragons::INI_FLAG_10;
@ -157,7 +157,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) {
stagePalette[i * 2 + 1] = cursorPalette[(i-0xc0) * 2 + 1]; stagePalette[i * 2 + 1] = cursorPalette[(i-0xc0) * 2 + 1];
} }
} }
for(int i = 1; i < 0x100; i ++) { for (int i = 1; i < 0x100; i ++) {
byte *stagePalette = _stage->getPalette(); byte *stagePalette = _stage->getPalette();
uint16 c = READ_LE_INT16(stagePalette + i * 2); uint16 c = READ_LE_INT16(stagePalette + i * 2);
if ((c & 0x7fff) == 0) { if ((c & 0x7fff) == 0) {
@ -166,7 +166,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) {
} }
_screen->loadPalette(0, _stage->getPalette()); _screen->loadPalette(0, _stage->getPalette());
for(int i = 1; i < 0x100; i ++) { for (int i = 1; i < 0x100; i ++) {
byte *stagePalette = _stage->getPalette(); byte *stagePalette = _stage->getPalette();
uint16 c = READ_LE_INT16(stagePalette + i * 2); uint16 c = READ_LE_INT16(stagePalette + i * 2);
if ((c & 0x7fff) == 0) { if ((c & 0x7fff) == 0) {
@ -219,7 +219,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) {
_vm->data_800633fc = 0; _vm->data_800633fc = 0;
// TODO 0x8002fff0 // TODO 0x8002fff0
for(int i=0;i < _dragonINIResource->totalRecords(); i++) { for (int i=0;i < _dragonINIResource->totalRecords(); i++) {
DragonINI *ini = _dragonINIResource->getRecord(i); DragonINI *ini = _dragonINIResource->getRecord(i);
if (ini->sceneId == sceneIdStripped) { if (ini->sceneId == sceneIdStripped) {
if (ini->field_1a_flags_maybe & 1) { if (ini->field_1a_flags_maybe & 1) {
@ -339,7 +339,7 @@ void Scene::draw() {
Common::Rect rect(_camera.x, _camera.y, _camera.x + 320, _camera.y + 200); Common::Rect rect(_camera.x, _camera.y, _camera.x + 320, _camera.y + 200);
_vm->_screen->clearScreen(); _vm->_screen->clearScreen();
for(uint16 priority = 1; priority < 16; priority++) { for (uint16 priority = 1; priority < 16; priority++) {
if (priority == 7 && _vm->isFlagSet(ENGINE_FLAG_200)) { if (priority == 7 && _vm->isFlagSet(ENGINE_FLAG_200)) {
_vm->_fontManager->updatePalette(); _vm->_fontManager->updatePalette();
} }
@ -483,7 +483,7 @@ void Scene::drawActorNumber(int16 x, int16 y, uint16 actorId) {
sprintf(text8, "%d", actorId); sprintf(text8, "%d", actorId);
for(int i = 0; i < strlen(text8); i++) { for (int i = 0; i < strlen(text8); i++) {
text[i] = text8[i]; text[i] = text8[i];
} }
_vm->_fontManager->addText(x, y, text, strlen(text8), 1); _vm->_fontManager->addText(x, y, text, strlen(text8), 1);

View file

@ -327,7 +327,7 @@ void ScriptOpcodes::opUnk6(ScriptOpCall &scriptOpCall) {
_vm->_cursor->_iniUnderCursor = field4; _vm->_cursor->_iniUnderCursor = field4;
_vm->_cursor->_sequenceID = 0; _vm->_cursor->_sequenceID = 0;
for(int16 i = field2 >> 1; i != 0; i = i >> 1) { for (int16 i = field2 >> 1; i != 0; i = i >> 1) {
_vm->_cursor->_sequenceID++; _vm->_cursor->_sequenceID++;
} }
@ -472,7 +472,7 @@ bool ScriptOpcodes::evaluateExpression(ScriptOpCall &scriptOpCall) {
int16 t2 = 0; int16 t2 = 0;
int16 t0 = 0; int16 t0 = 0;
for(;;) { for (;;) {
byte value = 0; byte value = 0;
if (*codePtrOffsetA & 1) { if (*codePtrOffsetA & 1) {
uint32 propId = READ_LE_UINT16(codePtrOffset2) * 8 + READ_LE_UINT16(codePtrOffsetA - 6); uint32 propId = READ_LE_UINT16(codePtrOffset2) * 8 + READ_LE_UINT16(codePtrOffsetA - 6);
@ -625,7 +625,7 @@ void ScriptOpcodes::opUnkE(ScriptOpCall &scriptOpCall) {
bool isFlicker = _vm->_dragonINIResource->isFlicker(ini); bool isFlicker = _vm->_dragonINIResource->isFlicker(ini);
ini->actor->startWalk(point.x, point.y, isFlicker ? 0 : 1); ini->actor->startWalk(point.x, point.y, isFlicker ? 0 : 1);
if(s3 == 0) { if (s3 == 0) {
while (ini->actor->_flags & Dragons::ACTOR_FLAG_10) { while (ini->actor->_flags & Dragons::ACTOR_FLAG_10) {
_vm->waitForFrames(1); _vm->waitForFrames(1);
} }
@ -678,7 +678,7 @@ void ScriptOpcodes::opUnkF(ScriptOpCall &scriptOpCall) {
bool isFlicker = _vm->_dragonINIResource->isFlicker(ini); bool isFlicker = _vm->_dragonINIResource->isFlicker(ini);
ini->actor->startWalk(field8, fieldA, isFlicker ? 0 : 1); ini->actor->startWalk(field8, fieldA, isFlicker ? 0 : 1);
if(s3 == 0) { if (s3 == 0) {
while (ini->actor->_flags & Dragons::ACTOR_FLAG_10) { while (ini->actor->_flags & Dragons::ACTOR_FLAG_10) {
_vm->waitForFrames(1); _vm->waitForFrames(1);
} }

View file

@ -200,7 +200,7 @@ void SequenceOpcodes::opSetField7a(Actor *actor, OpCall &opCall) {
} }
void SequenceOpcodes::opUpdateFlags(Actor *actor, OpCall &opCall) { void SequenceOpcodes::opUpdateFlags(Actor *actor, OpCall &opCall) {
if(actor->isFlagSet(ACTOR_FLAG_1000)) { if (actor->isFlagSet(ACTOR_FLAG_1000)) {
actor->setFlag(ACTOR_FLAG_4); actor->setFlag(ACTOR_FLAG_4);
} }
updateReturn(opCall, 0); updateReturn(opCall, 0);

View file

@ -139,7 +139,7 @@ bool SoundManager::getSpeechLocation(uint32 talkId, struct SpeechLocation *locat
void SoundManager::PauseCDMusic() { void SoundManager::PauseCDMusic() {
//TODO check PauseCDMusic() to see if we need any more logic. //TODO check PauseCDMusic() to see if we need any more logic.
if(isSpeechPlaying()) { if (isSpeechPlaying()) {
_vm->_mixer->stopHandle(_speechHandle); _vm->_mixer->stopHandle(_speechHandle);
_vm->clearFlags(ENGINE_FLAG_8000); _vm->clearFlags(ENGINE_FLAG_8000);
} }

View file

@ -514,10 +514,10 @@ void Talk::displayDialogAroundActor(Actor *actor, uint16 param_2, uint16 *dialog
} }
void Talk::copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLength) { void Talk::copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLength) {
for(int i = 0; i < destBufferLength - 1; i++) { for (int i = 0; i < destBufferLength - 1; i++) {
destBuffer[i] = READ_LE_UINT16(src); destBuffer[i] = READ_LE_UINT16(src);
src += 2; src += 2;
if(destBuffer[i] == 0) { if (destBuffer[i] == 0) {
return; return;
} }
} }
@ -527,7 +527,7 @@ void Talk::copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLeng
uint32 Talk::wideStrLen(uint16 *text) { uint32 Talk::wideStrLen(uint16 *text) {
int i = 0; int i = 0;
while(text[i] != 0) { while (text[i] != 0) {
i++; i++;
} }
return i; return i;