From 6d65b65cdc212b52ea58aeeb32e0e4a86741b465 Mon Sep 17 00:00:00 2001 From: scawful Date: Wed, 7 Aug 2024 16:10:50 -0400 Subject: [PATCH] add SpriteInstruction class --- src/app/zelda3/sprite/sprite_builder.cc | 58 +++++++++++++++++++++++++ src/app/zelda3/sprite/sprite_builder.h | 25 +++++++++++ 2 files changed, 83 insertions(+) diff --git a/src/app/zelda3/sprite/sprite_builder.cc b/src/app/zelda3/sprite/sprite_builder.cc index ae7f24bc..8b069411 100644 --- a/src/app/zelda3/sprite/sprite_builder.cc +++ b/src/app/zelda3/sprite/sprite_builder.cc @@ -90,6 +90,64 @@ SpriteAction& SpriteAction::SetNextAction(const std::string& nextActionName) { std::string SpriteAction::GetConfiguration() const { return ""; } +// ============================================================================ + +SpriteInstruction SpriteInstruction::PlayAnimation(int startFrame, int endFrame, + int speed) { + SpriteInstruction instruction; + + return instruction; +} + +SpriteInstruction SpriteInstruction::ApplySpeedTowardsPlayer(int speed) { + SpriteInstruction instruction; + instruction.SetConfiguration("JSL Sprite_ApplySpeedTowardsPlayer"); + return instruction; +} + +SpriteInstruction SpriteInstruction::CheckDamageFromPlayer() { + SpriteInstruction instruction; + + return instruction; +} + +SpriteInstruction SpriteInstruction::MoveXyz() { + SpriteInstruction instruction; + + return instruction; +} + +SpriteInstruction SpriteInstruction::BounceFromTileCollision() { + SpriteInstruction instruction; + + return instruction; +} + +SpriteInstruction SpriteInstruction::SetTimer(int timerId, int value) { + SpriteInstruction instruction; + + return instruction; +} + +SpriteInstruction SpriteInstruction::Custom(const std::string& asmCode) { + SpriteInstruction instruction; + + return instruction; +} + +SpriteInstruction SpriteInstruction::BehaveAsBarrier() { + SpriteInstruction instruction; + + return instruction; +} + +SpriteInstruction SpriteInstruction::JumpToFunction( + const std::string& functionName) { + SpriteInstruction instruction; + + return instruction; +} + } // namespace zelda3 } // namespace app } // namespace yaze diff --git a/src/app/zelda3/sprite/sprite_builder.h b/src/app/zelda3/sprite/sprite_builder.h index 7193e140..b9f20eaa 100644 --- a/src/app/zelda3/sprite/sprite_builder.h +++ b/src/app/zelda3/sprite/sprite_builder.h @@ -8,6 +8,31 @@ namespace yaze { namespace app { namespace zelda3 { +class SpriteInstruction { + public: + // Predefined instructions + static SpriteInstruction PlayAnimation(int startFrame, int endFrame, + int speed); + static SpriteInstruction ApplySpeedTowardsPlayer(int speed); + static SpriteInstruction CheckDamageFromPlayer(); + static SpriteInstruction MoveXyz(); + static SpriteInstruction BounceFromTileCollision(); + static SpriteInstruction SetTimer(int timerId, int value); + static SpriteInstruction BehaveAsBarrier(); + static SpriteInstruction JumpToFunction(const std::string& functionName); + + // Custom instruction + static SpriteInstruction Custom(const std::string& asmCode); + + // Get the instruction configuration + std::string GetConfiguration() const { return instruction_; } + void SetConfiguration(const std::string& instruction) { + instruction_ = instruction; + } + + private: + std::string instruction_; +}; class SpriteAction { public: