summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fakeStarCoin.cpp2
-rwxr-xr-xsrc/spritespawner.cpp44
2 files changed, 32 insertions, 14 deletions
diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp
index 579054f..4b35337 100644
--- a/src/fakeStarCoin.cpp
+++ b/src/fakeStarCoin.cpp
@@ -109,7 +109,7 @@ int daFakeStarCoin::onCreate() {
nw4r::g3d::ResFile rf(getResource("star_coin", "g3d/star_coin.brres"));
bodyModel.setup(rf.GetResMdl("star_coinA"), &allocator, 0x224, 1, 0);
- SetupTextures_Map(&bodyModel, 0);
+ SetupTextures_MapObj(&bodyModel, 0);
allocator.unlink();
diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp
index 4be86a3..47dbf13 100755
--- a/src/spritespawner.cpp
+++ b/src/spritespawner.cpp
@@ -17,6 +17,7 @@ struct SpriteSpawner {
u32 inheritSet; // 0x3D6
u8 lastEvState; // 0x3DA
u32 createdActor;
+ u8 respawn;
};
@@ -39,11 +40,12 @@ void SpriteSpawner_Update(SpriteSpawner *self);
bool SpriteSpawner_Create(SpriteSpawner *self) {
- char eventNum = (self->settings >> 28) & 0xF;
+ char eventNum = (self->settings >> 28) & 0xF;
- self->eventFlag = (u64)1 << (eventNum - 1);
- self->createdActor = 0;
- self->type = (self->settings >> 16) & 0xFFF;
+ self->eventFlag = (u64)1 << (eventNum - 1);
+ self->createdActor = 0;
+ self->type = (self->settings >> 16) & 0x7FF;
+ self->respawn = (self->settings >> 27) & 0x1;
short tempSet = self->settings & 0xFFFF;
self->inheritSet = (tempSet & 3) | ((tempSet & 0xC) << 2) | ((tempSet & 0x30) << 4) | ((tempSet & 0xC0) << 6) | ((tempSet & 0x300) << 8) | ((tempSet & 0xC00) << 10) | ((tempSet & 0x3000) << 12) | ((tempSet & 0xC000) << 14);
@@ -60,11 +62,11 @@ bool SpriteSpawner_Execute(SpriteSpawner *self) {
void SpriteSpawner_Update(SpriteSpawner *self) {
-
- if (dFlagMgr_c::instance->flags & self->eventFlag)
- {
- // Put an action for when the event turns on here
-
+
+ // If the event is active...
+ if (dFlagMgr_c::instance->flags & self->eventFlag) {
+
+ // And if the spawner hasn't spawned anything...
if (self->createdActor == 0)
{
Vec pos;
@@ -76,20 +78,36 @@ void SpriteSpawner_Update(SpriteSpawner *self) {
dStageActor_c *spawned = CreateActor(self->type, self->inheritSet, pos, 0, 0);
self->createdActor = spawned->id;
}
-// EventTable->events = EventTable->events & ~self->eventFlag;
}
- else
- {
+ else {
+ if (self->respawn) { return; }
+
if (self->createdActor != 0) {
dStageActor_c *spawned = Actor_SearchByID(self->createdActor);
if (spawned != 0) {
self->x = spawned->pos.x;
self->y = spawned->pos.y;
self->z = spawned->pos.z;
- //FIXME changed to add dStageActor_c's Delete(u8) instead of fBase_c's Delete(void)
+
spawned->Delete(1);
}
self->createdActor = 0;
}
}
+
+ if (self->respawn) {
+ if (self->createdActor != 0) {
+ dStageActor_c *spawned = Actor_SearchByID(self->createdActor);
+ if (spawned == 0) {
+ Vec pos;
+ pos.x = self->x;
+ pos.y = self->y;
+ pos.z = self->z;
+
+
+ dStageActor_c *spawned = CreateActor(self->type, self->inheritSet, pos, 0, 0);
+ self->createdActor = spawned->id;
+ }
+ }
+ }
}