summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-08-27 16:38:00 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-08-27 16:38:00 -0500
commitdd486705285fa58fe8a292203329b9a35ff1d77d (patch)
treea82dbd241f25736d2f992528e17d40eb2dae787d
parent74a7d023469eb0a5a2dc713c74709b11e1815b8a (diff)
downloadkamek-dd486705285fa58fe8a292203329b9a35ff1d77d.tar.gz
kamek-dd486705285fa58fe8a292203329b9a35ff1d77d.zip
Disable crowd clapper event, Sprite swapper fixes.
Diffstat (limited to '')
-rw-r--r--crowdclapper.yaml18
-rwxr-xr-xsrc/spriteswapper.cpp269
2 files changed, 220 insertions, 67 deletions
diff --git a/crowdclapper.yaml b/crowdclapper.yaml
index b7adea4..75ddc10 100644
--- a/crowdclapper.yaml
+++ b/crowdclapper.yaml
@@ -1,9 +1,9 @@
----
-source_files: [../src/crowdclapper.s]
-hooks:
-
- - name: CrowdClapperEventActivate
- type: branch_insn
- branch_type: bl
- src_addr_pal: 0x80872778
- target_func: 'CrowdClapperEventActivate'
+#---
+#source_files: [../src/crowdclapper.s]
+#hooks:
+#
+# - name: CrowdClapperEventActivate
+# type: branch_insn
+# branch_type: bl
+# src_addr_pal: 0x80872778
+# target_func: 'CrowdClapperEventActivate'
diff --git a/src/spriteswapper.cpp b/src/spriteswapper.cpp
index cbff99f..0eec8b1 100755
--- a/src/spriteswapper.cpp
+++ b/src/spriteswapper.cpp
@@ -13,11 +13,15 @@ struct SpriteSwapper {
u8 _B8[0x318]; // 0xB8
// Any variables you add to the class go here; starting at offset 0x3D0
u64 eventFlag; // 0x3D0
+ u64 alteventFlag; // 0x3D0
+ u8 alteventState;
+ u8 alteventTrue;
u16 firstType; // 0x3D4
u16 secondType; // 0x3D4
u8 lastEvState; // 0x3DA
u32 firstActor;
u32 secondActor;
+ u8 direction; // 0x3D0
};
struct EventTable_t {
@@ -25,15 +29,10 @@ struct EventTable_t {
};
-struct VEC {
- float x;
- float y;
- float z;
-};
extern EventTable_t *EventTable;
-extern "C" dStageActor_c *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);
extern "C" dStageActor_c *Actor_SearchByID(u32 actorID);
void SpriteSwapper_Update(SpriteSwapper *self);
@@ -48,15 +47,23 @@ bool SpriteSwapper_Create(SpriteSwapper *self) {
OSReport("I exist, dammit!");
char eventNum = (self->settings >> 28) & 0xF;
+ char alteventNum = (self->settings >> 12) & 0xF;
OSReport("Event to activate: %d", eventNum);
self->eventFlag = (u64)1 << (eventNum - 1);
+ self->alteventFlag = (u64)1 << (alteventNum - 1);
self->firstActor = 0;
self->secondActor = 0;
self->firstType = (self->settings >> 16) & 0xFFF;
self->secondType = self->settings & 0xFFF;
-
- VEC pos;
+
+ self->alteventState = 0;
+ if (alteventNum > 0)
+ self->alteventTrue = 1;
+ else
+ self->alteventTrue = 0;
+
+ Vec pos;
pos.x = self->x;
pos.y = self->y;
pos.z = self->z;
@@ -81,64 +88,210 @@ bool SpriteSwapper_Execute(SpriteSwapper *self) {
void SpriteSwapper_Update(SpriteSwapper *self) {
- if (EventTable->events & self->eventFlag)
- {
- // Put an action for when the event turns on here
- OSReport("Event turned on.");
+ if (self->alteventTrue == 0)
+ {
+ if (EventTable->events & self->eventFlag)
+ {
+ // Put an action for when the event turns on here
+ OSReport("Event turned on.");
+
+ if (self->firstActor != 0)
+ {
+ OSReport("Found the first sprite.");
+
+ dStageActor_c *spawned = Actor_SearchByID(self->firstActor);
+ if (spawned != 0) {
+ OSReport("It's still alive.");
+ self->x = spawned->pos.x;
+ self->y = spawned->pos.y;
+ self->z = spawned->pos.z;
+ self->direction = spawned->direction;
+ Vec speed = spawned->speed;
+ S16Vec rot = spawned->rot;
+ spawned->Delete();
+
+ self->firstActor = 0;
+ OSReport("Now it's deleted.");
- if (self->firstActor != 0)
+ Vec pos;
+ pos.x = self->x;
+ pos.y = self->y;
+ pos.z = self->z;
+
+ int x = 0;
+ while (x < 100000) {
+ x = x+1;
+ }
+
+ OSReport("Making second sprite.");
+ dStageActor_c *spawner = CreateActor(self->secondType, 0, pos, 0, 0);
+ self->secondActor = spawner->id;
+ spawner->direction = self->direction;
+ spawner->speed = speed;
+ spawner->rot = rot;
+ OSReport("Spawned %d.", self->secondActor);
+ }
+
+ else {
+ OSReport("Looks dead to me.");
+ }
+ }
+ // EventTable->events = EventTable->events & ~self->eventFlag;
+ }
+ else
{
- OSReport("Found the first sprite.");
-
- dStageActor_c *spawned = Actor_SearchByID(self->firstActor);
- if (spawned != 0) {
- OSReport("It's still alive.");
- self->x = spawned->pos.x;
- self->y = spawned->pos.y;
- self->z = spawned->pos.z;
- spawned->Delete();
- }
- self->firstActor = 0;
- OSReport("Now it's deleted.");
+ OSReport("Event turned off.");
+ if (self->secondActor != 0)
+ {
+ OSReport("Found the second sprite.");
+ dStageActor_c *spawned = Actor_SearchByID(self->secondActor);
+ if (spawned != 0) {
+ OSReport("It's still alive.");
+ self->x = spawned->pos.x;
+ self->y = spawned->pos.y;
+ self->z = spawned->pos.z;
+ self->direction = spawned->direction;
+ Vec speed = spawned->speed;
+ S16Vec rot = spawned->rot;
+ spawned->Delete();
+
+ self->secondActor = 0;
+ OSReport("Now it's deleted.");
+
+ Vec pos;
+ pos.x = self->x;
+ pos.y = self->y;
+ pos.z = self->z;
+
+ int x = 0;
+ while (x < 100000) {
+ x = x+1;
+ }
+
+ OSReport("Making first sprite again.");
+ dStageActor_c *spawner = CreateActor(self->firstType, 0, pos, 0, 0);
+ self->firstActor = spawner->id;
+ spawner->direction = self->direction;
+ spawner->speed = speed;
+ spawner->rot = rot;
+ OSReport("Spawned %d.", self->firstActor);
+ }
+
+ else {
+ OSReport("Looks dead to me.");
+ }
+ }
+ }
- VEC pos;
- pos.x = self->x;
- pos.y = self->y;
- pos.z = self->z;
-
- OSReport("Making second sprite.");
- dStageActor_c *spawner = CreateActor(self->secondType, 0, pos, 0, 0);
- self->secondActor = spawner->id;
- OSReport("Spawned %d.", self->secondActor);
- }
-// EventTable->events = EventTable->events & ~self->eventFlag;
}
else
{
- OSReport("Event turned off.");
- if (self->secondActor != 0)
+ if (EventTable->events & self->eventFlag)
+ {
+ if (self->alteventState == 0)
+ {
+ // Put an action for when the event turns on here
+ OSReport("Event turned on.");
+
+ if (self->firstActor != 0)
+ {
+ OSReport("Found the first sprite.");
+
+ dStageActor_c *spawned = Actor_SearchByID(self->firstActor);
+ if (spawned != 0) {
+ OSReport("It's still alive.");
+ self->x = spawned->pos.x;
+ self->y = spawned->pos.y;
+ self->z = spawned->pos.z;
+ self->direction = spawned->direction;
+ Vec speed = spawned->speed;
+ S16Vec rot = spawned->rot;
+ spawned->Delete();
+
+ self->firstActor = 0;
+ OSReport("Now it's deleted.");
+
+ Vec pos;
+ pos.x = self->x;
+ pos.y = self->y;
+ pos.z = self->z;
+
+ int x = 0;
+ while (x < 100000) {
+ x = x+1;
+ }
+
+ OSReport("Making second sprite.");
+ dStageActor_c *spawner = CreateActor(self->secondType, 0, pos, 0, 0);
+ self->secondActor = spawner->id;
+ spawner->direction = self->direction;
+ spawner->speed = speed;
+ spawner->rot = rot;
+ OSReport("Spawned %d.", self->secondActor);
+ }
+
+ else {
+ OSReport("Looks dead to me.");
+ }
+
+ }
+ EventTable->events = EventTable->events & ~self->alteventFlag;
+ self->alteventState = 1;
+ }
+ }
+
+ if (EventTable->events & self->alteventFlag)
{
- OSReport("Found the second sprite.");
- dStageActor_c *spawned = Actor_SearchByID(self->secondActor);
- if (spawned != 0) {
- OSReport("It's still alive.");
- self->x = spawned->pos.x;
- self->y = spawned->pos.y;
- self->z = spawned->pos.z;
- spawned->Delete();
+ if (self->alteventState == 1)
+ {
+ OSReport("Event turned off.");
+ if (self->secondActor != 0)
+ {
+ OSReport("Found the second sprite.");
+ dStageActor_c *spawned = Actor_SearchByID(self->secondActor);
+ if (spawned != 0) {
+ OSReport("It's still alive.");
+ self->x = spawned->pos.x;
+ self->y = spawned->pos.y;
+ self->z = spawned->pos.z;
+ self->direction = spawned->direction;
+ Vec speed = spawned->speed;
+ S16Vec rot = spawned->rot;
+ spawned->Delete();
+
+ self->secondActor = 0;
+ OSReport("Now it's deleted.");
+
+ Vec pos;
+ pos.x = self->x;
+ pos.y = self->y;
+ pos.z = self->z;
+
+ int x = 0;
+ while (x < 100000) {
+ x = x+1;
+ }
+
+ OSReport("Making first sprite again.");
+ dStageActor_c *spawner = CreateActor(self->firstType, 0, pos, 0, 0);
+ self->firstActor = spawner->id;
+ spawner->direction = self->direction;
+ spawner->speed = speed;
+ spawner->rot = rot;
+ OSReport("Spawned %d.", self->firstActor);
+ }
+
+
+ else {
+ OSReport("Looks dead to me.");
+ }
+
+ }
+ EventTable->events = EventTable->events & ~self->eventFlag;
+ self->alteventState = 0;
}
- self->secondActor = 0;
- OSReport("Now it's deleted.");
+ }
- VEC pos;
- pos.x = self->x;
- pos.y = self->y;
- pos.z = self->z;
-
- OSReport("Making first sprite again.");
- dStageActor_c *spawner = CreateActor(self->firstType, 0, pos, 0, 0);
- self->firstActor = spawner->id;
- OSReport("Spawned %d.", self->firstActor);
- }
}
+
}