[Scummvm-git-logs] scummvm master -> 9fe3ba9e8bd9aec46bfffa371649f12fb5bc53a1
npjg
noreply at scummvm.org
Wed Feb 25 03:30:12 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
23a79d92b6 MEDIASTATION: Rename EventHandler to ScriptResponse
9fe3ba9e8b MEDIASTATION: Attempt to fix unsigned expression warnings again
Commit: 23a79d92b6a4324a19dd5ec766b44d8a8835036f
https://github.com/scummvm/scummvm/commit/23a79d92b6a4324a19dd5ec766b44d8a8835036f
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-02-24T22:26:21-05:00
Commit Message:
MEDIASTATION: Rename EventHandler to ScriptResponse
In the original, there is another concept named EventHandler, which is not the same as what we mean by an event handler than can be triggered by a script.
Changed paths:
A engines/mediastation/mediascript/scriptresponse.cpp
A engines/mediastation/mediascript/scriptresponse.h
R engines/mediastation/mediascript/eventhandler.cpp
R engines/mediastation/mediascript/eventhandler.h
engines/mediastation/actor.cpp
engines/mediastation/actor.h
engines/mediastation/actors/camera.cpp
engines/mediastation/actors/hotspot.cpp
engines/mediastation/actors/movie.cpp
engines/mediastation/actors/path.cpp
engines/mediastation/actors/screen.h
engines/mediastation/actors/sound.cpp
engines/mediastation/actors/sprite.cpp
engines/mediastation/actors/text.cpp
engines/mediastation/actors/text.h
engines/mediastation/actors/timer.cpp
engines/mediastation/clients.cpp
engines/mediastation/module.mk
diff --git a/engines/mediastation/actor.cpp b/engines/mediastation/actor.cpp
index 3df9403c035..f2e9c7cc3d2 100644
--- a/engines/mediastation/actor.cpp
+++ b/engines/mediastation/actor.cpp
@@ -103,14 +103,14 @@ const char *Actor::debugName() const {
}
Actor::~Actor() {
- for (auto it = _eventHandlers.begin(); it != _eventHandlers.end(); ++it) {
- Common::Array<EventHandler *> &handlersForType = it->_value;
- for (EventHandler *handler : handlersForType) {
- delete handler;
+ for (auto it = _scriptResponses.begin(); it != _scriptResponses.end(); ++it) {
+ Common::Array<ScriptResponse *> &responsesForType = it->_value;
+ for (ScriptResponse *response : responsesForType) {
+ delete response;
}
- handlersForType.clear();
+ responsesForType.clear();
}
- _eventHandlers.clear();
+ _scriptResponses.clear();
}
void Actor::initFromParameterStream(Chunk &chunk) {
@@ -127,18 +127,18 @@ void Actor::initFromParameterStream(Chunk &chunk) {
void Actor::readParameter(Chunk &chunk, ActorHeaderSectionType paramType) {
switch (paramType) {
- case kActorHeaderEventHandler: {
- EventHandler *eventHandler = new EventHandler(chunk);
- Common::Array<EventHandler *> &eventHandlersForType = _eventHandlers.getOrCreateVal(eventHandler->_type);
+ case kActorHeaderScriptResponse: {
+ ScriptResponse *scriptResponse = new ScriptResponse(chunk);
+ Common::Array<ScriptResponse *> &scriptResponsesForType = _scriptResponses.getOrCreateVal(scriptResponse->_type);
// This is not a hashmap because we don't want to have to hash ScriptValues.
- for (EventHandler *existingEventHandler : eventHandlersForType) {
- if (existingEventHandler->_argumentValue == eventHandler->_argumentValue) {
- error("[%s] %s: Event handler for %s (%s) already exists", debugName(), __func__,
- eventTypeToStr(eventHandler->_type), eventHandler->_argumentValue.getDebugString().c_str());
+ for (ScriptResponse *existingScriptResponse : scriptResponsesForType) {
+ if (existingScriptResponse->_argumentValue == scriptResponse->_argumentValue) {
+ error("[%s] %s: Script response for %s (%s) already exists", debugName(), __func__,
+ eventTypeToStr(scriptResponse->_type), scriptResponse->_argumentValue.getDebugString().c_str());
}
}
- eventHandlersForType.push_back(eventHandler);
+ scriptResponsesForType.push_back(scriptResponse);
break;
}
@@ -160,18 +160,18 @@ ScriptValue Actor::callMethod(BuiltInMethod methodId, Common::Array<ScriptValue>
return ScriptValue();
}
-void Actor::processTimeEventHandlers() {
+void Actor::processTimeScriptResponses() {
// TODO: Replace with a queue.
uint currentTime = g_system->getMillis();
- const Common::Array<EventHandler *> &_timeHandlers = _eventHandlers.getValOrDefault(kTimerEvent);
- for (EventHandler *timeEvent : _timeHandlers) {
+ const Common::Array<ScriptResponse *> &_timeResponses = _scriptResponses.getValOrDefault(kTimerEvent);
+ for (ScriptResponse *timeEvent : _timeResponses) {
// Indeed float, not time.
double timeEventInFractionalSeconds = timeEvent->_argumentValue.asFloat();
uint timeEventInMilliseconds = timeEventInFractionalSeconds * 1000;
bool timeEventAlreadyProcessed = timeEventInMilliseconds < _lastProcessedTime;
bool timeEventNeedsToBeProcessed = timeEventInMilliseconds < currentTime - _startTime;
if (!timeEventAlreadyProcessed && timeEventNeedsToBeProcessed) {
- debugC(5, kDebugScript, "%s: Running On Time handler for time %d ms (lastProcessedTime: %d, currentTime: %d)",
+ debugC(5, kDebugScript, "%s: Running On Time response for time %d ms (lastProcessedTime: %d, currentTime: %d)",
__func__, timeEventInMilliseconds, _lastProcessedTime, currentTime);
timeEvent->execute(_id);
}
@@ -179,30 +179,30 @@ void Actor::processTimeEventHandlers() {
_lastProcessedTime = currentTime - _startTime;
}
-void Actor::runEventHandlerIfExists(EventType eventType, const ScriptValue &arg) {
- const Common::Array<EventHandler *> &eventHandlers = _eventHandlers.getValOrDefault(eventType);
- for (EventHandler *eventHandler : eventHandlers) {
- const ScriptValue &argToCheck = eventHandler->_argumentValue;
+void Actor::runScriptResponseIfExists(EventType eventType, const ScriptValue &arg) {
+ const Common::Array<ScriptResponse *> &scriptResponses = _scriptResponses.getValOrDefault(eventType);
+ for (ScriptResponse *scriptResponse : scriptResponses) {
+ const ScriptValue &argToCheck = scriptResponse->_argumentValue;
if (arg.getType() != argToCheck.getType()) {
- warning("[%s] %s: Got event handler arg type %s, expected %s", debugName(), __func__,
+ warning("[%s] %s: Got script response arg type %s, expected %s", debugName(), __func__,
scriptValueTypeToStr(arg.getType()), scriptValueTypeToStr(argToCheck.getType()));
continue;
}
if (arg == argToCheck) {
- debugC(5, kDebugScript, "[%s] %s: Executing handler for event type %s", debugName(), __func__, eventTypeToStr(eventType));
- eventHandler->execute(_id);
+ debugC(5, kDebugScript, "[%s] %s: Executing response for event type %s", debugName(), __func__, eventTypeToStr(eventType));
+ scriptResponse->execute(_id);
return;
}
}
- debugC(5, kDebugScript, "[%s] %s: No event handler for event type %s", debugName(), __func__, eventTypeToStr(eventType));
+ debugC(5, kDebugScript, "[%s] %s: No script response for event type %s", debugName(), __func__, eventTypeToStr(eventType));
}
-void Actor::runEventHandlerIfExists(EventType eventType) {
+void Actor::runScriptResponseIfExists(EventType eventType) {
ScriptValue scriptValue;
- runEventHandlerIfExists(eventType, scriptValue);
+ runScriptResponseIfExists(eventType, scriptValue);
}
SpatialEntity::~SpatialEntity() {
diff --git a/engines/mediastation/actor.h b/engines/mediastation/actor.h
index d86fea7069b..a0dcfd9f889 100644
--- a/engines/mediastation/actor.h
+++ b/engines/mediastation/actor.h
@@ -26,7 +26,7 @@
#include "common/keyboard.h"
#include "mediastation/datafile.h"
-#include "mediastation/mediascript/eventhandler.h"
+#include "mediastation/mediascript/scriptresponse.h"
#include "mediastation/mediascript/scriptconstants.h"
#include "mediastation/mediascript/scriptvalue.h"
@@ -69,7 +69,7 @@ const char *actorTypeToStr(ActorType type);
enum ActorHeaderSectionType {
kActorHeaderEmptySection = 0x0000,
- kActorHeaderEventHandler = 0x0017,
+ kActorHeaderScriptResponse = 0x0017,
kActorHeaderChildActorId = 0x0019,
kActorHeaderActorId = 0x001a,
kActorHeaderChannelIdent = 0x001b,
@@ -189,7 +189,7 @@ public:
Actor(ActorType type) : _type(type) {};
virtual ~Actor();
- // Does any needed frame drawing, audio playing, event handlers, etc.
+ // Does any needed frame drawing, audio playing, script responses, etc.
virtual void process() { return; }
// Runs built-in bytecode methods.
@@ -201,9 +201,9 @@ public:
virtual void readParameter(Chunk &chunk, ActorHeaderSectionType paramType);
virtual void loadIsComplete();
- void processTimeEventHandlers();
- void runEventHandlerIfExists(EventType eventType, const ScriptValue &arg);
- void runEventHandlerIfExists(EventType eventType);
+ void processTimeScriptResponses();
+ void runScriptResponseIfExists(EventType eventType, const ScriptValue &arg);
+ void runScriptResponseIfExists(EventType eventType);
ActorType type() const { return _type; }
uint id() const { return _id; }
@@ -223,7 +223,7 @@ protected:
uint _startTime = 0;
uint _lastProcessedTime = 0;
uint _duration = 0;
- Common::HashMap<uint, Common::Array<EventHandler *> > _eventHandlers;
+ Common::HashMap<uint, Common::Array<ScriptResponse *> > _scriptResponses;
};
class SpatialEntity : public Actor {
diff --git a/engines/mediastation/actors/camera.cpp b/engines/mediastation/actors/camera.cpp
index 92b6fb5175c..d253950829b 100644
--- a/engines/mediastation/actors/camera.cpp
+++ b/engines/mediastation/actors/camera.cpp
@@ -504,7 +504,7 @@ void CameraActor::timerEvent() {
// Common::Rect advanceRect = getAdvanceRect();
// _parentStage->preload(advanceRect);
} else {
- runEventHandlerIfExists(kCameraPanAbortEvent);
+ runScriptResponseIfExists(kCameraPanAbortEvent);
stopPan();
}
} else {
@@ -515,7 +515,7 @@ void CameraActor::timerEvent() {
success = processViewportMove();
}
if (success) {
- runEventHandlerIfExists(kCameraPanEndEvent);
+ runScriptResponseIfExists(kCameraPanEndEvent);
stopPan();
} else {
Common::Rect currentBounds = getBbox();
@@ -550,13 +550,13 @@ bool CameraActor::processViewportMove() {
void CameraActor::processNextPanStep() {
// If pan type includes per-step updates (4-arg pan in original engine),
// advance the pan step counter. Then compute the new viewport origin
- // and notify any script handlers registered for the pan-step event.
+ // and notify any script responses registered for the pan-step event.
if (_panState == kCameraPanByStepCount) {
_currentPanStep += 1;
}
calcNewViewportOrigin();
- runEventHandlerIfExists(kCameraPanStepEvent);
+ runScriptResponseIfExists(kCameraPanStepEvent);
uint stepDurationInMilliseconds = 20; // Visually smooth.
_nextPanStepTime += stepDurationInMilliseconds;
diff --git a/engines/mediastation/actors/hotspot.cpp b/engines/mediastation/actors/hotspot.cpp
index 11eb4ac07f0..3c2cea3e7a2 100644
--- a/engines/mediastation/actors/hotspot.cpp
+++ b/engines/mediastation/actors/hotspot.cpp
@@ -213,7 +213,7 @@ void HotspotActor::mouseDownEvent(const Common::Event &event) {
}
g_engine->setMouseDownHotspot(this);
- runEventHandlerIfExists(kMouseDownEvent);
+ runScriptResponseIfExists(kMouseDownEvent);
}
void HotspotActor::mouseUpEvent(const Common::Event &event) {
@@ -223,7 +223,7 @@ void HotspotActor::mouseUpEvent(const Common::Event &event) {
}
g_engine->setMouseDownHotspot(nullptr);
- runEventHandlerIfExists(kMouseUpEvent);
+ runScriptResponseIfExists(kMouseUpEvent);
}
void HotspotActor::mouseEnteredEvent(const Common::Event &event) {
@@ -241,7 +241,7 @@ void HotspotActor::mouseEnteredEvent(const Common::Event &event) {
g_engine->getCursorManager()->unsetTemporary();
}
- runEventHandlerIfExists(kMouseEnteredEvent);
+ runScriptResponseIfExists(kMouseEnteredEvent);
}
void HotspotActor::mouseMovedEvent(const Common::Event &event) {
@@ -250,7 +250,7 @@ void HotspotActor::mouseMovedEvent(const Common::Event &event) {
return;
}
- runEventHandlerIfExists(kMouseMovedEvent);
+ runScriptResponseIfExists(kMouseMovedEvent);
}
void HotspotActor::mouseExitedEvent(const Common::Event &event) {
@@ -260,7 +260,7 @@ void HotspotActor::mouseExitedEvent(const Common::Event &event) {
}
g_engine->setMouseInsideHotspot(nullptr);
- runEventHandlerIfExists(kMouseExitedEvent);
+ runScriptResponseIfExists(kMouseExitedEvent);
}
} // End of namespace MediaStation
diff --git a/engines/mediastation/actors/movie.cpp b/engines/mediastation/actors/movie.cpp
index 8050888b3c0..9544a659dfe 100644
--- a/engines/mediastation/actors/movie.cpp
+++ b/engines/mediastation/actors/movie.cpp
@@ -349,7 +349,7 @@ void StreamMovieActor::timePlay() {
_isPlaying = true;
_startTime = g_system->getMillis();
_lastProcessedTime = 0;
- runEventHandlerIfExists(kMovieBeginEvent);
+ runScriptResponseIfExists(kMovieBeginEvent);
process();
}
@@ -370,13 +370,13 @@ void StreamMovieActor::timeStop() {
_startTime = 0;
_lastProcessedTime = 0;
_isPlaying = false;
- runEventHandlerIfExists(kMovieStoppedEvent);
+ runScriptResponseIfExists(kMovieStoppedEvent);
}
void StreamMovieActor::process() {
if (_isVisible) {
if (_isPlaying) {
- processTimeEventHandlers();
+ processTimeScriptResponses();
}
updateFrameState();
}
@@ -437,7 +437,7 @@ void StreamMovieActor::updateFrameState() {
_framesNotYetShown = _streamFrames->_frames;
updateFrameState();
}
- runEventHandlerIfExists(kMovieEndEvent);
+ runScriptResponseIfExists(kMovieEndEvent);
break;
}
} else {
diff --git a/engines/mediastation/actors/path.cpp b/engines/mediastation/actors/path.cpp
index b1028e78925..5b7c5b2e87d 100644
--- a/engines/mediastation/actors/path.cpp
+++ b/engines/mediastation/actors/path.cpp
@@ -175,13 +175,13 @@ void PathActor::startPath() {
_nextPathStepTime = _startTime + _stepDurationInMilliseconds;
_currentStep = 0;
- // There is no path start event handler.
+ // There is no path start script response.
}
void PathActor::stopPath() {
if (_playState == kPathPlaying || _playState == kPathPaused) {
_playState = kPathStopped;
- runEventHandlerIfExists(kPathStoppedEvent);
+ runScriptResponseIfExists(kPathStoppedEvent);
}
}
@@ -236,7 +236,7 @@ bool PathActor::step() {
_endPoint.x, _endPoint.y, _startPoint.x, _startPoint.y, _currentPoint.x, _currentPoint.y);
// We don't run a step event for the last step.
- runEventHandlerIfExists(kPathStepEvent);
+ runScriptResponseIfExists(kPathStepEvent);
return false;
}
return true;
@@ -257,7 +257,7 @@ void PathActor::timerEvent() {
_nextPathStepTime = 0;
_currentStep = 0;
_stepDurationInMilliseconds = 0;
- runEventHandlerIfExists(kPathEndEvent);
+ runScriptResponseIfExists(kPathEndEvent);
}
}
diff --git a/engines/mediastation/actors/screen.h b/engines/mediastation/actors/screen.h
index 5167f7b526c..335d78ca9cb 100644
--- a/engines/mediastation/actors/screen.h
+++ b/engines/mediastation/actors/screen.h
@@ -28,7 +28,7 @@
namespace MediaStation {
-// A Screen holds actor data and processes event handlers for a Context.
+// A Screen holds actor data and processes script responses for a Context.
// The original separated them this way - there is a ContextParameters section,
// then a Screen actor header.
class ScreenActor : public Actor {
diff --git a/engines/mediastation/actors/sound.cpp b/engines/mediastation/actors/sound.cpp
index 2e0daff3601..e5936557604 100644
--- a/engines/mediastation/actors/sound.cpp
+++ b/engines/mediastation/actors/sound.cpp
@@ -82,11 +82,11 @@ void SoundActor::process() {
return;
}
- processTimeEventHandlers();
+ processTimeScriptResponses();
if (!_sequence.isActive()) {
_playState = kSoundStopped;
_sequence.stop();
- runEventHandlerIfExists(kSoundEndEvent);
+ runScriptResponseIfExists(kSoundEndEvent);
}
}
void SoundActor::readChunk(Chunk &chunk) {
@@ -156,7 +156,7 @@ void SoundActor::start() {
_startTime = g_system->getMillis();
_lastProcessedTime = 0;
_sequence.play();
- runEventHandlerIfExists(kSoundBeginEvent);
+ runScriptResponseIfExists(kSoundBeginEvent);
} else {
warning("[%s] %s: Attempted to play sound before it was loaded", debugName(), __func__);
}
@@ -166,7 +166,7 @@ void SoundActor::stop() {
if (_playState == kSoundPlaying || _playState == kSoundPaused) {
_playState = kSoundStopped;
_sequence.stop();
- runEventHandlerIfExists(kSoundStoppedEvent);
+ runScriptResponseIfExists(kSoundStoppedEvent);
}
}
diff --git a/engines/mediastation/actors/sprite.cpp b/engines/mediastation/actors/sprite.cpp
index 79701b8f20f..45f9d7f5719 100644
--- a/engines/mediastation/actors/sprite.cpp
+++ b/engines/mediastation/actors/sprite.cpp
@@ -324,7 +324,7 @@ void SpriteMovieActor::setCurrentFrameToFinal() {
void SpriteMovieActor::process() {
updateFrameState();
- // Sprites don't have time event handlers, separate timers do time handling.
+ // Sprites don't have time script responses, separate timers do time handling.
}
void SpriteMovieActor::readChunk(Chunk &chunk) {
@@ -420,7 +420,7 @@ void SpriteMovieActor::postMovieEndEventIfNecessary() {
ScriptValue value;
value.setToParamToken(_activeClip.id);
- runEventHandlerIfExists(kSpriteMovieEndEvent, value);
+ runScriptResponseIfExists(kSpriteMovieEndEvent, value);
}
void SpriteMovieActor::draw(DisplayContext &displayContext) {
diff --git a/engines/mediastation/actors/text.cpp b/engines/mediastation/actors/text.cpp
index 8845c0f3c6d..db632a0605b 100644
--- a/engines/mediastation/actors/text.cpp
+++ b/engines/mediastation/actors/text.cpp
@@ -363,10 +363,10 @@ void TextActor::keyboardEvent(const Common::Event &event) {
warning("STUB: %s", __func__);
}
-bool TextActor::hasEventHandler(EventType eventType, const ScriptValue &arg) const {
- const Common::Array<EventHandler *> &eventHandlers = _eventHandlers.getValOrDefault(eventType);
- for (const EventHandler *eventHandler : eventHandlers) {
- const ScriptValue &argToCheck = eventHandler->_argumentValue;
+bool TextActor::hasScriptResponse(EventType eventType, const ScriptValue &arg) const {
+ const Common::Array<ScriptResponse *> &scriptResponses = _scriptResponses.getValOrDefault(eventType);
+ for (const ScriptResponse *scriptResponse : scriptResponses) {
+ const ScriptValue &argToCheck = scriptResponse->_argumentValue;
if (arg.getType() != argToCheck.getType()) {
continue;
diff --git a/engines/mediastation/actors/text.h b/engines/mediastation/actors/text.h
index e5c2a12b155..74893a8f6b6 100644
--- a/engines/mediastation/actors/text.h
+++ b/engines/mediastation/actors/text.h
@@ -72,7 +72,7 @@ private:
void setText();
void addAcceptedChars(uint firstCharCode, uint lastCharCode, uint charCodeOffset = 0);
- bool hasEventHandler(EventType eventType, const ScriptValue &arg) const;
+ bool hasScriptResponse(EventType eventType, const ScriptValue &arg) const;
int16 calcStartingXPosition();
int16 calcBaseline();
diff --git a/engines/mediastation/actors/timer.cpp b/engines/mediastation/actors/timer.cpp
index 52adc2d9a51..1cf617adf3b 100644
--- a/engines/mediastation/actors/timer.cpp
+++ b/engines/mediastation/actors/timer.cpp
@@ -61,10 +61,10 @@ void TimerActor::timePlay() {
// Get the duration of the timer.
// TODO: Is there a better way to find out what the max time is? Do we have to look
- // through each of the timer event handlers to figure it out?
+ // through each of the timer script responses to figure it out?
_duration = 0;
- const Common::Array<EventHandler *> &timeHandlers = _eventHandlers.getValOrDefault(kTimerEvent);
- for (EventHandler *timeEvent : timeHandlers) {
+ const Common::Array<ScriptResponse *> &timeResponses = _scriptResponses.getValOrDefault(kTimerEvent);
+ for (ScriptResponse *timeEvent : timeResponses) {
// Indeed float, not time.
double timeEventInFractionalSeconds = timeEvent->_argumentValue.asFloat();
uint timeEventInMilliseconds = timeEventInFractionalSeconds * 1000;
@@ -88,7 +88,7 @@ void TimerActor::timeStop() {
void TimerActor::process() {
if (_isPlaying) {
- processTimeEventHandlers();
+ processTimeScriptResponses();
}
}
diff --git a/engines/mediastation/clients.cpp b/engines/mediastation/clients.cpp
index 0a0e16146db..c4ad5526eb8 100644
--- a/engines/mediastation/clients.cpp
+++ b/engines/mediastation/clients.cpp
@@ -125,7 +125,7 @@ void Document::startContextLoad(uint contextId) {
Actor *currentScreen = g_engine->getActorById(_currentScreenActorId);
ScriptValue arg;
arg.setToActorId(contextId);
- currentScreen->runEventHandlerIfExists(kContextLoadCompleteEvent2, arg);
+ currentScreen->runScriptResponseIfExists(kContextLoadCompleteEvent2, arg);
}
if (_loadingContextId == 0) {
@@ -210,7 +210,7 @@ void Document::contextLoadDidComplete() {
arg.setToActorId(_loadingContextId);
Actor *currentScreen = g_engine->getActorById(_currentScreenActorId);
if (currentScreen != nullptr) {
- currentScreen->runEventHandlerIfExists(kContextLoadCompleteEvent, arg);
+ currentScreen->runScriptResponseIfExists(kContextLoadCompleteEvent, arg);
}
}
_loadingContextId = 0;
@@ -219,7 +219,7 @@ void Document::contextLoadDidComplete() {
void Document::screenLoadDidComplete() {
_currentScreenActorId = _loadingScreenActorId;
Actor *currentScreen = g_engine->getActorById(_loadingScreenActorId);
- currentScreen->runEventHandlerIfExists(kScreenEntryEvent);
+ currentScreen->runScriptResponseIfExists(kScreenEntryEvent);
_loadingScreenActorId = 0;
}
@@ -241,7 +241,7 @@ void Document::blowAwayCurrentScreen() {
uint contextId = contextIdForScreenActorId(_currentScreenActorId);
if (contextId != 0) {
Actor *currentScreen = g_engine->getActorById(_currentScreenActorId);
- currentScreen->runEventHandlerIfExists(kScreenExitEvent);
+ currentScreen->runScriptResponseIfExists(kScreenExitEvent);
g_engine->destroyContext(contextId);
}
}
diff --git a/engines/mediastation/mediascript/eventhandler.cpp b/engines/mediastation/mediascript/scriptresponse.cpp
similarity index 79%
rename from engines/mediastation/mediascript/eventhandler.cpp
rename to engines/mediastation/mediascript/scriptresponse.cpp
index ae597207d10..f55e25afa6a 100644
--- a/engines/mediastation/mediascript/eventhandler.cpp
+++ b/engines/mediastation/mediascript/scriptresponse.cpp
@@ -19,13 +19,13 @@
*
*/
-#include "mediastation/mediascript/eventhandler.h"
+#include "mediastation/mediascript/scriptresponse.h"
#include "mediastation/debugchannels.h"
#include "mediastation/mediastation.h"
namespace MediaStation {
-EventHandler::EventHandler(Chunk &chunk) {
+ScriptResponse::ScriptResponse(Chunk &chunk) {
_type = static_cast<EventType>(chunk.readTypedUint16());
debugC(5, kDebugLoading, "%s: %s (%d)", __func__, eventTypeToStr(_type), static_cast<uint>(_type));
@@ -33,23 +33,22 @@ EventHandler::EventHandler(Chunk &chunk) {
_code = new CodeChunk(chunk);
}
-ScriptValue EventHandler::execute(uint actorId) {
+ScriptValue ScriptResponse::execute(uint actorId) {
// TODO: The actorId is only passed in for debug visibility, there should be
// a better way to handle that.
Common::String actorName = g_engine->formatActorName(actorId, true);
Common::String actorAndType = Common::String::format("%s (%s)", actorName.c_str(), eventTypeToStr(_type));
Common::String argValue = Common::String::format("(%s)", _argumentValue.getDebugString().c_str());
- debugC(5, kDebugScript, "\n********** EVENT HANDLER %s %s **********", actorAndType.c_str(), argValue.c_str());
+ debugC(5, kDebugScript, "\n********** SCRIPT RESPONSE %s %s **********", actorAndType.c_str(), argValue.c_str());
- // The only argument that can be provided to an
- // event handler is the _argumentValue.
+ // The only argument that can be provided to a script response is the argument value.
ScriptValue returnValue = _code->execute();
- debugC(5, kDebugScript, "********** END EVENT HANDLER %s %s **********", actorAndType.c_str(), argValue.c_str());
+ debugC(5, kDebugScript, "********** END SCRIPT RESPONSE %s %s **********", actorAndType.c_str(), argValue.c_str());
return returnValue;
}
-EventHandler::~EventHandler() {
+ScriptResponse::~ScriptResponse() {
delete _code;
_code = nullptr;
}
diff --git a/engines/mediastation/mediascript/eventhandler.h b/engines/mediastation/mediascript/scriptresponse.h
similarity index 84%
rename from engines/mediastation/mediascript/eventhandler.h
rename to engines/mediastation/mediascript/scriptresponse.h
index 66c36f9f4df..fb05e9e00b1 100644
--- a/engines/mediastation/mediascript/eventhandler.h
+++ b/engines/mediastation/mediascript/scriptresponse.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef MEDIASTATION_MEDIASCRIPT_EVENTHANDLER_H
-#define MEDIASTATION_MEDIASCRIPT_EVENTHANDLER_H
+#ifndef MEDIASTATION_MEDIASCRIPT_SCRIPTRESPONSE_H
+#define MEDIASTATION_MEDIASCRIPT_SCRIPTRESPONSE_H
#include "common/str.h"
@@ -30,10 +30,11 @@
namespace MediaStation {
-class EventHandler {
+// These handle events specifically for scripts.
+class ScriptResponse {
public:
- EventHandler(Chunk &chunk);
- ~EventHandler();
+ ScriptResponse(Chunk &chunk);
+ ~ScriptResponse();
ScriptValue execute(uint actorId);
EventType _type;
diff --git a/engines/mediastation/module.mk b/engines/mediastation/module.mk
index c8c7779b3fc..122dbf3a4d6 100644
--- a/engines/mediastation/module.mk
+++ b/engines/mediastation/module.mk
@@ -28,9 +28,9 @@ MODULE_OBJS = \
graphics.o \
mediascript/codechunk.o \
mediascript/collection.o \
- mediascript/eventhandler.o \
mediascript/function.o \
mediascript/scriptconstants.o \
+ mediascript/scriptresponse.o \
mediascript/scriptvalue.o \
mediastation.o \
metaengine.o \
Commit: 9fe3ba9e8bd9aec46bfffa371649f12fb5bc53a1
https://github.com/scummvm/scummvm/commit/9fe3ba9e8bd9aec46bfffa371649f12fb5bc53a1
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-02-24T22:26:21-05:00
Commit Message:
MEDIASTATION: Attempt to fix unsigned expression warnings again
Changed paths:
engines/mediastation/actor.h
diff --git a/engines/mediastation/actor.h b/engines/mediastation/actor.h
index a0dcfd9f889..ef54dd7b2fb 100644
--- a/engines/mediastation/actor.h
+++ b/engines/mediastation/actor.h
@@ -174,7 +174,7 @@ enum MouseEventFlag {
// For a range of valid argument counts (min to max).
#define ARGCOUNTRANGE(min, max) \
- if (((min) > 0 && args.size() < (size_t)(min)) || args.size() > (max)) { \
+ if ((int64)(min) > args.size() || args.size() > (int64)(max)) { \
warning("%s: Expected %d to %d arguments, got %d", builtInMethodToStr(methodId), (min), (max), args.size()); \
}
More information about the Scummvm-git-logs
mailing list