diff options
Diffstat (limited to 'src/spritespawner.cpp')
-rwxr-xr-x | src/spritespawner.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp index 7468bbb..911ae8a 100755 --- a/src/spritespawner.cpp +++ b/src/spritespawner.cpp @@ -15,7 +15,8 @@ struct SpriteSpawner { u64 eventFlag; // 0x3D0
u16 type; // 0x3D4
u32 inheritSet; // 0x3D6
- u8 lastEvState; // 0x3DA
+ u8 lastEvState; // 0x3DA + dStageActor_c *createdActor;
};
struct EventTable_t {
@@ -31,7 +32,7 @@ struct VEC { extern EventTable_t *EventTable;
-extern "C" void CreateActor(u16 classID, int settings, VEC pos, char rot, char layer); +extern "C" dStageActor_c *CreateActor(u16 classID, int settings, VEC pos, char rot, char layer); void SpriteSpawner_Update(SpriteSpawner *self);
@@ -60,7 +61,6 @@ bool SpriteSpawner_Create(SpriteSpawner *self) { }
bool SpriteSpawner_Execute(SpriteSpawner *self) {
- OSReport("Events: %08x%08x", EventTable->events >> 32, EventTable->events & 0xFFFFFFFF);
SpriteSpawner_Update(self);
return true;
}
@@ -72,15 +72,25 @@ void SpriteSpawner_Update(SpriteSpawner *self) { { // Put an action for when the event turns on here - VEC pos; - pos.x = self->x; - pos.y = self->y; - pos.z = self->z; - - OSReport("Spawning Sprite: %d at %f,%f,%f\n", self->type, pos.x, pos.y, pos.z);
- - CreateActor(self->type, self->inheritSet, pos, 0, 0); - - EventTable->events = EventTable->events & ~self->eventFlag; + if (self->createdActor == 0) + { + VEC pos; + pos.x = self->x; + pos.y = self->y; + pos.z = self->z; + + OSReport("Spawning Sprite: %d at %f,%f,%f\n", self->type, pos.x, pos.y, pos.z);
+ + self->createdActor = CreateActor(self->type, self->inheritSet, pos, 0, 0); + } +// EventTable->events = EventTable->events & ~self->eventFlag; + } + else + { + self->x = self->createdActor->pos.x; + self->y = self->createdActor->pos.y; + self->z = self->createdActor->pos.z; + self->createdActor->Delete(); + self->createdActor = 0; }
} |