Skip to content

Commit 4b2978d

Browse files
authored
Match some screen functions
1 parent 0be9975 commit 4b2978d

File tree

4 files changed

+59
-15
lines changed

4 files changed

+59
-15
lines changed

config/symbol_addrs.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ g_difficultyEasy = 0x261e90; // size:0x5c
191191
g_difficulty = 0x261ef0; // size:0x20
192192

193193

194+
// P2/font.c
195+
196+
g_pfont = 0x26227C; // size:0x4
197+
198+
194199
// P2/frm.c
195200
StartupFrame__Fv = 0x15E810; // type:func
196201
OpenFrame__Fv = 0x15E9F0; // type:func
@@ -337,7 +342,7 @@ PostBlotLoad__FP4BLOT = 0x1AA268; // type:func
337342
UpdateBlot__FP4BLOT = 0x1AA298; // type:func
338343
SetBlotAchzDraw__FP4BLOTPc = 0x1AA4F0; // type:func
339344
SetBlotRgba__FP4BLOTUi = 0x1AA5A0; // type:func
340-
SetBlotFontScale__FP4BLOTf = 0x1AA788; // type:func
345+
SetBlotFontScale__FfP4BLOT = 0x1AA788; // type:func
341346
DrawBlot__FP4BLOT = 0x1AA790; // type:func
342347
DtAppearBlot__FP4BLOT = 0x1AA898; // type:func
343348
DtVisibleBlot__FP4BLOT = 0x1AA8A0; // type:func

include/binoc.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ struct RGBA
4141
uchar bGreen;
4242
uchar bBlue;
4343
uchar bAlpha;
44+
45+
inline void operator=(const int rgba)
46+
{
47+
bRed = (rgba >> 24) & 0xFF;
48+
bGreen = (rgba >> 16) & 0xFF;
49+
bBlue = (rgba >> 8) & 0xFF;
50+
bAlpha = rgba & 0xFF;
51+
}
4452
};
4553

4654
class CTextBox
@@ -57,7 +65,7 @@ class CTextBox
5765
float m_y;
5866
float m_dx;
5967
float m_dy;
60-
struct RGBA m_rgba;
68+
RGBA m_rgba;
6169
enum JH m_jh;
6270
enum JV m_jv;
6371
};

include/font.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ class CFont
2626
float m_ryScale;
2727
};
2828

29+
extern CFont *g_pfont;
30+
2931
#endif // FONT_H

src/P2/screen.c

+42-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include <screen.h>
2+
#include <clock.h>
3+
#include <font.h>
24

35
INCLUDE_ASM(const s32, "P2/screen", StartupScreen__Fv);
46

@@ -16,31 +18,58 @@ INCLUDE_ASM(const s32, "P2/screen", DrawBlots__Fv);
1618

1719
INCLUDE_ASM(const s32, "P2/screen", InitBlot__FP4BLOT5BLOTK);
1820

19-
INCLUDE_ASM(const s32, "P2/screen", PostBlotLoad__FP4BLOT);
21+
void PostBlotLoad(BLOT *pblot)
22+
{
23+
pblot->pfont = g_pfont;
24+
*(int*)&pblot->rgba = 0xff808080; // Union?
25+
pblot->achzDraw[0] = 0;
26+
pblot->rFontScale = 1.0f;
27+
}
2028

2129
INCLUDE_ASM(const s32, "P2/screen", UpdateBlot__FP4BLOT);
2230

2331
INCLUDE_ASM(const s32, "P2/screen", SetBlotAchzDraw__FP4BLOTPc);
2432

2533
INCLUDE_ASM(const s32, "P2/screen", SetBlotRgba__FP4BLOTUi);
2634

27-
INCLUDE_ASM(const s32, "P2/screen", SetBlotFontScale__FP4BLOTf);
35+
void SetBlotFontScale(float rFontScale, BLOT *pblot)
36+
{
37+
pblot->rFontScale = rFontScale;
38+
}
2839

2940
INCLUDE_ASM(const s32, "P2/screen", DrawBlot__FP4BLOT);
3041

3142
INCLUDE_ASM(const s32, "P2/screen", func_001AA890);
3243

33-
INCLUDE_ASM(const s32, "P2/screen", DtAppearBlot__FP4BLOT);
34-
35-
INCLUDE_ASM(const s32, "P2/screen", DtVisibleBlot__FP4BLOT);
36-
37-
INCLUDE_ASM(const s32, "P2/screen", DtDisappearBlot__FP4BLOT);
38-
39-
INCLUDE_ASM(const s32, "P2/screen", SetBlotDtAppear__FP4BLOTf);
40-
41-
INCLUDE_ASM(const s32, "P2/screen", SetBlotDtVisible__FP4BLOTf);
42-
43-
INCLUDE_ASM(const s32, "P2/screen", SetBlotDtDisappear__FP4BLOTf);
44+
float DtAppearBlot(BLOT *pblot)
45+
{
46+
return pblot->dtAppear;
47+
}
48+
49+
float DtVisibleBlot(BLOT *pblot)
50+
{
51+
return pblot->dtVisible;
52+
}
53+
54+
float DtDisappearBlot(BLOT *pblot)
55+
{
56+
return pblot->dtDisappear;
57+
}
58+
59+
void SetBlotDtAppear(BLOT *pblot, float dtAppear)
60+
{
61+
pblot->dtAppear = dtAppear;
62+
}
63+
64+
void SetBlotDtVisible(BLOT *pblot, float dtVisible)
65+
{
66+
pblot->dtVisible = dtVisible;
67+
}
68+
69+
void SetBlotDtDisappear(BLOT *pblot, float dtDisappear)
70+
{
71+
pblot->dtDisappear = dtDisappear;
72+
}
4473

4574
INCLUDE_ASM(const s32, "P2/screen", OnBlotReset__FP4BLOT);
4675

0 commit comments

Comments
 (0)