Implement one more opcode needed for some Bishi levels.
This commit is contained in:
parent
459803d244
commit
2252390706
@ -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)):
|
||||
|
Loading…
x
Reference in New Issue
Block a user