mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
VCRUISE: Stub out say1, fix gong beater not being removed from inventory.
This commit is contained in:
parent
7f9e4d80a1
commit
0dd7d2308e
@ -76,7 +76,7 @@ const MapScreenDirectionDef *MapDef::getScreenDirection(uint screen, uint direct
|
||||
return screenDirections[screen][direction].get();
|
||||
}
|
||||
|
||||
ScriptEnvironmentVars::ScriptEnvironmentVars() : lmb(false), lmbDrag(false), panInteractionID(0), fpsOverride(0) {
|
||||
ScriptEnvironmentVars::ScriptEnvironmentVars() : lmb(false), lmbDrag(false), panInteractionID(0), fpsOverride(0), lastHighlightedItem(0) {
|
||||
}
|
||||
|
||||
void Runtime::RenderSection::init(const Common::Rect ¶mRect, const Graphics::PixelFormat &fmt) {
|
||||
@ -251,6 +251,22 @@ void SfxData::load(Common::SeekableReadStream &stream, Audio::Mixer *mixer) {
|
||||
workKey = workKey.substr(spaceSpanEnd, workKey.size() - spaceSpanEnd);
|
||||
}
|
||||
|
||||
// Strip leading and trailing spaces
|
||||
while (tokens.size() > 0) {
|
||||
if (tokens[0].empty()) {
|
||||
tokens.remove_at(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint lastIndex = tokens.size() - 1;
|
||||
if (tokens[lastIndex].empty()) {
|
||||
tokens.remove_at(lastIndex);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (tokens.size() != 4) {
|
||||
warning("Found unusual playlist entry: %s", key.c_str());
|
||||
continue;
|
||||
@ -1040,6 +1056,7 @@ bool Runtime::runScript() {
|
||||
DISPATCH_OP(Random);
|
||||
DISPATCH_OP(Drop);
|
||||
DISPATCH_OP(Dup);
|
||||
DISPATCH_OP(Say1);
|
||||
DISPATCH_OP(Say3);
|
||||
DISPATCH_OP(Say3Get);
|
||||
DISPATCH_OP(SetTimer);
|
||||
@ -2251,6 +2268,19 @@ void Runtime::inventoryAddItem(uint item) {
|
||||
drawInventory(firstOpenSlot);
|
||||
}
|
||||
|
||||
void Runtime::inventoryRemoveItem(uint itemID) {
|
||||
for (uint slot = 0; slot < kNumInventorySlots; slot++) {
|
||||
InventoryItem &item = _inventory[slot];
|
||||
|
||||
if (item.itemID == static_cast<uint>(itemID)) {
|
||||
item.highlighted = false;
|
||||
item.itemID = 0;
|
||||
item.graphic.reset();
|
||||
drawInventory(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Runtime::drawInventory(uint slot) {
|
||||
Common::Rect trayRect = _traySection.rect;
|
||||
trayRect.translate(-trayRect.left, -trayRect.top);
|
||||
@ -2795,6 +2825,7 @@ void Runtime::scriptOpItemCheck(ScriptArg_t arg) {
|
||||
|
||||
for (const InventoryItem &item : _inventory) {
|
||||
if (item.itemID == static_cast<uint>(stackArgs[0])) {
|
||||
_scriptEnv.lastHighlightedItem = item.itemID;
|
||||
_scriptStack.push_back(1);
|
||||
return;
|
||||
}
|
||||
@ -2806,18 +2837,7 @@ void Runtime::scriptOpItemCheck(ScriptArg_t arg) {
|
||||
void Runtime::scriptOpItemRemove(ScriptArg_t arg) {
|
||||
TAKE_STACK(1);
|
||||
|
||||
for (uint slot = 0; slot < kNumInventorySlots; slot++) {
|
||||
InventoryItem &item = _inventory[slot];
|
||||
|
||||
if (item.itemID == static_cast<uint>(stackArgs[0])) {
|
||||
item.highlighted = false;
|
||||
item.itemID = 0;
|
||||
item.graphic.reset();
|
||||
drawInventory(slot);
|
||||
}
|
||||
}
|
||||
|
||||
_scriptStack.push_back(0);
|
||||
inventoryRemoveItem(stackArgs[0]);
|
||||
}
|
||||
|
||||
void Runtime::scriptOpItemHighlightSet(ScriptArg_t arg) {
|
||||
@ -2838,7 +2858,13 @@ void Runtime::scriptOpItemHighlightSet(ScriptArg_t arg) {
|
||||
void Runtime::scriptOpItemAdd(ScriptArg_t arg) {
|
||||
TAKE_STACK(1);
|
||||
|
||||
inventoryAddItem(stackArgs[0]);
|
||||
if (stackArgs[0] == 0) {
|
||||
// Weird special case, happens in Reah when breaking the glass barrier, this is called with 0 as the parameter.
|
||||
// This can't be an inventory clear because it will not clear the crutch, but it does take away the gong beater,
|
||||
// so the only explanation I can think of is that it clears the previously-checked inventory item.
|
||||
inventoryRemoveItem(_scriptEnv.lastHighlightedItem);
|
||||
} else
|
||||
inventoryAddItem(stackArgs[0]);
|
||||
}
|
||||
|
||||
void Runtime::scriptOpItemHaveSpace(ScriptArg_t arg) {
|
||||
@ -3123,6 +3149,17 @@ void Runtime::scriptOpDup(ScriptArg_t arg) {
|
||||
_scriptStack.push_back(stackArgs[0]);
|
||||
}
|
||||
|
||||
void Runtime::scriptOpSay1(ScriptArg_t arg) {
|
||||
TAKE_STACK(3);
|
||||
|
||||
warning("Say1 cycles are not implemented yet, playing first sound in the cycle");
|
||||
|
||||
uint soundID = stackArgs[0];
|
||||
// uint cycleLength = stackArgs[2];
|
||||
|
||||
triggerSound(false, soundID, 100, 0, false);
|
||||
}
|
||||
|
||||
void Runtime::scriptOpSay3(ScriptArg_t arg) {
|
||||
TAKE_STACK(3);
|
||||
|
||||
|
@ -137,6 +137,7 @@ struct ScriptEnvironmentVars {
|
||||
bool lmbDrag;
|
||||
uint panInteractionID;
|
||||
uint fpsOverride;
|
||||
uint lastHighlightedItem;
|
||||
};
|
||||
|
||||
struct SfxSound {
|
||||
@ -504,6 +505,7 @@ private:
|
||||
bool computeFaceDirectionAnimation(uint desiredDirection, const AnimationDef *&outAnimDef, uint &outInitialFrame, uint &outStopFrame);
|
||||
|
||||
void inventoryAddItem(uint item);
|
||||
void inventoryRemoveItem(uint item);
|
||||
void drawInventory(uint slot);
|
||||
void resetInventoryHighlights();
|
||||
|
||||
@ -571,6 +573,7 @@ private:
|
||||
void scriptOpRandom(ScriptArg_t arg);
|
||||
void scriptOpDrop(ScriptArg_t arg);
|
||||
void scriptOpDup(ScriptArg_t arg);
|
||||
void scriptOpSay1(ScriptArg_t arg);
|
||||
void scriptOpSay3(ScriptArg_t arg);
|
||||
void scriptOpSay3Get(ScriptArg_t arg);
|
||||
void scriptOpSetTimer(ScriptArg_t arg);
|
||||
|
@ -348,8 +348,8 @@ static ScriptNamedInstruction g_namedInstructions[] = {
|
||||
{"rnd", ProtoOp::kProtoOpScript, ScriptOps::kRandom},
|
||||
{"drop", ProtoOp::kProtoOpScript, ScriptOps::kDrop},
|
||||
{"dup", ProtoOp::kProtoOpScript, ScriptOps::kDup},
|
||||
{"say1", ProtoOp::kProtoOpScript, ScriptOps::kSay3}, // FIXME: Figure out what the difference is between the say ops
|
||||
{"say2", ProtoOp::kProtoOpScript, ScriptOps::kSay3}, // FIXME: Figure out what the difference is between the say ops
|
||||
{"say1", ProtoOp::kProtoOpScript, ScriptOps::kSay1},
|
||||
{"say2", ProtoOp::kProtoOpScript, ScriptOps::kSay3}, // FIXME: Figure out what the difference is between say2 and say3. I think say2 is repeatable? Maybe works as say1 instead?
|
||||
{"say3", ProtoOp::kProtoOpScript, ScriptOps::kSay3},
|
||||
{"say3@", ProtoOp::kProtoOpScript, ScriptOps::kSay3Get},
|
||||
{"setTimer", ProtoOp::kProtoOpScript, ScriptOps::kSetTimer},
|
||||
|
@ -99,6 +99,7 @@ enum ScriptOp {
|
||||
kRandom,
|
||||
kDrop,
|
||||
kDup,
|
||||
kSay1,
|
||||
kSay3,
|
||||
kSay3Get,
|
||||
kSetTimer,
|
||||
|
Loading…
x
Reference in New Issue
Block a user