summaryrefslogtreecommitdiff
path: root/src/levelnames.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/levelnames.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 '')
-rw-r--r--src/levelnames.cpp166
1 files changed, 83 insertions, 83 deletions
diff --git a/src/levelnames.cpp b/src/levelnames.cpp
index b6f440e..95d7e5d 100644
--- a/src/levelnames.cpp
+++ b/src/levelnames.cpp
@@ -1,83 +1,83 @@
-#include <common.h>
-#include <actors.h>
-#include <stage.h>
-#include "levelinfo.h"
-#include "fileload.h"
-#include "layoutlib.h"
-
-//#define DEBUG_NAMES
-
-#ifndef DEBUG_NAMES
-#define OSReport(...)
-#endif
-
-extern char CurrentLevel;
-extern char CurrentWorld;
-
-int DoNames(int state) {
- OSReport("DoNames called - State param is %d\n", state);
- int wnum = (int)CurrentWorld;
- int lnum = (int)CurrentLevel;
- OSReport("Current Level: %d-%d\n", wnum+1, lnum+1);
-
- // Skip the title screen
- // and only process the code if the State is set to 1
- // (the screen has been initialised)
- if (state == 1 && lnum != STAGE_TITLE) {
- OSReport("Processing\n");
- // grab the CRSIN object
- Actor *ptr = FindActorByType(CRSIN, 0);
- //OSReport("CRSIN actor found at : %08X\n", ptr);
-
- // FIX !!!!!
-
- if (ptr != 0) {
- void *worldObj = EmbeddedLayout_FindTextBoxByName((Layout*)((u32)ptr+0xB0), "TXT_WorldName");
- void *levelObj = EmbeddedLayout_FindTextBoxByName((Layout*)((u32)ptr+0xB0), "TXT_LevelName");
- //OSReport("WorldObj TextBox : %08X; LevelObj TextBox : %08X\n", worldObj, levelObj);
- if (worldObj == 0 || levelObj == 0) return state;
-
- /*char *file = RetrieveFileFromArc(ARC_TABLE, "Mario", "newer/names.bin");
- //OSReport("RetrieveFileFromArc returned : %08X\n", file);
- char *worldname = file + (wnum * 0x40);
- char *levelname = file + 0x280 + (wnum * 0xA80) + (lnum * 0x40);*/
- OSReport("Loading file...\n");
- FileHandle fh;
- void *info = LoadFile(&fh, "/NewerRes/LevelInfo.bin");
-
- LevelInfo_Prepare(&fh);
- LevelInfo_Entry *entry = LevelInfo_Search(info, wnum, lnum);
- char *worldname = LevelInfo_GetName(info, entry);
- char *levelname = "";
- OSReport("Got name : %s\n", worldname);
-
- void *vtable = *((void**)levelObj);
- void *funcaddr = *((void**)((u32)vtable+0x7C));
- int (*SetString)(void*, unsigned short*, unsigned short);
- SetString = (int(*)(void*, unsigned short*, unsigned short))funcaddr;
-
- unsigned short wbuffer[0x40], lbuffer[0x40];
- for (int i = 0; i < 0x40; i++) {
- wbuffer[i] = (unsigned short)worldname[i];
- lbuffer[i] = (unsigned short)levelname[i];
- }
-
- SetString(worldObj, wbuffer, 0);
- SetString(levelObj, lbuffer, 0);
-
- OSReport("Freeing file\n");
- FreeFile(&fh);
- OSReport("Inserted strings\n");
- }
- } else {
- OSReport("Skipped\n");
- }
-
- OSReport("Reached the end of DoNames\n");
- return state;
-}
-
-int DoNamesTest2(int state, u32 ptr) {
- OSReport("TEST 1:%08X 2:%08X\n", state, ptr);
- return DoNames(state);
-}
+#include <common.h>
+#include <actors.h>
+#include <stage.h>
+#include "levelinfo.h"
+#include "fileload.h"
+#include "layoutlib.h"
+
+//#define DEBUG_NAMES
+
+#ifndef DEBUG_NAMES
+#define OSReport(...)
+#endif
+
+extern char CurrentLevel;
+extern char CurrentWorld;
+
+int DoNames(int state) {
+ OSReport("DoNames called - State param is %d\n", state);
+ int wnum = (int)CurrentWorld;
+ int lnum = (int)CurrentLevel;
+ OSReport("Current Level: %d-%d\n", wnum+1, lnum+1);
+
+ // Skip the title screen
+ // and only process the code if the State is set to 1
+ // (the screen has been initialised)
+ if (state == 1 && lnum != STAGE_TITLE) {
+ OSReport("Processing\n");
+ // grab the CRSIN object
+ Actor *ptr = FindActorByType(CRSIN, 0);
+ //OSReport("CRSIN actor found at : %08X\n", ptr);
+
+ // FIX !!!!!
+
+ if (ptr != 0) {
+ void *worldObj = EmbeddedLayout_FindTextBoxByName((Layout*)((u32)ptr+0xB0), "TXT_WorldName");
+ void *levelObj = EmbeddedLayout_FindTextBoxByName((Layout*)((u32)ptr+0xB0), "TXT_LevelName");
+ //OSReport("WorldObj TextBox : %08X; LevelObj TextBox : %08X\n", worldObj, levelObj);
+ if (worldObj == 0 || levelObj == 0) return state;
+
+ /*char *file = RetrieveFileFromArc(ARC_TABLE, "Mario", "newer/names.bin");
+ //OSReport("RetrieveFileFromArc returned : %08X\n", file);
+ char *worldname = file + (wnum * 0x40);
+ char *levelname = file + 0x280 + (wnum * 0xA80) + (lnum * 0x40);*/
+ OSReport("Loading file...\n");
+ FileHandle fh;
+ void *info = LoadFile(&fh, "/NewerRes/LevelInfo.bin");
+
+ LevelInfo_Prepare(&fh);
+ LevelInfo_Entry *entry = LevelInfo_Search(info, wnum, lnum);
+ char *worldname = LevelInfo_GetName(info, entry);
+ char *levelname = "";
+ OSReport("Got name : %s\n", worldname);
+
+ void *vtable = *((void**)levelObj);
+ void *funcaddr = *((void**)((u32)vtable+0x7C));
+ int (*SetString)(void*, unsigned short*, unsigned short);
+ SetString = (int(*)(void*, unsigned short*, unsigned short))funcaddr;
+
+ unsigned short wbuffer[0x40], lbuffer[0x40];
+ for (int i = 0; i < 0x40; i++) {
+ wbuffer[i] = (unsigned short)worldname[i];
+ lbuffer[i] = (unsigned short)levelname[i];
+ }
+
+ SetString(worldObj, wbuffer, 0);
+ SetString(levelObj, lbuffer, 0);
+
+ OSReport("Freeing file\n");
+ FreeFile(&fh);
+ OSReport("Inserted strings\n");
+ }
+ } else {
+ OSReport("Skipped\n");
+ }
+
+ OSReport("Reached the end of DoNames\n");
+ return state;
+}
+
+int DoNamesTest2(int state, u32 ptr) {
+ OSReport("TEST 1:%08X 2:%08X\n", state, ptr);
+ return DoNames(state);
+}