mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 09:56:30 +00:00
ZVISION: Convert ResultActions to take a String pointer in their constructors
There's no point in copying the String since it's just being parsed
This commit is contained in:
parent
e897a1bb2a
commit
7644e00bf3
@ -33,8 +33,8 @@ namespace ZVision {
|
||||
// ActionAdd
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionAdd::ActionAdd(Common::String line) {
|
||||
sscanf(line.c_str(), ":add(%u,%hhu)", &_key, &_value);
|
||||
ActionAdd::ActionAdd(Common::String *line) {
|
||||
sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value);
|
||||
}
|
||||
|
||||
bool ActionAdd::execute(ZVision *engine) {
|
||||
@ -47,8 +47,8 @@ bool ActionAdd::execute(ZVision *engine) {
|
||||
// ActionAssign
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionAssign::ActionAssign(Common::String line) {
|
||||
sscanf(line.c_str(), ":assign(%u, %hhu)", &_key, &_value);
|
||||
ActionAssign::ActionAssign(Common::String *line) {
|
||||
sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value);
|
||||
}
|
||||
|
||||
bool ActionAssign::execute(ZVision *engine) {
|
||||
@ -61,8 +61,8 @@ bool ActionAssign::execute(ZVision *engine) {
|
||||
// ActionAttenuate
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionAttenuate::ActionAttenuate(Common::String line) {
|
||||
sscanf(line.c_str(), ":assign(%u, %hd)", &_key, &_attenuation);
|
||||
ActionAttenuate::ActionAttenuate(Common::String *line) {
|
||||
sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation);
|
||||
}
|
||||
|
||||
bool ActionAttenuate::execute(ZVision *engine) {
|
||||
@ -75,8 +75,8 @@ bool ActionAttenuate::execute(ZVision *engine) {
|
||||
// ActionChangeLocation
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionChangeLocation::ActionChangeLocation(Common::String line) {
|
||||
sscanf(line.c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x);
|
||||
ActionChangeLocation::ActionChangeLocation(Common::String *line) {
|
||||
sscanf(line->c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x);
|
||||
}
|
||||
|
||||
bool ActionChangeLocation::execute(ZVision *engine) {
|
||||
@ -89,8 +89,8 @@ bool ActionChangeLocation::execute(ZVision *engine) {
|
||||
// ActionCrossfade
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionCrossfade::ActionCrossfade(Common::String line) {
|
||||
sscanf(line.c_str(),
|
||||
ActionCrossfade::ActionCrossfade(Common::String *line) {
|
||||
sscanf(line->c_str(),
|
||||
":crossfade(%u %u %hhu %hhu %hhu %hhu %hu)",
|
||||
&_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis);
|
||||
}
|
||||
@ -105,9 +105,9 @@ bool ActionCrossfade::execute(ZVision *engine) {
|
||||
// ActionPreloadAnimation
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionPreloadAnimation::ActionPreloadAnimation(Common::String line) {
|
||||
ActionPreloadAnimation::ActionPreloadAnimation(Common::String *line) {
|
||||
// The two %*hhu are always 0 and dont seem to have a use
|
||||
sscanf(line.c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate);
|
||||
sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate);
|
||||
}
|
||||
|
||||
bool ActionPreloadAnimation::execute(ZVision *engine) {
|
||||
@ -120,9 +120,9 @@ bool ActionPreloadAnimation::execute(ZVision *engine) {
|
||||
// ActionPlayAnimation
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionPlayAnimation::ActionPlayAnimation(Common::String line) {
|
||||
ActionPlayAnimation::ActionPlayAnimation(Common::String *line) {
|
||||
// The two %*hhu are always 0 and dont seem to have a use
|
||||
sscanf(line.c_str(),
|
||||
sscanf(line->c_str(),
|
||||
":animplay:%u(%s %u %u %u %u %u %u %hhu %*hhu %*hhu %u %hhu)",
|
||||
&_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate);
|
||||
}
|
||||
@ -137,8 +137,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) {
|
||||
// ActionRandom
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionRandom::ActionRandom(Common::String line) {
|
||||
sscanf(line.c_str(), ":random:%u, %u)", &_key, &_max);
|
||||
ActionRandom::ActionRandom(Common::String *line) {
|
||||
sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max);
|
||||
}
|
||||
|
||||
bool ActionRandom::execute(ZVision *engine) {
|
||||
@ -152,8 +152,8 @@ bool ActionRandom::execute(ZVision *engine) {
|
||||
// ActionTimer
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionTimer::ActionTimer(Common::String line) {
|
||||
sscanf(line.c_str(), ":timer:%u(%hu)", &_key, &_time);
|
||||
ActionTimer::ActionTimer(Common::String *line) {
|
||||
sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time);
|
||||
}
|
||||
|
||||
bool ActionTimer::execute(ZVision *engine) {
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
class ActionAdd : public ResultAction {
|
||||
public:
|
||||
ActionAdd(Common::String line);
|
||||
ActionAdd(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -84,7 +84,7 @@ private:
|
||||
|
||||
class ActionAssign : public ResultAction {
|
||||
public:
|
||||
ActionAssign(Common::String line);
|
||||
ActionAssign(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -94,7 +94,7 @@ private:
|
||||
|
||||
class ActionAttenuate : public ResultAction {
|
||||
public:
|
||||
ActionAttenuate(Common::String line);
|
||||
ActionAttenuate(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -104,7 +104,7 @@ private:
|
||||
|
||||
class ActionChangeLocation : public ResultAction {
|
||||
public:
|
||||
ActionChangeLocation(Common::String line);
|
||||
ActionChangeLocation(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -116,7 +116,7 @@ private:
|
||||
|
||||
class ActionCrossfade : public ResultAction {
|
||||
public:
|
||||
ActionCrossfade(Common::String line);
|
||||
ActionCrossfade(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -131,7 +131,7 @@ private:
|
||||
|
||||
class ActionPlayAnimation : public ResultAction {
|
||||
public:
|
||||
ActionPlayAnimation(Common::String line);
|
||||
ActionPlayAnimation(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -150,7 +150,7 @@ private:
|
||||
|
||||
class ActionPreloadAnimation : public ResultAction {
|
||||
public:
|
||||
ActionPreloadAnimation(Common::String line);
|
||||
ActionPreloadAnimation(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -163,13 +163,13 @@ private:
|
||||
// TODO: See if this exists in ZGI. It doesn't in ZNem
|
||||
//class ActionUnloadAnimation : public ResultAction {
|
||||
//public:
|
||||
// ActionUnloadAnimation(Common::String line);
|
||||
// ActionUnloadAnimation(Common::String *line);
|
||||
// bool execute(ZVision *engine);
|
||||
//};
|
||||
|
||||
class ActionRandom : public ResultAction {
|
||||
public:
|
||||
ActionRandom(Common::String line);
|
||||
ActionRandom(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
@ -179,7 +179,7 @@ private:
|
||||
|
||||
class ActionTimer : public ResultAction {
|
||||
public:
|
||||
ActionTimer(Common::String line);
|
||||
ActionTimer(Common::String *line);
|
||||
bool execute(ZVision *engine);
|
||||
|
||||
private:
|
||||
|
@ -135,11 +135,11 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List
|
||||
while (!line.contains('}')) {
|
||||
// Parse for the action type
|
||||
if (line.matchString("*:add*", true)) {
|
||||
actionList.push_back(new ActionAdd(line));
|
||||
actionList.push_back(new ActionAdd(&line));
|
||||
} else if (line.matchString("*:animplay*", true)) {
|
||||
actionList.push_back(new ActionPlayAnimation(line));
|
||||
actionList.push_back(new ActionPlayAnimation(&line));
|
||||
} else if (line.matchString("*:animpreload*", true)) {
|
||||
actionList.push_back(new ActionPreloadAnimation(line));
|
||||
actionList.push_back(new ActionPreloadAnimation(&line));
|
||||
} else if (line.matchString("*:animunload*", true)) {
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user