summaryrefslogtreecommitdiff
path: root/src/eventlooper.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-07-23 11:47:43 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-07-23 11:47:43 -0500
commit09d075c5469f64f500de70123bbb1042315d7ac0 (patch)
treeee92906230c7fa01e89afb84beeb65b8855393ad /src/eventlooper.cpp
parentffa9dabc6b535da90b3cd8a7849079c546cacfbd (diff)
downloadkamek-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 'src/eventlooper.cpp')
-rw-r--r--src/eventlooper.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/eventlooper.cpp b/src/eventlooper.cpp
index 755742d..6bc0526 100644
--- a/src/eventlooper.cpp
+++ b/src/eventlooper.cpp
@@ -1,37 +1,37 @@
-#include <common.h>
-#include <game.h>
-
-struct EventLooper {
- 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
- u64 eventActive; // 0x3D0
- u8 delay; // 0x3D4
- u8 delayCount; // 0x3D7
-};
-
-struct EventTable_t {
- u64 events;
- // ...
-};
-
-extern EventTable_t *EventTable;
+#include <common.h>
+#include <game.h>
-void EventLooper_Update(EventLooper *self);
+struct EventLooper {
+ 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
+ u64 eventActive; // 0x3D0
+ u8 delay; // 0x3D4
+ u8 delayCount; // 0x3D7
+};
+struct EventTable_t {
+ u64 events;
+ // ...
+};
-
-bool EventLooper_Create(EventLooper *self) {
- char eventStart = (self->settings >> 24) & 0xFF;
- char eventEnd = (self->settings >> 16) & 0xFF;
+extern EventTable_t *EventTable;
+
+void EventLooper_Update(EventLooper *self);
+
+
+
+bool EventLooper_Create(EventLooper *self) {
+ char eventStart = (self->settings >> 24) & 0xFF;
+ char eventEnd = (self->settings >> 16) & 0xFF;
// Putting all the events into the flag
int i;
@@ -41,41 +41,41 @@ bool EventLooper_Create(EventLooper *self) {
q = q | ((u64)1 << (i - 1));
}
- self->eventFlag = q;
+ self->eventFlag = q;
- self->delay = (((self->settings) & 0xFF) + 1) * 10;
- self->delayCount = 0;
+ self->delay = (((self->settings) & 0xFF) + 1) * 10;
+ self->delayCount = 0;
- char tmpEvent= (self->settings >> 8) & 0xFF;
+ char tmpEvent= (self->settings >> 8) & 0xFF;
if (tmpEvent == 0)
{
self->eventActive = (u64)0xFFFFFFFFFFFFFFFF;
}
else
{
- self->eventActive = (u64)1 << (tmpEvent - 1);
+ self->eventActive = (u64)1 << (tmpEvent - 1);
}
if (EventTable->events & self->eventActive)
- {
+ {
u64 evState = (u64)1 << (eventStart - 1);
EventTable->events = EventTable->events | evState;
}
- EventLooper_Update(self);
-
- return true;
-}
-
-bool EventLooper_Execute(EventLooper *self) {
- EventLooper_Update(self);
- return true;
-}
-
+ EventLooper_Update(self);
+
+ return true;
+}
+
+bool EventLooper_Execute(EventLooper *self) {
+ EventLooper_Update(self);
+ return true;
+}
+
-void EventLooper_Update(EventLooper *self) {
+void EventLooper_Update(EventLooper *self) {
if ((EventTable->events & self->eventActive) == 0)
return;
@@ -83,7 +83,7 @@ void EventLooper_Update(EventLooper *self) {
// Waiting for the right moment
if (self->delayCount < self->delay)
{
-// OSReport("Delaying: %d / %d\n", self->delayCount, self->delay);
+// OSReport("Delaying: %d / %d\n", self->delayCount, self->delay);
self->delayCount = self->delayCount + 1;
return;
@@ -93,7 +93,7 @@ void EventLooper_Update(EventLooper *self) {
self->delayCount = 0;
// Find which event(s) is/are on
- u64 evState = EventTable->events & self->eventFlag;
+ u64 evState = EventTable->events & self->eventFlag;
// Turn off the old events
EventTable->events = EventTable->events & (~self->eventFlag);
@@ -107,7 +107,7 @@ void EventLooper_Update(EventLooper *self) {
else
{
- char eventStart = (self->settings >> 24) & 0xFF;
+ char eventStart = (self->settings >> 24) & 0xFF;
evState = (u64)1 << (eventStart - 1);
EventTable->events = EventTable->events | evState;
}