Browse Source

Implement 'artfont.cpp' in DiabloUI (#218)

pull/4/head
galaxyhaxz 8 years ago committed by Anders Jenbo
parent
commit
e7aa782e06
  1. 1
      3rdParty/Storm/Source/storm.cpp
  2. 2
      3rdParty/Storm/Source/storm.def
  3. 1
      3rdParty/Storm/Source/storm.h
  4. 3
      3rdParty/Storm/Source/storm_gcc.def
  5. 252
      DiabloUI/_temp_data.cpp
  6. 27
      DiabloUI/_temp_funcs.h
  7. 380
      DiabloUI/artfont.cpp
  8. 22
      DiabloUI/diabloui.h

1
3rdParty/Storm/Source/storm.cpp vendored

@ -164,6 +164,7 @@ BOOL STORMAPI STransPointInMask(HANDLE hTrans, int x, int y) rBool;
BOOL STORMAPI STransCombineMasks(HANDLE hTransA, HANDLE hTransB, int left, int top, int flags, HANDLE * phTransResult) rBool;
BOOL STORMAPI STransCreateE(void *pBuffer, int width, int height, int bpp, int a5, int bufferSize, HANDLE *phTransOut) rBool;
BOOL STORMAPI STransCreateI(void *pBuffer, int width, int height, int bpp, int a5, int bufferSize, HANDLE *phTransOut) rBool;
BOOL STORMAPI SVidDestroy() rBool;
BOOL STORMAPI SVidGetSize(HANDLE video, int width, int height, int zero) rBool;

2
3rdParty/Storm/Source/storm.def vendored

@ -221,7 +221,7 @@ EXPORTS
;SReg430 @430 NONAME
STransBlt @431 NONAME
STransBltUsingMask @432 NONAME
;STransCreateI @433 NONAME
STransCreateI @433 NONAME
STransDelete @434 NONAME
STransDuplicate @436 NONAME

1
3rdParty/Storm/Source/storm.h vendored

@ -894,6 +894,7 @@ BOOL STORMAPI STransPointInMask(HANDLE hTrans, int x, int y); // Name is a pure
BOOL STORMAPI STransCombineMasks(HANDLE hTransA, HANDLE hTransB, int left, int top, int flags, HANDLE * phTransResult);
BOOL STORMAPI STransCreateE(void *pBuffer, int width, int height, int bpp, int a5, int bufferSize, HANDLE *phTransOut);
BOOL STORMAPI STransCreateI(void *pBuffer, int width, int height, int bpp, int a5, int bufferSize, HANDLE *phTransOut);
BOOL STORMAPI SVidDestroy();
BOOL STORMAPI SVidGetSize(HANDLE video, int width, int height, int zero);

3
3rdParty/Storm/Source/storm_gcc.def vendored

@ -273,7 +273,8 @@ EXPORTS
;SReg430 @430 NONAME
STransBlt @431 NONAME
STransBltUsingMask @432 NONAME
;STransCreateI @433 NONAME
STransCreateI @433 NONAME
STransCreateI@28 @433 NONAME
STransDelete @434 NONAME
STransDuplicate @436 NONAME

252
DiabloUI/_temp_data.cpp

@ -1,136 +1,132 @@
#define _UNKNOWN DWORD
char *off_1001F378 = "profile\\sex"; // weak
char byte_1001F37C[] = { '\x01' }; // weak
int dword_1001F380[] = { 1128 }; // weak
int dword_1001F384[] = { 8 }; // weak
_UNKNOWN unk_1001F3B8; // weak
_UNKNOWN unk_1001F3BC; // weak
_UNKNOWN unk_1001F3D0; // weak
//rdata
ProfileStruct bnprofiles[4] =
{
{ "profile\\sex", '\x01', 1128, 8 },
{ "profile\\age", '\x01', 1130, 4 },
{ "profile\\location", '\x01', 1132, 40 },
{ "profile\\description", '\x01', 1134, 200 }
};
int profilemsg1[6] = { 1125, 1127, 1129, 1131, 1133, 0 };
int profilemsg2[6] = { 1126, 1128, 1130, 1132, 1134, 0 };
int local_cpp_float_value = 2139095040; // weak
int dword_10022258 = 4; // weak
int dword_10022260[] = { 8 }; // weak
char *off_10022264 = "Arial"; // weak
int dword_10022268[] = { 400 }; // weak
_UNKNOWN unk_100228DC; // weak
_UNKNOWN unk_100228E8; // weak
_UNKNOWN unk_100228F0; // weak
_UNKNOWN unk_100228F8; // weak
DWORD pdwMsgTbl = 1094u; // idb
short word_10022958[] = { 30 }; // weak
short word_1002295A[] = { 15 }; // weak
short word_1002295C[] = { 20 }; // weak
short word_1002295E[8] = { 30, 25, 20, 30, 20, 15, 35, 25 }; // idb
_UNKNOWN unk_10022A2C; // weak
_UNKNOWN unk_10022A38; // weak
_UNKNOWN unk_10022A40; // weak
_UNKNOWN unk_10022A48; // weak
DWORD dword_10022A54 = 1100u; // idb
_UNKNOWN unk_10022A98; // weak
_UNKNOWN unk_10022AA4; // weak
_UNKNOWN unk_10022AFC; // weak
_UNKNOWN unk_10022B04; // weak
_UNKNOWN unk_10022B10; // weak
_UNKNOWN unk_10022B34; // weak
_UNKNOWN unk_10022B3C; // weak
_UNKNOWN unk_10022B48; // weak
_UNKNOWN unk_10022BE0; // weak
DWORD dword_10022BE8 = 1044u; // idb
_UNKNOWN unk_10022C4C; // weak
_UNKNOWN unk_10022C54; // weak
_UNKNOWN unk_10022C5C; // weak
_UNKNOWN unk_10022CAC; // weak
DWORD dword_10022CB4 = 2u; // idb
_UNKNOWN unk_10022EB4; // weak
_UNKNOWN unk_10022EBC; // weak
DWORD dword_10022EC8 = 1062u; // idb
_UNKNOWN unk_10022ED8; // weak
_UNKNOWN unk_10022EE4; // weak
_UNKNOWN unk_10022EF0; // weak
_UNKNOWN unk_10022F00; // weak
_UNKNOWN unk_10022F08; // weak
int dword_10022F18 = 1069; // weak
char *off_10022F8C[4] = { "Entry1", "Entry2", "Entry3", "Entry4" }; // weak
char *off_10022F90[3] = { "Entry2", "Entry3", "Entry4" }; // weak
_UNKNOWN unk_10022F9C; // weak
_UNKNOWN unk_10022FA4; // weak
DWORD dword_10022FB0 = 1117u; // idb
_UNKNOWN unk_10023000; // weak
_UNKNOWN unk_10023008; // weak
_UNKNOWN unk_10023020; // weak
_UNKNOWN unk_100230F0; // weak
_UNKNOWN unk_100230FC; // weak
_UNKNOWN unk_10023104; // weak
_UNKNOWN unk_1002310C; // weak
int dword_10023118 = 1088; // weak
_UNKNOWN unk_10023174; // weak
_UNKNOWN unk_1002317C; // weak
_UNKNOWN unk_10023188; // weak
int dword_10023190 = 1047; // weak
_UNKNOWN unk_100231AC; // weak
_UNKNOWN unk_100231B4; // weak
DWORD dword_100231C0 = 1106u; // idb
_UNKNOWN unk_100231CC; // weak
_UNKNOWN unk_100231D4; // weak
_UNKNOWN unk_100231E0; // weak
_UNKNOWN unk_100231E8; // weak
int dword_100231F4 = 1110; // weak
_UNKNOWN unk_10023244; // weak
_UNKNOWN unk_10023250; // weak
_UNKNOWN unk_10023258; // weak
_UNKNOWN unk_10023260; // weak
int dword_1002326C = 1135; // weak
_UNKNOWN unk_100232D4; // weak
DWORD dword_100232DC = 1109u; // idb
_UNKNOWN unk_10023340; // weak
int dword_10026BB0 = 0; // weak
_UNKNOWN unk_10026BB8; // weak
int dword_100270BC; // weak
int dword_100270C0; // weak
_UNKNOWN unk_100270C8; // weak
int dword_100275CC; // weak
_UNKNOWN unk_100275D0; // weak
int dword_10027AD4; // weak
_UNKNOWN unk_10027AD8; // weak
int dword_10027FDC; // weak
_UNKNOWN unk_10027FE0; // weak
int dword_100284E4; // weak
_UNKNOWN unk_100284E8; // weak
int dword_100289EC; // weak
_UNKNOWN unk_100289F0; // weak
int dword_10028EF4; // weak
_UNKNOWN unk_10028EF8; // weak
int dword_100293FC; // weak
LPARAM lParam; // idb
ProfFntStruct proffnts[4] =
{
{ 8, "Arial", 400 },
{ 10, "Arial", 400 },
{ 10, "Arial", 700 },
{ 13, "Time New Roman", 400 }
};
int dword_100228DC[3] = { 1038, 1080, 0 };
int dword_100228E8[2] = { 1097, 0 };
int dword_100228F0[2] = { 1099, 0 };
int dword_100228F8[3] = { 1056, 1054, 0 };
int dword_10022904[4] = { 1094, 1095, 1096, 0 };
short defstats[3][4] = { { 30, 15, 20, 30 }, { 25, 20, 30, 20 }, { 15, 35, 25, 20 } };
int dword_10022A2C[3] = { 1038, 1080, 0 };
int dword_10022A38[2] = { 1097, 0 };
int dword_10022A40[2] = { 1102, 0 };
int dword_10022A48[3] = { 1056, 1054, 0 };
int dword_10022A54[3] = { 1100, 1101, 0 };
int dword_10022A98[3] = { 1082, 1083, 0 };
int dword_10022AA4[4] = { 1084, 1085, 1086, 0 };
int dword_10022AFC[2] = { 1038, 0 };
int dword_10022B04[3] = { 1056, 1054, 0 };
int dword_10022B10[2] = { 1116, 0 };
int dword_10022B34[2] = { 1038, 0 };
int dword_10022B3C[3] = { 1056, 1054, 0 };
int dword_10022B48[2] = { 1065, 0 };
int dword_10022BE0[2] = { 1042, 0 };
int dword_10022BE8[6] = { 1044, 1001, 1002, 1003, 2, 0 };
int dword_10022C4C[2] = { 1038, 0 };
int dword_10022C54[2] = { 1080, 0 };
int dword_10022C5C[2] = { 1108, 0 };
int dword_10022CAC[2] = { 1026, 0 };
int dword_10022CB4[2] = { 2, 0 };
int dword_10022EB4[2] = { 1038, 0 };
int dword_10022EBC[3] = { 1056, 1054, 0 };
int dword_10022EC8[4] = { 1062, 1063, 1064, 0 };
int dword_10022ED8[3] = { 1038, 1080, 0 };
int dword_10022EE4[3] = { 1143, 1147, 0 };
int dword_10022EF0[4] = { 1081, 1076, 1144, 0 };
int dword_10022F00[2] = { 1075, 0 };
int dword_10022F08[4] = { 1056, 1054, 1145, 0 };
int dword_10022F18[7] = { 1069, 1070, 1071, 1072, 1073, 1074, 0 };
char *off_10022F8C[4] = { "Entry1", "Entry2", "Entry3", "Entry4" };
int dword_10022F9C[2] = { 1038, 0 };
int dword_10022FA4[3] = { 1056, 1054, 0 };
int dword_10022FB0[7] = { 1117, 1118, 1119, 1120, 1121, 1122, 0 };
int dword_10023000[2] = { 1038, 0 };
int dword_10023008[6] = { 1057, 1058, 1059, 1060, 1061, 0 };
int dword_10023020[6] = { 1014, 1018, 1017, 1016, 1015, 0 };
int dword_100230F0[3] = { 1038, 1080, 0 };
int dword_100230FC[2] = { 1097, 0 };
int dword_10023104[2] = { 1098, 0 };
int dword_1002310C[3] = { 1056, 1054, 0 };
int dword_10023118[7] = { 1088, 1089, 1090, 1091, 1092, 1093, 0 };
int dword_10023174[2] = { 1038, 0 };
int dword_1002317C[3] = { 1056, 1054, 0 };
int dword_10023188[2] = { 1006, 0 };
int dword_10023190[7] = { 1047, 1048, 1049, 1050, 1051, 1052, 0 };
int dword_100231AC[2] = { 1038, 0 };
int dword_100231B4[3] = { 1056, 1054, 0 };
int dword_100231C0[3] = { 1106, 1107, 0 };
int dword_100231CC[2] = { 1038, 0 };
int dword_100231D4[3] = { 1080, 1097, 0 };
int dword_100231E0[2] = { 1123, 0 };
int dword_100231E8[3] = { 1056, 1054, 0 };
int dword_100231F4[7] = { 1110, 1111, 1112, 1113, 1114, 1115, 0 };
int dword_10023244[3] = { 1038, 1080, 0 };
int dword_10023250[2] = { 1142, 0 };
int dword_10023258[2] = { 1146, 0 };
int dword_10023260[3] = { 1056, 1054, 0 };
int dword_1002326C[7] = { 1135, 1136, 1137, 1138, 1139, 1140, 0 };
int dword_100232D4[2] = { 1026, 0 };
int dword_100232DC[3] = { 1109, 2, 0 };
int dword_10023340[2] = { 1067, 0 };
//data+bss
int artfont_cpp_float = 0; // weak
FontStruct font42g;
FontStruct *sgpCurrFont;
FontStruct font30g;
FontStruct font16s;
FontStruct font24s;
FontStruct font16g;
FontStruct font24g;
FontStruct font30s;
FontStruct font42y;
LPARAM dword_10029400; // idb
int dword_10029404; // weak
int dword_10029408; // weak
int dword_1002940C; // weak
BYTE *a7; // idb
BYTE *dword_10029410; // idb
int dword_10029414; // weak
int dword_10029418; // weak
int dword_1002941C; // weak
HGDIOBJ ho; // idb
HGDIOBJ dword_10029420; // idb
HGDIOBJ dword_10029424; // idb
BYTE *buffer2; // idb
BYTE *dword_10029428; // idb
void *dword_1002942C; // idb
int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); // weak
void *location; // idb
int dword_10029438[4]; // idb
void *dword_10029434; // idb
int dword_10029438[4]; // weak
char byte_10029448; // idb
HGDIOBJ dword_10029450; // idb
int dword_10029454; // weak
int dword_10029458; // weak
_DWORD dword_10029460[3]; // idb
int dword_10029460[3]; // idb
int dword_1002946C; // weak
HGDIOBJ h; // idb
HGDIOBJ dword_10029470; // idb
int dword_10029478; // weak
_UNKNOWN unk_10029480; // weak
int dword_10029480; // weak
int dword_10029488; // weak
int dword_1002948C; // weak
int dword_100294A0; // weak
int dword_100294A4; // weak
DWORD pdwSize; // idb
DWORD dword_100294A8; // idb
char byte_100294B0[128]; // idb
_UNKNOWN unk_10029530; // weak
char byte_10029530[128]; // weak
int dword_100295B0; // weak
DWORD dword_100295B8; // idb
int dword_100295BC; // weak
@ -139,7 +135,7 @@ DWORD dword_100295C8; // idb
int dword_100295CC; // weak
int dword_100295D0; // weak
int dword_100295D4; // weak
BYTE *pBuffer; // idb
BYTE *dword_100295D8; // idb
BYTE *dword_100295DC; // idb
BYTE *dword_100295E0; // idb
void *dword_100295E4; // idb
@ -147,7 +143,7 @@ int dword_100295E8[10]; // idb
int dword_10029610; // weak
int dword_10029614; // weak
HGLOBAL dword_10029618; // idb
HGLOBAL hResData; // idb
HGLOBAL dword_1002961C; // idb
int dword_10029620; // weak
HGLOBAL dword_10029624; // idb
HGDIOBJ dword_10029628; // idb
@ -158,16 +154,16 @@ int dword_10029638; // weak
int dword_1002963C; // weak
int dword_10029640; // weak
int dword_10029644; // weak
_UNKNOWN unk_10029648; // weak
char byte_10029648; // weak
char byte_1002964C; // weak
HWND dword_10029650; // idb
HWND hWnd; // idb
HWND dword_10029654; // idb
int dword_10029658; // weak
DWORD dword_10029660; // idb
int dword_10029668; // weak
int dword_1002966C; // weak
char byte_10029670; // idb
char byte_10029690; // weak
char byte_10029690[32]; // weak
BYTE *dword_100296B0;
BYTE *dword_100296B4; // idb
BYTE *dword_100296B8; // idb
@ -188,7 +184,7 @@ int dword_100296F4; // weak
int dword_100296F8; // weak
int dword_100296FC; // weak
int dword_10029700; // weak
void *a6; // idb
void *dword_10029704; // idb
int dword_10029708; // weak
int dword_1002970C; // weak
int dword_10029710; // weak
@ -210,7 +206,7 @@ void *dword_10029848; // idb
int dword_1002984C; // weak
int dword_10029850; // weak
int dword_10029854; // weak
LPSTR lpString; // idb
LPSTR dword_10029858; // idb
int dword_1002985C; // weak
int dword_10029860; // weak
LPSTR dword_10029864; // idb
@ -218,7 +214,7 @@ int dword_10029868; // weak
int dword_1002986C; // weak
tagPALETTEENTRY fadepal[256];
int dword_10029C70; // weak
int dword_10029C78[8]; // idb
HANDLE dword_10029C78; // idb
int dword_10029C98; // weak
int dword_10029C9C; // weak
int dword_10029CA0; // weak
@ -255,20 +251,20 @@ int dword_1002A254; // weak
int dword_1002A258; // weak
int dword_1002A25C; // weak
int (*dword_1002A260)(void); // weak
char pszStr; // idb
char byte_1002A264; // idb
int dword_1002A2E4; // weak
int dword_1002A2E8; // weak
int dword_1002A2EC; // weak
int dword_1002A2F0; // weak
int (*dword_1002A2F4)(void); // weak
int dword_1002A2F8; // weak
BOOL bEnable; // idb
BOOL dword_1002A2FC; // idb
int dword_1002A300; // weak
int dword_1002A304; // weak
DWORD dword_1002A308; // idb
DWORD dword_1002A310; // idb
BYTE *dword_1002A318; // idb
BYTE *arg0; // idb
BYTE *dword_1002A31C; // idb
BYTE *dword_1002A320; // idb
BYTE *dword_1002A324; // idb
void *dword_1002A328; // idb
@ -288,14 +284,14 @@ int dword_1002A370; // weak
int dword_1002A374; // weak
char *dword_1002A378; // idb
int dword_1002A37C; // weak
char byte_1002A380[128]; // idb
char byte_1002A380[128]; // weak
int dword_1002A400; // weak
int dword_1002A404; // weak
int dword_1002A408; // weak
int (__stdcall *dword_1002A410)(_DWORD, _DWORD); // weak
int dword_1002A414; // weak
DWORD width; // idb
int height; // idb
DWORD dword_1002A418; // idb
int dword_1002A41C; // idb
int dword_1002A420; // weak
int dword_1002A424; // weak
int dword_1002A428; // weak
@ -308,7 +304,7 @@ int (UNKCALL *dword_1002A450)(_DWORD, _DWORD); // weak
CHAR byte_1002A454[4]; // idb
int dword_1002A458; // weak
int dword_1002A45C; // weak
_UNKNOWN unk_1002A460; // weak
char byte_1002A460; // weak
char byte_1002A464[18]; // idb
char byte_1002A476; // weak
int dword_1002A484; // weak
@ -345,7 +341,7 @@ int dword_1002A500; // weak
int dword_1002A504; // weak
int (*dword_1002A508)(void); // weak
int dword_1002A50C; // weak
int dword_1002A510[30]; // idb
HANDLE dword_1002A510; // idb
int dword_1002A588; // weak
int dword_1002A58C; // weak
int dword_1002A590; // weak

27
DiabloUI/_temp_funcs.h

@ -1,16 +1,17 @@
void UNKCALL artfont_10001058(char *arg);
int artfont_10001098();
int artfont_100010C8();
int UNKCALL artfont_10001120(_DWORD *arg);
signed int artfont_10001159();
void __fastcall artfont_100011FB(int ecx0, int edx0, const char *a1);
int artfont_100012F6();
int artfont_10001310();
int __fastcall artfont_10001329(unsigned char *a1);
signed int artfont_1000136C();
int __fastcall artfont_10001377(unsigned char *a1);
BOOL __cdecl artfont_100013B3(void *location);
void __fastcall artfont_100013CD(unsigned char *a1, _DWORD *a2, int a3, int a4);
void __fastcall artfont_SetArtFont(int nFont);
void __cdecl artfont_InitAllFonts();
void __cdecl artfont_FreeAllFonts();
void __fastcall artfont_FreeArtFont(FontStruct *pFont);
BOOL __cdecl artfont_LoadAllFonts();
void __fastcall artfont_LoadArtFont(FontStruct *pFont, const char *pszBinFile, const char *pszFileName);
int __cdecl artfont_GetFontMaxHeight();
int __cdecl artfont_GetFontDefWidth();
int __fastcall artfont_GetFontWidth(char *str);
void __cdecl j_artfont_cpp_init();
void __cdecl artfont_cpp_init();
int __fastcall artfont_GetFontBreak(char *str);
void __cdecl artfont_delete_operator(void *ptr);
void __fastcall artfont_PrintFontStr(char *str, DWORD **pSurface, int sx, int sy);
signed int bn_prof_100014E8();

380
DiabloUI/artfont.cpp

@ -1,15 +1,15 @@
// ref: 0x10001058
void UNKCALL artfont_10001058(char *arg) { return; }
/* {
void __fastcall artfont_SetArtFont(int nFont)
{
int v1; // ecx
int v2; // ecx
int v3; // ecx
int v4; // ecx
int v5; // ecx
if ( arg )
if ( nFont )
{
v1 = (int)(arg - 2);
v1 = nFont - 2;
if ( v1 )
{
v2 = v1 - 1;
@ -25,382 +25,328 @@ void UNKCALL artfont_10001058(char *arg) { return; }
if ( v5 )
{
if ( v5 == 1 )
dword_100270C0 = (int)&unk_10028EF8;
sgpCurrFont = &font42y;
else
dword_100270C0 = (int)&unk_100275D0;
sgpCurrFont = &font16s;
}
else
{
dword_100270C0 = (int)&unk_10026BB8;
sgpCurrFont = &font42g;
}
}
else
{
dword_100270C0 = (int)&unk_100289F0;
sgpCurrFont = &font30s;
}
}
else
{
dword_100270C0 = (int)&unk_100270C8;
sgpCurrFont = &font30g;
}
}
else
{
dword_100270C0 = (int)&unk_10027AD8;
sgpCurrFont = &font24s;
}
}
else
{
dword_100270C0 = (int)&unk_100284E8;
sgpCurrFont = &font24g;
}
}
else
{
dword_100270C0 = (int)&unk_10027FE0;
sgpCurrFont = &font16g;
}
} */
// 100270C0: using guessed type int dword_100270C0;
}
// ref: 0x10001098
int artfont_10001098() { return 0; }
/* {
int result; // eax
result = 0;
dword_100270BC = 0;
dword_100293FC = 0;
dword_100275CC = 0;
dword_10028EF4 = 0;
dword_100289EC = 0;
dword_10027FDC = 0;
dword_100284E4 = 0;
dword_10027AD4 = 0;
dword_100270C0 = 0;
return result;
} */
// 100270BC: using guessed type int dword_100270BC;
// 100270C0: using guessed type int dword_100270C0;
// 100275CC: using guessed type int dword_100275CC;
// 10027AD4: using guessed type int dword_10027AD4;
// 10027FDC: using guessed type int dword_10027FDC;
// 100284E4: using guessed type int dword_100284E4;
// 100289EC: using guessed type int dword_100289EC;
// 10028EF4: using guessed type int dword_10028EF4;
// 100293FC: using guessed type int dword_100293FC;
void __cdecl artfont_InitAllFonts()
{
font42g.active = 0;
font42y.active = 0;
font30g.active = 0;
font30s.active = 0;
font24g.active = 0;
font24s.active = 0;
font16g.active = 0;
font16s.active = 0;
sgpCurrFont = 0;
}
// ref: 0x100010C8
int artfont_100010C8() { return 0; }
/* {
int result; // eax
artfont_10001120(&unk_10026BB8);
artfont_10001120(&unk_10028EF8);
artfont_10001120(&unk_100270C8);
artfont_10001120(&unk_100289F0);
artfont_10001120(&unk_100284E8);
artfont_10001120(&unk_10027AD8);
artfont_10001120(&unk_10027FE0);
result = artfont_10001120(&unk_100275D0);
dword_100270C0 = 0;
return result;
} */
// 100270C0: using guessed type int dword_100270C0;
void __cdecl artfont_FreeAllFonts()
{
artfont_FreeArtFont(&font42g);
artfont_FreeArtFont(&font42y);
artfont_FreeArtFont(&font30g);
artfont_FreeArtFont(&font30s);
artfont_FreeArtFont(&font24g);
artfont_FreeArtFont(&font24s);
artfont_FreeArtFont(&font16g);
artfont_FreeArtFont(&font16s);
sgpCurrFont = 0;
}
// ref: 0x10001120
int UNKCALL artfont_10001120(_DWORD *arg) { return 0; }
/* {
_DWORD *v1; // edi
int *v2; // esi
void __fastcall artfont_FreeArtFont(FontStruct *pFont)
{
HANDLE *v2; // esi
signed int v3; // ebx
int result; // eax
v1 = arg;
if ( arg[321] )
if ( pFont->active )
{
v2 = arg + 65;
v2 = (HANDLE *)pFont->fontpal;
v3 = 256;
do
{
result = *v2;
if ( *v2 )
{
result = STransDelete(*v2);
STransDelete(*v2);
*v2 = 0;
}
++v2;
--v3;
}
while ( v3 );
v1[321] = 0;
pFont->active = 0;
}
return result;
} */
// 1001033A: using guessed type int __stdcall STransDelete(_DWORD);
}
// ref: 0x10001159
signed int artfont_10001159() { return 0; }
/* {
artfont_100011FB((int)&unk_100270C8, (int)"ui_art\\font30.bin", (int)"ui_art\\font30g.pcx");
artfont_100011FB((int)&unk_100289F0, (int)"ui_art\\font30.bin", (int)"ui_art\\font30s.pcx");
artfont_100011FB((int)&unk_100284E8, (int)"ui_art\\font24.bin", (int)"ui_art\\font24g.pcx");
artfont_100011FB((int)&unk_10027AD8, (int)"ui_art\\font24.bin", (int)"ui_art\\font24s.pcx");
artfont_100011FB((int)&unk_10027FE0, (int)"ui_art\\font16.bin", (int)"ui_art\\font16g.pcx");
artfont_100011FB((int)&unk_100275D0, (int)"ui_art\\font16.bin", (int)"ui_art\\font16s.pcx");
artfont_100011FB((int)&unk_10026BB8, (int)"ui_art\\font42.bin", (int)"ui_art\\font42g.pcx");
artfont_100011FB((int)&unk_10028EF8, (int)"ui_art\\font42.bin", (int)"ui_art\\font42y.pcx");
BOOL __cdecl artfont_LoadAllFonts()
{
artfont_LoadArtFont(&font30g, "ui_art\\font30.bin", "ui_art\\font30g.pcx");
artfont_LoadArtFont(&font30s, "ui_art\\font30.bin", "ui_art\\font30s.pcx");
artfont_LoadArtFont(&font24g, "ui_art\\font24.bin", "ui_art\\font24g.pcx");
artfont_LoadArtFont(&font24s, "ui_art\\font24.bin", "ui_art\\font24s.pcx");
artfont_LoadArtFont(&font16g, "ui_art\\font16.bin", "ui_art\\font16g.pcx");
artfont_LoadArtFont(&font16s, "ui_art\\font16.bin", "ui_art\\font16s.pcx");
artfont_LoadArtFont(&font42g, "ui_art\\font42.bin", "ui_art\\font42g.pcx");
artfont_LoadArtFont(&font42y, "ui_art\\font42.bin", "ui_art\\font42y.pcx");
return 1;
} */
}
// ref: 0x100011FB
void __fastcall artfont_100011FB(int a1, int a2, int a3) { return; }
/* {
int v3; // esi
int v4; // eax
void __fastcall artfont_LoadArtFont(FontStruct *pFont, const char *pszBinFile, const char *pszFileName)
{
LONG v4; // eax
signed int v5; // edi
unsigned char v6; // al
int v7; // ecx
int v8; // [esp+8h] [ebp-20h]
int v9; // [esp+Ch] [ebp-1Ch]
int v10; // [esp+10h] [ebp-18h]
int v11; // [esp+14h] [ebp-14h]
int v12; // [esp+18h] [ebp-10h]
int v13; // [esp+1Ch] [ebp-Ch]
int v14; // [esp+20h] [ebp-8h]
int v15; // [esp+24h] [ebp-4h]
int v16; // [esp+30h] [ebp+8h]
int a5[4]; // [esp+8h] [ebp-20h]
DWORD size[2]; // [esp+18h] [ebp-10h]
BYTE *pBuffer; // [esp+20h] [ebp-8h]
HANDLE phFile; // [esp+24h] [ebp-4h]
HANDLE *a1a; // [esp+30h] [ebp+8h]
v3 = a1;
if ( !*(_DWORD *)(a1 + 1284) && SFileOpenFile(a2, &v15) )
if ( !pFont->active && SFileOpenFile(pszBinFile, &phFile) )
{
v4 = SFileGetFileSize(v15, 0);
if ( SFileReadFile(v15, v3, v4, 0, 0) )
v4 = SFileGetFileSize(phFile, 0);
if ( SFileReadFile(phFile, pFont, v4, 0, 0) )
{
SFileCloseFile(v15);
local_100078BE(a3, &v14, &v12);
memset((void *)(v3 + 260), 0, 0x400u);
if ( v14 )
SFileCloseFile(phFile);
local_LoadArtImage(pszFileName, &pBuffer, size);
memset(pFont->fontpal, 0, 0x400u);
if ( pBuffer )
{
v5 = 0;
v16 = v3 + 260;
a1a = (HANDLE *)pFont->fontpal;
do
{
v6 = *(_BYTE *)(v3 + v5 + 2);
v6 = pFont->fontbin[v5 + 2];
if ( v6 )
{
v7 = *(unsigned char *)(v3 + 1);
v10 = v6;
v9 = v5 * v7;
v8 = 0;
v11 = v7 + v5 * v7 - 1;
STransCreateI(v14, v12, v13, 8, &v8, 16777248, v16);
v7 = pFont->fontbin[1];
a5[2] = v6;
a5[1] = v5 * v7;
a5[0] = 0;
a5[3] = v7 + v5 * v7 - 1;
STransCreateI(pBuffer, size[0], size[1], 8, (int)a5, 16777248, a1a);
}
v16 += 4;
++a1a;
++v5;
}
while ( v5 <= 256 );
*(_DWORD *)(v3 + 1284) = 1;
SMemFree(v14, "C:\\Src\\Diablo\\DiabloUI\\artfont.cpp", 206, 0);
pFont->active = 1;
SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\artfont.cpp", 206, 0);
}
}
else
{
SFileCloseFile(v15);
SFileCloseFile(phFile);
}
}
} */
// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD);
// 10010346: using guessed type int __stdcall STransCreateI(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 1001034C: using guessed type int __stdcall SFileCloseFile(_DWORD);
// 10010352: using guessed type int __stdcall SFileReadFile(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 10010358: using guessed type int __stdcall SFileGetFileSize(_DWORD, _DWORD);
// 1001035E: using guessed type int __stdcall SFileOpenFile(_DWORD, _DWORD);
}
// ref: 0x100012F6
int artfont_100012F6() { return 0; }
/* {
int __cdecl artfont_GetFontMaxHeight()
{
int result; // eax
if ( dword_100270C0 && *(_DWORD *)(dword_100270C0 + 1284) )
result = *(unsigned char *)(dword_100270C0 + 1);
if ( sgpCurrFont && sgpCurrFont->active )
result = sgpCurrFont->fontbin[1];
else
result = 0;
return result;
} */
// 100270C0: using guessed type int dword_100270C0;
}
// ref: 0x10001310
int artfont_10001310() { return 0; }
/* {
int __cdecl artfont_GetFontDefWidth()
{
int result; // eax
if ( dword_100270C0 && *(_DWORD *)(dword_100270C0 + 1284) )
result = *(unsigned char *)dword_100270C0;
if ( sgpCurrFont && sgpCurrFont->active )
result = sgpCurrFont->fontbin[0];
else
result = 0;
return result;
} */
// 100270C0: using guessed type int dword_100270C0;
}
// ref: 0x10001329
int __fastcall artfont_10001329(unsigned char *a1) { return 0; }
/* {
int __fastcall artfont_GetFontWidth(char *str)
{
int result; // eax
unsigned char i; // bl
unsigned char v3; // bl
int v4; // esi
result = 0;
if ( !dword_100270C0 || !*(_DWORD *)(dword_100270C0 + 1284) )
if ( !sgpCurrFont || !sgpCurrFont->active )
return 0;
for ( i = *a1; *a1; i = *a1 )
for ( i = *str; *str; i = *str )
{
v3 = *(_BYTE *)(i + dword_100270C0 + 2);
v3 = sgpCurrFont->fontbin[i + 2];
if ( v3 )
v4 = v3;
else
v4 = *(unsigned char *)dword_100270C0;
v4 = sgpCurrFont->fontbin[0];
result += v4;
++a1;
++str;
}
return result;
} */
// 100270C0: using guessed type int dword_100270C0;
}
// ref: 0x1000136C
signed int artfont_1000136C() { return 0; }
/* {
signed int result; // eax
result = 2139095040;
dword_10026BB0 = 2139095040;
return result;
} */
// 10026BB0: using guessed type int dword_10026BB0;
void __cdecl artfont_cpp_init()
{
artfont_cpp_float = 2139095040;
}
// 10026BB0: using guessed type int artfont_cpp_float;
// ref: 0x10001377
int __fastcall artfont_10001377(unsigned char *a1) { return 0; }
/* {
int __fastcall artfont_GetFontBreak(char *str)
{
int result; // eax
unsigned char v2; // dl
unsigned char v3; // dl
result = 0;
if ( !dword_100270C0 || !*(_DWORD *)(dword_100270C0 + 1284) )
if ( !sgpCurrFont || !sgpCurrFont->active )
return 0;
while ( 1 )
{
v3 = *a1;
if ( !*a1 )
v3 = *str;
if ( !*str )
break;
if ( v3 == 10 )
if ( v3 == '\n' )
break;
if ( v3 == 32 )
if ( v3 == ' ' )
break;
v2 = *(_BYTE *)(v3 + dword_100270C0 + 2);
v2 = sgpCurrFont->fontbin[v3 + 2];
if ( !v2 )
break;
result += v2;
++a1;
++str;
}
return result;
} */
// 100270C0: using guessed type int dword_100270C0;
}
// ref: 0x100013B3
int __cdecl artfont_100013B3(int a1) { return 0; }
/* {
int result; // eax
if ( a1 )
result = SMemFree(a1, "delete", -1, 0);
return result;
} */
// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD);
void __cdecl artfont_delete_operator(void *ptr)
{
if ( ptr )
SMemFree(ptr, "delete", -1, 0);
}
// ref: 0x100013CD
void __fastcall artfont_100013CD(unsigned char *a1, _DWORD *a2, int a3, int a4) { return; }
/* {
_DWORD *v4; // ebx
unsigned char *v5; // esi
void __fastcall artfont_PrintFontStr(char *str, DWORD **pSurface, int sx, int sy)
{
FontStruct *v5; // esi
unsigned char v6; // cl
int v7; // edi
unsigned char v8; // dl
int v9; // edi
int v10; // ecx
int v11; // [esp+Ch] [ebp-8h]
int v12; // [esp+Ch] [ebp-8h]
unsigned char *v13; // [esp+10h] [ebp-4h]
DWORD *v10; // ecx
HANDLE hTrans; // [esp+Ch] [ebp-8h]
HANDLE hTransa; // [esp+Ch] [ebp-8h]
v4 = a2;
v13 = a1;
if ( a2 )
if ( pSurface )
{
if ( *a2 )
if ( *pSurface )
{
v5 = (unsigned char *)dword_100270C0;
if ( dword_100270C0 )
v5 = sgpCurrFont;
if ( sgpCurrFont )
{
if ( *(_DWORD *)(dword_100270C0 + 1284) )
if ( sgpCurrFont->active )
{
if ( a3 < 0 )
a3 = 0;
if ( a4 < 0 )
a4 = 0;
v6 = *a1;
if ( *v13 )
if ( sx < 0 )
sx = 0;
if ( sy < 0 )
sy = 0;
v6 = *str;
if ( *str )
{
while ( 1 )
{
v11 = a4 + v5[1];
if ( a4 + v5[1] > v4[2] )
hTrans = (HANDLE)(sy + v5->fontbin[1]);
if ( sy + v5->fontbin[1] > (signed int)pSurface[2] )
return;
if ( v6 == 10 )
if ( v6 == '\n' )
break;
v7 = v6;
v8 = v5[v6 + 2];
v8 = v5->fontbin[v6 + 2];
if ( !v8 )
{
v9 = *v5;
if ( a3 + v9 + artfont_10001377(++v13) < v4[1] )
v9 = v5->fontbin[0];
if ( sx + v9 + artfont_GetFontBreak(++str) < (signed int)pSurface[1] )
{
a3 += v9;
sx += v9;
}
else
{
a3 = 0;
a4 = v11;
sx = 0;
sy = (int)hTrans;
}
goto LABEL_23;
}
v12 = *(_DWORD *)&v5[4 * v6 + 260];
if ( *(_DWORD *)&v5[4 * v6 + 260] )
hTransa = (HANDLE)&v5->fontpal[v6];
if ( hTransa ) /* check */
{
v10 = v4[1];
if ( a3 + v8 <= v10 )
v10 = pSurface[1];
if ( sx + v8 <= (signed int)v10 )
{
STransBlt(*v4, a3, a4, v10, v12);
v5 = (unsigned char *)dword_100270C0;
a3 += *(unsigned char *)(v7 + dword_100270C0 + 2);
STransBlt(*pSurface, sx, sy, (int)v10, hTransa);
v5 = sgpCurrFont;
sx += sgpCurrFont->fontbin[v7 + 2];
goto LABEL_22;
}
a3 = 0;
a4 += v5[1];
sx = 0;
sy += v5->fontbin[1];
}
LABEL_23:
v6 = *v13;
if ( !*v13 )
v6 = *str;
if ( !*str )
return;
}
a3 = 0;
a4 += v5[1];
sx = 0;
sy += v5->fontbin[1];
LABEL_22:
++v13;
++str;
goto LABEL_23;
}
}
}
}
}
} */
// 1001036A: using guessed type int __stdcall STransBlt(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 100270C0: using guessed type int dword_100270C0;
}

22
DiabloUI/diabloui.h

@ -6,6 +6,28 @@
extern "C" {
#endif
struct FontStruct
{
unsigned char fontbin[258];
PALETTEENTRY fontpal[256];
BOOL active;
};
struct ProfileStruct
{
char *name;
char field_4;
int msg;
int field_C;
};
struct ProfFntStruct
{
int size;
char *fontname;
int field_8;
};
void __cdecl UiDestroy();
void __stdcall UiTitleDialog(int a1);
void __cdecl UiInitialize();

Loading…
Cancel
Save