Skip to content

Commit

Permalink
Merge branch 'master' into prince-lukaslw
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jun 22, 2014
2 parents 770a453 + c340570 commit 5a8b686
Show file tree
Hide file tree
Showing 98 changed files with 2,589 additions and 520 deletions.
8 changes: 4 additions & 4 deletions audio/mixer.cpp
Expand Up @@ -333,7 +333,7 @@ void MixerImpl::stopHandle(SoundHandle handle) {
}

void MixerImpl::muteSoundType(SoundType type, bool mute) {
assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings));
_soundTypeSettings[type].mute = mute;

for (int i = 0; i != NUM_CHANNELS; ++i) {
Expand All @@ -343,7 +343,7 @@ void MixerImpl::muteSoundType(SoundType type, bool mute) {
}

bool MixerImpl::isSoundTypeMuted(SoundType type) const {
assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings));
return _soundTypeSettings[type].mute;
}

Expand Down Expand Up @@ -468,7 +468,7 @@ bool MixerImpl::hasActiveChannelOfType(SoundType type) {
}

void MixerImpl::setVolumeForSoundType(SoundType type, int volume) {
assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings));

// Check range
if (volume > kMaxMixerVolume)
Expand All @@ -489,7 +489,7 @@ void MixerImpl::setVolumeForSoundType(SoundType type, int volume) {
}

int MixerImpl::getVolumeForSoundType(SoundType type) const {
assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings));

return _soundTypeSettings[type].volume;
}
Expand Down
4 changes: 2 additions & 2 deletions backends/platform/android/gfx.cpp
Expand Up @@ -759,8 +759,8 @@ void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h,
uint16 *d = (uint16 *)tmp;
for (uint16 y = 0; y < h; ++y, d += pitch / 2 - w)
for (uint16 x = 0; x < w; ++x, d++)
if (*s++ != (keycolor & 0xffff))
*d |= 1;
if (*s++ == (keycolor & 0xffff))
*d = 0;

_mouse_texture->updateBuffer(0, 0, w, h, tmp, pitch);

Expand Down
6 changes: 6 additions & 0 deletions common/EventMapper.cpp
Expand Up @@ -37,11 +37,17 @@ List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
#ifdef ENABLE_VKEYBD
else if (ev.kbd.keycode == KEYCODE_F7 && ev.kbd.hasFlags(0)) {
mappedEvent.type = EVENT_VIRTUAL_KEYBOARD;

// Avoid blocking F7 events from engine.
addDelayedEvent(100, ev);
}
#endif
#ifdef ENABLE_KEYMAPPER
else if (ev.kbd.keycode == KEYCODE_F8 && ev.kbd.hasFlags(0)) {
mappedEvent.type = EVENT_KEYMAPPER_REMAP;

// Avoid blocking F8 events from engine.
addDelayedEvent(100, ev);
}
#endif
}
Expand Down
3 changes: 3 additions & 0 deletions configure
Expand Up @@ -967,6 +967,7 @@ Optional Libraries:
--with-freetype2-prefix=DIR Prefix where the freetype-config script is
installed (optional)
--disable-freetype2 disable freetype2 TTF library usage [autodetect]
--with-nasm-prefix=DIR Prefix where nasm executable is installed (optional)
--disable-nasm disable assembly language optimizations [autodetect]
Expand Down Expand Up @@ -2058,6 +2059,8 @@ case $_host_os in
# We have to use 'long' for our 4 byte typedef because AmigaOS already typedefs (u)int32
# as (unsigned) long, and consequently we'd get a compiler error otherwise.
type_4_byte='long'
# Supress format warnings as the long 4 byte causes noisy warnings.
CXXFLAGS="$CXXFLAGS -Wno-format"
add_line_to_config_mk 'AMIGAOS = 1'
;;
android)
Expand Down
4 changes: 4 additions & 0 deletions engines/agos/midi.cpp
Expand Up @@ -235,6 +235,10 @@ void MidiPlayer::startTrack(int track) {
_music.parser = parser; // That plugs the power cord into the wall
} else if (_music.parser) {
if (!_music.parser->setTrack(track)) {
// The Roland MT32 music in Simon the Sorcerer 2
// is missing the extra tracks in many scenes,
// like the introduction sequence.
stop();
return;
}
_currentTrack = (byte)track;
Expand Down
15 changes: 8 additions & 7 deletions engines/avalanche/animation.cpp
Expand Up @@ -764,7 +764,7 @@ void Animation::catacombMove(byte ped) {
spr1->init(5, true); // ...Load Geida.
appearPed(1, geidaPed(ped));
spr1->_callEachStepFl = true;
spr1->_eachStepProc = kProcGeida;
spr1->_eachStepProc = kProcFollowAvvy;
}
}

Expand Down Expand Up @@ -1121,7 +1121,7 @@ void Animation::spin(Direction dir, byte &tripnum) {
}
}

void Animation::geidaProcs(byte tripnum) {
void Animation::follow(byte tripnum) {
AnimationType *tripSpr = _sprites[tripnum];
AnimationType *avvy = _sprites[0];

Expand All @@ -1132,14 +1132,14 @@ void Animation::geidaProcs(byte tripnum) {
}

if (tripSpr->_y < (avvy->_y - 2)) {
// Geida is further from the screen than Avvy.
// The following NPC is further from the screen than Avvy.
spin(kDirDown, tripnum);
tripSpr->_moveY = 1;
tripSpr->_moveX = 0;
takeAStep(tripnum);
return;
} else if (tripSpr->_y > (avvy->_y + 2)) {
// Avvy is further from the screen than Geida.
// Avvy is further from the screen than the following NPC.
spin(kDirUp, tripnum);
tripSpr->_moveY = -1;
tripSpr->_moveX = 0;
Expand Down Expand Up @@ -1205,8 +1205,9 @@ void Animation::drawSprites() {
* @remarks Originally called 'trippancy_link'
*/
void Animation::animLink() {
if (_vm->_dropdown->isActive() || _vm->_seeScroll)
if (_vm->_dropdown->isActive() || !_vm->_animationsEnabled)
return;

for (int16 i = 0; i < kSpriteNumbMax; i++) {
AnimationType *curSpr = _sprites[i];
if (curSpr->_quick && curSpr->_visible)
Expand Down Expand Up @@ -1235,8 +1236,8 @@ void Animation::animLink() {
case kProcGrabAvvy :
grabAvvy(i);
break;
case kProcGeida :
geidaProcs(i);
case kProcFollowAvvy :
follow(i);
break;
default:
break;
Expand Down
5 changes: 2 additions & 3 deletions engines/avalanche/animation.h
Expand Up @@ -102,9 +102,8 @@ class Animation {
kProcBackAndForth,
kProcFaceAvvy,
kProcArrow,
kProcSpludwick, // Unused
kProcGrabAvvy,
kProcGeida // Spludwick uses it as well for homing! TODO: Unify it with kProcSpludwick.
kProcFollowAvvy
};

AnimationType *_sprites[kSpriteNumbMax];
Expand Down Expand Up @@ -167,7 +166,7 @@ class Animation {
// Movements for Homing NPCs: Spludwick and Geida.
void spin(Direction dir, byte &tripnum);
void takeAStep(byte &tripnum);
void geidaProcs(byte tripnum);
void follow(byte tripnum);

void drawSprites();
};
Expand Down
17 changes: 10 additions & 7 deletions engines/avalanche/avalanche.cpp
Expand Up @@ -57,6 +57,7 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *
_nim = nullptr;
_ghostroom = nullptr;
_help = nullptr;
_highscore = nullptr;

_platform = gd->desc.platform;
initVariables();
Expand All @@ -81,6 +82,7 @@ AvalancheEngine::~AvalancheEngine() {
delete _nim;
delete _ghostroom;
delete _help;
delete _highscore;

for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++) {
Expand Down Expand Up @@ -142,7 +144,7 @@ void AvalancheEngine::initVariables() {
_letMeOut = false;
_thinks = 2;
_thinkThing = true;
_seeScroll = false;
_animationsEnabled = true;
_currentMouse = 177;
_holdLeftMouse = false;

Expand All @@ -165,6 +167,7 @@ Common::ErrorCode AvalancheEngine::initialize() {
_nim = new Nim(this);
_ghostroom = new GhostRoom(this);
_help = new Help(this);
_highscore = new HighScore(this);

_graphics->init();
_dialogs->init();
Expand Down Expand Up @@ -200,7 +203,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
sz.syncAsByte(_carryNum);
for (int i = 0; i < kObjectNum; i++)
sz.syncAsByte(_objects[i]);
sz.syncAsSint16LE(_dnascore);
sz.syncAsSint16LE(_score);
sz.syncAsSint32LE(_money);
sz.syncAsByte(_room);
if (sz.isSaving())
Expand Down Expand Up @@ -336,8 +339,8 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {

}

bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!!
return (!_seeScroll && _alive);
bool AvalancheEngine::canSaveGameStateCurrently() {
return (_animationsEnabled && _alive);
}

Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) {
Expand Down Expand Up @@ -381,8 +384,8 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) {
return Common::String::format("%s.%03d", _targetName.c_str(), slot);
}

bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!!
return (!_seeScroll);
bool AvalancheEngine::canLoadGameStateCurrently() {
return (_animationsEnabled);
}

Common::Error AvalancheEngine::loadGameState(int slot) {
Expand Down Expand Up @@ -432,7 +435,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {

_isLoaded = true;

_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded.
_animationsEnabled = false;

if (_holdTheDawn) {
_holdTheDawn = false;
Expand Down
6 changes: 4 additions & 2 deletions engines/avalanche/avalanche.h
Expand Up @@ -46,6 +46,7 @@
#include "avalanche/help.h"
#include "avalanche/shootemup.h"
#include "avalanche/mainmenu.h"
#include "avalanche/highscore.h"

#include "common/serializer.h"

Expand Down Expand Up @@ -91,6 +92,7 @@ class AvalancheEngine : public Engine {
Nim *_nim;
GhostRoom *_ghostroom;
Help *_help;
HighScore *_highscore;

OSystem *_system;

Expand Down Expand Up @@ -150,7 +152,7 @@ class AvalancheEngine : public Engine {
// Former DNA structure
byte _carryNum; // How many objects you're carrying...
bool _objects[kObjectNum]; // ...and which ones they are.
int16 _dnascore; // your score, of course
int16 _score; // your score, of course
int32 _money; // your current amount of dosh
Room _room; // your current room
bool _wonNim; // Have you *won* Nim? (That's harder.)
Expand Down Expand Up @@ -210,7 +212,7 @@ class AvalancheEngine : public Engine {
bool _letMeOut;
byte _thinks;
bool _thinkThing;
bool _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll?
bool _animationsEnabled; // If set to TRUE, it stops the animation system working. This prevents display of the new sprites before the new picture is loaded or during the display of a scroll. Original name: seescroll.
char _objectList[10];
// Called .free() for them in ~Gyro().

Expand Down
31 changes: 14 additions & 17 deletions engines/avalanche/avalot.cpp
Expand Up @@ -202,6 +202,8 @@ void AvalancheEngine::setup() {

_graphics->drawSoundLight(_sound->_soundFl);

drawToolbar();

int16 loadSlot = ConfMan.instance().getInt("save_slot");
if (loadSlot >= 0) {
_thinks = 2; // You always have money.
Expand All @@ -218,8 +220,6 @@ void AvalancheEngine::setup() {

newGame();

drawToolbar();

thinkAbout(kObjectMoney, kThing);

_dialogs->displayScrollChain('Q', 83); // Info on the game, etc.
Expand Down Expand Up @@ -249,8 +249,6 @@ void AvalancheEngine::runAvalot() {
_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight).
};

warning("STUB: run()");

_closing->exitGame();
}

Expand Down Expand Up @@ -464,7 +462,7 @@ void AvalancheEngine::findPeople(byte room) {
void AvalancheEngine::exitRoom(byte x) {
_sound->stopSound();
_background->release();
_seeScroll = true; // This stops the trippancy system working over the length of this procedure.
_animationsEnabled = false;

switch (x) {
case kRoomSpludwicks:
Expand All @@ -487,7 +485,7 @@ void AvalancheEngine::exitRoom(byte x) {
}

_interrogation = 0; // Leaving the room cancels all the questions automatically.
_seeScroll = false; // Now it can work again!
_animationsEnabled = true;

_lastRoom = _room;
if (_room != kRoomMap)
Expand Down Expand Up @@ -534,11 +532,11 @@ void AvalancheEngine::putGeidaAt(byte whichPed, byte ped) {
spr1->init(5, false); // load Geida
_animation->appearPed(1, whichPed);
spr1->_callEachStepFl = true;
spr1->_eachStepProc = Animation::kProcGeida;
spr1->_eachStepProc = Animation::kProcFollowAvvy;
}

void AvalancheEngine::enterRoom(Room roomId, byte ped) {
_seeScroll = true; // This stops the trippancy system working over the length of this procedure.
_animationsEnabled = false;

findPeople(roomId);
_room = roomId;
Expand Down Expand Up @@ -619,7 +617,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {
}

spr1->_callEachStepFl = true;
spr1->_eachStepProc = Animation::kProcGeida;
spr1->_eachStepProc = Animation::kProcFollowAvvy;
} else
_whereIs[kPeopleSpludwick - 150] = kRoomNowhere;
break;
Expand Down Expand Up @@ -922,7 +920,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {
break;
}

_seeScroll = false; // Now it can work again!
_animationsEnabled = true;
}

void AvalancheEngine::thinkAbout(byte object, bool type) {
Expand Down Expand Up @@ -957,7 +955,7 @@ void AvalancheEngine::drawToolbar() {
}

void AvalancheEngine::drawScore() {
uint16 score = _dnascore;
uint16 score = _score;
int8 numbers[3] = {0, 0, 0};
for (int i = 0; i < 2; i++) {
byte divisor = 1;
Expand All @@ -983,15 +981,14 @@ void AvalancheEngine::drawScore() {

void AvalancheEngine::incScore(byte num) {
for (int i = 1; i <= num; i++) {
_dnascore++;
_score++;

if (_soundFx) {
for (int j = 1; j <= 97; j++)
// Length os 2 is a guess, the original doesn't have a delay specified
_sound->playNote(177 + _dnascore * 3, 2);
// Length of 2 is a guess, the original doesn't have a delay specified
_sound->playNote(177 + _score * 3, 2);
}
}
warning("STUB: points()");

drawScore();
}
Expand Down Expand Up @@ -1336,7 +1333,7 @@ void AvalancheEngine::resetVariables() {
for (int i = 0; i < kObjectNum; i++)
_objects[i] = false;

_dnascore = 0;
_score = 0;
_money = 0;
_room = kRoomNowhere;
_saveNum = 0;
Expand Down Expand Up @@ -1442,7 +1439,7 @@ void AvalancheEngine::newGame() {
_thinkThing = true;
_thinks = 2;
refreshObjectList();
_seeScroll = false;
_animationsEnabled = true;

avvy->appear(300, 117, kDirRight); // Needed to initialize Avalot.
//for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil;
Expand Down

0 comments on commit 5a8b686

Please sign in to comment.