AGS: Fixed few type cast warnings

From upstream 3085660c96318f2fb4943aff6fc41dfcd6a00c3d
This commit is contained in:
Paul Gilbert 2021-06-07 20:38:39 -07:00
parent c7ce28934a
commit 46ddd20145
6 changed files with 13 additions and 14 deletions

View File

@ -180,7 +180,7 @@ int mgetbutton() {
}
bool ags_misbuttondown(int but) {
return mouse_button_poll() & MB_ARRAY[but];
return (mouse_button_poll() & MB_ARRAY[but]) != 0;
}
int ags_mgetbutton() {

View File

@ -68,7 +68,7 @@ char *FileBasedAGSDebugger::GetNextMessage() {
// check again, because the editor might have deleted the file in the meantime
return nullptr;
}
int fileSize = in->GetLength();
soff_t fileSize = in->GetLength();
char *msg = (char *)malloc(fileSize + 1);
in->Read(msg, fileSize);
delete in;

View File

@ -21,7 +21,6 @@
*/
#include "ags/lib/std/algorithm.h"
//include <cstdio>
#include "ags/lib/allegro.h" // find files
#include "ags/engine/gui/gui_dialog.h"
#include "ags/shared/ac/common.h"

View File

@ -40,7 +40,7 @@
namespace AGS3 {
SOUNDCLIP *my_load_wave(const AssetPath &asset_name, int voll, int loop) {
SOUNDCLIP *my_load_wave(const AssetPath &asset_name, int voll, bool loop) {
Common::SeekableReadStream *data = _GP(AssetMgr)->OpenAssetStream(asset_name.Name, asset_name.Filter);
if (data) {
Audio::AudioStream *audioStream = Audio::makeWAVStream(data, DisposeAfterUse::YES);
@ -86,16 +86,16 @@ SOUNDCLIP *my_load_ogg(const AssetPath &asset_name, int voll) {
return my_load_static_ogg(asset_name, voll, false);
}
SOUNDCLIP *my_load_midi(const AssetPath &asset_name, bool repeat) {
SOUNDCLIP *my_load_midi(const AssetPath &asset_name, bool loop) {
Common::SeekableReadStream *data = _GP(AssetMgr)->OpenAssetStream(asset_name.Name, asset_name.Filter);
if (data) {
return new MYMIDI(data, repeat);
return new MYMIDI(data, loop);
} else {
return nullptr;
}
}
SOUNDCLIP *my_load_mod(const AssetPath &asset_name, bool repeat) {
SOUNDCLIP *my_load_mod(const AssetPath &asset_name, bool loop) {
Common::SeekableReadStream *data = _GP(AssetMgr)->OpenAssetStream(asset_name.Name, asset_name.Filter);
if (data) {
// determine the file extension
@ -126,7 +126,7 @@ SOUNDCLIP *my_load_mod(const AssetPath &asset_name, bool repeat) {
return nullptr;
}
return new SoundClipWave<MUS_MOD>(audioStream, 255, repeat);
return new SoundClipWave<MUS_MOD>(audioStream, 255, loop);
} else {
return nullptr;
}

View File

@ -34,13 +34,13 @@
namespace AGS3 {
SOUNDCLIP *my_load_wave(const AssetPath &asset_name, int voll, int loop);
SOUNDCLIP *my_load_wave(const AssetPath &asset_name, int voll, bool loop);
SOUNDCLIP *my_load_mp3(const AssetPath &asset_name, int voll);
SOUNDCLIP *my_load_static_mp3(const AssetPath &asset_name, int voll, bool loop);
SOUNDCLIP *my_load_static_ogg(const AssetPath &asset_name, int voll, bool loop);
SOUNDCLIP *my_load_ogg(const AssetPath &asset_name, int voll);
SOUNDCLIP *my_load_midi(const AssetPath &asset_name, bool repeat);
SOUNDCLIP *my_load_mod(const AssetPath &asset_name, bool repeat);
SOUNDCLIP *my_load_midi(const AssetPath &asset_name, bool loop);
SOUNDCLIP *my_load_mod(const AssetPath &asset_name, bool loop);
} // namespace AGS3

View File

@ -536,7 +536,7 @@ void IAGSEngine::PlaySoundChannel(int32 channel, int32 soundType, int32 volume,
AssetPath asset_name(filename, "audio");
if (soundType == PSND_WAVE)
newcha = my_load_wave(asset_name, volume, loop);
newcha = my_load_wave(asset_name, volume, (loop != 0));
else if (soundType == PSND_MP3STREAM)
newcha = my_load_mp3(asset_name, volume);
else if (soundType == PSND_OGGSTREAM)
@ -548,10 +548,10 @@ void IAGSEngine::PlaySoundChannel(int32 channel, int32 soundType, int32 volume,
else if (soundType == PSND_MIDI) {
if (_GP(play).silent_midi != 0 || _G(current_music_type) == MUS_MIDI)
quit("!IAGSEngine::PlaySoundChannel: MIDI already in use");
newcha = my_load_midi(asset_name, loop);
newcha = my_load_midi(asset_name, (loop != 0));
newcha->set_volume(volume);
} else if (soundType == PSND_MOD) {
newcha = my_load_mod(asset_name, loop);
newcha = my_load_mod(asset_name, (loop != 0));
newcha->set_volume(volume);
} else
quit("!IAGSEngine::PlaySoundChannel: unknown sound type");