summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/game.h74
-rw-r--r--kamek_ntsc.x6
-rw-r--r--kamek_ntsc2.x6
-rw-r--r--kamek_pal.x6
-rw-r--r--kamek_pal2.x6
5 files changed, 97 insertions, 1 deletions
diff --git a/include/game.h b/include/game.h
index f713d0a..7c8b4e2 100755
--- a/include/game.h
+++ b/include/game.h
@@ -455,7 +455,7 @@ namespace lyt {
u8 origin;
u8 flag;
- char name[0x14];
+ char name[0x11];
char userdata[8];
u8 _D5;
@@ -1157,6 +1157,78 @@ private:
+namespace nw4r {
+ namespace ut {
+ class CharWriter {
+ public:
+ CharWriter();
+ ~CharWriter();
+
+ void SetupGX();
+
+ void SetFontSize(float w, float h);
+ void SetFontSize(float v);
+ float GetFontWidth() const;
+ float GetFontHeight() const;
+ float GetFontAscent() const;
+ float GetFontDescent() const;
+
+ // returns width
+ float Print(ushort character);
+
+ void PrintGlyph(float, float, float, /* nw4r::ut::Glyph const & */ void*);
+
+ void UpdateVertexColor();
+
+ private:
+ void SetupGXWithColorMapping(Color c1, Color c2);
+
+ public:
+ Color colors[8]; // todo: document
+ u32 modeOfSomeKind;
+ float scaleX;
+ float scaleY;
+ float posX;
+ float posY;
+ float posZ;
+ GXTexFilter minFilt;
+ GXTexFilter magFilt;
+ u16 completelyUnknown;
+ u8 alpha;
+ u8 isFixedWidth;
+ float fixedWidthValue;
+ /* ResFont* */ void *font;
+ };
+
+ // actually TextWriterBase<w>, but ...
+ class TextWriter : public CharWriter {
+ public:
+ TextWriter();
+ ~TextWriter();
+
+ float GetLineHeight() const;
+
+ // left out most of these to avoid all the format string vararg bullshit
+ float CalcStringWidth(wchar_t const *string, int length) const;
+
+ float Print(wchar_t const *string, int length);
+
+ float CalcLineWidth(wchar_t const *string, int length);
+
+ float GetLineSpace() const;
+
+ bool IsDrawFlagSet(ulong, ulong) const;
+
+ float _4C;
+ float charSpace;
+ float somethingRelatedToLineHeight;
+ u32 _58;
+ u32 drawFlag;
+ void *tagProcessorMaybe;
+ };
+ }
+}
+
// More layout crap
// This file REALLY needs to be reorganised.
diff --git a/kamek_ntsc.x b/kamek_ntsc.x
index e633c41..6e28956 100644
--- a/kamek_ntsc.x
+++ b/kamek_ntsc.x
@@ -268,6 +268,12 @@ SECTIONS {
allocateBuffer__10mTexture_cFPv = 0x802C11E0;
plotPixel__10mTexture_cFUsUs8_GXColor = 0x802C1280;
+ SetFontSize__Q34nw4r2ut10CharWriterFff = 0x8022D2F0;
+
+ __ct__Q34nw4r2ut10TextWriterFv = 0x80230780;
+ __dt__Q34nw4r2ut10TextWriterFv = 0x802307E0;
+ CalcStringWidth__Q34nw4r2ut10TextWriterCFPCwi = 0x802310D0;
+
GameHeaps = 0x80377C48;
BGDatClass = 0x80429DF0;
diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x
index 15bb3b1..075d868 100644
--- a/kamek_ntsc2.x
+++ b/kamek_ntsc2.x
@@ -268,6 +268,12 @@ SECTIONS {
allocateBuffer__10mTexture_cFPv = 0x802C11E0;
plotPixel__10mTexture_cFUsUs8_GXColor = 0x802C1280;
+ SetFontSize__Q34nw4r2ut10CharWriterFff = 0x8022D2F0;
+
+ __ct__Q34nw4r2ut10TextWriterFv = 0x80230780;
+ __dt__Q34nw4r2ut10TextWriterFv = 0x802307E0;
+ CalcStringWidth__Q34nw4r2ut10TextWriterCFPCwi = 0x802310D0;
+
GameHeaps = 0x80377C48;
BGDatClass = 0x80429DF0;
diff --git a/kamek_pal.x b/kamek_pal.x
index 8d4b0da..72cce55 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -268,6 +268,12 @@ SECTIONS {
allocateBuffer__10mTexture_cFPv = 0x802C14D0;
plotPixel__10mTexture_cFUsUs8_GXColor = 0x802C1570;
+ SetFontSize__Q34nw4r2ut10CharWriterFff = 0x8022D430;
+
+ __ct__Q34nw4r2ut10TextWriterFv = 0x802308C0;
+ __dt__Q34nw4r2ut10TextWriterFv = 0x80230920;
+ CalcStringWidth__Q34nw4r2ut10TextWriterCFPCwi = 0x80231210;
+
GameHeaps = 0x80377F48;
BGDatClass = 0x8042A0D0;
diff --git a/kamek_pal2.x b/kamek_pal2.x
index 326ff25..3136527 100644
--- a/kamek_pal2.x
+++ b/kamek_pal2.x
@@ -268,6 +268,12 @@ SECTIONS {
allocateBuffer__10mTexture_cFPv = 0xDEADBEEF;
plotPixel__10mTexture_cFUsUs8_GXColor = 0xDEADBEEF;
+ SetFontSize__Q34nw4r2ut10CharWriterFff = 0xDEADBEEF;
+
+ __ct__Q34nw4r2ut10TextWriterFv = 0xDEADBEEF;
+ __dt__Q34nw4r2ut10TextWriterFv = 0xDEADBEEF;
+ CalcStringWidth__Q34nw4r2ut10TextWriterCFPCwi = 0xDEADBEEF;
+
GameHeaps = 0xDEADBEEF;
BGDatClass = 0xDEADBEEF;