diff options
author | Colin Noga <Tempus@Spectrum-Song.local> | 2011-07-23 11:47:43 -0500 |
---|---|---|
committer | Colin Noga <Tempus@Spectrum-Song.local> | 2011-07-23 11:47:43 -0500 |
commit | 09d075c5469f64f500de70123bbb1042315d7ac0 (patch) | |
tree | ee92906230c7fa01e89afb84beeb65b8855393ad /src/spritespawner.cpp | |
parent | ffa9dabc6b535da90b3cd8a7849079c546cacfbd (diff) | |
download | kamek-09d075c5469f64f500de70123bbb1042315d7ac0.tar.gz kamek-09d075c5469f64f500de70123bbb1042315d7ac0.zip |
Added Crowd clapper. Changed everything to LF only. If anyone on Windows tries to read the code now, they will be faced with a single impenetrable line!
Diffstat (limited to '')
-rwxr-xr-x | src/spritespawner.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp index 1d6a071..5335dfe 100755 --- a/src/spritespawner.cpp +++ b/src/spritespawner.cpp @@ -1,74 +1,74 @@ -#include <common.h>
-#include <game.h>
-
-struct SpriteSpawner {
- u32 id; // 0x00
- u32 settings; // 0x04
- u16 name; // 0x08
- u8 _0A[6]; // 0x0A
- u8 _10[0x9C]; // 0x10
- float x; // 0xAC
- float y; // 0xB0
- float z; // 0xB4
- u8 _B8[0x318]; // 0xB8
- // Any variables you add to the class go here; starting at offset 0x3D0
- u64 eventFlag; // 0x3D0
- u16 type; // 0x3D4
- u32 inheritSet; // 0x3D6
+#include <common.h> +#include <game.h> + +struct SpriteSpawner { + u32 id; // 0x00 + u32 settings; // 0x04 + u16 name; // 0x08 + u8 _0A[6]; // 0x0A + u8 _10[0x9C]; // 0x10 + float x; // 0xAC + float y; // 0xB0 + float z; // 0xB4 + u8 _B8[0x318]; // 0xB8 + // Any variables you add to the class go here; starting at offset 0x3D0 + u64 eventFlag; // 0x3D0 + u16 type; // 0x3D4 + u32 inheritSet; // 0x3D6 u8 lastEvState; // 0x3DA - u32 createdActor;
-};
-
-struct EventTable_t {
- u64 events;
-};
- - -struct VEC {
- float x;
- float y;
- float z;
-};
- -
-extern EventTable_t *EventTable;
+ u32 createdActor; +}; + +struct EventTable_t { + u64 events; +}; + + +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 *Actor_SearchByID(u32 actorID); -void SpriteSpawner_Update(SpriteSpawner *self);
- -#define ACTIVATE 1
-#define DEACTIVATE 0
-
- - -
-bool SpriteSpawner_Create(SpriteSpawner *self) {
- OSReport("I exist, dammit!");
- - char eventNum = (self->settings >> 28) & 0xF;
- OSReport("Event to activate: %d", eventNum);
- - self->eventFlag = (u64)1 << (eventNum - 1);
- self->createdActor = 0;
- self->type = (self->settings >> 16) & 0xFFF;
-
- 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);
-
- SpriteSpawner_Update(self);
-
- return true;
-}
-
-bool SpriteSpawner_Execute(SpriteSpawner *self) {
- SpriteSpawner_Update(self);
- return true;
-}
-
- -void SpriteSpawner_Update(SpriteSpawner *self) {
-
+void SpriteSpawner_Update(SpriteSpawner *self); + +#define ACTIVATE 1 +#define DEACTIVATE 0 + + + + +bool SpriteSpawner_Create(SpriteSpawner *self) { + OSReport("I exist, dammit!"); + + char eventNum = (self->settings >> 28) & 0xF; + OSReport("Event to activate: %d", eventNum); + + self->eventFlag = (u64)1 << (eventNum - 1); + self->createdActor = 0; + self->type = (self->settings >> 16) & 0xFFF; + + 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); + + SpriteSpawner_Update(self); + + return true; +} + +bool SpriteSpawner_Execute(SpriteSpawner *self) { + SpriteSpawner_Update(self); + return true; +} + + +void SpriteSpawner_Update(SpriteSpawner *self) { + if (EventTable->events & self->eventFlag) { // Put an action for when the event turns on here @@ -80,7 +80,7 @@ void SpriteSpawner_Update(SpriteSpawner *self) { 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);
+ OSReport("Spawning Sprite: %d at %f,%f,%f\n", self->type, pos.x, pos.y, pos.z); dStageActor_c *spawned = CreateActor(self->type, self->inheritSet, pos, 0, 0); self->createdActor = spawned->id; @@ -99,5 +99,5 @@ void SpriteSpawner_Update(SpriteSpawner *self) { } self->createdActor = 0; } - }
+ } } |