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/levelspecial.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 'src/levelspecial.cpp')
-rw-r--r-- | src/levelspecial.cpp | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index 7ad69ff..e075773 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -1,30 +1,30 @@ -#include <common.h>
-#include <game.h>
-
-struct LevelSpecial {
- 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
- u8 type; // 0x3D4
- u8 effect; // 0x3D5
- u8 lastEvState; // 0x3D6
- u8 func; // 0x3D7
-};
-
-struct EventTable_t {
- u64 events;
- // ...
-};
- -extern EventTable_t *EventTable;
+#include <common.h> +#include <game.h> + +struct LevelSpecial { + 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 + u8 type; // 0x3D4 + u8 effect; // 0x3D5 + u8 lastEvState; // 0x3D6 + u8 func; // 0x3D7 +}; + +struct EventTable_t { + u64 events; + // ... +}; + +extern EventTable_t *EventTable; extern u16 TimeStopFlag; extern u32 TimerBranch; @@ -50,17 +50,17 @@ float GlobalRiderFloatModifications [] = {1, 0.6, 0.7, 0.9, 1, 1, 1, 1.1, 1.25, extern "C" dAc_Py_c *GetSpecificPlayerActor(int number); -void LevelSpecial_Update(LevelSpecial *self);
+void LevelSpecial_Update(LevelSpecial *self); bool ResetAfterLevel(); -#define ACTIVATE 1
-#define DEACTIVATE 0
-
-fBase_c *FindActorByID(u32 id);
+#define ACTIVATE 1 +#define DEACTIVATE 0 +fBase_c *FindActorByID(u32 id); -bool ResetAfterLevel(void) {
+ +bool ResetAfterLevel(void) { TimeStopFlag = 0; TimerBranch = 0x3403FFA4; MarioDescentRate = -4; @@ -75,50 +75,50 @@ bool ResetAfterLevel(void) { AlwaysDrawFlag = 0x9421FFF0; AlwaysDrawBranch = 0x7C0802A6; ZOrderOn = 0; - return true;
-}
-
-bool LevelSpecial_Create(LevelSpecial *self) {
- char eventNum = (self->settings >> 24) & 0xFF;
- self->eventFlag = (u64)1 << (eventNum - 1);
-
- OSReport("Special Event created @%p event %d\n", self, eventNum);
-
- OSReport("Eventnum: %d. Event flag: %08x %08x\n", eventNum, self->eventFlag >> 32, self->eventFlag & 0xFFFFFFFF);
-
- self->type = (self->settings) & 15;
- self->effect = (self->settings >> 4) & 15;
-
- self->lastEvState = 0xFF;
-
- LevelSpecial_Update(self);
-
- return true;
-}
-
-bool LevelSpecial_Execute(LevelSpecial *self) {
- LevelSpecial_Update(self);
- return true;
-}
-
- -void LevelSpecial_Update(LevelSpecial *self) {
- //OSReport("%08x%08x", EventTable->events >> 32, EventTable->events & 0xFFFFFFFF);
-
- u8 newEvState = 0;
- if (EventTable->events & self->eventFlag)
- newEvState = 1;
-
- if (newEvState == self->lastEvState)
- return;
-
- OSReport("Event state changed from %d to %d\n", self->lastEvState, newEvState);
-
- u8 offState;
+ return true; +} + +bool LevelSpecial_Create(LevelSpecial *self) { + char eventNum = (self->settings >> 24) & 0xFF; + self->eventFlag = (u64)1 << (eventNum - 1); + + OSReport("Special Event created @%p event %d\n", self, eventNum); + + OSReport("Eventnum: %d. Event flag: %08x %08x\n", eventNum, self->eventFlag >> 32, self->eventFlag & 0xFFFFFFFF); + + self->type = (self->settings) & 15; + self->effect = (self->settings >> 4) & 15; + + self->lastEvState = 0xFF; + + LevelSpecial_Update(self); + + return true; +} + +bool LevelSpecial_Execute(LevelSpecial *self) { + LevelSpecial_Update(self); + return true; +} + + +void LevelSpecial_Update(LevelSpecial *self) { + //OSReport("%08x%08x", EventTable->events >> 32, EventTable->events & 0xFFFFFFFF); + + u8 newEvState = 0; + if (EventTable->events & self->eventFlag) + newEvState = 1; + + if (newEvState == self->lastEvState) + return; + + OSReport("Event state changed from %d to %d\n", self->lastEvState, newEvState); + + u8 offState; if (newEvState == ACTIVATE) - {
- offState = (newEvState == 1) ? 1 : 0;
- OSReport("Activate Special Event!", offState);
+ { + offState = (newEvState == 1) ? 1 : 0; + OSReport("Activate Special Event!", offState); switch (self->type) { case 1: // Time Freeze @@ -251,12 +251,12 @@ void LevelSpecial_Update(LevelSpecial *self) { default: break; } - }
-
+ } + else - {
- offState = (newEvState == 1) ? 0 : 1;
- OSReport("Deactivate Special Event", offState);
+ { + offState = (newEvState == 1) ? 0 : 1; + OSReport("Deactivate Special Event", offState); switch (self->type) { case 1: // Time Freeze @@ -371,14 +371,14 @@ void LevelSpecial_Update(LevelSpecial *self) { default: break; } - }
- OSReport("Special Event is %d\n", offState);
+ } + OSReport("Special Event is %d\n", offState); - OSReport("Success!\n");
-
-
- self->lastEvState = newEvState;
+ OSReport("Success!\n"); + + + self->lastEvState = newEvState; } |