diff options
Diffstat (limited to 'src/engine/Actor.cpp')
| -rw-r--r-- | src/engine/Actor.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/engine/Actor.cpp b/src/engine/Actor.cpp index be86d2a5f..f3254fed0 100644 --- a/src/engine/Actor.cpp +++ b/src/engine/Actor.cpp @@ -1,16 +1,41 @@ #include <libultraship.h> +#include "Matrix.h" #include "Actor.h" +extern "C" { +#include "math_util.h" +} + AActor::AActor() {} // Virtual functions to be overridden by derived classes void AActor::Tick() { } -void AActor::Draw(Camera *camera) { } +void AActor::Draw(Camera *camera) { + if (Model) { + Mat4 mtx; + + gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); + gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); + + ApplyMatrixTransformations(mtx, *(FVector*)Pos, *(IRotator*)Rot, Scale); + if (render_set_position(mtx, 0) != 0) { + gSPDisplayList(gDisplayListHead++, Model); + } + } +} void AActor::Collision(Player* player, AActor* actor) {} void AActor::VehicleCollision(s32 playerId, Player* player){} void AActor::Destroy() { // Set uuid to zero. memset(uuid, 0, sizeof(uuid)); } -bool AActor::IsMod() { return false; }
\ No newline at end of file +bool AActor::IsMod() { return false; } +void AActor::SetLocation(FVector pos) { + Pos[0] = pos.x; + Pos[1] = pos.y; + Pos[2] = pos.z; +} +FVector AActor::GetLocation() const { + return FVector(Pos[0], Pos[1], Pos[2]); +} |
