[Scummvm-git-logs] scummvm master -> c2dc7c9e86fa4b5e7ef917d2d6acd936dbc5273a
dreammaster
dreammaster at scummvm.org
Sat Jul 24 03:10:39 UTC 2021
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2a3bfcf8c6 AGS: Clear methodName in RuntimeScriptValue for other data types
2702b13768 AGS: Built-in script methods were being added to wrong import list
c2dc7c9e86 AGS: Fixes to playing sound effects in AGSWaves
Commit: 2a3bfcf8c66704b2fc31359e71897065e74a8fec
https://github.com/scummvm/scummvm/commit/2a3bfcf8c66704b2fc31359e71897065e74a8fec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-23T20:08:20-07:00
Commit Message:
AGS: Clear methodName in RuntimeScriptValue for other data types
Changed paths:
engines/ags/engine/script/runtime_script_value.h
diff --git a/engines/ags/engine/script/runtime_script_value.h b/engines/ags/engine/script/runtime_script_value.h
index 60c49de367..24b5b84352 100644
--- a/engines/ags/engine/script/runtime_script_value.h
+++ b/engines/ags/engine/script/runtime_script_value.h
@@ -130,6 +130,7 @@ public:
inline RuntimeScriptValue &Invalidate() {
Type = kScValUndefined;
+ methodName.clear();
IValue = 0;
Ptr = nullptr;
MgrPtr = nullptr;
@@ -138,6 +139,7 @@ public:
}
inline RuntimeScriptValue &SetUInt8(uint8_t val) {
Type = kScValInteger;
+ methodName.clear();
IValue = val;
Ptr = nullptr;
MgrPtr = nullptr;
@@ -146,6 +148,7 @@ public:
}
inline RuntimeScriptValue &SetInt16(int16_t val) {
Type = kScValInteger;
+ methodName.clear();
IValue = val;
Ptr = nullptr;
MgrPtr = nullptr;
@@ -154,6 +157,7 @@ public:
}
inline RuntimeScriptValue &SetInt32(int32_t val) {
Type = kScValInteger;
+ methodName.clear();
IValue = val;
Ptr = nullptr;
MgrPtr = nullptr;
@@ -162,6 +166,7 @@ public:
}
inline RuntimeScriptValue &SetFloat(float val) {
Type = kScValFloat;
+ methodName.clear();
FValue = val;
Ptr = nullptr;
MgrPtr = nullptr;
@@ -176,6 +181,7 @@ public:
}
inline RuntimeScriptValue &SetPluginArgument(int32_t val) {
Type = kScValPluginArg;
+ methodName.clear();
IValue = val;
Ptr = nullptr;
MgrPtr = nullptr;
@@ -184,6 +190,7 @@ public:
}
inline RuntimeScriptValue &SetStackPtr(RuntimeScriptValue *stack_entry) {
Type = kScValStackPtr;
+ methodName.clear();
IValue = 0;
RValue = stack_entry;
MgrPtr = nullptr;
@@ -192,6 +199,7 @@ public:
}
inline RuntimeScriptValue &SetData(char *data, int size) {
Type = kScValData;
+ methodName.clear();
IValue = 0;
Ptr = data;
MgrPtr = nullptr;
@@ -200,6 +208,7 @@ public:
}
inline RuntimeScriptValue &SetGlobalVar(RuntimeScriptValue *glvar_value) {
Type = kScValGlobalVar;
+ methodName.clear();
IValue = 0;
RValue = glvar_value;
MgrPtr = nullptr;
@@ -209,6 +218,7 @@ public:
// TODO: size?
inline RuntimeScriptValue &SetStringLiteral(const char *str) {
Type = kScValStringLiteral;
+ methodName.clear();
IValue = 0;
Ptr = const_cast<char *>(str);
MgrPtr = nullptr;
@@ -217,6 +227,7 @@ public:
}
inline RuntimeScriptValue &SetStaticObject(void *object, ICCStaticObject *manager) {
Type = kScValStaticObject;
+ methodName.clear();
IValue = 0;
Ptr = (char *)object;
StcMgr = manager;
@@ -225,6 +236,7 @@ public:
}
inline RuntimeScriptValue &SetStaticArray(void *object, StaticArray *manager) {
Type = kScValStaticArray;
+ methodName.clear();
IValue = 0;
Ptr = (char *)object;
StcArr = manager;
@@ -233,6 +245,7 @@ public:
}
inline RuntimeScriptValue &SetDynamicObject(void *object, ICCDynamicObject *manager) {
Type = kScValDynamicObject;
+ methodName.clear();
IValue = 0;
Ptr = (char *)object;
DynMgr = manager;
@@ -241,6 +254,7 @@ public:
}
inline RuntimeScriptValue &SetPluginObject(void *object, ICCDynamicObject *manager) {
Type = kScValPluginObject;
+ methodName.clear();
IValue = 0;
Ptr = (char *)object;
DynMgr = manager;
@@ -249,6 +263,7 @@ public:
}
inline RuntimeScriptValue &SetStaticFunction(ScriptAPIFunction *pfn) {
Type = kScValStaticFunction;
+ methodName.clear();
IValue = 0;
SPfn = pfn;
MgrPtr = nullptr;
@@ -266,6 +281,7 @@ public:
}
inline RuntimeScriptValue &SetObjectFunction(ScriptAPIObjectFunction *pfn) {
Type = kScValObjectFunction;
+ methodName.clear();
IValue = 0;
ObjPfn = pfn;
MgrPtr = nullptr;
@@ -274,6 +290,7 @@ public:
}
inline RuntimeScriptValue &SetCodePtr(char *ptr) {
Type = kScValCodePtr;
+ methodName.clear();
IValue = 0;
Ptr = ptr;
MgrPtr = nullptr;
Commit: 2702b13768eb9b04c3c31f15f072fb1f6c6b8f16
https://github.com/scummvm/scummvm/commit/2702b13768eb9b04c3c31f15f072fb1f6c6b8f16
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-23T20:08:21-07:00
Commit Message:
AGS: Built-in script methods were being added to wrong import list
Changed paths:
engines/ags/engine/script/script_runtime.cpp
engines/ags/engine/script/script_runtime.h
engines/ags/plugins/ags_plugin.cpp
engines/ags/plugins/ags_plugin.h
engines/ags/plugins/plugin_base.h
diff --git a/engines/ags/engine/script/script_runtime.cpp b/engines/ags/engine/script/script_runtime.cpp
index d7f4c9a89e..5eaaceb409 100644
--- a/engines/ags/engine/script/script_runtime.cpp
+++ b/engines/ags/engine/script/script_runtime.cpp
@@ -98,8 +98,8 @@ void *ccGetSymbolAddress(const String &name) {
return nullptr;
}
-bool ccAddExternalFunctionForPlugin(const String &name, Plugins::ScriptContainer *sc) {
- return _GP(simp_for_plugin).add(name, RuntimeScriptValue().SetPluginMethod(sc, name), nullptr) == 0;
+bool ccAddExternalFunctionForPlugin(const String &name, Plugins::ScriptContainer *instance) {
+ return _GP(simp_for_plugin).add(name, RuntimeScriptValue().SetPluginMethod(instance, name), nullptr) == 0;
}
Plugins::PluginMethod ccGetSymbolAddressForPlugin(const String &name) {
diff --git a/engines/ags/engine/script/script_runtime.h b/engines/ags/engine/script/script_runtime.h
index b8e8cf91e9..abf97cb603 100644
--- a/engines/ags/engine/script/script_runtime.h
+++ b/engines/ags/engine/script/script_runtime.h
@@ -71,7 +71,7 @@ extern void *ccGetSymbolAddress(const String &name);
// registering functions, compatible with old unsafe call style;
// this is to be used solely by plugins until plugin inteface is redone
-extern bool ccAddExternalFunctionForPlugin(const String &name, void *pfn);
+extern bool ccAddExternalFunctionForPlugin(const String &name, Plugins::ScriptContainer *instance);
extern Plugins::PluginMethod ccGetSymbolAddressForPlugin(const String &name);
// DEBUG HOOK
diff --git a/engines/ags/plugins/ags_plugin.cpp b/engines/ags/plugins/ags_plugin.cpp
index 247460f44a..101c5512d9 100644
--- a/engines/ags/plugins/ags_plugin.cpp
+++ b/engines/ags/plugins/ags_plugin.cpp
@@ -99,6 +99,9 @@ const char *IAGSEngine::GetEngineVersion() {
void IAGSEngine::RegisterScriptFunction(const char *name, Plugins::ScriptContainer *instance) {
ccAddExternalPluginFunction(name, instance);
}
+void IAGSEngine::RegisterBuiltInFunction(const char *name, Plugins::ScriptContainer *instance) {
+ ccAddExternalFunctionForPlugin(name, instance);
+}
const char *IAGSEngine::GetGraphicsDriverID() {
if (_G(gfxDriver) == nullptr)
return nullptr;
diff --git a/engines/ags/plugins/ags_plugin.h b/engines/ags/plugins/ags_plugin.h
index 8285731fd9..d7fceff6fe 100644
--- a/engines/ags/plugins/ags_plugin.h
+++ b/engines/ags/plugins/ags_plugin.h
@@ -326,7 +326,9 @@ public:
// register a script function with the system
AGSIFUNC(void) RegisterScriptFunction(const char *name,
Plugins::ScriptContainer *instance);
- #ifdef WINDOWS_VERSION
+ AGSIFUNC(void) RegisterBuiltInFunction(const char *name,
+ Plugins::ScriptContainer *instance);
+#ifdef WINDOWS_VERSION
// get game window handle
AGSIFUNC(HWND) GetWindowHandle();
// get reference to main DirectDraw interface
diff --git a/engines/ags/plugins/plugin_base.h b/engines/ags/plugins/plugin_base.h
index a65b9563db..d40367858f 100644
--- a/engines/ags/plugins/plugin_base.h
+++ b/engines/ags/plugins/plugin_base.h
@@ -37,13 +37,13 @@ namespace Plugins {
#define SCRIPT_METHOD(NAME, PROC) addMethod(#NAME, &PROC)
-#define SCRIPT_HASH_SUB(TheClass, BaseClass) \
+#define SCRIPT_HASH_MACRO(TheClass, BaseClass, RegisterMethod) \
private: \
typedef void (TheClass::*MethodPtr)(ScriptMethodParams ¶ms); \
Common::HashMap<Common::String, MethodPtr> _methods; \
inline void addMethod(const Common::String &name, MethodPtr fn) { \
_methods[name] = fn; \
- _engine->RegisterScriptFunction(name.c_str(), this); \
+ _engine->RegisterMethod(name.c_str(), this); \
} \
public: \
void execMethod(const Common::String &name, ScriptMethodParams ¶ms) override { \
@@ -52,8 +52,9 @@ namespace Plugins {
else \
BaseClass::execMethod(name, params); \
}
-#define SCRIPT_HASH(TheClass) SCRIPT_HASH_SUB(TheClass, PluginBase)
-#define BUILT_IN_HASH(TheClass) SCRIPT_HASH_SUB(TheClass, ScriptContainer)
+#define SCRIPT_HASH(TheClass) SCRIPT_HASH_MACRO(TheClass, PluginBase, RegisterScriptFunction)
+#define BUILT_IN_HASH(TheClass) SCRIPT_HASH_MACRO(TheClass, ScriptContainer, RegisterBuiltInFunction)
+#define SCRIPT_HASH_SUB(TheClass, BaseClass) SCRIPT_HASH_MACRO(TheClass, BaseClass, RegisterScriptFunction)
inline float PARAM_TO_FLOAT(int32 xi) {
float x;
Commit: c2dc7c9e86fa4b5e7ef917d2d6acd936dbc5273a
https://github.com/scummvm/scummvm/commit/c2dc7c9e86fa4b5e7ef917d2d6acd936dbc5273a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-23T20:08:21-07:00
Commit Message:
AGS: Fixes to playing sound effects in AGSWaves
Changed paths:
engines/ags/plugins/ags_waves/sound.cpp
diff --git a/engines/ags/plugins/ags_waves/sound.cpp b/engines/ags/plugins/ags_waves/sound.cpp
index b2f0599678..be79ff8d44 100644
--- a/engines/ags/plugins/ags_waves/sound.cpp
+++ b/engines/ags/plugins/ags_waves/sound.cpp
@@ -45,18 +45,19 @@ void AGSWaves::SFX_Play(ScriptMethodParams ¶ms) {
if (sound != nullptr) {
effect._volume = 255;
- if (repeat != 1) {
- assert(repeat != 0);
+ if (repeat != 0) {
Audio::SeekableAudioStream *sas =
dynamic_cast<Audio::SeekableAudioStream *>(sound);
assert(sas);
+ // -1 for infinite, >0 number of successive repeats
Audio::LoopingAudioStream *las =
- new Audio::LoopingAudioStream(sas, repeat, DisposeAfterUse::NO);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &effect._soundHandle, las);
+ new Audio::LoopingAudioStream(sas, repeat + 1, DisposeAfterUse::NO);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &effect._soundHandle, las,
+ -1, 255, 0, DisposeAfterUse::YES);
} else {
_mixer->playStream(Audio::Mixer::kSFXSoundType, &effect._soundHandle, sound,
- -1, effect._volume, 0, DisposeAfterUse::YES);
+ -1, effect._volume, 0, DisposeAfterUse::NO);
}
if (OGG_Filter && effect._filter && effect._volume > 1) {
More information about the Scummvm-git-logs
mailing list