1
0
mirror of synced 2025-02-20 20:50:59 +01:00

Implement one more opcode needed for some Bishi levels.

This commit is contained in:
Jennifer Taylor 2021-05-06 19:37:55 +00:00
parent 459803d244
commit 2252390706

View File

@ -368,6 +368,20 @@ class CloneSpriteStatement(Statement):
return [f"{prefix}builtin_CloneSprite({obj}, {name}, {depth});"]
class RemoveSpriteStatement(Statement):
# Clone a sprite.
def __init__(self, obj_to_remove: Any) -> None:
self.obj_to_remove = obj_to_remove
def __repr__(self) -> str:
obj = object_ref(self.obj_to_remove, "")
return f"builtin_RemoveSprite({obj})"
def render(self, prefix: str) -> List[str]:
obj = object_ref(self.obj_to_remove, prefix)
return [f"{prefix}builtin_RemoveSprite({obj});"]
class GetURL2Statement(Statement):
# Load the URL given in the parameters, with any possible target.
def __init__(self, action: int, url: Any, target: Any) -> None:
@ -2527,6 +2541,11 @@ class ByteCodeDecompiler(VerboseOutput):
chunk.actions[i] = CloneSpriteStatement(obj, name, depth)
continue
if action.opcode == AP2Action.REMOVE_SPRITE:
obj = stack.pop()
chunk.actions[i] = RemoveSpriteStatement(obj)
continue
if action.opcode == AP2Action.GET_VARIABLE:
variable_name = stack.pop()
if isinstance(variable_name, (str, StringConstant)):