DRAGONS: Replaced max scale with define
This commit is contained in:
parent
5e2a7a6882
commit
8c9a0cf1bb
15 changed files with 102 additions and 50 deletions
|
@ -31,7 +31,6 @@ class ActorResource;
|
||||||
struct ActorFrame;
|
struct ActorFrame;
|
||||||
|
|
||||||
#define DRAGONS_ENGINE_NUM_ACTORS 64
|
#define DRAGONS_ENGINE_NUM_ACTORS 64
|
||||||
#define DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE 256
|
|
||||||
|
|
||||||
enum ActorFlags {
|
enum ActorFlags {
|
||||||
ACTOR_FLAG_1 = 1,
|
ACTOR_FLAG_1 = 1,
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "graphics/screen.h"
|
#include "graphics/screen.h"
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
#include "background.h"
|
#include "background.h"
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
namespace Dragons {
|
namespace Dragons {
|
||||||
|
|
||||||
|
@ -286,10 +287,6 @@ Common::Point Background::getLayerOffset(uint8 layerNumber) {
|
||||||
return layerOffset[layerNumber];
|
return layerOffset[layerNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Background::getScale(int16 y) {
|
|
||||||
return _scaleLayer.getScale(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
BackgroundResourceLoader::BackgroundResourceLoader(BigfileArchive *bigFileArchive, DragonRMS *dragonRMS) : _bigFileArchive(
|
BackgroundResourceLoader::BackgroundResourceLoader(BigfileArchive *bigFileArchive, DragonRMS *dragonRMS) : _bigFileArchive(
|
||||||
bigFileArchive), _dragonRMS(dragonRMS) {}
|
bigFileArchive), _dragonRMS(dragonRMS) {}
|
||||||
|
|
||||||
|
@ -394,4 +391,38 @@ uint16 ScaleLayer::getScale(uint16 y) {
|
||||||
return uVar1 & 0xfff8u;
|
return uVar1 & 0xfff8u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScaleLayer::ScaleLayer(): _savedBands(NULL) {
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
_bands[i]._y = -1;
|
||||||
|
_bands[i]._priority = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScaleLayer::~ScaleLayer() {
|
||||||
|
delete _savedBands;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleLayer::backup() {
|
||||||
|
delete _savedBands;
|
||||||
|
_savedBands = new ScaleBand[32];
|
||||||
|
memcpy(_savedBands, _bands, sizeof(_bands));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleLayer::restore() {
|
||||||
|
assert(_savedBands);
|
||||||
|
memcpy(_bands, _savedBands, sizeof(_bands));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleLayer::clearAll() {
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
_bands[i]._y = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleLayer::setValue(uint8 index, int16 y, int16 value) {
|
||||||
|
assert(index < 32);
|
||||||
|
_bands[index]._y = y;
|
||||||
|
_bands[index]._priority = value;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Dragons
|
} // End of namespace Dragons
|
||||||
|
|
|
@ -50,11 +50,18 @@ typedef struct {
|
||||||
|
|
||||||
class ScaleLayer {
|
class ScaleLayer {
|
||||||
public:
|
public:
|
||||||
|
ScaleLayer();
|
||||||
|
~ScaleLayer();
|
||||||
void load(Common::SeekableReadStream &stream);
|
void load(Common::SeekableReadStream &stream);
|
||||||
uint16 getScale(uint16 y);
|
uint16 getScale(uint16 y);
|
||||||
|
void backup();
|
||||||
|
void restore();
|
||||||
|
void clearAll();
|
||||||
|
void setValue(uint8 index, int16 y, int16 value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ScaleBand _bands[32];
|
ScaleBand _bands[32];
|
||||||
|
ScaleBand *_savedBands;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TileMap {
|
struct TileMap {
|
||||||
|
@ -106,7 +113,7 @@ public:
|
||||||
void setPalette(byte *newPalette);
|
void setPalette(byte *newPalette);
|
||||||
void setLayerOffset(uint8 layerNumber, Common::Point offset);
|
void setLayerOffset(uint8 layerNumber, Common::Point offset);
|
||||||
Common::Point getLayerOffset(uint8 layerNumber);
|
Common::Point getLayerOffset(uint8 layerNumber);
|
||||||
int16 getScale(int16 y);
|
ScaleLayer *getScaleLayer() { return &_scaleLayer; }
|
||||||
private:
|
private:
|
||||||
Common::Point *loadPoints(Common::SeekableReadStream &stream);
|
Common::Point *loadPoints(Common::SeekableReadStream &stream);
|
||||||
Graphics::Surface *initGfxLayer(TileMap &tileMap);
|
Graphics::Surface *initGfxLayer(TileMap &tileMap);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "inventory.h"
|
#include "inventory.h"
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
#include "scriptopcodes.h"
|
#include "scriptopcodes.h"
|
||||||
|
#include "dragons/screen.h"
|
||||||
|
|
||||||
namespace Dragons {
|
namespace Dragons {
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ void Cursor::init(ActorManager *actorManager, DragonINIResource *dragonINIResour
|
||||||
_actor->y_pos = _y = 100;
|
_actor->y_pos = _y = 100;
|
||||||
_actor->priorityLayer = 6;
|
_actor->priorityLayer = 6;
|
||||||
_actor->flags = 0;
|
_actor->flags = 0;
|
||||||
_actor->scale = 0x100;
|
_actor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
_actor->updateSequence(_sequenceID);
|
_actor->updateSequence(_sequenceID);
|
||||||
_actor->flags |= (Dragons::ACTOR_FLAG_40 | Dragons::ACTOR_FLAG_80 | Dragons::ACTOR_FLAG_100 |
|
_actor->flags |= (Dragons::ACTOR_FLAG_40 | Dragons::ACTOR_FLAG_80 | Dragons::ACTOR_FLAG_100 |
|
||||||
Dragons::ACTOR_FLAG_200);
|
Dragons::ACTOR_FLAG_200);
|
||||||
|
|
|
@ -567,7 +567,7 @@ void DragonsEngine::gameLoop()
|
||||||
if (tmpId != 0) {
|
if (tmpId != 0) {
|
||||||
actor->flags = 0;
|
actor->flags = 0;
|
||||||
actor->priorityLayer = 0;
|
actor->priorityLayer = 0;
|
||||||
actor->scale = 0x100;
|
actor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
actor->updateSequence(getINI(tmpId - 1)->field_8 * 2 + 10);
|
actor->updateSequence(getINI(tmpId - 1)->field_8 * 2 + 10);
|
||||||
actor->setFlag(ACTOR_FLAG_40);
|
actor->setFlag(ACTOR_FLAG_40);
|
||||||
actor->setFlag(ACTOR_FLAG_80);
|
actor->setFlag(ACTOR_FLAG_80);
|
||||||
|
@ -584,7 +584,7 @@ void DragonsEngine::gameLoop()
|
||||||
Actor *invActor = _inventory->getInventoryItemActor(_cursor->iniItemInHand);
|
Actor *invActor = _inventory->getInventoryItemActor(_cursor->iniItemInHand);
|
||||||
invActor->flags = 0;
|
invActor->flags = 0;
|
||||||
invActor->priorityLayer = 0;
|
invActor->priorityLayer = 0;
|
||||||
invActor->scale = 0x100;
|
invActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
invActor->updateSequence(
|
invActor->updateSequence(
|
||||||
getINI(_cursor->iniItemInHand - 1)->field_8 * 2 + 10);
|
getINI(_cursor->iniItemInHand - 1)->field_8 * 2 + 10);
|
||||||
_cursor->iniItemInHand = 0;
|
_cursor->iniItemInHand = 0;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "bag.h"
|
#include "bag.h"
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
#include "talk.h"
|
#include "talk.h"
|
||||||
|
#include "dragons/screen.h"
|
||||||
|
|
||||||
namespace Dragons {
|
namespace Dragons {
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ void Inventory::init(ActorManager *actorManager, BackgroundResourceLoader *backg
|
||||||
_actor->y_pos = 0;
|
_actor->y_pos = 0;
|
||||||
_actor->priorityLayer = 6;
|
_actor->priorityLayer = 6;
|
||||||
_actor->flags = 0;
|
_actor->flags = 0;
|
||||||
_actor->scale = 0x100;
|
_actor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
_actor->updateSequence(0);
|
_actor->updateSequence(0);
|
||||||
_actor->flags |= (Dragons::ACTOR_FLAG_40 | Dragons::ACTOR_FLAG_80 | Dragons::ACTOR_FLAG_100 |
|
_actor->flags |= (Dragons::ACTOR_FLAG_40 | Dragons::ACTOR_FLAG_80 | Dragons::ACTOR_FLAG_100 |
|
||||||
Dragons::ACTOR_FLAG_200);
|
Dragons::ACTOR_FLAG_200);
|
||||||
|
@ -174,7 +175,7 @@ void Inventory::openInventory() {
|
||||||
|
|
||||||
if (inventoryItemTbl[i]) {
|
if (inventoryItemTbl[i]) {
|
||||||
item->flags = 0; //clear all flags
|
item->flags = 0; //clear all flags
|
||||||
item->scale = 0x100;
|
item->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
item->priorityLayer = 0;
|
item->priorityLayer = 0;
|
||||||
item->updateSequence(_vm->getINI(inventoryItemTbl[i] - 1)->field_8 * 2 + 10);
|
item->updateSequence(_vm->getINI(inventoryItemTbl[i] - 1)->field_8 * 2 + 10);
|
||||||
item->setFlag(ACTOR_FLAG_200);
|
item->setFlag(ACTOR_FLAG_200);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "dragons.h"
|
#include "dragons.h"
|
||||||
#include "dragons/dragonini.h"
|
#include "dragons/dragonini.h"
|
||||||
#include "dragons/talk.h"
|
#include "dragons/talk.h"
|
||||||
|
#include "dragons/screen.h"
|
||||||
|
|
||||||
namespace Dragons {
|
namespace Dragons {
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ void Minigame1::run() {
|
||||||
_vm->_dragonINIResource->setFlickerRecord(_vm->getINI(DAT_80063a40 - 1));
|
_vm->_dragonINIResource->setFlickerRecord(_vm->getINI(DAT_80063a40 - 1));
|
||||||
flickerActor = _vm->getINI(DAT_80063a40 - 1)->actor;
|
flickerActor = _vm->getINI(DAT_80063a40 - 1)->actor;
|
||||||
flickerActor->flags = flickerActor->flags | 0x380;
|
flickerActor->flags = flickerActor->flags | 0x380;
|
||||||
flickerActor->scale = 0x100;
|
flickerActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
flickerActor->priorityLayer = 4;
|
flickerActor->priorityLayer = 4;
|
||||||
flickerActor->_sequenceID2 = -1;
|
flickerActor->_sequenceID2 = -1;
|
||||||
flickerActor->updateSequence(0x15);
|
flickerActor->updateSequence(0x15);
|
||||||
|
@ -191,14 +192,14 @@ void Minigame1::run() {
|
||||||
pusherActor->flags = pusherActor->flags | 0x380;
|
pusherActor->flags = pusherActor->flags | 0x380;
|
||||||
pusherActor->x_pos = flickerActor->x_pos + -0xe;
|
pusherActor->x_pos = flickerActor->x_pos + -0xe;
|
||||||
pusherActor->y_pos = flickerActor->y_pos + 7;
|
pusherActor->y_pos = flickerActor->y_pos + 7;
|
||||||
pusherActor->scale = 0x100;
|
pusherActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
pusherActor->priorityLayer = 6;
|
pusherActor->priorityLayer = 6;
|
||||||
wheelsActor = _vm->_actorManager->loadActor(7,0x11,0,0);
|
wheelsActor = _vm->_actorManager->loadActor(7,0x11,0,0);
|
||||||
// if (wheelsActorId == -1) {
|
// if (wheelsActorId == -1) {
|
||||||
// ProbablyShowASCIIMessage(s_couldn't_alloc_wheels_8008e96c,2,4,0,0xffffffff);
|
// ProbablyShowASCIIMessage(s_couldn't_alloc_wheels_8008e96c,2,4,0,0xffffffff);
|
||||||
// }
|
// }
|
||||||
wheelsActor->flags = wheelsActor->flags | 0x380;
|
wheelsActor->flags = wheelsActor->flags | 0x380;
|
||||||
wheelsActor->scale = 0x100;
|
wheelsActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
wheelsActor->x_pos = flickerActor->x_pos;
|
wheelsActor->x_pos = flickerActor->x_pos;
|
||||||
wheelsActor->y_pos = flickerActor->y_pos;
|
wheelsActor->y_pos = flickerActor->y_pos;
|
||||||
wheelsActor->priorityLayer = 5;
|
wheelsActor->priorityLayer = 5;
|
||||||
|
@ -209,7 +210,7 @@ void Minigame1::run() {
|
||||||
// ProbablyShowASCIIMessage(s_couldn't_alloc-cat_8008e984,2,4,0,0xffffffff);
|
// ProbablyShowASCIIMessage(s_couldn't_alloc-cat_8008e984,2,4,0,0xffffffff);
|
||||||
// }
|
// }
|
||||||
catActor->flags = catActor->flags | 0x380;
|
catActor->flags = catActor->flags | 0x380;
|
||||||
catActor->scale = 0x100;
|
catActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
catActor->priorityLayer = 0;
|
catActor->priorityLayer = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 3) {
|
while (i < 3) {
|
||||||
|
@ -218,7 +219,7 @@ void Minigame1::run() {
|
||||||
// ProbablyShowASCIIMessage(s_couldn't_alloc_target!_8008e998,2,4,0,0xffffffff);
|
// ProbablyShowASCIIMessage(s_couldn't_alloc_target!_8008e998,2,4,0,0xffffffff);
|
||||||
// }
|
// }
|
||||||
targetActorIdTbl[(uint)i + 1]->flags = targetActorIdTbl[(uint)i + 1]->flags | 0x380;
|
targetActorIdTbl[(uint)i + 1]->flags = targetActorIdTbl[(uint)i + 1]->flags | 0x380;
|
||||||
targetActorIdTbl[(uint)i + 1]->scale = 0x100;
|
targetActorIdTbl[(uint)i + 1]->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
auStack378[(uint)i] = 0;
|
auStack378[(uint)i] = 0;
|
||||||
//TODO FUN_80017010_update_actor_texture_maybe(1);
|
//TODO FUN_80017010_update_actor_texture_maybe(1);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
|
@ -233,7 +234,7 @@ void Minigame1::run() {
|
||||||
// ProbablyShowASCIIMessage(s_couldn't_alloc_dust_sprite!_8008e9b0,2,5,0,0xffffffff);
|
// ProbablyShowASCIIMessage(s_couldn't_alloc_dust_sprite!_8008e9b0,2,5,0,0xffffffff);
|
||||||
// }
|
// }
|
||||||
dustSpriteActor->flags = dustSpriteActor->flags | 0x380;
|
dustSpriteActor->flags = dustSpriteActor->flags | 0x380;
|
||||||
dustSpriteActor->scale = 0x100;
|
dustSpriteActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
uVar1 = _vm->getINI(DAT_80063a48 - 1)->actor; //dragon_ini_pointer[DAT_80063a48 + -1].actorId;
|
uVar1 = _vm->getINI(DAT_80063a48 - 1)->actor; //dragon_ini_pointer[DAT_80063a48 + -1].actorId;
|
||||||
local_21e = 0;
|
local_21e = 0;
|
||||||
actorFieldC = uVar1->field_c;
|
actorFieldC = uVar1->field_c;
|
||||||
|
@ -382,7 +383,7 @@ void Minigame1::run() {
|
||||||
local_23a = (local_25a + 3) * 0x80;
|
local_23a = (local_25a + 3) * 0x80;
|
||||||
catActor->y_pos = 0x5a;
|
catActor->y_pos = 0x5a;
|
||||||
catFieldE_scaleMaybe = 0x100;
|
catFieldE_scaleMaybe = 0x100;
|
||||||
catActor->scale = 0x100;
|
catActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
catActor->updateSequence(0xc);
|
catActor->updateSequence(0xc);
|
||||||
_vm->playOrStopSound(5);
|
_vm->playOrStopSound(5);
|
||||||
catActor->priorityLayer = 3;
|
catActor->priorityLayer = 3;
|
||||||
|
@ -586,7 +587,7 @@ void Minigame1::run() {
|
||||||
else {
|
else {
|
||||||
if ((int)(uint)(local_240 >> 7) < (int)((uint)flickerXPos - 0x32)) {
|
if ((int)(uint)(local_240 >> 7) < (int)((uint)flickerXPos - 0x32)) {
|
||||||
if (catActor->_sequenceID != 9) {
|
if (catActor->_sequenceID != 9) {
|
||||||
catActor->scale = 0x100;
|
catActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
catActor->updateSequence(9);
|
catActor->updateSequence(9);
|
||||||
}
|
}
|
||||||
local_240 = local_240 + 0x180;
|
local_240 = local_240 + 0x180;
|
||||||
|
@ -595,7 +596,7 @@ void Minigame1::run() {
|
||||||
else {
|
else {
|
||||||
if ((uint)flickerXPos + 0x32 < (uint)(local_240 >> 7)) {
|
if ((uint)flickerXPos + 0x32 < (uint)(local_240 >> 7)) {
|
||||||
if (catActor->_sequenceID != 10) {
|
if (catActor->_sequenceID != 10) {
|
||||||
catActor->scale = 0x100;
|
catActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
catActor->updateSequence(10);
|
catActor->updateSequence(10);
|
||||||
}
|
}
|
||||||
local_240 = local_240 - 0x180;
|
local_240 = local_240 - 0x180;
|
||||||
|
|
|
@ -222,7 +222,7 @@ void Minigame3::run() {
|
||||||
error("Couldn't alloc tear");
|
error("Couldn't alloc tear");
|
||||||
}
|
}
|
||||||
tearActorTbl[(int16)i]->flags = tearActorTbl[(int16)i]->flags | 0x380;
|
tearActorTbl[(int16)i]->flags = tearActorTbl[(int16)i]->flags | 0x380;
|
||||||
tearActorTbl[(int16)i]->scale = 0x100;
|
tearActorTbl[(int16)i]->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
tearActorTbl[(int16)i]->priorityLayer = 0;
|
tearActorTbl[(int16)i]->priorityLayer = 0;
|
||||||
local_208[(int16)i] = -1;
|
local_208[(int16)i] = -1;
|
||||||
local_208[(int)(int16)i + 8] = 0;
|
local_208[(int)(int16)i + 8] = 0;
|
||||||
|
@ -240,7 +240,7 @@ void Minigame3::run() {
|
||||||
handActorId->setFlag(ACTOR_FLAG_800);
|
handActorId->setFlag(ACTOR_FLAG_800);
|
||||||
handActorId->setFlag(ACTOR_FLAG_2000);
|
handActorId->setFlag(ACTOR_FLAG_2000);
|
||||||
handActorId->setFlag(ACTOR_FLAG_4000);
|
handActorId->setFlag(ACTOR_FLAG_4000);
|
||||||
handActorId->scale = 0x100;
|
handActorId->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
handActorId->priorityLayer = 0;
|
handActorId->priorityLayer = 0;
|
||||||
handActorId->field_7c = 0x40000;
|
handActorId->field_7c = 0x40000;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -250,7 +250,7 @@ void Minigame3::run() {
|
||||||
error("Couldn't alloc tear blink");
|
error("Couldn't alloc tear blink");
|
||||||
}
|
}
|
||||||
tearBlinkActorTbl[(int16)i]->flags = tearBlinkActorTbl[(int16)i]->flags | 0x4384;
|
tearBlinkActorTbl[(int16)i]->flags = tearBlinkActorTbl[(int16)i]->flags | 0x4384;
|
||||||
tearBlinkActorTbl[(int16)i]->scale = 0x100;
|
tearBlinkActorTbl[(int16)i]->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
tearBlinkActorTbl[(int16)i]->priorityLayer = 0;
|
tearBlinkActorTbl[(int16)i]->priorityLayer = 0;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ void Minigame3::run() {
|
||||||
}
|
}
|
||||||
tearBlinkActorTbl2[(int16)i]->setFlag(ACTOR_FLAG_100);
|
tearBlinkActorTbl2[(int16)i]->setFlag(ACTOR_FLAG_100);
|
||||||
tearBlinkActorTbl2[(int16)i]->setFlag(ACTOR_FLAG_800);
|
tearBlinkActorTbl2[(int16)i]->setFlag(ACTOR_FLAG_800);
|
||||||
tearBlinkActorTbl2[(int16)i]->scale = 0x100;
|
tearBlinkActorTbl2[(int16)i]->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
tearBlinkActorTbl2[(int16)i]->priorityLayer = 0;
|
tearBlinkActorTbl2[(int16)i]->priorityLayer = 0;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "dragons/dragonini.h"
|
#include "dragons/dragonini.h"
|
||||||
#include "dragons/talk.h"
|
#include "dragons/talk.h"
|
||||||
#include "dragons/scene.h"
|
#include "dragons/scene.h"
|
||||||
|
#include "dragons/screen.h"
|
||||||
|
|
||||||
namespace Dragons {
|
namespace Dragons {
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ void Minigame5::run() {
|
||||||
uint16 local_76;
|
uint16 local_76;
|
||||||
ushort local_74;
|
ushort local_74;
|
||||||
ushort local_72;
|
ushort local_72;
|
||||||
ushort local_70;
|
ushort bombScale;
|
||||||
Actor *bombActor;
|
Actor *bombActor;
|
||||||
Actor *flickerActor;
|
Actor *flickerActor;
|
||||||
Actor *pusherActor;
|
Actor *pusherActor;
|
||||||
|
@ -107,7 +108,7 @@ void Minigame5::run() {
|
||||||
_vm->_dragonINIResource->setFlickerRecord(_vm->_dragonINIResource->getRecord(DAT_80063a40 - 1));
|
_vm->_dragonINIResource->setFlickerRecord(_vm->_dragonINIResource->getRecord(DAT_80063a40 - 1));
|
||||||
flickerActor = _vm->_dragonINIResource->getFlickerRecord()->actor;
|
flickerActor = _vm->_dragonINIResource->getFlickerRecord()->actor;
|
||||||
flickerActor->flags = flickerActor->flags | 0x380;
|
flickerActor->flags = flickerActor->flags | 0x380;
|
||||||
flickerActor->scale = 0x100;
|
flickerActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
flickerActor->priorityLayer = 4;
|
flickerActor->priorityLayer = 4;
|
||||||
flickerActor->_sequenceID2 = -1;
|
flickerActor->_sequenceID2 = -1;
|
||||||
flickerActor->updateSequence(0x19);
|
flickerActor->updateSequence(0x19);
|
||||||
|
@ -126,7 +127,7 @@ void Minigame5::run() {
|
||||||
pusherActor->flags = pusherActor->flags | 0x380;
|
pusherActor->flags = pusherActor->flags | 0x380;
|
||||||
pusherActor->x_pos = flickerActor->x_pos + -0xe;
|
pusherActor->x_pos = flickerActor->x_pos + -0xe;
|
||||||
pusherActor->y_pos = flickerActor->y_pos + 7;
|
pusherActor->y_pos = flickerActor->y_pos + 7;
|
||||||
pusherActor->scale = 0x100;
|
pusherActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
pusherActor->priorityLayer = 6;
|
pusherActor->priorityLayer = 6;
|
||||||
// DisableVSyncEvent();
|
// DisableVSyncEvent();
|
||||||
wheelsActor = _vm->_actorManager->loadActor(7,0x11,0,0);
|
wheelsActor = _vm->_actorManager->loadActor(7,0x11,0,0);
|
||||||
|
@ -135,7 +136,7 @@ void Minigame5::run() {
|
||||||
error("Couldn't alloc wheels!");
|
error("Couldn't alloc wheels!");
|
||||||
}
|
}
|
||||||
wheelsActor->flags = wheelsActor->flags | 0x380;
|
wheelsActor->flags = wheelsActor->flags | 0x380;
|
||||||
wheelsActor->scale = 0x100;
|
wheelsActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
wheelsActor->x_pos = flickerActor->x_pos;
|
wheelsActor->x_pos = flickerActor->x_pos;
|
||||||
wheelsActor->y_pos = flickerActor->y_pos;
|
wheelsActor->y_pos = flickerActor->y_pos;
|
||||||
wheelsActor->priorityLayer = 5;
|
wheelsActor->priorityLayer = 5;
|
||||||
|
@ -148,7 +149,7 @@ void Minigame5::run() {
|
||||||
error("Couldn't alloc bomb!");
|
error("Couldn't alloc bomb!");
|
||||||
}
|
}
|
||||||
bombActor->flags = bombActor->flags | 0x380;
|
bombActor->flags = bombActor->flags | 0x380;
|
||||||
bombActor->scale = 0x100;
|
bombActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
bombActor->priorityLayer = 0;
|
bombActor->priorityLayer = 0;
|
||||||
// DisableVSyncEvent();
|
// DisableVSyncEvent();
|
||||||
dustActor = _vm->_actorManager->loadActor(8,8,100,100,0);
|
dustActor = _vm->_actorManager->loadActor(8,8,100,100,0);
|
||||||
|
@ -157,7 +158,7 @@ void Minigame5::run() {
|
||||||
error("Couldn't alloc dust sprite!");
|
error("Couldn't alloc dust sprite!");
|
||||||
}
|
}
|
||||||
dustActor->flags = dustActor->flags | 0x380;
|
dustActor->flags = dustActor->flags | 0x380;
|
||||||
dustActor->scale = 0x100;
|
dustActor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
local_4e = _vm->_dragonINIResource->getRecord(DAT_80063a48 + -1)->actor;
|
local_4e = _vm->_dragonINIResource->getRecord(DAT_80063a48 + -1)->actor;
|
||||||
local_4c = 0;
|
local_4c = 0;
|
||||||
local_4a = local_4e->field_c;
|
local_4a = local_4e->field_c;
|
||||||
|
@ -279,8 +280,8 @@ void Minigame5::run() {
|
||||||
local_5e = 0x2d00;
|
local_5e = 0x2d00;
|
||||||
local_5a = (local_72 + 3) * 0x80;
|
local_5a = (local_72 + 3) * 0x80;
|
||||||
bombActor->y_pos = 0x5a;
|
bombActor->y_pos = 0x5a;
|
||||||
local_70 = 0x100;
|
bombScale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
bombActor->scale = 0x100;
|
bombActor->scale = bombScale;
|
||||||
_vm->playOrStopSound(10);
|
_vm->playOrStopSound(10);
|
||||||
bombActor->priorityLayer = 3;
|
bombActor->priorityLayer = 3;
|
||||||
flickerActor->updateSequence(8);
|
flickerActor->updateSequence(8);
|
||||||
|
@ -294,7 +295,7 @@ void Minigame5::run() {
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
local_60 = local_60 + local_5c;
|
local_60 = local_60 + local_5c;
|
||||||
if ((uint)local_72 * 2 + 0xb4 < (uint)local_70) {
|
if ((uint)local_72 * 2 + 0xb4 < (uint)bombScale) {
|
||||||
local_5e = local_5e - local_5a;
|
local_5e = local_5e - local_5a;
|
||||||
local_5a = local_5a - local_28[((uint)local_72 - 1) * 3];
|
local_5a = local_5a - local_28[((uint)local_72 - 1) * 3];
|
||||||
if (local_5a < 0) {
|
if (local_5a < 0) {
|
||||||
|
@ -302,7 +303,7 @@ void Minigame5::run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((int)(uint)local_70 < (int)((uint)local_72 * -4 + 0xba)) {
|
if ((int)(uint)bombScale < (int)((uint)local_72 * -4 + 0xba)) {
|
||||||
local_5e = local_5e + local_5a;
|
local_5e = local_5e + local_5a;
|
||||||
local_5a = local_5a + local_28[((uint)local_72 - 1) * 3 + 2];
|
local_5a = local_5a + local_28[((uint)local_72 - 1) * 3 + 2];
|
||||||
}
|
}
|
||||||
|
@ -312,9 +313,9 @@ void Minigame5::run() {
|
||||||
}
|
}
|
||||||
bombActor->x_pos = local_60 >> 7;
|
bombActor->x_pos = local_60 >> 7;
|
||||||
bombActor->y_pos = local_5e >> 7;
|
bombActor->y_pos = local_5e >> 7;
|
||||||
local_70 = local_70 - 3;
|
bombScale = bombScale - 3;
|
||||||
bombActor->scale = local_70;
|
bombActor->scale = bombScale;
|
||||||
if (local_70 == 0x7f) {
|
if (bombScale == 0x7f) {
|
||||||
if (((local_60 >> 7 < local_30[0]) || (local_30[1] < local_60 >> 7)) ||
|
if (((local_60 >> 7 < local_30[0]) || (local_30[1] < local_60 >> 7)) ||
|
||||||
(local_72 != local_30[2])) {
|
(local_72 != local_30[2])) {
|
||||||
local_42 = 8;
|
local_42 = 8;
|
||||||
|
@ -346,13 +347,13 @@ void Minigame5::run() {
|
||||||
currentState = 8;
|
currentState = 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (local_70 < 0x7f) {
|
if (bombScale < 0x7f) {
|
||||||
bombActor->priorityLayer = 2;
|
bombActor->priorityLayer = 2;
|
||||||
}
|
}
|
||||||
if ((0xc < local_70) && (local_70 < 0x41)) {
|
if ((0xc < bombScale) && (bombScale < 0x41)) {
|
||||||
bombActor->priorityLayer = 0;
|
bombActor->priorityLayer = 0;
|
||||||
}
|
}
|
||||||
if ((short)local_70 < 2) {
|
if ((short)bombScale < 2) {
|
||||||
currentState = 5;
|
currentState = 5;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -370,7 +370,7 @@ void Scene::draw() {
|
||||||
Graphics::Surface *s = actor->surface;
|
Graphics::Surface *s = actor->surface;
|
||||||
if (actor->priorityLayer == priority) { //} && x + s->w < 320 && y + s->h < 200) {
|
if (actor->priorityLayer == priority) { //} && x + s->w < 320 && y + s->h < 200) {
|
||||||
if (!actor->isFlagSet(ACTOR_FLAG_80)) {
|
if (!actor->isFlagSet(ACTOR_FLAG_80)) {
|
||||||
actor->scale = _stage->getScale(actor->y_pos);
|
actor->scale = _stage->getScaleLayer()->getScale(actor->y_pos);
|
||||||
}
|
}
|
||||||
int x = actor->x_pos - (actor->frame->xOffset * actor->scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE) - (actor->isFlagSet(ACTOR_FLAG_200) ? 0 : _camera.x);
|
int x = actor->x_pos - (actor->frame->xOffset * actor->scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE) - (actor->isFlagSet(ACTOR_FLAG_200) ? 0 : _camera.x);
|
||||||
int y = actor->y_pos - (actor->frame->yOffset * actor->scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE) - (actor->isFlagSet(ACTOR_FLAG_200) ? 0 : _camera.y);
|
int y = actor->y_pos - (actor->frame->yOffset * actor->scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE) - (actor->isFlagSet(ACTOR_FLAG_200) ? 0 : _camera.y);
|
||||||
|
@ -515,4 +515,8 @@ void Scene::drawBgLayer(uint8 layerNumber, Common::Rect rect, Graphics::Surface
|
||||||
_screen->copyRectToSurface8bpp(*surface, _screen->getPalette(0), 0, 0, rect, false, 128);
|
_screen->copyRectToSurface8bpp(*surface, _screen->getPalette(0), 0, 0, rect, false, 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScaleLayer *Scene::getScaleLayer() {
|
||||||
|
return _stage->getScaleLayer();
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Dragons
|
} // End of namespace Dragons
|
||||||
|
|
|
@ -37,6 +37,7 @@ class DragonINIResource;
|
||||||
class BigfileArchive;
|
class BigfileArchive;
|
||||||
class Screen;
|
class Screen;
|
||||||
class ScriptOpcodes;
|
class ScriptOpcodes;
|
||||||
|
class ScaleLayer;
|
||||||
struct DragonINI;
|
struct DragonINI;
|
||||||
|
|
||||||
class Scene {
|
class Scene {
|
||||||
|
@ -83,6 +84,7 @@ public:
|
||||||
|
|
||||||
void setLayerOffset(uint8 layerNumber, Common::Point offset);
|
void setLayerOffset(uint8 layerNumber, Common::Point offset);
|
||||||
Common::Point getLayerOffset(uint8 layerNumber);
|
Common::Point getLayerOffset(uint8 layerNumber);
|
||||||
|
ScaleLayer *getScaleLayer();
|
||||||
private:
|
private:
|
||||||
void resetActorFrameFlags();
|
void resetActorFrameFlags();
|
||||||
void drawActorNumber(int16 x, int16 y, uint16 actorId);
|
void drawActorNumber(int16 x, int16 y, uint16 actorId);
|
||||||
|
|
|
@ -168,7 +168,9 @@ void Screen::copyRectToSurface8bpp(const void *buffer, byte* palette, int srcPit
|
||||||
void Screen::drawScaledSprite(Graphics::Surface *destSurface, byte *source, int sourceWidth, int sourceHeight,
|
void Screen::drawScaledSprite(Graphics::Surface *destSurface, byte *source, int sourceWidth, int sourceHeight,
|
||||||
int destX, int destY, int destWidth, int destHeight, byte *palette, bool flipX, uint8 alpha) {
|
int destX, int destY, int destWidth, int destHeight, byte *palette, bool flipX, uint8 alpha) {
|
||||||
// Based on the GNAP engine scaling code
|
// Based on the GNAP engine scaling code
|
||||||
// TODO Implement flipping
|
if (destWidth == 0 || destHeight == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const int xs = ((sourceWidth - 1) << 16) / destWidth;
|
const int xs = ((sourceWidth - 1) << 16) / destWidth;
|
||||||
const int ys = ((sourceHeight -1) << 16) / destHeight;
|
const int ys = ((sourceHeight -1) << 16) / destHeight;
|
||||||
int clipX = 0, clipY = 0;
|
int clipX = 0, clipY = 0;
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
Graphics::PixelFormat getPixelFormat() { return _pixelFormat; }
|
Graphics::PixelFormat getPixelFormat() { return _pixelFormat; }
|
||||||
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY);
|
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY);
|
||||||
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, Common::Rect srcRect, bool flipX = false, uint8 alpha = 255);
|
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, Common::Rect srcRect, bool flipX = false, uint8 alpha = 255);
|
||||||
void copyRectToSurface8bpp(const Graphics::Surface &srcSurface, byte *palette, int destX, int destY, Common::Rect srcRect, bool flipX = false, uint8 alpha = 255, uint16 scale = 0x100);
|
void copyRectToSurface8bpp(const Graphics::Surface &srcSurface, byte *palette, int destX, int destY, Common::Rect srcRect, bool flipX = false, uint8 alpha = 255, uint16 scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE);
|
||||||
void updateScreen();
|
void updateScreen();
|
||||||
void loadPalette(uint16 paletteNum, byte *palette);
|
void loadPalette(uint16 paletteNum, byte *palette);
|
||||||
byte *getPalette(uint16 paletteNum);
|
byte *getPalette(uint16 paletteNum);
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "dragons/actor.h"
|
#include "dragons/actor.h"
|
||||||
#include "dragons/sound.h"
|
#include "dragons/sound.h"
|
||||||
#include "dragons/talk.h"
|
#include "dragons/talk.h"
|
||||||
|
#include "dragons/screen.h"
|
||||||
#include "scriptopcodes.h"
|
#include "scriptopcodes.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -933,7 +934,7 @@ void ScriptOpcodes::opCode_UnkA_setsProperty(ScriptOpCall &scriptOpCall) {
|
||||||
if (field2 == 0x1a && ini->field_1a_flags_maybe & 1 && ini->sceneId == _vm->getCurrentSceneId()) {
|
if (field2 == 0x1a && ini->field_1a_flags_maybe & 1 && ini->sceneId == _vm->getCurrentSceneId()) {
|
||||||
if (s1 & 2) {
|
if (s1 & 2) {
|
||||||
ini->actor->flags |= Dragons::ACTOR_FLAG_80;
|
ini->actor->flags |= Dragons::ACTOR_FLAG_80;
|
||||||
ini->actor->scale = 0x100;
|
ini->actor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
} else {
|
} else {
|
||||||
ini->actor->flags &= ~Dragons::ACTOR_FLAG_80;
|
ini->actor->flags &= ~Dragons::ACTOR_FLAG_80;
|
||||||
}
|
}
|
||||||
|
@ -1232,7 +1233,7 @@ void ScriptOpcodes::opCode_Unk7(ScriptOpCall &scriptOpCall) {
|
||||||
Actor *actor = _vm->_inventory->getInventoryItemActor(_vm->_cursor->iniItemInHand);
|
Actor *actor = _vm->_inventory->getInventoryItemActor(_vm->_cursor->iniItemInHand);
|
||||||
actor->flags = 0;
|
actor->flags = 0;
|
||||||
actor->priorityLayer = 0;
|
actor->priorityLayer = 0;
|
||||||
actor->scale = 0x100;
|
actor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
actor->updateSequence((_vm->getINI(_vm->_cursor->iniItemInHand - 1)->field_8 * 2 + 10) & 0xfffe);
|
actor->updateSequence((_vm->getINI(_vm->_cursor->iniItemInHand - 1)->field_8 * 2 + 10) & 0xfffe);
|
||||||
actor->setFlag(ACTOR_FLAG_40);
|
actor->setFlag(ACTOR_FLAG_40);
|
||||||
actor->setFlag(ACTOR_FLAG_80);
|
actor->setFlag(ACTOR_FLAG_80);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dragons/actorresource.h"
|
#include "dragons/actorresource.h"
|
||||||
|
#include "dragons/background.h"
|
||||||
#include "dragons/cursor.h"
|
#include "dragons/cursor.h"
|
||||||
#include "dragons/cutscene.h"
|
#include "dragons/cutscene.h"
|
||||||
#include "dragons/credits.h"
|
#include "dragons/credits.h"
|
||||||
|
@ -410,7 +411,7 @@ void SpecialOpcodes::spcStGeorgeDragonLanded() {
|
||||||
origActor->reset_maybe();
|
origActor->reset_maybe();
|
||||||
// reset_actor_maybe();
|
// reset_actor_maybe();
|
||||||
ini121->actor->setFlag(ACTOR_FLAG_80);
|
ini121->actor->setFlag(ACTOR_FLAG_80);
|
||||||
ini121->actor->scale = 0x100;
|
ini121->actor->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
ini121->actor->priorityLayer = 2;
|
ini121->actor->priorityLayer = 2;
|
||||||
ini121->actorResourceId = 0x48;
|
ini121->actorResourceId = 0x48;
|
||||||
|
|
||||||
|
@ -497,15 +498,16 @@ void SpecialOpcodes::spcStopFlameBedroomEscapeSceneLogic() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecialOpcodes::spcCastleMoatFull() {
|
void SpecialOpcodes::spcCastleMoatFull() {
|
||||||
//TODO
|
_vm->_scene->getScaleLayer()->backup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecialOpcodes::spcCastleRestoreScalePoints() {
|
void SpecialOpcodes::spcCastleRestoreScalePoints() {
|
||||||
//TODO spcCastleRestoreScalePoints
|
_vm->_scene->getScaleLayer()->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecialOpcodes::spcCastleMoatUpdateActorSceneScalePoints() {
|
void SpecialOpcodes::spcCastleMoatUpdateActorSceneScalePoints() {
|
||||||
//TODO
|
_vm->_scene->getScaleLayer()->clearAll();
|
||||||
|
_vm->_scene->getScaleLayer()->setValue(0, 199, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecialOpcodes::spcCastleGateMoatDrainedSceneLogic() {
|
void SpecialOpcodes::spcCastleGateMoatDrainedSceneLogic() {
|
||||||
|
@ -514,7 +516,7 @@ void SpecialOpcodes::spcCastleGateMoatDrainedSceneLogic() {
|
||||||
void SpecialOpcodes::spcUnk34() {
|
void SpecialOpcodes::spcUnk34() {
|
||||||
Actor *flicker = _vm->_dragonINIResource->getFlickerRecord()->actor;
|
Actor *flicker = _vm->_dragonINIResource->getFlickerRecord()->actor;
|
||||||
flicker->setFlag(ACTOR_FLAG_80);
|
flicker->setFlag(ACTOR_FLAG_80);
|
||||||
flicker->scale = 0x100;
|
flicker->scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecialOpcodes::spcFlickerClearFlag0x80() {
|
void SpecialOpcodes::spcFlickerClearFlag0x80() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue