Browse Source

Autoformat non-stub parts of DiabloUi

pull/25/head
Anders Jenbo 8 years ago
parent
commit
9a8166a628
  1. 551
      DiabloUI/_temp_data.cpp
  2. 57
      DiabloUI/_temp_funcs.h
  3. 473
      DiabloUI/artfont.cpp
  4. 1611
      DiabloUI/connect.cpp
  5. 233
      DiabloUI/copyprot.cpp
  6. 604
      DiabloUI/cr8game.cpp
  7. 417
      DiabloUI/creadung.cpp
  8. 16
      DiabloUI/creastat.cpp
  9. 361
      DiabloUI/credits.cpp
  10. 389
      DiabloUI/diabedit.cpp
  11. 83
      DiabloUI/diabloui.cpp
  12. 35
      DiabloUI/diabloui.h
  13. 128
      DiabloUI/disclaim.cpp
  14. 584
      DiabloUI/doom.cpp
  15. 210
      DiabloUI/entname.cpp
  16. 185
      DiabloUI/fade.cpp
  17. 310
      DiabloUI/focus.cpp
  18. 788
      DiabloUI/local.cpp
  19. 327
      DiabloUI/mainmenu.cpp
  20. 479
      DiabloUI/okcancel.cpp
  21. 382
      DiabloUI/sbar.cpp
  22. 244
      DiabloUI/selclass.cpp
  23. 1132
      DiabloUI/selhero.cpp
  24. 1195
      DiabloUI/sellist.cpp
  25. 193
      DiabloUI/selload.cpp
  26. 8
      DiabloUI/selregn.cpp
  27. 307
      DiabloUI/selyesno.cpp
  28. 393
      DiabloUI/title.cpp
  29. 16
      DiabloUI/titlesnd.cpp

551
DiabloUI/_temp_data.cpp

@ -1,120 +1,117 @@
//rdata
ProfileStruct bnprofiles[4] =
{
{ "profile\\sex", '\x01', 1128, 8 },
{ "profile\\age", '\x01', 1130, 4 },
{ "profile\\location", '\x01', 1132, 40 },
{ "profile\\description", '\x01', 1134, 200 }
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 Connect_cpp_float_value = 2139095040; // weak
int profilemsg1[6] = { 1125, 1127, 1129, 1131, 1133, 0 };
int profilemsg2[6] = { 1126, 1128, 1130, 1132, 1134, 0 };
int Connect_cpp_float_value = 2139095040; // weak
int CopyProt_cpp_float_value = 2139095040; // weak
int cr8game_cpp_float_value = 2139095040; // weak
int cr8game_cpp_float_value = 2139095040; // weak
int CreaDung_cpp_float_value = 2139095040; // weak
int CreaStat_cpp_float_value = 2139095040; // weak
int credits_cpp_float_value = 2139095040; // weak
int credits_cpp_float_value = 2139095040; // weak
int DiabEdit_cpp_float_value = 2139095040; // weak
int DiabloUI_cpp_float_value = 2139095040; // weak
int disclaim_cpp_float_value = 2139095040; // weak
int doom_cpp_float_value = 2139095040; // weak
int EntName_cpp_float_value = 2139095040; // weak
int fade_cpp_float_value = 2139095040; // weak
int focus_cpp_float_value = 2139095040; // weak
int local_cpp_float_value = 2139095040; // weak
int doom_cpp_float_value = 2139095040; // weak
int EntName_cpp_float_value = 2139095040; // weak
int fade_cpp_float_value = 2139095040; // weak
int focus_cpp_float_value = 2139095040; // weak
int local_cpp_float_value = 2139095040; // weak
int mainmenu_cpp_float_value = 2139095040; // weak
int OkCancel_cpp_float_value = 2139095040; // weak
int Sbar_cpp_float_value = 2139095040; // weak
int Sbar_cpp_float_value2 = 2139095040; // weak
int Sbar_cpp_float_value = 2139095040; // weak
int Sbar_cpp_float_value2 = 2139095040; // weak
int SelClass_cpp_float_value = 2139095040; // weak
int SelHero_cpp_float_value = 2139095040; // weak
int SelList_cpp_float_value = 2139095040; // weak
int SelLoad_cpp_float_value = 2139095040; // weak
int SelHero_cpp_float_value = 2139095040; // weak
int SelList_cpp_float_value = 2139095040; // weak
int SelLoad_cpp_float_value = 2139095040; // weak
int SelYesNo_cpp_float_value = 2139095040; // weak
int Title_cpp_float_value = 2139095040; // weak
int Title_cpp_float_value = 2139095040; // weak
int titlesnd_cpp_float_value = 2139095040; // weak
int dword_10022258 = 4; // weak
ProfFntStruct proffnts[4] =
{
{ 8, "Arial", 400 },
{ 10, "Arial", 400 },
{ 10, "Arial", 700 },
{ 13, "Time New Roman", 400 }
int dword_10022258 = 4; // weak
ProfFntStruct proffnts[4] = {
{ 8, "Arial", 400 },
{ 10, "Arial", 400 },
{ 10, "Arial", 700 },
{ 13, "Time New Roman", 400 }
};
unsigned char connect_subnet_ip[4][4] =
{
{ 13, 0, 0, 0 }, // 13.0.0.0
{ 128, 128, 128, 0 }, // 128.128.128.0
{ 14, 0, 0, 0 }, // 14.0.0.0
{ 255, 255, 255, 0 } // 255.255.255.0
unsigned char connect_subnet_ip[4][4] = {
{ 13, 0, 0, 0 }, // 13.0.0.0
{ 128, 128, 128, 0 }, // 128.128.128.0
{ 14, 0, 0, 0 }, // 14.0.0.0
{ 255, 255, 255, 0 } // 255.255.255.0
};
int creadung_msgtbl1[3] = { 1038, 1080, 0 };
int creadung_msgtbl2[2] = { 1097, 0 };
int creadung_msgtbl3[2] = { 1099, 0 };
int creadung_msgtbl4[3] = { 1056, 1054, 0 };
int creadung_msgtbl5[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 disclaim_msgtbl1[3] = { 1082, 1083, 0 };
int disclaim_msgtbl2[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 entname_msgtbl1[2] = { 1038, 0 };
int entname_msgtbl2[3] = { 1056, 1054, 0 };
int entname_msgtbl3[2] = { 1065, 0 };
int menumsgs_1option[2] = { 1042, 0 };
int menumsgs_5options[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 selclass_msgtbl1[2] = { 1038, 0 };
int selclass_msgtbl2[3] = { 1056, 1054, 0 };
int selclass_msgtbl3[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 creadung_msgtbl1[3] = { 1038, 1080, 0 };
int creadung_msgtbl2[2] = { 1097, 0 };
int creadung_msgtbl3[2] = { 1099, 0 };
int creadung_msgtbl4[3] = { 1056, 1054, 0 };
int creadung_msgtbl5[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 disclaim_msgtbl1[3] = { 1082, 1083, 0 };
int disclaim_msgtbl2[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 entname_msgtbl1[2] = { 1038, 0 };
int entname_msgtbl2[3] = { 1056, 1054, 0 };
int entname_msgtbl3[2] = { 1065, 0 };
int menumsgs_1option[2] = { 1042, 0 };
int menumsgs_5options[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 selclass_msgtbl1[2] = { 1038, 0 };
int selclass_msgtbl2[3] = { 1056, 1054, 0 };
int selclass_msgtbl3[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 selhero_msgtbl_string[2] = { 1038, 0 };
int selhero_msgtbl_3[6] = { 1057, 1058, 1059, 1060, 1061, 0 };
int selhero_msgtbl_info[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 sellist_msgtbl1[2] = { 1038, 0 };
int sellist_msgtbl2[3] = { 1056, 1054, 0 };
int sellist_msgtbl3[2] = { 1006, 0 };
int sellist_msgtbl4[7] = { 1047, 1048, 1049, 1050, 1051, 1052, 0 };
int selload_msgtbl1[2] = { 1038, 0 };
int selload_msgtbl2[3] = { 1056, 1054, 0 };
int selload_msgtbl3[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 yesno_msgtbl2[2] = { 1026, 0 };
int yesno_msgtbl1[3] = { 1109, 2, 0 };
int titlemsgtbl[2] = { 1067, 0 };
int selhero_msgtbl_3[6] = { 1057, 1058, 1059, 1060, 1061, 0 };
int selhero_msgtbl_info[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 sellist_msgtbl1[2] = { 1038, 0 };
int sellist_msgtbl2[3] = { 1056, 1054, 0 };
int sellist_msgtbl3[2] = { 1006, 0 };
int sellist_msgtbl4[7] = { 1047, 1048, 1049, 1050, 1051, 1052, 0 };
int selload_msgtbl1[2] = { 1038, 0 };
int selload_msgtbl2[3] = { 1056, 1054, 0 };
int selload_msgtbl3[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 yesno_msgtbl2[2] = { 1026, 0 };
int yesno_msgtbl1[3] = { 1109, 2, 0 };
int titlemsgtbl[2] = { 1067, 0 };
//data+bss
int artfont_cpp_float = 0; // weak
@ -127,34 +124,34 @@ 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 *dword_10029410; // idb
int dword_10029414; // weak
int dword_10029418; // weak
int dword_1002941C; // weak
HGDIOBJ dword_10029420; // idb
HGDIOBJ dword_10029424; // idb
BYTE *dword_10029428; // idb
void *dword_1002942C; // idb
int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); // weak
void *dword_10029434; // idb
int dword_10029438[4]; // weak
char nullcharacter; /* check */
HGDIOBJ dword_10029450; // idb
int dword_10029454; // weak
int dword_10029458; // weak
int dword_10029460[3]; // idb
int dword_1002946C; // weak
HGDIOBJ dword_10029470; // idb
int dword_10029478; // weak
int dword_10029480; // weak
int dword_10029488; // weak
int dword_1002948C; // weak
int Connect_cpp_float; // weak
int special_frames; // weak
LPARAM dword_10029400; // idb
int dword_10029404; // weak
int dword_10029408; // weak
int dword_1002940C; // weak
BYTE *dword_10029410; // idb
int dword_10029414; // weak
int dword_10029418; // weak
int dword_1002941C; // weak
HGDIOBJ dword_10029420; // idb
HGDIOBJ dword_10029424; // idb
BYTE *dword_10029428; // idb
void *dword_1002942C; // idb
int(__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); // weak
void *dword_10029434; // idb
int dword_10029438[4]; // weak
char nullcharacter; /* check */
HGDIOBJ dword_10029450; // idb
int dword_10029454; // weak
int dword_10029458; // weak
int dword_10029460[3]; // idb
int dword_1002946C; // weak
HGDIOBJ dword_10029470; // idb
int dword_10029478; // weak
int dword_10029480; // weak
int dword_10029488; // weak
int dword_1002948C; // weak
int Connect_cpp_float; // weak
int special_frames; // weak
DWORD heroport_data[2];
char connect_categorystr[128];
char connect_plrinfostr[128];
@ -162,30 +159,30 @@ int heronum_frames2; // weak
DWORD special_data[2];
int heroport_frames; // weak
DWORD heronum_data[2];
int heronum_frames; // idb
int heronum_frames; // idb
int connect_draw_height; // idb
BYTE *connect_data1; // idb
BYTE *connect_data2; // idb
BYTE *connect_data3; // idb
void *connect_data4; // idb
BYTE *connect_data1; // idb
BYTE *connect_data2; // idb
BYTE *connect_data3; // idb
void *connect_data4; // idb
HANDLE connect_trans[10];
char *connect_charname;
int connect_color_text; // weak
int connect_color_text; // weak
HGLOBAL copyprot_popupart; // idb
HGLOBAL copyprot_artpal; // idb
int CopyProt_cpp_float; // weak
HGLOBAL copyprot_btnart; // idb
HGDIOBJ cr8game_hobject; // idb
int cr8game_cpp_float; // weak
int cr8_playercount; // weak
HGLOBAL copyprot_artpal; // idb
int CopyProt_cpp_float; // weak
HGLOBAL copyprot_btnart; // idb
HGDIOBJ cr8game_hobject; // idb
int cr8game_cpp_float; // weak
int cr8_playercount; // weak
DWORD *cr8_somegamestruct;
int cr8_dword_10029638; // weak
int cr8_dword_1002963C; // weak
int cr8_dword_10029640; // weak
int *cr8game_playerID; // idb
int *cr8game_playerID; // idb
_gamedata cr8_gamedata;
HWND cr8_sendmsg1; // idb
HWND cr8_sendmsg2; // idb
HWND cr8_sendmsg1; // idb
HWND cr8_sendmsg2; // idb
int cr8_dword_10029658; // weak
DWORD cr8diffbtns_size[2];
int cr8_dword_10029668; // weak
@ -193,140 +190,144 @@ int cr8_dword_1002966C; // idb
char cr8_gamename[32];
char cr8_gamepassword[32];
BYTE *cr8_creat_bg_ptr;
BYTE *cr8_but_xsm_ptr; // idb
BYTE *cr8_diffbtns_ptr; // idb
int creadung_playername; // weak
int *creadung_playerID; // idb
int CreaDung_cpp_float; // weak
BYTE *cr8_but_xsm_ptr; // idb
BYTE *cr8_diffbtns_ptr; // idb
int creadung_playername; // weak
int *creadung_playerID; // idb
int CreaDung_cpp_float; // weak
int creadung_dword_100296C8; // weak
int creadung_delspinners; // weak
int creadung_delspinners; // weak
DWORD *crea_somegamestruct;
int creadung_lasterror; // weak
int creadung_lasterror; // weak
int creadung_dword_100296D8; // weak
char *creadung_gamename;
int CreaStat_cpp_float; // weak
int credittext_size; // weak
int credits_cpp_float; // weak
HGLOBAL credittext_rsrc; // idb
int CreaStat_cpp_float; // weak
int credittext_size; // weak
int credits_cpp_float; // weak
HGLOBAL credittext_rsrc; // idb
int credit_vertical_pos2; // idb
int credit_horz_pos; // idb
int credit_horz_pos; // idb
int credit_vertical_pos1; // weak
int credit_line_count; // weak
void *credit_back_img; // idb
HANDLE creditsobj; // idb
int DiabEdit_cpp_float; // weak
int DiabloUI_cpp_float; // weak
int sgbUiIsInitialized; // weak
HINSTANCE ghUiInst; // idb
int backbmp_flag1; // weak
int backbmp_flag2; // weak
int backbmp_flag3; // weak
int app_is_active; // weak
int sgbIsSpawn; // weak
int dword_10029730; // weak
int dword_10029738; // weak
char byte_1002973C; // idb
char byte_100297BC; // idb
int dword_1002983C; // weak
int dword_10029840; // weak
int dword_10029844; // weak
void *dword_10029848; // idb
int dword_1002984C; // weak
int disclaim_cpp_float; // weak
int doom_cpp_float; // weak
LPSTR dword_10029858; // idb
int dword_1002985C; // weak
int EntName_cpp_float; // weak
int credit_line_count; // weak
void *credit_back_img; // idb
HANDLE creditsobj; // idb
int DiabEdit_cpp_float; // weak
int DiabloUI_cpp_float; // weak
int sgbUiIsInitialized; // weak
HINSTANCE ghUiInst; // idb
int backbmp_flag1; // weak
int backbmp_flag2; // weak
int backbmp_flag3; // weak
int app_is_active; // weak
int sgbIsSpawn; // weak
int dword_10029730; // weak
int dword_10029738; // weak
char byte_1002973C; // idb
char byte_100297BC; // idb
int dword_1002983C; // weak
int dword_10029840; // weak
int dword_10029844; // weak
void *dword_10029848; // idb
int dword_1002984C; // weak
int disclaim_cpp_float; // weak
int doom_cpp_float; // weak
LPSTR dword_10029858; // idb
int dword_1002985C; // weak
int EntName_cpp_float; // weak
char *entname_charname;
int fade_cpp_float; // weak
int sgbFadeRange; // idb
int sgbFadeRange; // idb
tagPALETTEENTRY fadepal[256];
int sgbIsFading; // weak
HANDLE SpinnerTransOut[8];
int focus_spin_width; // idb
int focus_spin_width; // idb
int focus_spin_height; // weak
int focus_cpp_float; // weak
int focus_cpp_float; // weak
int sgbSpinnersLoaded; // weak
int dword_10029CA8; // weak
int dword_10029CAC; // weak
int sgnSpinnerFrame; // weak
int local_cpp_float; // weak
DWORD gdwCursData[2]; // weak
int dword_10029CA8; // weak
int dword_10029CAC; // weak
int sgnSpinnerFrame; // weak
int local_cpp_float; // weak
DWORD gdwCursData[2]; // weak
tagPALETTEENTRY artpal[256];
HGDIOBJ objPalette; // idb
BYTE *gpCursorArt;
BYTE *gpCursorArt2;
int mainmenu_cpp_float; // weak
char menu_version_str[64];
int menu_item_timer; // weak
int dword_1002A120; // weak
int dword_1002A124; // weak
int dword_1002A128; // weak
int dword_1002A12C; // weak
int dword_1002A130; // weak
int dword_1002A134; // weak
int dword_1002A138; // weak
int dword_1002A13C; // weak
int dword_1002A140; // weak
int dword_1002A144; // weak
int dword_1002A148; // weak
void *dword_1002A14C; // idb
int dword_1002A150; // weak
char byte_1002A154; // idb
char byte_1002A1D4; // idb
int dword_1002A254; // weak
int dword_1002A258; // weak
int dword_1002A25C; // weak
int menu_item_timer; // weak
int dword_1002A120; // weak
int dword_1002A124; // weak
int dword_1002A128; // weak
int dword_1002A12C; // weak
int dword_1002A130; // weak
int dword_1002A134; // weak
int dword_1002A138; // weak
int dword_1002A13C; // weak
int dword_1002A140; // weak
int dword_1002A144; // weak
int dword_1002A148; // weak
void *dword_1002A14C; // idb
int dword_1002A150; // weak
char byte_1002A154; // idb
char byte_1002A1D4; // idb
int dword_1002A254; // weak
int dword_1002A258; // weak
int dword_1002A25C; // weak
int (*dword_1002A260)(void); // weak
char byte_1002A264; // idb
int OkCancel_cpp_float; // weak
int dword_1002A2E8; // weak
int dword_1002A2EC; // weak
int dword_1002A2F0; // weak
char byte_1002A264; // idb
int OkCancel_cpp_float; // weak
int dword_1002A2E8; // weak
int dword_1002A2EC; // weak
int dword_1002A2F0; // weak
int (*dword_1002A2F4)(void); // weak
int dword_1002A2F8; // weak
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 *dword_1002A31C; // idb
BYTE *dword_1002A320; // idb
BYTE *dword_1002A324; // idb
void *dword_1002A328; // idb
int Sbar_cpp_float; // weak
int Sbar_cpp_float2; // weak
int SelClass_cpp_float; // weak
int dword_1002A34C; // idb
int dword_1002A350; // weak
int dword_1002A354; // weak
char *dword_1002A358; // idb
int dword_1002A35C; // weak
int dword_1002A360; // idb
int dword_1002A364; // weak
int dword_1002A368; // weak
int dword_1002A36C; // weak
int dword_1002A370; // weak
int dword_1002A374; // weak
char *dword_1002A378; // idb
int dword_1002A37C; // weak
char byte_1002A380[128]; // weak
int dword_1002A400; // weak
int dword_1002A404; // weak
int dword_1002A408; // weak
BOOL (__stdcall *selhero_fnstats)(unsigned int, _uidefaultstats *);
int SelHero_cpp_float; // weak
int dword_1002A2F8; // weak
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 *dword_1002A31C; // idb
BYTE *dword_1002A320; // idb
BYTE *dword_1002A324; // idb
void *dword_1002A328; // idb
int Sbar_cpp_float; // weak
int Sbar_cpp_float2; // weak
int SelClass_cpp_float; // weak
int dword_1002A34C; // idb
int dword_1002A350; // weak
int dword_1002A354; // weak
char *dword_1002A358; // idb
int dword_1002A35C; // weak
int dword_1002A360; // idb
int dword_1002A364; // weak
int dword_1002A368; // weak
int dword_1002A36C; // weak
int dword_1002A370; // weak
int dword_1002A374; // weak
char *dword_1002A378; // idb
int dword_1002A37C; // weak
char byte_1002A380[128]; // weak
int dword_1002A400; // weak
int dword_1002A404; // weak
int dword_1002A408; // weak
BOOL(__stdcall *selhero_fnstats)
(unsigned int, _uidefaultstats *);
int SelHero_cpp_float; // weak
DWORD selhero_sizedata[2]; // idb
int selhero_difficulty; // weak
int selhero_difficulty; // weak
int selhero_hero_hassaved; // weak
int selhero_numheroesleft; // weak
char selhero_herolevel[4];
BOOL (__stdcall *selhero_fnremove)(_uiheroinfo *);
BOOL (__stdcall *selhero_fninfo)(BOOL (__stdcall *fninfo)(_uiheroinfo *));
BOOL(__stdcall *selhero_fnremove)
(_uiheroinfo *);
BOOL(__stdcall *selhero_fninfo)
(BOOL(__stdcall *fninfo)(_uiheroinfo *));
char selhero_heromag[4];
char selhero_heronamestr[16];
BOOL (__stdcall *selhero_fncreate)(_uiheroinfo *);
BOOL(__stdcall *selhero_fncreate)
(_uiheroinfo *);
char selhero_herodex[4];
_uiheroinfo *sgpHeroInfo;
int selhero_is_created; // weak
@ -335,37 +336,37 @@ int selhero_is_good; // idb
char selhero_herostr[4];
char selhero_herovit[4];
BYTE *selhero_buffer;
int dword_1002A49C; // weak
void *dword_1002A4A0; // idb
int dword_1002A4A4; // weak
int dword_1002A4A8; // weak
int dword_1002A4AC; // weak
int dword_1002A4B0; // weak
int dword_1002A4B4; // weak
int dword_1002A4B8; // idb
int dword_1002A4BC; // weak
int dword_1002A49C; // weak
void *dword_1002A4A0; // idb
int dword_1002A4A4; // weak
int dword_1002A4A8; // weak
int dword_1002A4AC; // weak
int dword_1002A4B0; // weak
int dword_1002A4B4; // weak
int dword_1002A4B8; // idb
int dword_1002A4BC; // weak
int SelList_cpp_float; // weak
_uiheroinfo *sellist_pheroinfo;
int SelLoad_cpp_float; // weak
int dword_1002A4CC; // weak
int dword_1002A4D0; // weak
void *dword_1002A4D4; // idb
int dword_1002A4D8; // idb
int dword_1002A4DC; // weak
int dword_1002A4E0; // weak
int dword_1002A4E4; // weak
int dword_1002A4E8; // weak
int SelLoad_cpp_float; // weak
int dword_1002A4CC; // weak
int dword_1002A4D0; // weak
void *dword_1002A4D4; // idb
int dword_1002A4D8; // idb
int dword_1002A4DC; // weak
int dword_1002A4E0; // weak
int dword_1002A4E4; // weak
int dword_1002A4E8; // weak
_uiheroinfo *dword_1002A4EC; // idb
int dword_1002A4F0; // weak
int dword_1002A4F4; // idb
int dword_1002A4F0; // weak
int dword_1002A4F4; // idb
char *yesno_dialog_string;
int SelYesNo_cpp_float; // weak
int yesno_remove_focus; // weak
char *yesno_hero_name;
int (*YesNoFunc)(void); // weak
int yesno_is_popup; // weak
int yesno_is_popup; // weak
HANDLE titlePHTrans[30];
int Title_cpp_float; // weak
int titleTransIdx; // weak
int Title_cpp_float; // weak
int titleTransIdx; // weak
int titlesnd_cpp_float; // weak
void (__stdcall *gfnSoundFunction)(char *file);
void(__stdcall *gfnSoundFunction)(char *file);

57
DiabloUI/_temp_funcs.h

@ -13,7 +13,6 @@ 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();
//const char *UiProfileGetString();
//BOOL __stdcall UiProfileCallback(int a1, int a2, int a3, int a4, LPARAM a5, int a6, int a7, int a8, int (__stdcall *a9)(_DWORD, _DWORD, _DWORD, _DWORD));
@ -24,7 +23,7 @@ int __fastcall bn_prof_10001938(HDC a1, _DWORD *a2, char *a3, int a4, int a5);
int __fastcall bn_prof_10001A10(HWND a1, HWND a2);
HINSTANCE __fastcall bn_prof_10001B0A(HWND a1, const CHAR *a2);
HWND UNKCALL bn_prof_10001C0E(HWND hWnd);
void __fastcall bn_prof_10001CB9(_DWORD *a1, int a2, void (__fastcall *a3)(_BYTE *, _DWORD, int), int a4);
void __fastcall bn_prof_10001CB9(_DWORD *a1, int a2, void(__fastcall *a3)(_BYTE *, _DWORD, int), int a4);
BOOL UNKCALL bn_prof_10001CF3(HWND hWnd);
HFONT __fastcall bn_prof_10001D81(HWND hWnd, int a2, int a3);
void UNKCALL bn_prof_10001E34(void *arg);
@ -37,7 +36,7 @@ BOOL bn_prof_100021C4();
void *bn_prof_10002247();
int j_bn_prof_10002282();
_DWORD *bn_prof_10002282();
void __cdecl bn_prof_10002298(); // idb
void __cdecl bn_prof_10002298(); // idb
int UNKCALL bn_prof_100022A2(HWND hWnd); // idb
int UNKCALL bn_prof_10002353(HGDIOBJ h); // idb
HGDIOBJ bn_prof_100023D8();
@ -54,7 +53,6 @@ _DWORD *UNKCALL bn_prof_1000280C(int *arg, _DWORD *a2, int a3, _DWORD *a4);
void UNKCALL bn_prof_1000287D(_DWORD *arg);
void UNKCALL bn_prof_10002890(_DWORD *arg);
void UNKCALL BNetGW_100028C2(_DWORD *arg);
void UNKCALL BNetGW_100029BF(_DWORD *arg, int a2);
void *UNKCALL BNetGW_10002A07(_DWORD *arg);
@ -70,7 +68,6 @@ int UNKCALL BNetGW_10002DBF(_DWORD *arg);
char *__stdcall BNetGW_10002DEB(char *a1, unsigned int a2);
char *__stdcall BNetGW_10002E0B(char *a1, unsigned int a2);
void __cdecl Connect_FreeConnectData();
BOOL __cdecl Connect_LoadGFXAndStuff();
BOOL __stdcall UiArtCallback(int game_type, unsigned int art_code, PALETTEENTRY *pPalette, void *pBuffer, DWORD dwBuffersize, DWORD *pdwWidth, DWORD *pdwHeight, DWORD *pdwBpp);
@ -91,7 +88,6 @@ BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, int mode, char *desc
void __stdcall UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, int type);
void __fastcall Connect_CopyPlrDescStrings(char *str1, int size1, char *str2, int size2);
BOOL __stdcall UiCopyProtError(int *pdwResult);
LRESULT __stdcall CopyProt_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __cdecl CopyProt_FreeCopyResrcs();
@ -100,7 +96,6 @@ void __fastcall CopyProt_EndCopyDlg(HWND hWnd, int a2);
void __cdecl j_CopyProt_cpp_init();
void __cdecl CopyProt_cpp_init();
void __cdecl j_cr8game_cpp_init();
void __cdecl cr8game_cpp_init();
BOOL __fastcall cr8game_GetSnetCreaGame(HWND hWnd);
@ -117,7 +112,6 @@ void __fastcall cr8game_SetWindowStr(HWND hWnd, int dlgitem, int a3);
int __fastcall cr8game_CheckValidGameName(char *name);
HFONT __fastcall cr8game_GetCr8Object(HWND hWnd);
void __fastcall CreaDung_SetDelSpin(int a1);
void __cdecl j_CreaDung_cpp_init();
void __cdecl CreaDung_cpp_init();
@ -131,12 +125,10 @@ void __fastcall CreaDung_DoSnetCreaGame(HWND hWnd);
void __fastcall CreaDung_CheckDlgForSnd(HWND hWnd, int a2, int a3);
BOOL __fastcall CreaDung_SelDungDiff(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
BOOL __stdcall UiGetDefaultStats(int pclass, _uidefaultstats *pStats);
void __cdecl j_CreaStat_cpp_init();
void __cdecl CreaStat_cpp_init();
void __cdecl j_credits_cpp_init();
void __cdecl credits_cpp_init();
BOOL __stdcall UiCreditsDialog(int a1);
@ -148,7 +140,6 @@ void __fastcall credits_PrintCredLines(HWND hWnd);
int __fastcall credits_GetCredLineBreak(char *str);
char *__fastcall credits_GetAdjustText(char *str, int len);
void __fastcall DiabEdit_DoPaintBMP(HWND hWnd);
void __cdecl j_DiabEdit_cpp_init();
void __cdecl DiabEdit_cpp_init();
@ -162,7 +153,6 @@ void __fastcall DiabEdit_SetRestrictString(HWND hWnd, LPARAM lParam);
void __fastcall DiabEdit_SetRestrictTimer(HWND hWnd);
void __fastcall DiabEdit_RemoveAllProps(HWND hWnd);
int __cdecl DiabloUI_GetSpawned();
void __stdcall UiOnPaint(int a1);
void __stdcall UiSetBackgroundBitmap(int a1, PALETTEENTRY *a2, int a3, int a4, int a5);
@ -174,7 +164,6 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
void __cdecl j_DiabloUI_cpp_init();
void __cdecl DiabloUI_cpp_init();
signed int DirLink_10005CFA();
BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int a6);
int __stdcall DirLink_10005D63(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam);
@ -190,7 +179,6 @@ int UNKCALL DirLink_100062BF(void *arg, int a2, char *a3, char *a4);
signed int __stdcall DirLink_1000632B(int a1, char *a2, char *a3);
HWND __fastcall DirLink_10006359(HWND hWnd, int a2, int height);
BOOL __stdcall UiBetaDisclaimer(int a1);
LRESULT __stdcall disclaim_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall disclaim_DelDisclaimProcs(HWND hWnd);
@ -199,7 +187,6 @@ void __fastcall disclaim_FadeFromDisclaim(HWND hWnd);
void __cdecl j_disclaim_cpp_init();
void __cdecl disclaim_cpp_init();
void __cdecl j_Doom_cpp_init();
void __cdecl Doom_cpp_init();
void __fastcall Doom_ParseWndProcs(HWND hWnd, int *msgtbl, int a3, int a4);
@ -221,7 +208,6 @@ void __fastcall Doom_ParseWndProc6(HWND hWnd, int *msgtbl, int a3);
void __fastcall Doom_GetSetWndTxt6(HWND hWnd, int msg, int nFont);
void __fastcall Doom_DeleteFreeProcs(HWND hWnd, int *msgtbl);
int __stdcall EntDial_10006C96(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam); // idb
HWND UNKCALL EntDial_10006D78(HWND hDlg);
HWND USERCALL EntDial_10006DB8(HWND hWnd, int a2);
@ -230,7 +216,6 @@ void __fastcall EntDial_10006EE8(HWND hWnd, unsigned int a2, int a3);
int __fastcall EntDial_10006F16(HWND hDlg, int, int); // idb
signed int EntDial_10006F71();
LRESULT __stdcall EntName_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall EntName_DelEntNameMsgs(HWND hWnd);
void __fastcall EntName_LoadFocusChkName(HWND hWnd);
@ -239,7 +224,6 @@ void __fastcall EntName_GetMessageName(HWND hWnd, unsigned int a2, int a3);
void __cdecl j_EntName_cpp_init();
void __cdecl EntName_cpp_init();
void __fastcall Fade_ApplyPaletteRange(int range1, int range2);
void __fastcall Fade_UpdatePaletteRange(int range);
BOOL __cdecl Fade_CheckRange5();
@ -251,7 +235,6 @@ void __stdcall Fade_TimerFunctionDlg(int a1, int a2, int a3, int a4);
void __cdecl j_Fade_cpp_init();
void __cdecl Fade_cpp_init();
void __fastcall Focus_CheckPlayMove(LPARAM lParam);
int __cdecl Focus_GetSpinWidthOrZero();
void __fastcall Focus_BlitSpinner(HWND hWnd1, HWND hWnd2);
@ -267,7 +250,6 @@ void __fastcall Focus_SetFocusTimer(HWND hWnd, const char *pszFileName);
void __stdcall Focus_SetFocusAndBlit(int hWnd, int a2, int a3, int a4);
void __fastcall Focus_KillFocusTimer(HWND hWnd);
void __cdecl local_InitUiPalette();
void __cdecl local_DelUiPalette();
tagPALETTEENTRY *__fastcall local_GetArtPalEntry(int entry);
@ -299,10 +281,9 @@ void __cdecl local_SetCursorArt();
void __cdecl local_SetCursorDefault();
void __fastcall local_SetDiabloCursor(HWND hWnd);
void __cdecl j_MainMenu_cpp_init();
void __cdecl MainMenu_cpp_init();
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void (__stdcall *fnSound)(char *file), int a4);
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4);
LRESULT __stdcall MainMenu_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall MainMenu_KillAndFreeMenu(HWND hWnd);
void __fastcall MainMenu_SetMenuTimer(HWND hWnd);
@ -311,7 +292,6 @@ void __fastcall MainMenu_DoOptions(HWND hWnd, int option, int PlaySelect);
BOOL __cdecl MainMenu_CheckEnoughMemory();
void __fastcall MainMenu_CheckWParamFocus(HWND hWnd, WPARAM wParam);
int Modem_1000855D();
HWND __fastcall Modem_10008563(HWND hDlg, const char *edx0, int a2);
int __stdcall Modem_100085D8(int, char *, char *); // idb
@ -326,24 +306,22 @@ int __stdcall Modem_100086DE(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void **UNKCALL Modem_1000879E(HWND hDlg);
BOOL UNKCALL Modem_100087DB(HWND hWnd);
int Modem_10008888();
int UNKCALL Modem_100088DB(HWND hWnd); // idb
int UNKCALL Modem_1000893D(HWND hWnd); // idb
int UNKCALL Modem_100088DB(HWND hWnd); // idb
int UNKCALL Modem_1000893D(HWND hWnd); // idb
int __fastcall Modem_10008A38(HWND hWnd, int); // idb
void __cdecl Modem_10008B42(char *a1);
int UNKCALL Modem_10008BB7(HWND hWnd); // idb
int UNKCALL Modem_10008BFE(HWND hWnd); // idb
int __stdcall ModmStat_10008C62(char *, int, int, int, int); // idb
int UNKCALL ModmStat_10008C87(void *arg);
int __stdcall ModmStat_10008CA0(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb
int UNKCALL ModmStat_10008DB3(HWND hDlg); // idb
int UNKCALL ModmStat_10008DB3(HWND hDlg); // idb
BOOL UNKCALL ModmStat_10008DE4(HWND hWnd);
int __fastcall ModmStat_10008E89(int a1, int a2);
void UNKCALL ModmStat_10008EBF(HWND hDlg);
signed int ModmStat_10008F26();
BOOL __fastcall OkCancel_DrawString(HWND hWnd, char *str);
void __cdecl j_OkCancel_cpp_init();
void __cdecl OkCancel_cpp_init();
@ -354,7 +332,6 @@ void __fastcall OkCancel_PlaySndEndDlg(HWND hWnd, int a2);
void __fastcall OkCancel_DoOkDialog(HWND hWnd, char *str, int a3);
void __stdcall UiMessageBoxCallback(HWND hWnd, char *lpText, LPCSTR lpCaption, UINT uType);
signed int Progress_10009480();
//BOOL __stdcall UiProgressDialog(int a1, int a2, BOOL a3, int (*a4)(void), int a5);
int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb
@ -365,7 +342,6 @@ void Progress_100098B0();
void UNKCALL Progress_100098C5(HWND hWnd);
BOOL UNKCALL Progress_1000991C(HWND hWnd);
void __cdecl j_Sbar_cpp_init();
void __cdecl Sbar_cpp_init();
BOOL __fastcall Sbar_CheckIfNextHero(HWND hWnd);
@ -376,7 +352,6 @@ void __cdecl j_Sbar_cpp_init2();
void __cdecl Sbar_cpp_init2();
void __fastcall Sbar_FreeScrollBar(HWND hWnd, int nIDDlgItem);
LRESULT __stdcall SelClass_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall SelClass_FreeClassMsgTbl(HWND hWnd);
void __fastcall SelClass_LoadClassFocus(HWND hWnd);
@ -385,7 +360,6 @@ void __fastcall SelClass_CheckClassSpawn(HWND hWnd, int a2);
void __cdecl j_SelClass_cpp_init();
void __cdecl SelClass_cpp_init();
void *SelConn_1000A082();
signed int SelConn_1000A09B();
int __stdcall SelConn_1000A0A6(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam);
@ -417,7 +391,6 @@ int __fastcall SelConn_1000AE19(int a1, UINT a2);
HWND __fastcall SelConn_1000AE59(HWND hWnd, int a2, int height);
//signed int __stdcall UiSelectProvider(int a1, int a2, int a3, int a4, char *a5, int *a6);
int UNKCALL SelDial_1000B011(char *arg);
signed int SelDial_1000B0C4();
int __stdcall SelDial_1000B0CF(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb
@ -431,7 +404,6 @@ HWND USERCALL SelDial_1000B483(HWND hWnd, int a2);
int SelDial_1000B5D9();
int __fastcall SelDial_1000B614(HWND hWnd, int, int); // idb
void UNKCALL SelGame_1000B66A(void *arg);
int SelGame_1000B671();
void UNKCALL SelGame_1000B677(void *arg);
@ -439,7 +411,6 @@ int SelGame_1000B67E();
//int __stdcall UiSelectGame(int, int, void *, int, int, int); // idb
signed int SelGame_1000B795();
_uiheroinfo *__cdecl SelHero_GetCurrentHeroInfo();
int __cdecl SelHero_GetNumHeroesLeft();
void __fastcall SelHero_SetHeroDifficulty(int diff);
@ -456,7 +427,7 @@ BOOL __fastcall SelHero_IsNameReserved(char *name);
void __fastcall SelHero_SetLastNamePos(char *name);
BOOL __fastcall SelHero_NameHasChar(char *name, char *illegalchrs);
BOOL __fastcall UiValidPlayerName(char *name);
BOOL __stdcall UiSelHeroMultDialog(BOOL (__stdcall *fninfo)(BOOL (__stdcall *fninfofunc)(_uiheroinfo *)), BOOL (__stdcall *fncreate)(_uiheroinfo *), BOOL (__stdcall *fnremove)(_uiheroinfo *), BOOL (__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, int *a6, char *name);
BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, int *a6, char *name);
LRESULT __stdcall SelHero_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall SelHero_DoStuffWithStrings(HWND hWnd);
_uiheroinfo *__fastcall SelHero_GetNextHeroFromStr(_uiheroinfo *pInfo, char *name);
@ -474,8 +445,7 @@ void __fastcall SelHero_DoHeroEndFade(HWND hWnd, int a2);
void __fastcall SelHero_LoadHeroGFX(HWND hWnd);
void __fastcall SelHero_SelectHeroRegion(HWND hWnd);
BOOL __stdcall SelHero_GetHeroInfo(_uiheroinfo *pInfo);
BOOL __stdcall UiSelHeroSingDialog(BOOL (__stdcall *fninfo)(BOOL (__stdcall *fninfofunc)(_uiheroinfo *)), BOOL (__stdcall *fncreate)(_uiheroinfo *), BOOL (__stdcall *fnremove)(_uiheroinfo *), BOOL (__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty);
BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty);
void *SelIPX_1000C610();
signed int SelIPX_1000C629();
@ -513,7 +483,6 @@ const char *__fastcall SelIPX_1000D58D(const char *a1, const char *a2);
int __fastcall SelIPX_1000D5B0(int a1, int a2);
HWND __fastcall SelIPX_1000D696(HWND hDlg, int a2, int height);
void __cdecl j_SelList_cpp_init();
void __cdecl SelList_cpp_init();
LRESULT __stdcall SelList_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
@ -536,7 +505,6 @@ void __fastcall SelList_HeroDlgWithSound(HWND hWnd);
void __fastcall SelList_HeroDlgWithSnd2(HWND hWnd);
void __fastcall SelList_ChooseDlgFromSize(HWND hWnd, int width, int height);
LRESULT __stdcall SelLoad_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall SelLoad_DeleteProcsAndSpin(HWND hWnd);
void __fastcall SelLoad_LoadFocusAndMsg(HWND hWnd);
@ -544,7 +512,6 @@ void __fastcall SelLoad_SelectSndLoad(HWND hWnd, int a2);
void __cdecl j_SelLoad_cpp_init();
void __cdecl SelLoad_cpp_init();
signed int SelModem_1000E42A();
int __fastcall SelModem_1000E435(void *a1, int a2, int a3, char *a4, char *a5);
char *__stdcall SelModem_1000E497(int a1, char *a2, char *a3);
@ -574,7 +541,6 @@ HWND UNKCALL SelModem_1000EDBC(HWND hWnd);
int __fastcall SelModem_1000EE29(int a1, int a2);
HWND __fastcall SelModem_1000EE78(HWND hWnd, int a2, int height);
void *SelRegn_1000EF42();
_uiheroinfo *__fastcall SelRegn_SetNextHero(_uiheroinfo *pNext, _uiheroinfo *pCurrent);
signed int SelRegn_1000EF60();
@ -603,18 +569,16 @@ signed int SelRegn_1000F8F6();
HWND __fastcall SelRegn_1000F929(HWND hWnd, int a2, int height);
//signed int __stdcall UiSelectRegion(_DWORD *a1);
int __fastcall SelYesNo_YesNoDialog(HWND hWnd, char *dialogstr, char *hero, int nofocus); /* void */
LRESULT __stdcall SelYesNo_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall SelYesNo_RemoveYNDialog(HWND hWnd);
void __fastcall SelYesNo_LoadSelYN_GFX(HWND hWnd);
void __fastcall SelYesNo_DoSelectYesNo(HWND hWnd, int option);
int __fastcall SelYesNo_SelOkDialog(HWND hWnd, char *dialogstr, char *hero, int nofocus); /* void */
int __fastcall SelYesNo_SpawnErrDialog(HWND hWnd, int string_rsrc, int is_popup); /* void */
int __fastcall SelYesNo_SpawnErrDialog(HWND hWnd, int string_rsrc, int is_popup); /* void */
void __cdecl j_SelYesNo_cpp_init();
void __cdecl SelYesNo_cpp_init();
void __fastcall Title_BlitTitleBuffer(HWND hWnd);
void __cdecl Title_DeletePhTrans();
void __fastcall Title_FreeTransMem(HWND hWnd);
@ -631,8 +595,7 @@ void __fastcall Title_KillTimerAndFree(HWND hWnd);
void __fastcall Title_LoadAllTitleImgs(HWND hWnd, int time);
void __fastcall Title_KillAndFadeDlg(HWND hWnd);
void __fastcall TitleSnd_SetSoundFunction(void (__stdcall *func)(char *file));
void __fastcall TitleSnd_SetSoundFunction(void(__stdcall *func)(char *file));
void __cdecl TitleSnd_InitSoundFunc();
void __cdecl TitleSnd_PlayMoveSound();
void __cdecl TitleSnd_PlaySelectSound();

473
DiabloUI/artfont.cpp

@ -1,322 +1,295 @@
// ref: 0x10001058
void __fastcall artfont_SetArtFont(int nFont)
{
switch ( nFont )
{
case 0:
sgpCurrFont = &font16g;
break;
case 2:
sgpCurrFont = &font24g;
break;
case 3:
sgpCurrFont = &font24s;
break;
case 4:
sgpCurrFont = &font30g;
break;
case 5:
sgpCurrFont = &font30s;
break;
case 6:
sgpCurrFont = &font42g;
break;
case 7:
sgpCurrFont = &font42y;
break;
default:
sgpCurrFont = &font16s;
break;
}
switch (nFont) {
case 0:
sgpCurrFont = &font16g;
break;
case 2:
sgpCurrFont = &font24g;
break;
case 3:
sgpCurrFont = &font24s;
break;
case 4:
sgpCurrFont = &font30g;
break;
case 5:
sgpCurrFont = &font30s;
break;
case 6:
sgpCurrFont = &font42g;
break;
case 7:
sgpCurrFont = &font42y;
break;
default:
sgpCurrFont = &font16s;
break;
}
}
// ref: 0x10001098
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;
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
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;
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
void __fastcall artfont_FreeArtFont(FontStruct *pFont)
{
HANDLE *v2; // esi
signed int v3; // ebx
HANDLE *v2; // esi
signed int v3; // ebx
if ( pFont->active )
{
v2 = pFont->fonttrans;
v3 = 256;
do
{
if ( *v2 )
{
STransDelete(*v2);
*v2 = 0;
}
++v2;
--v3;
}
while ( v3 );
pFont->active = 0;
}
if (pFont->active) {
v2 = pFont->fonttrans;
v3 = 256;
do {
if (*v2) {
STransDelete(*v2);
*v2 = 0;
}
++v2;
--v3;
} while (v3);
pFont->active = 0;
}
}
// ref: 0x10001159
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;
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_LoadArtFont(FontStruct *pFont, const char *pszBinFile, const char *pszFileName)
{
LONG v4; // eax
signed int v5; // edi
unsigned char v6; // al
int v7; // ecx
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]
LONG v4; // eax
signed int v5; // edi
unsigned char v6; // al
int v7; // ecx
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]
if ( !pFont->active && SFileOpenFile(pszBinFile, &phFile) )
{
v4 = SFileGetFileSize(phFile, 0);
if ( SFileReadFile(phFile, pFont, v4, 0, 0) )
{
SFileCloseFile(phFile);
local_LoadArtImage(pszFileName, &pBuffer, size);
memset(pFont->fonttrans, 0, 0x400u);
if ( pBuffer )
{
v5 = 0;
a1a = pFont->fonttrans;
do
{
v6 = pFont->fontbin[v5 + 2];
if ( v6 )
{
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);
}
++a1a;
++v5;
}
while ( v5 <= 256 );
pFont->active = 1;
SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\artfont.cpp", 206, 0);
}
}
else
{
SFileCloseFile(phFile);
}
}
if (!pFont->active && SFileOpenFile(pszBinFile, &phFile)) {
v4 = SFileGetFileSize(phFile, 0);
if (SFileReadFile(phFile, pFont, v4, 0, 0)) {
SFileCloseFile(phFile);
local_LoadArtImage(pszFileName, &pBuffer, size);
memset(pFont->fonttrans, 0, 0x400u);
if (pBuffer) {
v5 = 0;
a1a = pFont->fonttrans;
do {
v6 = pFont->fontbin[v5 + 2];
if (v6) {
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);
}
++a1a;
++v5;
} while (v5 <= 256);
pFont->active = 1;
SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\artfont.cpp", 206, 0);
}
} else {
SFileCloseFile(phFile);
}
}
}
// ref: 0x100012F6
int __cdecl artfont_GetFontMaxHeight()
{
int result; // eax
int result; // eax
if ( sgpCurrFont && sgpCurrFont->active )
result = sgpCurrFont->fontbin[1];
else
result = 0;
return result;
if (sgpCurrFont && sgpCurrFont->active)
result = sgpCurrFont->fontbin[1];
else
result = 0;
return result;
}
// ref: 0x10001310
int __cdecl artfont_GetFontDefWidth()
{
int result; // eax
int result; // eax
if ( sgpCurrFont && sgpCurrFont->active )
result = sgpCurrFont->fontbin[0];
else
result = 0;
return result;
if (sgpCurrFont && sgpCurrFont->active)
result = sgpCurrFont->fontbin[0];
else
result = 0;
return result;
}
// ref: 0x10001329
int __fastcall artfont_GetFontWidth(char *str)
{
int result; // eax
unsigned char i; // bl
unsigned char v3; // bl
int v4; // esi
int result; // eax
unsigned char i; // bl
unsigned char v3; // bl
int v4; // esi
result = 0;
if ( !sgpCurrFont || !sgpCurrFont->active )
return 0;
for ( i = *str; *str; i = *str )
{
v3 = sgpCurrFont->fontbin[i + 2];
if ( v3 )
v4 = v3;
else
v4 = sgpCurrFont->fontbin[0];
result += v4;
++str;
}
return result;
result = 0;
if (!sgpCurrFont || !sgpCurrFont->active)
return 0;
for (i = *str; *str; i = *str) {
v3 = sgpCurrFont->fontbin[i + 2];
if (v3)
v4 = v3;
else
v4 = sgpCurrFont->fontbin[0];
result += v4;
++str;
}
return result;
}
// ref: 0x1000136C
void __cdecl artfont_cpp_init()
{
artfont_cpp_float = 2139095040;
artfont_cpp_float = 2139095040;
}
// 10026BB0: using guessed type int artfont_cpp_float;
// ref: 0x10001377
int __fastcall artfont_GetFontBreak(char *str)
{
int result; // eax
unsigned char v2; // dl
unsigned char v3; // dl
int result; // eax
unsigned char v2; // dl
unsigned char v3; // dl
result = 0;
if ( !sgpCurrFont || !sgpCurrFont->active )
return 0;
while ( 1 )
{
v3 = *str;
if ( !*str )
break;
if ( v3 == '\n' )
break;
if ( v3 == ' ' )
break;
v2 = sgpCurrFont->fontbin[v3 + 2];
if ( !v2 )
break;
result += v2;
++str;
}
return result;
result = 0;
if (!sgpCurrFont || !sgpCurrFont->active)
return 0;
while (1) {
v3 = *str;
if (!*str)
break;
if (v3 == '\n')
break;
if (v3 == ' ')
break;
v2 = sgpCurrFont->fontbin[v3 + 2];
if (!v2)
break;
result += v2;
++str;
}
return result;
}
// ref: 0x100013B3
void __cdecl artfont_delete_operator(void *ptr)
{
if ( ptr )
SMemFree(ptr, "delete", -1, 0);
if (ptr)
SMemFree(ptr, "delete", -1, 0);
}
// ref: 0x100013CD
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
DWORD *v10; // ecx
HANDLE hTrans; // [esp+Ch] [ebp-8h]
HANDLE hTransa; // [esp+Ch] [ebp-8h]
FontStruct *v5; // esi
unsigned char v6; // cl
int v7; // edi
unsigned char v8; // dl
int v9; // edi
DWORD *v10; // ecx
HANDLE hTrans; // [esp+Ch] [ebp-8h]
HANDLE hTransa; // [esp+Ch] [ebp-8h]
if ( pSurface )
{
if ( *pSurface )
{
v5 = sgpCurrFont;
if ( sgpCurrFont )
{
if ( sgpCurrFont->active )
{
if ( sx < 0 )
sx = 0;
if ( sy < 0 )
sy = 0;
v6 = *str;
if ( *str )
{
while ( 1 )
{
hTrans = (HANDLE)(sy + v5->fontbin[1]);
if ( sy + v5->fontbin[1] > (signed int)pSurface[2] )
return;
if ( v6 == '\n' )
break;
v7 = v6;
v8 = v5->fontbin[v6 + 2];
if ( !v8 )
{
v9 = v5->fontbin[0];
if ( sx + v9 + artfont_GetFontBreak(++str) < (signed int)pSurface[1] )
{
sx += v9;
}
else
{
sx = 0;
sy = (int)hTrans;
}
goto LABEL_23;
}
hTransa = v5->fonttrans[v6];
if ( v5->fonttrans[v6] )
{
v10 = pSurface[1];
if ( sx + v8 <= (signed int)v10 )
{
STransBlt(*pSurface, sx, sy, (int)v10, hTransa);
v5 = sgpCurrFont;
sx += sgpCurrFont->fontbin[v7 + 2];
goto LABEL_22;
}
sx = 0;
sy += v5->fontbin[1];
}
LABEL_23:
v6 = *str;
if ( !*str )
return;
}
sx = 0;
sy += v5->fontbin[1];
LABEL_22:
++str;
goto LABEL_23;
}
}
}
}
}
if (pSurface) {
if (*pSurface) {
v5 = sgpCurrFont;
if (sgpCurrFont) {
if (sgpCurrFont->active) {
if (sx < 0)
sx = 0;
if (sy < 0)
sy = 0;
v6 = *str;
if (*str) {
while (1) {
hTrans = (HANDLE)(sy + v5->fontbin[1]);
if (sy + v5->fontbin[1] > (signed int)pSurface[2])
return;
if (v6 == '\n')
break;
v7 = v6;
v8 = v5->fontbin[v6 + 2];
if (!v8) {
v9 = v5->fontbin[0];
if (sx + v9 + artfont_GetFontBreak(++str) < (signed int)pSurface[1]) {
sx += v9;
} else {
sx = 0;
sy = (int)hTrans;
}
goto LABEL_23;
}
hTransa = v5->fonttrans[v6];
if (v5->fonttrans[v6]) {
v10 = pSurface[1];
if (sx + v8 <= (signed int)v10) {
STransBlt(*pSurface, sx, sy, (int)v10, hTransa);
v5 = sgpCurrFont;
sx += sgpCurrFont->fontbin[v7 + 2];
goto LABEL_22;
}
sx = 0;
sy += v5->fontbin[1];
}
LABEL_23:
v6 = *str;
if (!*str)
return;
}
sx = 0;
sy += v5->fontbin[1];
LABEL_22:
++str;
goto LABEL_23;
}
}
}
}
}
}

1611
DiabloUI/connect.cpp

File diff suppressed because it is too large Load Diff

233
DiabloUI/copyprot.cpp

@ -1,157 +1,148 @@
// ref: 0x10004054
BOOL __stdcall UiCopyProtError(int *pdwResult)
{
int v1; // eax
int v2; // eax
char Buffer[128]; // [esp+0h] [ebp-80h]
int v1; // eax
int v2; // eax
char Buffer[128]; // [esp+0h] [ebp-80h]
if ( DiabloUI_GetSpawned() )
LoadStringA(ghUiInst, 0x3Fu, Buffer, 127);
else
LoadStringA(ghUiInst, 0x1Bu, Buffer, 127);
v1 = (int)SDrawGetFrameWindow();
v2 = SDlgDialogBoxParam(ghUiInst, "OKCANCEL_DIALOG", v1, CopyProt_WndProc, (int)Buffer);
if ( pdwResult )
*pdwResult = v2;
return 1;
if (DiabloUI_GetSpawned())
LoadStringA(ghUiInst, 0x3Fu, Buffer, 127);
else
LoadStringA(ghUiInst, 0x1Bu, Buffer, 127);
v1 = (int)SDrawGetFrameWindow();
v2 = SDlgDialogBoxParam(ghUiInst, "OKCANCEL_DIALOG", v1, CopyProt_WndProc, (int)Buffer);
if (pdwResult)
*pdwResult = v2;
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x100040AF
LRESULT __stdcall CopyProt_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v4; // ecx
int v5; // edx
HWND v6; // eax
LONG v7; // eax
HWND v9; // eax
HWND v4; // ecx
int v5; // edx
HWND v6; // eax
LONG v7; // eax
HWND v9; // eax
if ( Msg == 2 )
{
CopyProt_FreeCopyResrcs();
Fade_UpdatePaletteRange(10);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg <= 0x103 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if ( Msg <= 0x105 )
{
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg == 272 )
{
CopyProt_LoadCopyStuff(hWnd, lParam);
return 1;
}
if ( Msg != 273 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
switch ( (unsigned short)wParam )
{
case 1u:
v6 = GetFocus();
v7 = GetWindowLongA(v6, -12);
v4 = hWnd;
if ( v7 == 1109 )
{
v5 = 1;
goto LABEL_13;
}
goto LABEL_12;
case 2u:
v4 = hWnd;
LABEL_12:
v5 = 2;
goto LABEL_13;
case 0x455u:
v4 = hWnd;
v5 = 1;
LABEL_13:
CopyProt_EndCopyDlg(v4, v5);
break;
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg == 2) {
CopyProt_FreeCopyResrcs();
Fade_UpdatePaletteRange(10);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg <= 0x103)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg <= 0x105) {
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg == 272) {
CopyProt_LoadCopyStuff(hWnd, lParam);
return 1;
}
if (Msg != 273)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
switch ((unsigned short)wParam) {
case 1u:
v6 = GetFocus();
v7 = GetWindowLongA(v6, -12);
v4 = hWnd;
if (v7 == 1109) {
v5 = 1;
goto LABEL_13;
}
goto LABEL_12;
case 2u:
v4 = hWnd;
LABEL_12:
v5 = 2;
goto LABEL_13;
case 0x455u:
v4 = hWnd;
v5 = 1;
LABEL_13:
CopyProt_EndCopyDlg(v4, v5);
break;
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x10004173
void __cdecl CopyProt_FreeCopyResrcs()
{
if ( copyprot_artpal )
{
FreeResource(copyprot_artpal);
copyprot_artpal = 0;
}
if ( copyprot_btnart )
{
FreeResource(copyprot_btnart);
copyprot_btnart = 0;
}
if ( copyprot_popupart )
{
FreeResource(copyprot_popupart);
copyprot_popupart = 0;
}
if (copyprot_artpal) {
FreeResource(copyprot_artpal);
copyprot_artpal = 0;
}
if (copyprot_btnart) {
FreeResource(copyprot_btnart);
copyprot_btnart = 0;
}
if (copyprot_popupart) {
FreeResource(copyprot_popupart);
copyprot_popupart = 0;
}
}
// ref: 0x100041B5
BOOL __fastcall CopyProt_LoadCopyStuff(HWND hWnd, int a2)
{
HRSRC v2; // eax
HRSRC v3; // eax
HRSRC v4; // eax
void *v5; // edi
void *v6; // ebx
HWND v7; // eax
PALETTEENTRY pPalEntries[256]; // [esp+Ch] [ebp-420h]
int msgs[3]; // [esp+40Ch] [ebp-20h]
DWORD data[2]; // [esp+418h] [ebp-14h]
LPCSTR lpString; // [esp+420h] [ebp-Ch]
void *v13; // [esp+424h] [ebp-8h]
HRSRC v2; // eax
HRSRC v3; // eax
HRSRC v4; // eax
void *v5; // edi
void *v6; // ebx
HWND v7; // eax
PALETTEENTRY pPalEntries[256]; // [esp+Ch] [ebp-420h]
int msgs[3]; // [esp+40Ch] [ebp-20h]
DWORD data[2]; // [esp+418h] [ebp-14h]
LPCSTR lpString; // [esp+420h] [ebp-Ch]
void *v13; // [esp+424h] [ebp-8h]
msgs[2] = 0;
lpString = (LPCSTR)a2;
data[0] = 112;
data[1] = 140;
msgs[0] = 1109;
msgs[1] = 2;
v2 = FindResourceA(ghUiInst, "IDR_POPUPART", "ART_FILES");
copyprot_popupart = LoadResource(ghUiInst, v2);
v3 = FindResourceA(ghUiInst, "IDR_BTNART", "ART_FILES");
copyprot_btnart = LoadResource(ghUiInst, v3);
v4 = FindResourceA(ghUiInst, "IDR_ARTPAL", "ART_FILES");
copyprot_artpal = LoadResource(ghUiInst, v4);
v5 = LockResource(copyprot_popupart);
v6 = LockResource(copyprot_btnart);
v13 = LockResource(copyprot_artpal);
if ( v5 )
SDlgSetBitmapI(hWnd, 0, &nullcharacter, -1, 1, v5, 0, 284, 148, -1);
ShowCursor(1);
Fade_SetInputWindow(hWnd);
if ( v6 )
local_FitButtonDlg(hWnd, msgs, v6, data);
if ( v13 )
{
memcpy(pPalEntries, v13, 0x400u);
SDrawUpdatePalette(0, 0x100u, pPalEntries, 1);
}
v7 = GetDlgItem(hWnd, 1026);
SetWindowTextA(v7, lpString);
return 1;
msgs[2] = 0;
lpString = (LPCSTR)a2;
data[0] = 112;
data[1] = 140;
msgs[0] = 1109;
msgs[1] = 2;
v2 = FindResourceA(ghUiInst, "IDR_POPUPART", "ART_FILES");
copyprot_popupart = LoadResource(ghUiInst, v2);
v3 = FindResourceA(ghUiInst, "IDR_BTNART", "ART_FILES");
copyprot_btnart = LoadResource(ghUiInst, v3);
v4 = FindResourceA(ghUiInst, "IDR_ARTPAL", "ART_FILES");
copyprot_artpal = LoadResource(ghUiInst, v4);
v5 = LockResource(copyprot_popupart);
v6 = LockResource(copyprot_btnart);
v13 = LockResource(copyprot_artpal);
if (v5)
SDlgSetBitmapI(hWnd, 0, &nullcharacter, -1, 1, v5, 0, 284, 148, -1);
ShowCursor(1);
Fade_SetInputWindow(hWnd);
if (v6)
local_FitButtonDlg(hWnd, msgs, v6, data);
if (v13) {
memcpy(pPalEntries, v13, 0x400u);
SDrawUpdatePalette(0, 0x100u, pPalEntries, 1);
}
v7 = GetDlgItem(hWnd, 1026);
SetWindowTextA(v7, lpString);
return 1;
}
// ref: 0x1000430C
void __fastcall CopyProt_EndCopyDlg(HWND hWnd, int a2)
{
ShowCursor(0);
SDlgEndDialog(hWnd, (HANDLE)a2);
ShowCursor(0);
SDlgEndDialog(hWnd, (HANDLE)a2);
}
// ref: 0x10004329
void __cdecl CopyProt_cpp_init()
{
CopyProt_cpp_float = CopyProt_cpp_float_value;
CopyProt_cpp_float = CopyProt_cpp_float_value;
}
// 1001F3F8: using guessed type int CopyProt_cpp_float_value;
// 10029620: using guessed type int CopyProt_cpp_float;

604
DiabloUI/cr8game.cpp

@ -1,7 +1,7 @@
// ref: 0x10004339
void __cdecl cr8game_cpp_init()
{
cr8game_cpp_float = cr8game_cpp_float_value;
cr8game_cpp_float = cr8game_cpp_float_value;
}
// 1001F3FC: using guessed type int cr8game_cpp_float_value;
// 1002962C: using guessed type int cr8game_cpp_float;
@ -9,57 +9,49 @@ void __cdecl cr8game_cpp_init()
// ref: 0x10004344
BOOL __fastcall cr8game_GetSnetCreaGame(HWND hWnd)
{
BOOL result; // eax
DWORD *v2; // eax
int *v3; // ST24_4
int v4; // ST18_4
int v5; // ST14_4
char *v6; // ST10_4
int v7; // eax
char Buffer[128]; // [esp+Ch] [ebp-308h]
char Text[256]; // [esp+8Ch] [ebp-288h]
char a4[128]; // [esp+18Ch] [ebp-188h]
char a2[128]; // [esp+20Ch] [ebp-108h]
char str[128]; // [esp+28Ch] [ebp-88h]
BOOL v13; // [esp+30Ch] [ebp-8h]
BOOL result; // eax
DWORD *v2; // eax
int *v3; // ST24_4
int v4; // ST18_4
int v5; // ST14_4
char *v6; // ST10_4
int v7; // eax
char Buffer[128]; // [esp+Ch] [ebp-308h]
char Text[256]; // [esp+8Ch] [ebp-288h]
char a4[128]; // [esp+18Ch] [ebp-188h]
char a2[128]; // [esp+20Ch] [ebp-108h]
char str[128]; // [esp+28Ch] [ebp-88h]
BOOL v13; // [esp+30Ch] [ebp-8h]
Connect_CopyPlrDescStrings(a2, 128, str, 128);
Connect_SetDiffString(&cr8_gamedata, a2, str, a4, 128);
if ( UiAuthCallback(2, a2, str, 0, a4, Text, 256) )
{
v2 = cr8_somegamestruct;
if ( cr8_somegamestruct[8] >= 8 )
{
*(_BYTE *)(cr8_somegamestruct[7] + 4) = cr8_gamedata.bDiff;
v2 = cr8_somegamestruct;
}
v3 = cr8game_playerID;
v4 = *(_DWORD *)(cr8_playercount + 8);
v5 = v2[8];
v6 = (char *)v2[7];
v7 = Connect_GetRankFromLevel(str);
v13 = SNetCreateGame(cr8_gamename, cr8_gamepassword, a4, v7, v6, v5, v4, a2, 0, v3);
if ( !v13 )
{
if ( SErrGetLastError() == 183 )
{
LoadStringA(ghUiInst, 0x40Fu, Buffer, 128);
sprintf(Text, Buffer, cr8_gamename);
}
else
{
LoadStringA(ghUiInst, 0x410u, Text, 256);
}
UiMessageBoxCallback(hWnd, Text, 0, 0x30u);
}
result = v13;
}
else
{
UiMessageBoxCallback(hWnd, Text, 0, 0x30u);
result = 0;
}
return result;
Connect_CopyPlrDescStrings(a2, 128, str, 128);
Connect_SetDiffString(&cr8_gamedata, a2, str, a4, 128);
if (UiAuthCallback(2, a2, str, 0, a4, Text, 256)) {
v2 = cr8_somegamestruct;
if (cr8_somegamestruct[8] >= 8) {
*(_BYTE *)(cr8_somegamestruct[7] + 4) = cr8_gamedata.bDiff;
v2 = cr8_somegamestruct;
}
v3 = cr8game_playerID;
v4 = *(_DWORD *)(cr8_playercount + 8);
v5 = v2[8];
v6 = (char *)v2[7];
v7 = Connect_GetRankFromLevel(str);
v13 = SNetCreateGame(cr8_gamename, cr8_gamepassword, a4, v7, v6, v5, v4, a2, 0, v3);
if (!v13) {
if (SErrGetLastError() == 183) {
LoadStringA(ghUiInst, 0x40Fu, Buffer, 128);
sprintf(Text, Buffer, cr8_gamename);
} else {
LoadStringA(ghUiInst, 0x410u, Text, 256);
}
UiMessageBoxCallback(hWnd, Text, 0, 0x30u);
}
result = v13;
} else {
UiMessageBoxCallback(hWnd, Text, 0, 0x30u);
result = 0;
}
return result;
}
// 10010406: using guessed type _DWORD __stdcall SErrGetLastError();
// 10029630: using guessed type int cr8_playercount;
@ -67,16 +59,16 @@ BOOL __fastcall cr8game_GetSnetCreaGame(HWND hWnd)
// ref: 0x100044AA
BOOL __stdcall UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int a6)
{
BOOL v6; // eax
BOOL v6; // eax
cr8_playercount = a1;
cr8_somegamestruct = (DWORD *)a2;
cr8_dword_10029638 = a3;
cr8_dword_10029640 = a5;
cr8_dword_1002963C = a4;
cr8game_playerID = (int *)a6;
v6 = SDlgDialogBoxParam(ghUiInst, "DIALOG_CREATE_GAME", *(_DWORD *)(a4 + 8), cr8game_WndProc, 0);
return v6 != -1 ? v6 : 0;
cr8_playercount = a1;
cr8_somegamestruct = (DWORD *)a2;
cr8_dword_10029638 = a3;
cr8_dword_10029640 = a5;
cr8_dword_1002963C = a4;
cr8game_playerID = (int *)a6;
v6 = SDlgDialogBoxParam(ghUiInst, "DIALOG_CREATE_GAME", *(_DWORD *)(a4 + 8), cr8game_WndProc, 0);
return v6 != -1 ? v6 : 0;
}
// 10029630: using guessed type int cr8_playercount;
// 10029638: using guessed type int cr8_dword_10029638;
@ -86,243 +78,214 @@ BOOL __stdcall UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int
// ref: 0x10004506
LRESULT __stdcall cr8game_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
signed int v4; // ebx
HWND v6; // eax
HWND v7; // eax
HWND v8; // eax
char Buffer[256]; // [esp+Ch] [ebp-104h]
int a2; // [esp+10Ch] [ebp-4h]
signed int v4; // ebx
HWND v6; // eax
HWND v7; // eax
HWND v8; // eax
char Buffer[256]; // [esp+Ch] [ebp-104h]
int a2; // [esp+10Ch] [ebp-4h]
v4 = Msg;
if ( Msg == 2 )
{
cr8game_FreeCreaStuff();
cr8game_FreeMainMem(hWnd);
if ( cr8game_hobject )
DeleteObject(cr8game_hobject);
cr8_sendmsg1 = 0;
cr8_sendmsg2 = 0;
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
}
if ( Msg > 0x103 )
{
if ( Msg > 0x105 )
{
if ( Msg == 272 )
{
cr8_sendmsg2 = GetDlgItem(hWnd, 1010);
cr8_sendmsg1 = GetDlgItem(hWnd, 1011);
cr8game_LoadCreaGFX(hWnd);
cr8game_AllocMainMem(hWnd);
cr8game_SendMessageF5(hWnd);
cr8game_hobject = cr8game_GetCr8Object(hWnd);
SendMessageA(cr8_sendmsg2, 0xC5u, 0x1Fu, 0);
SendMessageA(cr8_sendmsg1, 0xC5u, 0x1Fu, 0);
return 1;
}
if ( Msg != 273 )
{
if ( Msg == 312 && GetWindowLongA((HWND)lParam, -12) == 1030 )
{
local_SetWhiteText((HDC)wParam);
return (LRESULT)GetStockObject(5);
}
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
}
if ( (unsigned short)wParam == 1 )
{
if ( SendMessageA(cr8_sendmsg2, 0xEu, 0, 0) )
{
SendMessageA(cr8_sendmsg2, 0xDu, 0x20u, (LPARAM)cr8_gamename);
if ( SelHero_IsNameReserved(cr8_gamename)
|| SelHero_NameHasChar(cr8_gamename, &nullcharacter)
|| !cr8game_CheckValidGameName(cr8_gamename) )
{
LoadStringA(ghUiInst, 0x404u, Buffer, 256);
OkCancel_DoOkDialog(hWnd, Buffer, 1);
cr8_gamename[0] = 0;
}
else
{
cr8_gamepassword[0] = 0;
if ( SendMessageA(cr8_sendmsg1, 0xEu, 0, 0) )
SendMessageA(cr8_sendmsg1, 0xDu, 0x20u, (LPARAM)cr8_gamepassword);
cr8_gamedata.bDiff = cr8_dword_1002966C;
TitleSnd_PlaySelectSound();
if ( cr8game_GetSnetCreaGame(hWnd) )
SDlgEndDialog(hWnd, (void *)HANDLE_FLAG_INHERIT);
}
}
else
{
LoadStringA(ghUiInst, 0x3F0u, Buffer, 256);
OkCancel_DoOkDialog(hWnd, Buffer, 1);
}
}
else
{
if ( (unsigned short)wParam != 2 )
{
if ( (signed int)(unsigned short)wParam > 1031 && (signed int)(unsigned short)wParam <= 1034 )
{
a2 = (unsigned short)wParam - 1032;
if ( HIWORD(wParam) == 6 )
SetFocus(cr8_sendmsg2);
if ( cr8_dword_1002966C != (unsigned short)wParam - 1032 )
{
if ( cr8_dword_1002966C != -1 )
{
v6 = GetDlgItem(hWnd, cr8_dword_1002966C + 1032);
SendMessageA(v6, 0xF3u, 0, 0);
TitleSnd_PlayMoveSound();
}
cr8game_BlitCr8Dialog(hWnd, a2);
v7 = GetDlgItem(hWnd, 1040);
cr8game_SetWindowStr(v7, 1029, a2);
v4 = 273;
cr8_dword_1002966C = a2;
}
SendMessageA((HWND)lParam, 0xF3u, 1u, 0);
}
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
}
TitleSnd_PlaySelectSound();
SDlgEndDialog(hWnd, 0);
}
return 0;
}
v8 = (HWND)SDrawGetFrameWindow();
SendMessageA(v8, Msg, wParam, lParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
v4 = Msg;
if (Msg == 2) {
cr8game_FreeCreaStuff();
cr8game_FreeMainMem(hWnd);
if (cr8game_hobject)
DeleteObject(cr8game_hobject);
cr8_sendmsg1 = 0;
cr8_sendmsg2 = 0;
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
}
if (Msg > 0x103) {
if (Msg > 0x105) {
if (Msg == 272) {
cr8_sendmsg2 = GetDlgItem(hWnd, 1010);
cr8_sendmsg1 = GetDlgItem(hWnd, 1011);
cr8game_LoadCreaGFX(hWnd);
cr8game_AllocMainMem(hWnd);
cr8game_SendMessageF5(hWnd);
cr8game_hobject = cr8game_GetCr8Object(hWnd);
SendMessageA(cr8_sendmsg2, 0xC5u, 0x1Fu, 0);
SendMessageA(cr8_sendmsg1, 0xC5u, 0x1Fu, 0);
return 1;
}
if (Msg != 273) {
if (Msg == 312 && GetWindowLongA((HWND)lParam, -12) == 1030) {
local_SetWhiteText((HDC)wParam);
return (LRESULT)GetStockObject(5);
}
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
}
if ((unsigned short)wParam == 1) {
if (SendMessageA(cr8_sendmsg2, 0xEu, 0, 0)) {
SendMessageA(cr8_sendmsg2, 0xDu, 0x20u, (LPARAM)cr8_gamename);
if (SelHero_IsNameReserved(cr8_gamename)
|| SelHero_NameHasChar(cr8_gamename, &nullcharacter)
|| !cr8game_CheckValidGameName(cr8_gamename)) {
LoadStringA(ghUiInst, 0x404u, Buffer, 256);
OkCancel_DoOkDialog(hWnd, Buffer, 1);
cr8_gamename[0] = 0;
} else {
cr8_gamepassword[0] = 0;
if (SendMessageA(cr8_sendmsg1, 0xEu, 0, 0))
SendMessageA(cr8_sendmsg1, 0xDu, 0x20u, (LPARAM)cr8_gamepassword);
cr8_gamedata.bDiff = cr8_dword_1002966C;
TitleSnd_PlaySelectSound();
if (cr8game_GetSnetCreaGame(hWnd))
SDlgEndDialog(hWnd, (void *)HANDLE_FLAG_INHERIT);
}
} else {
LoadStringA(ghUiInst, 0x3F0u, Buffer, 256);
OkCancel_DoOkDialog(hWnd, Buffer, 1);
}
} else {
if ((unsigned short)wParam != 2) {
if ((signed int)(unsigned short)wParam > 1031 && (signed int)(unsigned short)wParam <= 1034) {
a2 = (unsigned short)wParam - 1032;
if (HIWORD(wParam) == 6)
SetFocus(cr8_sendmsg2);
if (cr8_dword_1002966C != (unsigned short)wParam - 1032) {
if (cr8_dword_1002966C != -1) {
v6 = GetDlgItem(hWnd, cr8_dword_1002966C + 1032);
SendMessageA(v6, 0xF3u, 0, 0);
TitleSnd_PlayMoveSound();
}
cr8game_BlitCr8Dialog(hWnd, a2);
v7 = GetDlgItem(hWnd, 1040);
cr8game_SetWindowStr(v7, 1029, a2);
v4 = 273;
cr8_dword_1002966C = a2;
}
SendMessageA((HWND)lParam, 0xF3u, 1u, 0);
}
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
}
TitleSnd_PlaySelectSound();
SDlgEndDialog(hWnd, 0);
}
return 0;
}
v8 = (HWND)SDrawGetFrameWindow();
SendMessageA(v8, Msg, wParam, lParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, v4, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x10004828
void __cdecl cr8game_FreeCreaStuff()
{
if ( cr8_creat_bg_ptr )
{
SMemFree(cr8_creat_bg_ptr, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 55, 0);
cr8_creat_bg_ptr = 0;
}
if ( cr8_but_xsm_ptr )
{
SMemFree(cr8_but_xsm_ptr, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 60, 0);
cr8_but_xsm_ptr = 0;
}
if ( cr8_diffbtns_ptr )
{
SMemFree(cr8_diffbtns_ptr, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 65, 0);
cr8_diffbtns_ptr = 0;
}
if (cr8_creat_bg_ptr) {
SMemFree(cr8_creat_bg_ptr, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 55, 0);
cr8_creat_bg_ptr = 0;
}
if (cr8_but_xsm_ptr) {
SMemFree(cr8_but_xsm_ptr, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 60, 0);
cr8_but_xsm_ptr = 0;
}
if (cr8_diffbtns_ptr) {
SMemFree(cr8_diffbtns_ptr, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 65, 0);
cr8_diffbtns_ptr = 0;
}
}
// ref: 0x1000487F
BOOL __fastcall cr8game_LoadCreaGFX(HWND hWnd)
{
int id[3]; // [esp+8h] [ebp-1Ch]
DWORD a8[2]; // [esp+14h] [ebp-10h]
DWORD a3[2]; // [esp+1Ch] [ebp-8h]
int id[3]; // [esp+8h] [ebp-1Ch]
DWORD a8[2]; // [esp+14h] [ebp-10h]
DWORD a3[2]; // [esp+1Ch] [ebp-8h]
id[0] = 0;
id[0] = 1;
id[1] = 2;
local_LoadArtWithPal(hWnd, 0, "Dialog", -1, 1, "ui_art\\creat_bg.pcx", &cr8_creat_bg_ptr, a8, 1);
local_LoadArtImage("ui_art\\but_xsm.pcx", &cr8_but_xsm_ptr, a3);
SDlgSetControlBitmaps(hWnd, id, 0, (char *)cr8_but_xsm_ptr, (char *)a3, 1, -1);
local_LoadArtImage("ui_art\\diffbtns.pcx", &cr8_diffbtns_ptr, cr8diffbtns_size);
local_SetStaticBmp(hWnd, 1040, cr8_creat_bg_ptr, a8);
return 1;
id[0] = 0;
id[0] = 1;
id[1] = 2;
local_LoadArtWithPal(hWnd, 0, "Dialog", -1, 1, "ui_art\\creat_bg.pcx", &cr8_creat_bg_ptr, a8, 1);
local_LoadArtImage("ui_art\\but_xsm.pcx", &cr8_but_xsm_ptr, a3);
SDlgSetControlBitmaps(hWnd, id, 0, (char *)cr8_but_xsm_ptr, (char *)a3, 1, -1);
local_LoadArtImage("ui_art\\diffbtns.pcx", &cr8_diffbtns_ptr, cr8diffbtns_size);
local_SetStaticBmp(hWnd, 1040, cr8_creat_bg_ptr, a8);
return 1;
}
// ref: 0x10004914
void __fastcall cr8game_FreeMainMem(HWND hWnd)
{
signed int v2; // edi
HWND v3; // esi
void **v4; // eax MAPDST
void *v6; // eax
struct tagRECT Rect; // [esp+10h] [ebp-10h]
signed int v2; // edi
HWND v3; // esi
void **v4; // eax MAPDST
void *v6; // eax
struct tagRECT Rect; // [esp+10h] [ebp-10h]
v2 = 0;
do
{
v3 = GetDlgItem(hWnd, v2 + 1032);
GetClientRect(v3, &Rect);
v4 = (void **)GetWindowLongA(v3, -21);
if ( v4 )
{
v6 = *v4;
if ( *v4 )
SMemFree(v6, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 160, 0);
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 162, 0);
}
++v2;
}
while ( v2 < 3 );
v2 = 0;
do {
v3 = GetDlgItem(hWnd, v2 + 1032);
GetClientRect(v3, &Rect);
v4 = (void **)GetWindowLongA(v3, -21);
if (v4) {
v6 = *v4;
if (*v4)
SMemFree(v6, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 160, 0);
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 162, 0);
}
++v2;
} while (v2 < 3);
}
// ref: 0x1000497F
void __fastcall cr8game_AllocMainMem(HWND hWnd)
{
int v1; // ebx
void **v2; // esi
HWND v3; // ST1C_4
LONG v4; // eax
struct tagRECT Rect; // [esp+Ch] [ebp-18h]
HWND hWnda; // [esp+20h] [ebp-4h]
int v1; // ebx
void **v2; // esi
HWND v3; // ST1C_4
LONG v4; // eax
struct tagRECT Rect; // [esp+Ch] [ebp-18h]
HWND hWnda; // [esp+20h] [ebp-4h]
v1 = 0;
do
{
hWnda = GetDlgItem(hWnd, v1 + 1032);
GetClientRect(hWnda, &Rect);
v2 = (void **)SMemAlloc(0x110u, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 177, 0);
*v2 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 178, 0);
v3 = hWnda;
v2[1] = (void *)Rect.right;
v4 = Rect.bottom;
v2[3] = 0;
v2[2] = (void *)v4;
SetWindowLongA(v3, -21, (LONG)v2);
SDlgSetBitmapI(hWnda, 0, &nullcharacter, -1, 241, *v2, 0, (int)v2[1], (int)v2[2], -1);
cr8game_DoAROP3Blit(hWnda, v1++, 0);
}
while ( v1 < 3 );
v1 = 0;
do {
hWnda = GetDlgItem(hWnd, v1 + 1032);
GetClientRect(hWnda, &Rect);
v2 = (void **)SMemAlloc(0x110u, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 177, 0);
*v2 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\cr8game.cpp", 178, 0);
v3 = hWnda;
v2[1] = (void *)Rect.right;
v4 = Rect.bottom;
v2[3] = 0;
v2[2] = (void *)v4;
SetWindowLongA(v3, -21, (LONG)v2);
SDlgSetBitmapI(hWnda, 0, &nullcharacter, -1, 241, *v2, 0, (int)v2[1], (int)v2[2], -1);
cr8game_DoAROP3Blit(hWnda, v1++, 0);
} while (v1 < 3);
}
// ref: 0x10004A34
void __fastcall cr8game_DoAROP3Blit(HWND hWnd, int frame, int size)
{
DWORD *v5; // eax
DWORD *v5; // eax
v5 = (DWORD *)GetWindowLongA(hWnd, -21);
if ( v5 )
{
if ( cr8_diffbtns_ptr )
{
SBltROP3(
(void *)*v5,
&cr8_diffbtns_ptr[cr8diffbtns_size[0] * v5[2] * (size + 2 * frame)],
v5[1],
v5[2],
v5[1],
cr8diffbtns_size[0],
0,
0xCC0020u);
InvalidateRect(hWnd, 0, 0);
}
}
v5 = (DWORD *)GetWindowLongA(hWnd, -21);
if (v5) {
if (cr8_diffbtns_ptr) {
SBltROP3(
(void *)*v5,
&cr8_diffbtns_ptr[cr8diffbtns_size[0] * v5[2] * (size + 2 * frame)],
v5[1],
v5[2],
v5[1],
cr8diffbtns_size[0],
0,
0xCC0020u);
InvalidateRect(hWnd, 0, 0);
}
}
}
// ref: 0x10004A93
void __fastcall cr8game_SendMessageF5(HWND hWnd)
{
cr8_dword_1002966C = -1;
cr8_dword_10029658 = 0;
cr8_dword_10029668 = 0;
SendDlgItemMessageA(hWnd, 1032, 0xF5u, 0, 0);
cr8_dword_1002966C = -1;
cr8_dword_10029658 = 0;
cr8_dword_10029668 = 0;
SendDlgItemMessageA(hWnd, 1032, 0xF5u, 0, 0);
}
// 10029658: using guessed type int cr8_dword_10029658;
// 10029668: using guessed type int cr8_dword_10029668;
@ -330,87 +293,78 @@ void __fastcall cr8game_SendMessageF5(HWND hWnd)
// ref: 0x10004ABA
void __fastcall cr8game_BlitCr8Dialog(HWND hWnd, int a2)
{
HWND v4; // eax
HWND v5; // eax
HWND v4; // eax
HWND v5; // eax
if ( cr8_dword_1002966C != -1 )
{
v4 = GetDlgItem(hWnd, cr8_dword_1002966C + 1032);
cr8game_DoAROP3Blit(v4, cr8_dword_1002966C, 0);
}
v5 = GetDlgItem(hWnd, a2 + 1032);
cr8game_DoAROP3Blit(v5, a2, 1);
if (cr8_dword_1002966C != -1) {
v4 = GetDlgItem(hWnd, cr8_dword_1002966C + 1032);
cr8game_DoAROP3Blit(v4, cr8_dword_1002966C, 0);
}
v5 = GetDlgItem(hWnd, a2 + 1032);
cr8game_DoAROP3Blit(v5, a2, 1);
}
// ref: 0x10004B02
void __fastcall cr8game_SetWindowStr(HWND hWnd, int dlgitem, int a3)
{
char Buffer[256]; // [esp+4h] [ebp-100h]
char Buffer[256]; // [esp+4h] [ebp-100h]
LoadStringA(ghUiInst, a3 + dlgitem, Buffer, 256);
SetWindowTextA(hWnd, Buffer);
LoadStringA(ghUiInst, a3 + dlgitem, Buffer, 256);
SetWindowTextA(hWnd, Buffer);
}
// ref: 0x10004B3F
int __fastcall cr8game_CheckValidGameName(char *name)
{
signed int v1; // edi
char v2; // al
signed int v3; // esi
int result; // eax
char v5[32]; // [esp+8h] [ebp-24h]
signed int v1; // edi
char v2; // al
signed int v3; // esi
int result; // eax
char v5[32]; // [esp+8h] [ebp-24h]
strcpy(v5, name);
v1 = 0;
if ( v5[0] == 32 )
{
v2 = 32;
while ( v2 )
{
v2 = v5[v1++ + 1];
if ( v2 != 32 )
goto LABEL_5;
}
LABEL_9:
result = 0;
}
else
{
LABEL_5:
v3 = strlen(v5);
while ( v5[--v3] == 32 )
{
if ( v3 <= v1 )
goto LABEL_9;
}
v5[v3 + 1] = 0;
strcpy(name, &v5[v1]);
result = v3 + 1 - v1;
}
return result;
strcpy(v5, name);
v1 = 0;
if (v5[0] == 32) {
v2 = 32;
while (v2) {
v2 = v5[v1++ + 1];
if (v2 != 32)
goto LABEL_5;
}
LABEL_9:
result = 0;
} else {
LABEL_5:
v3 = strlen(v5);
while (v5[--v3] == 32) {
if (v3 <= v1)
goto LABEL_9;
}
v5[v3 + 1] = 0;
strcpy(name, &v5[v1]);
result = v3 + 1 - v1;
}
return result;
}
// ref: 0x10004BA8
HFONT __fastcall cr8game_GetCr8Object(HWND hWnd)
{
HFONT v2; // eax MAPDST
int pv[15]; // [esp+8h] [ebp-40h]
HFONT v2; // eax MAPDST
int pv[15]; // [esp+8h] [ebp-40h]
v2 = (HFONT)SendMessageA(hWnd, 0x31u, 0, 0);
if ( v2 )
{
if ( GetObjectA(v2, 60, pv) )
{
pv[0] = -MulDiv(12, 96, 72);
pv[1] = 0;
v2 = CreateFontIndirectA((const LOGFONTA *)pv);
if ( v2 )
{
SendDlgItemMessageA(hWnd, 1032, 0x30u, (WPARAM)v2, 0);
SendDlgItemMessageA(hWnd, 1033, 0x30u, (WPARAM)v2, 0);
SendDlgItemMessageA(hWnd, 1034, 0x30u, (WPARAM)v2, 0);
}
}
}
return v2;
v2 = (HFONT)SendMessageA(hWnd, 0x31u, 0, 0);
if (v2) {
if (GetObjectA(v2, 60, pv)) {
pv[0] = -MulDiv(12, 96, 72);
pv[1] = 0;
v2 = CreateFontIndirectA((const LOGFONTA *)pv);
if (v2) {
SendDlgItemMessageA(hWnd, 1032, 0x30u, (WPARAM)v2, 0);
SendDlgItemMessageA(hWnd, 1033, 0x30u, (WPARAM)v2, 0);
SendDlgItemMessageA(hWnd, 1034, 0x30u, (WPARAM)v2, 0);
}
}
}
return v2;
}

417
DiabloUI/creadung.cpp

@ -1,14 +1,14 @@
// ref: 0x10004C33
void __fastcall CreaDung_SetDelSpin(int a1)
{
creadung_delspinners = a1;
creadung_delspinners = a1;
}
// 100296CC: using guessed type int creadung_delspinners;
// ref: 0x10004C3F
void __cdecl CreaDung_cpp_init()
{
CreaDung_cpp_float = CreaDung_cpp_float_value;
CreaDung_cpp_float = CreaDung_cpp_float_value;
}
// 1001F400: using guessed type int CreaDung_cpp_float_value;
// 100296C4: using guessed type int CreaDung_cpp_float;
@ -16,64 +16,47 @@ void __cdecl CreaDung_cpp_init()
// ref: 0x10004C4A
LRESULT __stdcall CreaDung_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v4; // eax
HWND v6; // eax
HWND v4; // eax
HWND v6; // eax
if ( Msg == 2 )
{
CreaDung_FreeDungProcs(hWnd);
}
else if ( Msg > 0x103 )
{
if ( Msg > 0x105 )
{
if ( Msg == 272 )
{
creadung_dword_100296D8 = lParam;
CreaDung_LoadDungGFX(hWnd);
}
else
{
if ( Msg == 273 )
{
if ( HIWORD(wParam) == 7 )
{
Focus_GetAndBlitSpin(hWnd, lParam);
}
else if ( HIWORD(wParam) == 6 )
{
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
CreaDung_ParseDungProcs(hWnd, (unsigned short)wParam);
}
else if ( HIWORD(wParam) == 5 || (_WORD)wParam == 1 )
{
CreaDung_DoAllPlaySnd(hWnd);
}
else if ( (_WORD)wParam == 2 )
{
CreaDung_PlaySndAndKill(hWnd, 2);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg != 275 )
{
if ( Msg == 513 )
CreaDung_CheckDlgForSnd(hWnd, (unsigned short)lParam, (unsigned int)lParam >> 16);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( wParam == 1 )
{
v4 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v4);
}
}
return 0;
}
v6 = (HWND)SDrawGetFrameWindow();
SendMessageA(v6, Msg, wParam, lParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg == 2) {
CreaDung_FreeDungProcs(hWnd);
} else if (Msg > 0x103) {
if (Msg > 0x105) {
if (Msg == 272) {
creadung_dword_100296D8 = lParam;
CreaDung_LoadDungGFX(hWnd);
} else {
if (Msg == 273) {
if (HIWORD(wParam) == 7) {
Focus_GetAndBlitSpin(hWnd, lParam);
} else if (HIWORD(wParam) == 6) {
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
CreaDung_ParseDungProcs(hWnd, (unsigned short)wParam);
} else if (HIWORD(wParam) == 5 || (_WORD)wParam == 1) {
CreaDung_DoAllPlaySnd(hWnd);
} else if ((_WORD)wParam == 2) {
CreaDung_PlaySndAndKill(hWnd, 2);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg != 275) {
if (Msg == 513)
CreaDung_CheckDlgForSnd(hWnd, (unsigned short)lParam, (unsigned int)lParam >> 16);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (wParam == 1) {
v4 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v4);
}
}
return 0;
}
v6 = (HWND)SDrawGetFrameWindow();
SendMessageA(v6, Msg, wParam, lParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// 100296D8: using guessed type int creadung_dword_100296D8;
@ -81,119 +64,113 @@ LRESULT __stdcall CreaDung_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP
// ref: 0x10004D75
void __fastcall CreaDung_ParseDungProcs(HWND hWnd, int dlg)
{
HWND v3; // eax
int v4; // eax
HWND v5; // eax
int v6; // eax
char Buffer[256]; // [esp+4h] [ebp-100h]
HWND v3; // eax
int v4; // eax
HWND v5; // eax
int v6; // eax
char Buffer[256]; // [esp+4h] [ebp-100h]
LoadStringA(ghUiInst, dlg - 1055, Buffer, 255);
v3 = GetDlgItem(hWnd, 1097);
if ( v3 )
{
v4 = GetWindowLongA(v3, -21);
local_SetWndLongStr(v4, Buffer);
}
Doom_ParseWndProc4(hWnd, creadung_msgtbl2, 5);
LoadStringA(ghUiInst, dlg - 65, Buffer, 255);
v5 = GetDlgItem(hWnd, 1099);
if ( v5 )
{
v6 = GetWindowLongA(v5, -21);
local_SetWndLongStr(v6, Buffer);
}
Doom_ParseWndProc4(hWnd, creadung_msgtbl3, 1);
LoadStringA(ghUiInst, dlg - 1055, Buffer, 255);
v3 = GetDlgItem(hWnd, 1097);
if (v3) {
v4 = GetWindowLongA(v3, -21);
local_SetWndLongStr(v4, Buffer);
}
Doom_ParseWndProc4(hWnd, creadung_msgtbl2, 5);
LoadStringA(ghUiInst, dlg - 65, Buffer, 255);
v5 = GetDlgItem(hWnd, 1099);
if (v5) {
v6 = GetWindowLongA(v5, -21);
local_SetWndLongStr(v6, Buffer);
}
Doom_ParseWndProc4(hWnd, creadung_msgtbl3, 1);
}
// ref: 0x10004E2E
void __fastcall CreaDung_FreeDungProcs(HWND hWnd)
{
void **v2; // eax
void **v2; // eax
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl5);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl4);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl3);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl2);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl1);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
if ( creadung_delspinners )
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl5);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl4);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl3);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl2);
Doom_DeleteFreeProcs(hWnd, creadung_msgtbl1);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
if (creadung_delspinners)
Focus_DeleteSpinners();
}
// 100296CC: using guessed type int creadung_delspinners;
// ref: 0x10004E8B
void __fastcall CreaDung_LoadDungGFX(HWND hWnd)
{
DWORD *v2; // eax MAPDST
DWORD *v2; // eax MAPDST
if ( creadung_delspinners )
Focus_LoadSpinner("ui_art\\focus16.pcx");
else
Focus_ResetSpinToZero();
SDlgSetTimer((int)hWnd, 1, 55, 0);
v2 = local_AllocWndLongData();
if ( v2 )
{
SetWindowLongA(hWnd, -21, (LONG)v2);
local_LoadArtWithPal(hWnd, 0, "popup", -1, 1, "ui_art\\seldiff.pcx", (BYTE **)v2, v2 + 1, 0);
}
local_DoUiWndProc(hWnd, (DWORD *)creadung_msgtbl5);
Doom_ParseWndProc3(hWnd, creadung_msgtbl1, 5);
Doom_ParseWndProc3(hWnd, creadung_msgtbl2, 5);
Doom_ParseWndProc3(hWnd, creadung_msgtbl3, 1);
Doom_ParseWndProcs(hWnd, creadung_msgtbl4, 4, 0);
Doom_ParseWndProcs(hWnd, creadung_msgtbl5, 2, 1);
if (creadung_delspinners)
Focus_LoadSpinner("ui_art\\focus16.pcx");
else
Focus_ResetSpinToZero();
SDlgSetTimer((int)hWnd, 1, 55, 0);
v2 = local_AllocWndLongData();
if (v2) {
SetWindowLongA(hWnd, -21, (LONG)v2);
local_LoadArtWithPal(hWnd, 0, "popup", -1, 1, "ui_art\\seldiff.pcx", (BYTE **)v2, v2 + 1, 0);
}
local_DoUiWndProc(hWnd, (DWORD *)creadung_msgtbl5);
Doom_ParseWndProc3(hWnd, creadung_msgtbl1, 5);
Doom_ParseWndProc3(hWnd, creadung_msgtbl2, 5);
Doom_ParseWndProc3(hWnd, creadung_msgtbl3, 1);
Doom_ParseWndProcs(hWnd, creadung_msgtbl4, 4, 0);
Doom_ParseWndProcs(hWnd, creadung_msgtbl5, 2, 1);
}
// 100296CC: using guessed type int creadung_delspinners;
// ref: 0x10004F40
void __fastcall CreaDung_PlaySndAndKill(HWND hWnd, int a2)
{
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
SDlgEndDialog(hWnd, (HANDLE)a2);
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
SDlgEndDialog(hWnd, (HANDLE)a2);
}
// ref: 0x10004F5D
void __fastcall CreaDung_DoAllPlaySnd(HWND hWnd)
{
//int v1; // ebp
HWND v2; // esi
HWND v3; // eax
LONG v4; // eax
HWND v5; // edi
HWND v6; // eax
int v7; // [esp-288h] [ebp-28Ch]
int v8; // [esp-188h] [ebp-18Ch]
char *v9; // [esp-108h] [ebp-10Ch]
char *v10; // [esp-88h] [ebp-8Ch]
int v11; // [esp-8h] [ebp-Ch]
char v12; // [esp-4h] [ebp-8h]
//int v13; // [esp+0h] [ebp-4h]
//int v1; // ebp
HWND v2; // esi
HWND v3; // eax
LONG v4; // eax
HWND v5; // edi
HWND v6; // eax
int v7; // [esp-288h] [ebp-28Ch]
int v8; // [esp-188h] [ebp-18Ch]
char *v9; // [esp-108h] [ebp-10Ch]
char *v10; // [esp-88h] [ebp-8Ch]
int v11; // [esp-8h] [ebp-Ch]
char v12; // [esp-4h] [ebp-8h]
//int v13; // [esp+0h] [ebp-4h]
/* note: stack is hosed, fix me */
v2 = hWnd;
if ( creadung_dword_100296D8 == 1 )
{
//v13 = v1;
v5 = hWnd;
Connect_CopyPlrDescStrings((char *)&v10, 128, (char *)&v9, 128);
v6 = GetFocus();
v12 = GetWindowLongA(v6, -12) - 70;
Connect_SetDiffString((_gamedata *)&v11, (const char *)&v10, (char *)&v9, (char *)&v8, 128);
if ( UiAuthCallback(2, (char *)&v10, (char *)&v9, 0, (char *)&v8, (LPSTR)&v7, 256) )
CreaDung_DoSnetCreaGame(v5);
else
SelYesNo_SelOkDialog(v5, (char *)&v7, 0, 0);
}
else
{
v3 = GetFocus();
v4 = GetWindowLongA(v3, -12);
SelHero_SetHeroDifficulty(v4 - 1094);
CreaDung_PlaySndAndKill(v2, 1);
}
/* note: stack is hosed, fix me */
v2 = hWnd;
if (creadung_dword_100296D8 == 1) {
//v13 = v1;
v5 = hWnd;
Connect_CopyPlrDescStrings((char *)&v10, 128, (char *)&v9, 128);
v6 = GetFocus();
v12 = GetWindowLongA(v6, -12) - 70;
Connect_SetDiffString((_gamedata *)&v11, (const char *)&v10, (char *)&v9, (char *)&v8, 128);
if (UiAuthCallback(2, (char *)&v10, (char *)&v9, 0, (char *)&v8, (LPSTR)&v7, 256))
CreaDung_DoSnetCreaGame(v5);
else
SelYesNo_SelOkDialog(v5, (char *)&v7, 0, 0);
} else {
v3 = GetFocus();
v4 = GetWindowLongA(v3, -12);
SelHero_SetHeroDifficulty(v4 - 1094);
CreaDung_PlaySndAndKill(v2, 1);
}
}
// 10004F5D: could not find valid save-restore pair for ebp
// 100296D8: using guessed type int creadung_dword_100296D8;
@ -201,58 +178,50 @@ void __fastcall CreaDung_DoAllPlaySnd(HWND hWnd)
// ref: 0x10005037
void __fastcall CreaDung_DoSnetCreaGame(HWND hWnd)
{
HWND v1; // ebx
DWORD *v2; // eax
DWORD v3; // edi
char a4[256]; // [esp+8h] [ebp-34Ch]
char v5[128]; // [esp+108h] [ebp-24Ch]
char Buffer[192]; // [esp+188h] [ebp-1CCh]
char a3[128]; // [esp+248h] [ebp-10Ch]
char a2[128]; // [esp+2C8h] [ebp-8Ch]
_gamedata a1; // [esp+348h] [ebp-Ch]
HWND v1; // ebx
DWORD *v2; // eax
DWORD v3; // edi
char a4[256]; // [esp+8h] [ebp-34Ch]
char v5[128]; // [esp+108h] [ebp-24Ch]
char Buffer[192]; // [esp+188h] [ebp-1CCh]
char a3[128]; // [esp+248h] [ebp-10Ch]
char a2[128]; // [esp+2C8h] [ebp-8Ch]
_gamedata a1; // [esp+348h] [ebp-Ch]
v1 = GetFocus();
if ( hWnd == GetParent(v1) )
{
Connect_CopyPlrDescStrings(a2, 128, a3, 128);
a1.bDiff = GetWindowLongA(v1, -12) - 70;
Connect_SetDiffString(&a1, a2, a3, a4, 256);
v2 = crea_somegamestruct;
if ( crea_somegamestruct[8] >= 8 )
{
v3 = crea_somegamestruct[7];
*(_BYTE *)(v3 + 4) = GetWindowLongA(v1, -12) - 70;
v2 = crea_somegamestruct;
}
if ( SNetCreateGame(
creadung_gamename,
0,
a4,
0,
(char *)v2[7],
v2[8],
*(_DWORD *)(creadung_playername + 8),
a2,
0,
creadung_playerID) )
{
CreaDung_PlaySndAndKill(hWnd, 1);
}
else
{
creadung_lasterror = SErrGetLastError();
if ( creadung_lasterror == 183 )
{
LoadStringA(ghUiInst, 0x49u, v5, 127);
wsprintfA(Buffer, v5, creadung_gamename);
}
else
{
LoadStringA(ghUiInst, 0x26u, Buffer, 191);
}
SelYesNo_SelOkDialog(hWnd, Buffer, 0, 0);
}
}
v1 = GetFocus();
if (hWnd == GetParent(v1)) {
Connect_CopyPlrDescStrings(a2, 128, a3, 128);
a1.bDiff = GetWindowLongA(v1, -12) - 70;
Connect_SetDiffString(&a1, a2, a3, a4, 256);
v2 = crea_somegamestruct;
if (crea_somegamestruct[8] >= 8) {
v3 = crea_somegamestruct[7];
*(_BYTE *)(v3 + 4) = GetWindowLongA(v1, -12) - 70;
v2 = crea_somegamestruct;
}
if (SNetCreateGame(
creadung_gamename,
0,
a4,
0,
(char *)v2[7],
v2[8],
*(_DWORD *)(creadung_playername + 8),
a2,
0,
creadung_playerID)) {
CreaDung_PlaySndAndKill(hWnd, 1);
} else {
creadung_lasterror = SErrGetLastError();
if (creadung_lasterror == 183) {
LoadStringA(ghUiInst, 0x49u, v5, 127);
wsprintfA(Buffer, v5, creadung_gamename);
} else {
LoadStringA(ghUiInst, 0x26u, Buffer, 191);
}
SelYesNo_SelOkDialog(hWnd, Buffer, 0, 0);
}
}
}
// 10010406: using guessed type _DWORD __stdcall SErrGetLastError();
// 100296BC: using guessed type int creadung_playername;
@ -261,42 +230,38 @@ void __fastcall CreaDung_DoSnetCreaGame(HWND hWnd)
// ref: 0x1000517E
void __fastcall CreaDung_CheckDlgForSnd(HWND hWnd, int a2, int a3)
{
HWND v6; // eax
HWND v7; // eax
HWND v6; // eax
HWND v7; // eax
v6 = GetDlgItem(hWnd, 1056);
if ( local_GetBottomRect(hWnd, v6, a2, a3) )
{
CreaDung_DoAllPlaySnd(hWnd);
}
else
{
v7 = GetDlgItem(hWnd, 1054);
if ( local_GetBottomRect(hWnd, v7, a2, a3) )
CreaDung_PlaySndAndKill(hWnd, 2);
}
v6 = GetDlgItem(hWnd, 1056);
if (local_GetBottomRect(hWnd, v6, a2, a3)) {
CreaDung_DoAllPlaySnd(hWnd);
} else {
v7 = GetDlgItem(hWnd, 1054);
if (local_GetBottomRect(hWnd, v7, a2, a3))
CreaDung_PlaySndAndKill(hWnd, 2);
}
}
// ref: 0x100051D8
BOOL __fastcall CreaDung_SelDungDiff(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
{
int v8; // ST10_4
BOOL result; // eax
int v8; // ST10_4
BOOL result; // eax
creadung_playername = a1;
creadung_dword_100296C8 = a3;
creadung_playerID = (int *)a6;
creadung_delspinners = a7;
crea_somegamestruct = (DWORD *)a2;
creadung_gamename = (char *)a8;
v8 = SelHero_GetHeroIsGood();
result = SDlgDialogBoxParam(ghUiInst, "SELDIFF_DIALOG", *(_DWORD *)(a4 + 8), CreaDung_WndProc, v8);
if ( result != 1 )
{
SErrSetLastError(creadung_lasterror);
result = 0;
}
return result;
creadung_playername = a1;
creadung_dword_100296C8 = a3;
creadung_playerID = (int *)a6;
creadung_delspinners = a7;
crea_somegamestruct = (DWORD *)a2;
creadung_gamename = (char *)a8;
v8 = SelHero_GetHeroIsGood();
result = SDlgDialogBoxParam(ghUiInst, "SELDIFF_DIALOG", *(_DWORD *)(a4 + 8), CreaDung_WndProc, v8);
if (result != 1) {
SErrSetLastError(creadung_lasterror);
result = 0;
}
return result;
}
// 1001041E: using guessed type int __stdcall SErrSetLastError(_DWORD);
// 100296BC: using guessed type int creadung_playername;

16
DiabloUI/creastat.cpp

@ -1,19 +1,19 @@
// ref: 0x1000523E
BOOL __stdcall UiGetDefaultStats(int pclass, _uidefaultstats *pStats)
{
if ( !pStats )
return 0;
pStats->strength = defstats[pclass][0];
pStats->magic = defstats[pclass][1];
pStats->dexterity = defstats[pclass][2];
pStats->vitality = defstats[pclass][3];
return 1;
if (!pStats)
return 0;
pStats->strength = defstats[pclass][0];
pStats->magic = defstats[pclass][1];
pStats->dexterity = defstats[pclass][2];
pStats->vitality = defstats[pclass][3];
return 1;
}
// ref: 0x10005287
void __cdecl CreaStat_cpp_init()
{
CreaStat_cpp_float = CreaStat_cpp_float_value;
CreaStat_cpp_float = CreaStat_cpp_float_value;
}
// 1001F404: using guessed type int CreaStat_cpp_float_value;
// 100296E0: using guessed type int CreaStat_cpp_float;

361
DiabloUI/credits.cpp

@ -1,7 +1,7 @@
// ref: 0x10005297
void __cdecl credits_cpp_init()
{
credits_cpp_float = credits_cpp_float_value;
credits_cpp_float = credits_cpp_float_value;
}
// 1001F408: using guessed type int credits_cpp_float_value;
// 100296EC: using guessed type int credits_cpp_float;
@ -9,149 +9,135 @@ void __cdecl credits_cpp_init()
// ref: 0x100052A2
BOOL __stdcall UiCreditsDialog(int a1)
{
int v1; // eax
int v1; // eax
v1 = (int)SDrawGetFrameWindow();
SDlgDialogBoxParam(ghUiInst, "CREDITS_DIALOG", v1, credits_WndProc, 25);
return 1;
v1 = (int)SDrawGetFrameWindow();
SDlgDialogBoxParam(ghUiInst, "CREDITS_DIALOG", v1, credits_WndProc, 25);
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x100052C7
LRESULT __stdcall credits_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v5; // eax
HWND v5; // eax
if ( Msg > 0x111 )
{
if ( Msg == 275 )
{
credits_CalcPosROP3(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg == 513 || Msg == 516 )
goto LABEL_12;
if ( Msg != 528 )
{
if ( Msg == 2024 )
{
if ( !Fade_CheckRange5() )
Fade_SetFadeTimer((int)hWnd);
return 0;
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( (_WORD)wParam != 513 && (_WORD)wParam != 516 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
LABEL_25:
Title_KillAndFadeDlg(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg == 273 )
goto LABEL_25;
if ( Msg != 2 )
{
if ( Msg == 135 )
return 4;
if ( Msg != 256 )
{
if ( Msg > 0x103 )
{
if ( Msg <= 0x105 )
{
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, Msg, wParam, lParam);
}
else if ( Msg == 272 )
{
credits_LoadImgCreditTxt(hWnd, lParam);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( wParam != 32 )
return 0;
LABEL_12:
Title_KillAndFadeDlg(hWnd);
return 0;
}
credits_FreeCreditResrc(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg > 0x111) {
if (Msg == 275) {
credits_CalcPosROP3(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg == 513 || Msg == 516)
goto LABEL_12;
if (Msg != 528) {
if (Msg == 2024) {
if (!Fade_CheckRange5())
Fade_SetFadeTimer((int)hWnd);
return 0;
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ((_WORD)wParam != 513 && (_WORD)wParam != 516)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
LABEL_25:
Title_KillAndFadeDlg(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg == 273)
goto LABEL_25;
if (Msg != 2) {
if (Msg == 135)
return 4;
if (Msg != 256) {
if (Msg > 0x103) {
if (Msg <= 0x105) {
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, Msg, wParam, lParam);
} else if (Msg == 272) {
credits_LoadImgCreditTxt(hWnd, lParam);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (wParam != 32)
return 0;
LABEL_12:
Title_KillAndFadeDlg(hWnd);
return 0;
}
credits_FreeCreditResrc(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x100053D9
void __fastcall credits_FreeCreditResrc(HWND hWnd)
{
void **v2; // eax
void **v2; // eax
if ( creditsobj )
{
SGdiDeleteObject(creditsobj);
creditsobj = 0;
}
if ( credit_back_img )
{
SMemFree(credit_back_img, "C:\\Src\\Diablo\\DiabloUI\\credits.cpp", 46, 0);
credit_back_img = 0;
}
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
if ( credittext_rsrc )
{
FreeResource(credittext_rsrc);
credittext_rsrc = 0;
}
if (creditsobj) {
SGdiDeleteObject(creditsobj);
creditsobj = 0;
}
if (credit_back_img) {
SMemFree(credit_back_img, "C:\\Src\\Diablo\\DiabloUI\\credits.cpp", 46, 0);
credit_back_img = 0;
}
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
if (credittext_rsrc) {
FreeResource(credittext_rsrc);
credittext_rsrc = 0;
}
}
// ref: 0x1000543A
void __fastcall credits_LoadImgCreditTxt(HWND hWnd, LPARAM lParam)
{
signed int v2; // eax
HRSRC v3; // eax
HRSRC v4; // eax
DWORD *v5; // eax
DWORD *v6; // esi
int v7; // ebx
int v8; // esi
HFONT v9; // eax MAPDST
BOOL v11; // ebx
struct tagRECT Rect; // [esp+Ch] [ebp-18h]
HWND v13; // [esp+1Ch] [ebp-8h]
signed int v2; // eax
HRSRC v3; // eax
HRSRC v4; // eax
DWORD *v5; // eax
DWORD *v6; // esi
int v7; // ebx
int v8; // esi
HFONT v9; // eax MAPDST
BOOL v11; // ebx
struct tagRECT Rect; // [esp+Ch] [ebp-18h]
HWND v13; // [esp+1Ch] [ebp-8h]
if ( lParam )
v2 = 1000 / lParam;
else
v2 = 50;
SDlgSetTimer((int)hWnd, 1, v2, 0);
v3 = FindResourceA(ghUiInst, "IDR_CREDITS", "TEXT_FILES");
credittext_rsrc = LoadResource(ghUiInst, v3);
v4 = FindResourceA(ghUiInst, "IDR_CREDITS", "TEXT_FILES");
credittext_size = SizeofResource(ghUiInst, v4);
v5 = local_AllocWndLongData();
v6 = v5;
if ( v5 )
{
SetWindowLongA(hWnd, -21, (LONG)v5);
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, "ui_art\\credits.pcx", (BYTE **)v6, v6 + 1, 0);
Fade_NoInputAndArt(hWnd, 0);
}
v13 = GetDlgItem(hWnd, 1000);
GetWindowRect(v13, &Rect);
v7 = Rect.right - Rect.left;
v8 = Rect.bottom - Rect.top + 60;
credit_back_img = SMemAlloc((Rect.right - Rect.left) * v8, "C:\\Src\\Diablo\\DiabloUI\\credits.cpp", 122, 0);
credit_horz_pos = v7;
credit_vertical_pos1 = v8;
local_AdjustRectSize(&Rect, 0, 30);
SDlgSetBitmapI(v13, 0, 0, -1, 1, credit_back_img, (int)&Rect, v7, v8, -1);
credit_vertical_pos2 = v8 - 30;
credits_CalcPosROP3(hWnd);
v9 = CreateFontA(-17, 0, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0x12u, "Times New Roman");
if ( !v9 || (v11 = SGdiImportFont(v9, (int)&creditsobj), DeleteObject(v9), !v11) )
Title_KillAndFadeDlg(hWnd);
if (lParam)
v2 = 1000 / lParam;
else
v2 = 50;
SDlgSetTimer((int)hWnd, 1, v2, 0);
v3 = FindResourceA(ghUiInst, "IDR_CREDITS", "TEXT_FILES");
credittext_rsrc = LoadResource(ghUiInst, v3);
v4 = FindResourceA(ghUiInst, "IDR_CREDITS", "TEXT_FILES");
credittext_size = SizeofResource(ghUiInst, v4);
v5 = local_AllocWndLongData();
v6 = v5;
if (v5) {
SetWindowLongA(hWnd, -21, (LONG)v5);
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, "ui_art\\credits.pcx", (BYTE **)v6, v6 + 1, 0);
Fade_NoInputAndArt(hWnd, 0);
}
v13 = GetDlgItem(hWnd, 1000);
GetWindowRect(v13, &Rect);
v7 = Rect.right - Rect.left;
v8 = Rect.bottom - Rect.top + 60;
credit_back_img = SMemAlloc((Rect.right - Rect.left) * v8, "C:\\Src\\Diablo\\DiabloUI\\credits.cpp", 122, 0);
credit_horz_pos = v7;
credit_vertical_pos1 = v8;
local_AdjustRectSize(&Rect, 0, 30);
SDlgSetBitmapI(v13, 0, 0, -1, 1, credit_back_img, (int)&Rect, v7, v8, -1);
credit_vertical_pos2 = v8 - 30;
credits_CalcPosROP3(hWnd);
v9 = CreateFontA(-17, 0, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0x12u, "Times New Roman");
if (!v9 || (v11 = SGdiImportFont(v9, (int)&creditsobj), DeleteObject(v9), !v11))
Title_KillAndFadeDlg(hWnd);
}
// 100296E8: using guessed type int credittext_size;
// 100296FC: using guessed type int credit_vertical_pos1;
@ -159,68 +145,64 @@ void __fastcall credits_LoadImgCreditTxt(HWND hWnd, LPARAM lParam)
// ref: 0x100055C0
void __fastcall credits_CalcPosROP3(HWND hWnd)
{
_DWORD *v2; // edi
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
HWND hWnda; // [esp+1Ch] [ebp-4h]
_DWORD *v2; // edi
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
HWND hWnda; // [esp+1Ch] [ebp-4h]
hWnda = GetDlgItem(hWnd, 1000);
v2 = (_DWORD *)GetWindowLongA(hWnd, -21);
GetWindowRect(hWnda, &Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect.right);
SBltROP3(
(char *)credit_back_img + 30 * credit_horz_pos,
(void *)(Rect.left + *v2 + Rect.top * v2[1]),
credit_horz_pos,
Rect.bottom - Rect.top,
credit_horz_pos,
v2[1],
0,
0xCC0020u);
--credit_vertical_pos2;
credits_PrintCredLines(hWnd);
InvalidateRect(hWnda, 0, 0);
UpdateWindow(hWnda);
hWnda = GetDlgItem(hWnd, 1000);
v2 = (_DWORD *)GetWindowLongA(hWnd, -21);
GetWindowRect(hWnda, &Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect.right);
SBltROP3(
(char *)credit_back_img + 30 * credit_horz_pos,
(void *)(Rect.left + *v2 + Rect.top * v2[1]),
credit_horz_pos,
Rect.bottom - Rect.top,
credit_horz_pos,
v2[1],
0,
0xCC0020u);
--credit_vertical_pos2;
credits_PrintCredLines(hWnd);
InvalidateRect(hWnda, 0, 0);
UpdateWindow(hWnda);
}
// ref: 0x10005660
void __fastcall credits_PrintCredLines(HWND hWnd)
{
char *v1; // esi
int i; // edi
int v3; // ebp
int v4; // ebx
char *v1; // esi
int i; // edi
int v3; // ebp
int v4; // ebx
v1 = (char *)LockResource(credittext_rsrc);
credit_line_count = credittext_size;
SGdiSelectObject((int)creditsobj);
SGdiSetPitch(credit_horz_pos);
for ( i = credit_vertical_pos2; credit_line_count > 0; v1 = credits_GetAdjustText(v1, v4) )
{
v3 = 0;
while ( *v1 == 9 )
{
v3 += 40;
++v1;
--credit_line_count;
}
v4 = credits_GetCredLineBreak(v1);
if ( v4 == -1 )
break;
if ( i >= 0 )
{
if ( i > credit_vertical_pos1 - 30 )
break;
if ( v4 )
{
SGdiTextOut(credit_back_img, v3 + 2, i + 2, 0x1000000, v1, v4);
SGdiTextOut(credit_back_img, v3, i, 16777440, v1, v4);
}
}
i += 22;
}
if ( i < 0 )
Title_KillAndFadeDlg(hWnd);
v1 = (char *)LockResource(credittext_rsrc);
credit_line_count = credittext_size;
SGdiSelectObject((int)creditsobj);
SGdiSetPitch(credit_horz_pos);
for (i = credit_vertical_pos2; credit_line_count > 0; v1 = credits_GetAdjustText(v1, v4)) {
v3 = 0;
while (*v1 == 9) {
v3 += 40;
++v1;
--credit_line_count;
}
v4 = credits_GetCredLineBreak(v1);
if (v4 == -1)
break;
if (i >= 0) {
if (i > credit_vertical_pos1 - 30)
break;
if (v4) {
SGdiTextOut(credit_back_img, v3 + 2, i + 2, 0x1000000, v1, v4);
SGdiTextOut(credit_back_img, v3, i, 16777440, v1, v4);
}
}
i += 22;
}
if (i < 0)
Title_KillAndFadeDlg(hWnd);
}
// 100103A6: using guessed type int __stdcall SGdiSetPitch(_DWORD);
// 100103AC: using guessed type int __stdcall SGdiSelectObject(_DWORD);
@ -231,24 +213,23 @@ void __fastcall credits_PrintCredLines(HWND hWnd)
// ref: 0x10005736
int __fastcall credits_GetCredLineBreak(char *str)
{
int result; // eax
int result; // eax
result = 0;
while ( *str != 13 && *str != 10 )
{
++result;
++str;
if ( result > credit_line_count )
return -1;
}
return result;
result = 0;
while (*str != 13 && *str != 10) {
++result;
++str;
if (result > credit_line_count)
return -1;
}
return result;
}
// 10029700: using guessed type int credit_line_count;
// ref: 0x10005755
char *__fastcall credits_GetAdjustText(char *str, int len)
{
credit_line_count += -2 - len;
return &str[len + 2];
credit_line_count += -2 - len;
return &str[len + 2];
}
// 10029700: using guessed type int credit_line_count;

389
DiabloUI/diabedit.cpp

@ -1,17 +1,17 @@
// ref: 0x10005765
void __fastcall DiabEdit_DoPaintBMP(HWND hWnd)
{
struct tagPAINTSTRUCT Paint; // [esp+4h] [ebp-40h]
struct tagPAINTSTRUCT Paint; // [esp+4h] [ebp-40h]
BeginPaint(hWnd, &Paint);
SDlgDrawBitmap(hWnd, 1, 0, 0, 0, 0, 0);
EndPaint(hWnd, &Paint);
BeginPaint(hWnd, &Paint);
SDlgDrawBitmap(hWnd, 1, 0, 0, 0, 0, 0);
EndPaint(hWnd, &Paint);
}
// ref: 0x1000579B
void __cdecl DiabEdit_cpp_init()
{
DiabEdit_cpp_float = DiabEdit_cpp_float_value;
DiabEdit_cpp_float = DiabEdit_cpp_float_value;
}
// 1001F40C: using guessed type int DiabEdit_cpp_float_value;
// 1002970C: using guessed type int DiabEdit_cpp_float;
@ -19,249 +19,222 @@ void __cdecl DiabEdit_cpp_init()
// ref: 0x100057A6
void __cdecl DiabEdit_SetupWindow()
{
WNDCLASSA WndClass; // [esp+0h] [ebp-28h]
memset(&WndClass, 0, 0x28u);
WndClass.style = 64;
WndClass.lpfnWndProc = DiabEdit_WndProc;
WndClass.hInstance = GetModuleHandleA(0);
WndClass.lpszClassName = "DIABLOEDIT";
RegisterClassA(&WndClass);
WNDCLASSA WndClass; // [esp+0h] [ebp-28h]
memset(&WndClass, 0, 0x28u);
WndClass.style = 64;
WndClass.lpfnWndProc = DiabEdit_WndProc;
WndClass.hInstance = GetModuleHandleA(0);
WndClass.lpszClassName = "DIABLOEDIT";
RegisterClassA(&WndClass);
}
// ref: 0x100057E8
LRESULT __stdcall DiabEdit_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if ( Msg <= 0x113 )
{
if ( Msg == 275 )
{
DiabEdit_GetCursorProp(hWnd);
return 0;
}
if ( Msg == 1 )
{
DiabEdit_SetRestrictTimer(hWnd);
}
else if ( Msg == 2 )
{
DiabEdit_RemoveAllProps(hWnd);
}
else
{
if ( Msg != 7 )
{
if ( Msg == 15 )
{
DiabEdit_DoPaintBMP(hWnd);
}
else
{
if ( Msg == 135 )
return 129;
if ( Msg != 256 )
{
if ( Msg == 258 )
DiabEdit_RestrictAndLimit(hWnd, wParam, lParam);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
DiabEdit_SetTextAndProp(hWnd, wParam, lParam);
}
return 0;
}
DiabEdit_SendWndCommand(hWnd, 1u);
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
switch ( Msg )
{
case 0x201u:
SetFocus(hWnd);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
case 0x400u:
SetWindowTextA(hWnd, &nullcharacter);
DiabEdit_SendWndCommand(hWnd, 3u);
return 0;
case 0x401u:
SetPropA(hWnd, "LIMIT", (HANDLE)wParam);
return 0;
case 0x402u:
return (LRESULT)GetPropA(hWnd, "LIMIT");
}
if ( Msg != 1027 )
{
if ( Msg == 1028 )
{
DiabEdit_SetRestrictString(hWnd, lParam);
return 0;
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
return (LRESULT)GetPropA(hWnd, "CURSOR");
if (Msg <= 0x113) {
if (Msg == 275) {
DiabEdit_GetCursorProp(hWnd);
return 0;
}
if (Msg == 1) {
DiabEdit_SetRestrictTimer(hWnd);
} else if (Msg == 2) {
DiabEdit_RemoveAllProps(hWnd);
} else {
if (Msg != 7) {
if (Msg == 15) {
DiabEdit_DoPaintBMP(hWnd);
} else {
if (Msg == 135)
return 129;
if (Msg != 256) {
if (Msg == 258)
DiabEdit_RestrictAndLimit(hWnd, wParam, lParam);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
DiabEdit_SetTextAndProp(hWnd, wParam, lParam);
}
return 0;
}
DiabEdit_SendWndCommand(hWnd, 1u);
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
switch (Msg) {
case 0x201u:
SetFocus(hWnd);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
case 0x400u:
SetWindowTextA(hWnd, &nullcharacter);
DiabEdit_SendWndCommand(hWnd, 3u);
return 0;
case 0x401u:
SetPropA(hWnd, "LIMIT", (HANDLE)wParam);
return 0;
case 0x402u:
return (LRESULT)GetPropA(hWnd, "LIMIT");
}
if (Msg != 1027) {
if (Msg == 1028) {
DiabEdit_SetRestrictString(hWnd, lParam);
return 0;
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
return (LRESULT)GetPropA(hWnd, "CURSOR");
}
// ref: 0x1000591C
void __fastcall DiabEdit_SendWndCommand(HWND hWnd, WORD a2)
{
int v4; // ST08_4
HWND v5; // eax
int v4; // ST08_4
HWND v5; // eax
v4 = (a2 << 16) | (unsigned short)GetWindowLongA(hWnd, -12);
v5 = GetParent(hWnd);
SendMessageA(v5, 0x111u, v4, (LPARAM)hWnd);
v4 = (a2 << 16) | (unsigned short)GetWindowLongA(hWnd, -12);
v5 = GetParent(hWnd);
SendMessageA(v5, 0x111u, v4, (LPARAM)hWnd);
}
// ref: 0x1000594E
void __fastcall DiabEdit_GetCursorProp(HWND hWnd)
{
size_t v2; // eax
char *v3; // esi
char String[256]; // [esp+Ch] [ebp-100h]
String[0] = nullcharacter;
memset(&String[1], 0, 0xFCu);
*(_WORD *)&String[253] = 0;
String[255] = 0;
if ( GetPropA(hWnd, "CURSOR") )
{
SetPropA(hWnd, "CURSOR", 0);
DiabEdit_SendWndCommand(hWnd, 3u);
}
else
{
SetPropA(hWnd, "CURSOR", (void *)HANDLE_FLAG_INHERIT);
GetWindowTextA(hWnd, String, 255);
String[254] = 0;
v2 = strlen(String);
String[v2 + 1] = 0;
v3 = &String[v2];
String[v2] = 124;
SetWindowTextA(hWnd, String);
DiabEdit_SendWndCommand(hWnd, 3u);
*v3 = 0;
SetWindowTextA(hWnd, String);
}
size_t v2; // eax
char *v3; // esi
char String[256]; // [esp+Ch] [ebp-100h]
String[0] = nullcharacter;
memset(&String[1], 0, 0xFCu);
*(_WORD *)&String[253] = 0;
String[255] = 0;
if (GetPropA(hWnd, "CURSOR")) {
SetPropA(hWnd, "CURSOR", 0);
DiabEdit_SendWndCommand(hWnd, 3u);
} else {
SetPropA(hWnd, "CURSOR", (void *)HANDLE_FLAG_INHERIT);
GetWindowTextA(hWnd, String, 255);
String[254] = 0;
v2 = strlen(String);
String[v2 + 1] = 0;
v3 = &String[v2];
String[v2] = 124;
SetWindowTextA(hWnd, String);
DiabEdit_SendWndCommand(hWnd, 3u);
*v3 = 0;
SetWindowTextA(hWnd, String);
}
}
// ref: 0x10005A0A
void __fastcall DiabEdit_RestrictAndLimit(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
unsigned char v3; // bl
char *v4; // eax
char v5; // cl
signed int v6; // eax
signed int v7; // esi
//char v8; // [esp+7h] [ebp-105h]
char String[256]; // [esp+8h] [ebp-104h]
String[0] = nullcharacter;
v3 = wParam;
memset(&String[1], 0, 0xFCu);
*(_WORD *)&String[253] = 0;
String[255] = 0;
if ( (_BYTE)wParam == 8 )
goto LABEL_9;
if ( (unsigned char)wParam < 0x20u || (unsigned char)wParam > 0x7Eu && (unsigned char)wParam < 0xC0u )
return;
v4 = (char *)GetPropA(hWnd, "RESTRICTED");
if ( !v4 || (v5 = *v4) == 0 )
{
LABEL_9:
GetWindowTextA(hWnd, String, 255);
String[254] = 0;
v6 = strlen(String);
v7 = v6;
if ( v3 == 8 )
{
if ( v6 )
{
String[v6-1] = 0; // *(&v8 + v6) = 0;
goto LABEL_14;
}
}
else if ( v6 < (signed int)GetPropA(hWnd, "LIMIT") )
{
String[v7] = v3;
String[v7 + 1] = 0;
LABEL_14:
SetWindowTextA(hWnd, String);
goto LABEL_15;
}
LABEL_15:
DiabEdit_GetCursorProp(hWnd);
return;
}
while ( v3 != v5 )
{
v5 = *++v4;
if ( !*v4 )
goto LABEL_9;
}
unsigned char v3; // bl
char *v4; // eax
char v5; // cl
signed int v6; // eax
signed int v7; // esi
//char v8; // [esp+7h] [ebp-105h]
char String[256]; // [esp+8h] [ebp-104h]
String[0] = nullcharacter;
v3 = wParam;
memset(&String[1], 0, 0xFCu);
*(_WORD *)&String[253] = 0;
String[255] = 0;
if ((_BYTE)wParam == 8)
goto LABEL_9;
if ((unsigned char)wParam < 0x20u || (unsigned char)wParam > 0x7Eu && (unsigned char)wParam < 0xC0u)
return;
v4 = (char *)GetPropA(hWnd, "RESTRICTED");
if (!v4 || (v5 = *v4) == 0) {
LABEL_9:
GetWindowTextA(hWnd, String, 255);
String[254] = 0;
v6 = strlen(String);
v7 = v6;
if (v3 == 8) {
if (v6) {
String[v6 - 1] = 0; // *(&v8 + v6) = 0;
goto LABEL_14;
}
} else if (v6 < (signed int)GetPropA(hWnd, "LIMIT")) {
String[v7] = v3;
String[v7 + 1] = 0;
LABEL_14:
SetWindowTextA(hWnd, String);
goto LABEL_15;
}
LABEL_15:
DiabEdit_GetCursorProp(hWnd);
return;
}
while (v3 != v5) {
v5 = *++v4;
if (!*v4)
goto LABEL_9;
}
}
// ref: 0x10005AF4
void __fastcall DiabEdit_SetTextAndProp(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
WPARAM v4; // ebx
size_t v5; // eax
//char v6; // [esp+Bh] [ebp-101h]
char String[256]; // [esp+Ch] [ebp-100h]
String[0] = nullcharacter;
memset(&String[1], 0, 0xFCu);
*(_WORD *)&String[253] = 0;
String[255] = 0;
v4 = wParam;
GetWindowTextA(hWnd, String, 255);
String[254] = 0;
v5 = strlen(String);
if ( v4 == 37 )
{
if ( v5 )
{
String[v5-1] = 0; // *(&v6 + v5) = 0;
SetWindowTextA(hWnd, String);
}
DiabEdit_GetCursorProp(hWnd);
}
WPARAM v4; // ebx
size_t v5; // eax
//char v6; // [esp+Bh] [ebp-101h]
char String[256]; // [esp+Ch] [ebp-100h]
String[0] = nullcharacter;
memset(&String[1], 0, 0xFCu);
*(_WORD *)&String[253] = 0;
String[255] = 0;
v4 = wParam;
GetWindowTextA(hWnd, String, 255);
String[254] = 0;
v5 = strlen(String);
if (v4 == 37) {
if (v5) {
String[v5 - 1] = 0; // *(&v6 + v5) = 0;
SetWindowTextA(hWnd, String);
}
DiabEdit_GetCursorProp(hWnd);
}
}
// ref: 0x10005B70
void __fastcall DiabEdit_SetRestrictString(HWND hWnd, LPARAM lParam)
{
const char *v2; // edi
char *v3; // eax MAPDST
v2 = (const char *)lParam;
v3 = (char *)GetPropA(hWnd, "RESTRICTED");
if ( v3 )
{
strncpy(v3, v2, 0xFFu);
v3[255] = 0;
}
const char *v2; // edi
char *v3; // eax MAPDST
v2 = (const char *)lParam;
v3 = (char *)GetPropA(hWnd, "RESTRICTED");
if (v3) {
strncpy(v3, v2, 0xFFu);
v3[255] = 0;
}
}
// ref: 0x10005B9F
void __fastcall DiabEdit_SetRestrictTimer(HWND hWnd)
{
unsigned char *v2; // eax
unsigned char *v2; // eax
SDlgSetTimer((int)hWnd, 1, 500, 0);
SetPropA(hWnd, "CURSOR", 0);
v2 = (unsigned char *)SMemAlloc(0x100u, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 185, 0);
*v2 = 0;
SetPropA(hWnd, "RESTRICTED", v2);
SDlgSetTimer((int)hWnd, 1, 500, 0);
SetPropA(hWnd, "CURSOR", 0);
v2 = (unsigned char *)SMemAlloc(0x100u, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 185, 0);
*v2 = 0;
SetPropA(hWnd, "RESTRICTED", v2);
}
// ref: 0x10005BE7
void __fastcall DiabEdit_RemoveAllProps(HWND hWnd)
{
HANDLE v2; // eax
SDlgKillTimer((int)hWnd, 1);
RemovePropA(hWnd, "LIMIT");
RemovePropA(hWnd, "CURSOR");
v2 = RemovePropA(hWnd, "RESTRICTED");
if ( v2 )
SMemFree(v2, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 200, 0);
HANDLE v2; // eax
SDlgKillTimer((int)hWnd, 1);
RemovePropA(hWnd, "LIMIT");
RemovePropA(hWnd, "CURSOR");
v2 = RemovePropA(hWnd, "RESTRICTED");
if (v2)
SMemFree(v2, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 200, 0);
}

83
DiabloUI/diabloui.cpp

@ -1,34 +1,34 @@
#include <windows.h>
#include <stdio.h>
#include <ddraw.h>
#include <dsound.h>
#include <io.h>
#include <math.h>
#include <time.h>
#include <process.h>
#include <shlobj.h>
#include <stdio.h>
#include <time.h>
#include <windows.h>
#ifdef _MSC_VER
#pragma warning (disable : 4018) // signed/unsigned mismatch
#pragma warning(disable : 4018) // signed/unsigned mismatch
#endif
#include "..\3rdParty\Storm\Source\storm.h"
#include "..\defs.h"
#include "..\enums.h"
#include "..\structs.h"
#include "..\3rdParty\Storm\Source\storm.h"
#include "diabloui.h"
#define UNKCALL __fastcall
#define USERCALL __fastcall
#define USERPURGE __fastcall
#define UNKCALL __fastcall
#define USERCALL __fastcall
#define USERPURGE __fastcall
//temporarily include everything directly
#include "_temp_funcs.h"
#include "_temp_data.cpp"
#include "_temp_funcs.h"
#include "artfont.cpp"
#include "bnetgw.cpp"
#include "bn_prof.cpp"
#include "bnetgw.cpp"
#include "connect.cpp"
#include "copyprot.cpp"
#include "cr8game.cpp"
@ -64,27 +64,26 @@
#include "title.cpp"
#include "titlesnd.cpp"
// ref: 0x10005C2A
int __cdecl DiabloUI_GetSpawned()
{
return sgbIsSpawn;
return sgbIsSpawn;
}
// 1002972C: using guessed type int sgbIsSpawn;
// ref: 0x10005C30
void __stdcall UiOnPaint(int a1)
{
return;
return;
}
// ref: 0x10005C33
void __stdcall UiSetBackgroundBitmap(int a1, PALETTEENTRY *a2, int a3, int a4, int a5)
{
backbmp_flag1 = a3;
backbmp_flag2 = a4;
backbmp_flag3 = a5;
SDrawUpdatePalette(0xAu, 0xECu, a2 + 10, 0);
backbmp_flag1 = a3;
backbmp_flag2 = a4;
backbmp_flag3 = a5;
SDrawUpdatePalette(0xAu, 0xECu, a2 + 10, 0);
}
// 1002971C: using guessed type int backbmp_flag1;
// 10029720: using guessed type int backbmp_flag2;
@ -93,62 +92,58 @@ void __stdcall UiSetBackgroundBitmap(int a1, PALETTEENTRY *a2, int a3, int a4, i
// ref: 0x10005C67
void __stdcall UiSetSpawned(BOOL bSpawned)
{
sgbIsSpawn = bSpawned;
sgbIsSpawn = bSpawned;
}
// 1002972C: using guessed type int sgbIsSpawn;
// ref: 0x10005C73
void __cdecl UiInitialize()
{
sgbUiIsInitialized = 1;
TitleSnd_InitSoundFunc();
artfont_InitAllFonts();
Connect_LoadGFXAndStuff();
local_LoadArtCursor();
bn_prof_100021C4();
sgbUiIsInitialized = 1;
TitleSnd_InitSoundFunc();
artfont_InitAllFonts();
Connect_LoadGFXAndStuff();
local_LoadArtCursor();
bn_prof_100021C4();
}
// 10029714: using guessed type int sgbUiIsInitialized;
// ref: 0x10005C96
void __cdecl UiDestroy()
{
bn_prof_10002247();
local_FreeArtCursor();
Connect_FreeConnectData();
sgbUiIsInitialized = 0;
bn_prof_10002247();
local_FreeArtCursor();
Connect_FreeConnectData();
sgbUiIsInitialized = 0;
}
// 10029714: using guessed type int sgbUiIsInitialized;
// ref: 0x10005CAD
void __stdcall UiAppActivate(BOOL bActive)
{
app_is_active = bActive;
app_is_active = bActive;
}
// 10029728: using guessed type int app_is_active;
// ref: 0x10005CB9
BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if ( fdwReason )
{
if ( fdwReason == 1 )
{
ghUiInst = hinstDLL;
DiabEdit_SetupWindow();
local_InitUiPalette();
}
}
else
{
local_DelUiPalette();
}
return 1;
if (fdwReason) {
if (fdwReason == 1) {
ghUiInst = hinstDLL;
DiabEdit_SetupWindow();
local_InitUiPalette();
}
} else {
local_DelUiPalette();
}
return 1;
}
// ref: 0x10005CEA
void __cdecl DiabloUI_cpp_init()
{
DiabloUI_cpp_float = DiabloUI_cpp_float_value;
DiabloUI_cpp_float = DiabloUI_cpp_float_value;
}
// 1001F410: using guessed type int DiabloUI_cpp_float_value;
// 10029710: using guessed type int DiabloUI_cpp_float;

35
DiabloUI/diabloui.h

@ -6,26 +6,23 @@
extern "C" {
#endif
struct FontStruct
{
unsigned char fontbin[258];
HANDLE fonttrans[256];
BOOL active;
struct FontStruct {
unsigned char fontbin[258];
HANDLE fonttrans[256];
BOOL active;
};
struct ProfileStruct
{
char *name;
char field_4;
int msg;
int field_C;
struct ProfileStruct {
char *name;
char field_4;
int msg;
int field_C;
};
struct ProfFntStruct
{
int size;
char *fontname;
int field_8;
struct ProfFntStruct {
int size;
char *fontname;
int field_8;
};
void __cdecl UiDestroy();
@ -34,10 +31,10 @@ void __cdecl UiInitialize();
BOOL __stdcall UiCopyProtError(int *pdwResult);
void __stdcall UiAppActivate(BOOL bActive);
BOOL __fastcall UiValidPlayerName(char *name); /* check __stdcall */
BOOL __stdcall UiSelHeroMultDialog(BOOL (__stdcall *fninfo)(BOOL (__stdcall *fninfofunc)(_uiheroinfo *)), BOOL (__stdcall *fncreate)(_uiheroinfo *), BOOL (__stdcall *fnremove)(_uiheroinfo *), BOOL (__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, int *a6, char *name);
BOOL __stdcall UiSelHeroSingDialog(BOOL (__stdcall *fninfo)(BOOL (__stdcall *fninfofunc)(_uiheroinfo *)), BOOL (__stdcall *fncreate)(_uiheroinfo *), BOOL (__stdcall *fnremove)(_uiheroinfo *), BOOL (__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty);
BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, int *a6, char *name);
BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty);
BOOL __stdcall UiCreditsDialog(int a1);
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void (__stdcall *fnSound)(char *file), int a4);
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4);
int __stdcall UiProgressDialog(HWND window, char *msg, int a3, void *fnfunc, int a5);
int __cdecl UiProfileGetString();
void __cdecl UiProfileCallback();

128
DiabloUI/disclaim.cpp

@ -1,109 +1,95 @@
// ref: 0x100063B3
BOOL __stdcall UiBetaDisclaimer(int a1)
{
int v1; // eax
int v1; // eax
v1 = (int)SDrawGetFrameWindow();
SDlgDialogBoxParam(ghUiInst, "DISCLAIMER_DIALOG", v1, disclaim_WndProc, a1);
return 1;
v1 = (int)SDrawGetFrameWindow();
SDlgDialogBoxParam(ghUiInst, "DISCLAIMER_DIALOG", v1, disclaim_WndProc, a1);
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x100063DA
LRESULT __stdcall disclaim_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v5; // eax
HWND v5; // eax
if ( Msg > 0x111 )
{
if ( Msg != 513 && Msg != 516 )
{
if ( Msg == 528 )
{
if ( (_WORD)wParam == 513 || (_WORD)wParam == 516 )
disclaim_FadeFromDisclaim(hWnd);
}
else if ( Msg == 2024 )
{
if ( !Fade_CheckRange5() )
Fade_SetFadeTimer((int)hWnd);
return 0;
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
}
else if ( Msg != 273 )
{
if ( Msg != 2 )
{
if ( Msg != 256 )
{
if ( Msg > 0x103 )
{
if ( Msg <= 0x105 )
{
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, Msg, wParam, lParam);
}
else if ( Msg == 272 )
{
disclaim_LoadDisclaimGFX(hWnd);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_21;
}
disclaim_DelDisclaimProcs(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg > 0x111) {
if (Msg != 513 && Msg != 516) {
if (Msg == 528) {
if ((_WORD)wParam == 513 || (_WORD)wParam == 516)
disclaim_FadeFromDisclaim(hWnd);
} else if (Msg == 2024) {
if (!Fade_CheckRange5())
Fade_SetFadeTimer((int)hWnd);
return 0;
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
} else if (Msg != 273) {
if (Msg != 2) {
if (Msg != 256) {
if (Msg > 0x103) {
if (Msg <= 0x105) {
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, Msg, wParam, lParam);
} else if (Msg == 272) {
disclaim_LoadDisclaimGFX(hWnd);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_21;
}
disclaim_DelDisclaimProcs(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
LABEL_21:
disclaim_FadeFromDisclaim(hWnd);
return 0;
disclaim_FadeFromDisclaim(hWnd);
return 0;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x100064C9
void __fastcall disclaim_DelDisclaimProcs(HWND hWnd)
{
void **v2; // eax
void **v2; // eax
Doom_DeleteFreeProcs(hWnd, disclaim_msgtbl2);
Doom_DeleteFreeProcs(hWnd, disclaim_msgtbl1);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
Doom_DeleteFreeProcs(hWnd, disclaim_msgtbl2);
Doom_DeleteFreeProcs(hWnd, disclaim_msgtbl1);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
}
// ref: 0x100064F3
void __fastcall disclaim_LoadDisclaimGFX(HWND hWnd)
{
DWORD *v2; // eax MAPDST
DWORD *v2; // eax MAPDST
v2 = local_AllocWndLongData();
if ( v2 )
{
SetWindowLongA(hWnd, -21, (LONG)v2);
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, "ui_art\\disclaim.pcx", (BYTE **)v2, v2 + 1, 0);
Fade_NoInputAndArt(hWnd, 0);
}
Doom_ParseWndProc3(hWnd, disclaim_msgtbl1, 5);
Doom_ParseWndProc3(hWnd, disclaim_msgtbl2, 2);
v2 = local_AllocWndLongData();
if (v2) {
SetWindowLongA(hWnd, -21, (LONG)v2);
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, "ui_art\\disclaim.pcx", (BYTE **)v2, v2 + 1, 0);
Fade_NoInputAndArt(hWnd, 0);
}
Doom_ParseWndProc3(hWnd, disclaim_msgtbl1, 5);
Doom_ParseWndProc3(hWnd, disclaim_msgtbl2, 2);
}
// ref: 0x10006552
void __fastcall disclaim_FadeFromDisclaim(HWND hWnd)
{
Fade_Range5SetZero();
Fade_UpdatePaletteRange(10);
SDlgEndDialog(hWnd, (void *)HANDLE_FLAG_INHERIT);
Fade_Range5SetZero();
Fade_UpdatePaletteRange(10);
SDlgEndDialog(hWnd, (void *)HANDLE_FLAG_INHERIT);
}
// ref: 0x10006571
void __cdecl disclaim_cpp_init()
{
disclaim_cpp_float = disclaim_cpp_float_value;
disclaim_cpp_float = disclaim_cpp_float_value;
}
// 1001F418: using guessed type int disclaim_cpp_float_value;
// 10029850: using guessed type int disclaim_cpp_float;

584
DiabloUI/doom.cpp

@ -1,7 +1,7 @@
// ref: 0x10006581
void __cdecl Doom_cpp_init()
{
doom_cpp_float = doom_cpp_float_value;
doom_cpp_float = doom_cpp_float_value;
}
// 1001F41C: using guessed type int doom_cpp_float_value;
// 10029854: using guessed type int doom_cpp_float;
@ -9,396 +9,364 @@ void __cdecl Doom_cpp_init()
// ref: 0x1000658C
void __fastcall Doom_ParseWndProcs(HWND hWnd, int *msgtbl, int a3, int a4)
{
HWND v6; // eax
while ( *msgtbl )
{
v6 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndText(hWnd, (int)v6, a3, a4);
++msgtbl;
}
HWND v6; // eax
while (*msgtbl) {
v6 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndText(hWnd, (int)v6, a3, a4);
++msgtbl;
}
}
// ref: 0x100065BB
void __fastcall Doom_GetSetWndText(HWND hWnd, int msg, int nFont, int a4)
{
HWND v4; // esi
HWND v5; // edi
int v6; // eax
char String[256]; // [esp+8h] [ebp-100h]
v4 = (HWND)msg;
v5 = hWnd;
if ( msg )
{
Doom_AllocAndSetBMP(hWnd, msg, 1521);
Doom_GetWindowROP3(v5, v4);
artfont_SetArtFont(nFont);
Doom_PrintStrWithSpin(v4, a4);
GetWindowTextA(v4, String, 255);
if ( strlen(String) )
{
v6 = GetWindowLongA(v4, -21);
local_SetWndLongStr(v6, String);
SetWindowTextA(v4, &nullcharacter);
}
}
HWND v4; // esi
HWND v5; // edi
int v6; // eax
char String[256]; // [esp+8h] [ebp-100h]
v4 = (HWND)msg;
v5 = hWnd;
if (msg) {
Doom_AllocAndSetBMP(hWnd, msg, 1521);
Doom_GetWindowROP3(v5, v4);
artfont_SetArtFont(nFont);
Doom_PrintStrWithSpin(v4, a4);
GetWindowTextA(v4, String, 255);
if (strlen(String)) {
v6 = GetWindowLongA(v4, -21);
local_SetWndLongStr(v6, String);
SetWindowTextA(v4, &nullcharacter);
}
}
}
// ref: 0x1000663F
void __fastcall Doom_PrintStrWithSpin(HWND hWnd, BOOL a2)
{
_DWORD *v3; // eax
_DWORD *v4; // esi
char *v5; // ebx
int v6; // edi
size_t v7; // eax
char *i; // eax
int v9; // kr04_4
int v10; // eax
char String[256]; // [esp+8h] [ebp-10Ch]
char *v12; // [esp+108h] [ebp-Ch]
int v14; // [esp+110h] [ebp-4h]
v3 = (_DWORD *)GetWindowLongA(hWnd, -21);
v4 = v3;
if ( v3 && *v3 )
{
GetWindowTextA(hWnd, String, 255);
v5 = String;
if ( !strlen(String) )
v5 = (char *)(v4 + 4);
v14 = artfont_GetFontWidth(v5);
if ( a2 )
{
v6 = v4[1] - 2 * Focus_GetSpinWidthOrZero();
v7 = strlen(v5);
if ( v14 > v6 )
{
for ( i = &v5[v7]; ; i = v12 )
{
v12 = i - 1;
*v12 = 0;
v14 = artfont_GetFontWidth(v5);
if ( v14 <= v6 )
break;
}
}
}
v9 = v4[1] - v14 - 1;
v10 = artfont_GetFontMaxHeight();
artfont_PrintFontStr(v5, (DWORD **)v4, v9 / 2, (v4[2] - v10) / 2);
InvalidateRect(hWnd, 0, 0);
}
_DWORD *v3; // eax
_DWORD *v4; // esi
char *v5; // ebx
int v6; // edi
size_t v7; // eax
char *i; // eax
int v9; // kr04_4
int v10; // eax
char String[256]; // [esp+8h] [ebp-10Ch]
char *v12; // [esp+108h] [ebp-Ch]
int v14; // [esp+110h] [ebp-4h]
v3 = (_DWORD *)GetWindowLongA(hWnd, -21);
v4 = v3;
if (v3 && *v3) {
GetWindowTextA(hWnd, String, 255);
v5 = String;
if (!strlen(String))
v5 = (char *)(v4 + 4);
v14 = artfont_GetFontWidth(v5);
if (a2) {
v6 = v4[1] - 2 * Focus_GetSpinWidthOrZero();
v7 = strlen(v5);
if (v14 > v6) {
for (i = &v5[v7];; i = v12) {
v12 = i - 1;
*v12 = 0;
v14 = artfont_GetFontWidth(v5);
if (v14 <= v6)
break;
}
}
}
v9 = v4[1] - v14 - 1;
v10 = artfont_GetFontMaxHeight();
artfont_PrintFontStr(v5, (DWORD **)v4, v9 / 2, (v4[2] - v10) / 2);
InvalidateRect(hWnd, 0, 0);
}
}
// ref: 0x10006719
void __fastcall Doom_AllocAndSetBMP(HWND hWnd, int a2, int bmp_flags)
{
DWORD *v4; // esi
struct tagRECT Rect; // [esp+8h] [ebp-10h]
GetClientRect((HWND)a2, &Rect);
v4 = local_AllocWndLongData();
v4[1] = Rect.right;
v4[2] = Rect.bottom;
*v4 = (DWORD)SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Doom.cpp", 139, 0);
SetWindowLongA((HWND)a2, -21, (LONG)v4);
SDlgSetBitmapI((HWND)a2, 0, &nullcharacter, -1, bmp_flags, (void *)*v4, 0, v4[1], v4[2], -1);
DWORD *v4; // esi
struct tagRECT Rect; // [esp+8h] [ebp-10h]
GetClientRect((HWND)a2, &Rect);
v4 = local_AllocWndLongData();
v4[1] = Rect.right;
v4[2] = Rect.bottom;
*v4 = (DWORD)SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Doom.cpp", 139, 0);
SetWindowLongA((HWND)a2, -21, (LONG)v4);
SDlgSetBitmapI((HWND)a2, 0, &nullcharacter, -1, bmp_flags, (void *)*v4, 0, v4[1], v4[2], -1);
}
// ref: 0x1000678A
void __fastcall Doom_GetWindowROP3(HWND hWnd1, HWND hWnd2)
{
_DWORD *v3; // ebx
LONG v4; // eax MAPDST
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
v3 = (_DWORD *)GetWindowLongA(hWnd1, -21);
v4 = GetWindowLongA(hWnd2, -21);
if ( v3 && *v3 && v4 )
{
if ( *(_DWORD *)v4 )
{
GetWindowRect(hWnd2, &Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect.right);
SBltROP3(
*(void **)v4,
(void *)(Rect.left + *v3 + Rect.top * v3[1]),
*(_DWORD *)(v4 + 4),
*(_DWORD *)(v4 + 8),
*(_DWORD *)(v4 + 4),
v3[1],
0,
0xCC0020u);
}
}
_DWORD *v3; // ebx
LONG v4; // eax MAPDST
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
v3 = (_DWORD *)GetWindowLongA(hWnd1, -21);
v4 = GetWindowLongA(hWnd2, -21);
if (v3 && *v3 && v4) {
if (*(_DWORD *)v4) {
GetWindowRect(hWnd2, &Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect.right);
SBltROP3(
*(void **)v4,
(void *)(Rect.left + *v3 + Rect.top * v3[1]),
*(_DWORD *)(v4 + 4),
*(_DWORD *)(v4 + 8),
*(_DWORD *)(v4 + 4),
v3[1],
0,
0xCC0020u);
}
}
}
// ref: 0x1000680A
void __fastcall Doom_ParseWndProc2(HWND hWnd, int *msgtbl, int a3, int a4)
{
HWND v6; // eax
while ( *msgtbl )
{
v6 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt2(hWnd, (int)v6, a3, a4);
++msgtbl;
}
HWND v6; // eax
while (*msgtbl) {
v6 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt2(hWnd, (int)v6, a3, a4);
++msgtbl;
}
}
// ref: 0x10006839
void __fastcall Doom_GetSetWndTxt2(HWND hWnd, int msg, int nFont, int a4)
{
HWND v4; // esi
int v5; // eax
char String[256]; // [esp+4h] [ebp-100h]
v4 = (HWND)msg;
if ( msg )
{
Doom_GetWindowROP3(hWnd, (HWND)msg);
artfont_SetArtFont(nFont);
Doom_PrintStrWithSpin(v4, a4);
GetWindowTextA(v4, String, 255);
if ( strlen(String) )
{
v5 = GetWindowLongA(v4, -21);
local_SetWndLongStr(v5, String);
SetWindowTextA(v4, &nullcharacter);
}
}
HWND v4; // esi
int v5; // eax
char String[256]; // [esp+4h] [ebp-100h]
v4 = (HWND)msg;
if (msg) {
Doom_GetWindowROP3(hWnd, (HWND)msg);
artfont_SetArtFont(nFont);
Doom_PrintStrWithSpin(v4, a4);
GetWindowTextA(v4, String, 255);
if (strlen(String)) {
v5 = GetWindowLongA(v4, -21);
local_SetWndLongStr(v5, String);
SetWindowTextA(v4, &nullcharacter);
}
}
}
// ref: 0x100068AB
void __fastcall Doom_ParseWndProc3(HWND hWnd, int *msgtbl, int a3)
{
HWND v5; // eax
while ( *msgtbl )
{
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt3(hWnd, (int)v5, a3);
++msgtbl;
}
HWND v5; // eax
while (*msgtbl) {
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt3(hWnd, (int)v5, a3);
++msgtbl;
}
}
// ref: 0x100068D6
void __fastcall Doom_GetSetWndTxt3(HWND hWnd, int msg, int nFont)
{
HWND v3; // esi
HWND v4; // edi
int v5; // eax
int v6; // eax
char String[256]; // [esp+8h] [ebp-100h]
v3 = (HWND)msg;
v4 = hWnd;
if ( msg )
{
Doom_AllocAndSetBMP(hWnd, msg, 1);
Doom_GetWindowROP3(v4, v3);
artfont_SetArtFont(nFont);
v5 = GetWindowLongA(v3, -16);
Doom_PrintStrWithSpn2(v3, v5);
GetWindowTextA(v3, String, 255);
if ( strlen(String) )
{
v6 = GetWindowLongA(v3, -21);
local_SetWndLongStr(v6, String);
SetWindowTextA(v3, &nullcharacter);
}
}
HWND v3; // esi
HWND v4; // edi
int v5; // eax
int v6; // eax
char String[256]; // [esp+8h] [ebp-100h]
v3 = (HWND)msg;
v4 = hWnd;
if (msg) {
Doom_AllocAndSetBMP(hWnd, msg, 1);
Doom_GetWindowROP3(v4, v3);
artfont_SetArtFont(nFont);
v5 = GetWindowLongA(v3, -16);
Doom_PrintStrWithSpn2(v3, v5);
GetWindowTextA(v3, String, 255);
if (strlen(String)) {
v6 = GetWindowLongA(v3, -21);
local_SetWndLongStr(v6, String);
SetWindowTextA(v3, &nullcharacter);
}
}
}
// ref: 0x1000695D
void __fastcall Doom_PrintStrWithSpn2(HWND hWnd, int justify_type)
{
_DWORD *v2; // eax
_DWORD *v3; // esi
char *v4; // edi
int v5; // eax
char String[256]; // [esp+4h] [ebp-108h]
v2 = (_DWORD *)GetWindowLongA(hWnd, -21);
v3 = v2;
if ( v2 && *v2 )
{
GetWindowTextA(hWnd, String, 255);
v4 = String;
if ( !strlen(String) )
v4 = (char *)(v3 + 4);
if ( justify_type & 2 )
{
v5 = v3[1] - artfont_GetFontWidth(v4) - 1;
}
else if ( justify_type & 1 )
{
v5 = (v3[1] - artfont_GetFontWidth(v4) - 1) / 2;
}
else
{
v5 = 0;
}
artfont_PrintFontStr(v4, (DWORD **)v3, v5, 0);
InvalidateRect(hWnd, 0, 0);
}
_DWORD *v2; // eax
_DWORD *v3; // esi
char *v4; // edi
int v5; // eax
char String[256]; // [esp+4h] [ebp-108h]
v2 = (_DWORD *)GetWindowLongA(hWnd, -21);
v3 = v2;
if (v2 && *v2) {
GetWindowTextA(hWnd, String, 255);
v4 = String;
if (!strlen(String))
v4 = (char *)(v3 + 4);
if (justify_type & 2) {
v5 = v3[1] - artfont_GetFontWidth(v4) - 1;
} else if (justify_type & 1) {
v5 = (v3[1] - artfont_GetFontWidth(v4) - 1) / 2;
} else {
v5 = 0;
}
artfont_PrintFontStr(v4, (DWORD **)v3, v5, 0);
InvalidateRect(hWnd, 0, 0);
}
}
// ref: 0x10006A13
void __fastcall Doom_ParseWndProc4(HWND hWnd, int *msgtbl, int a3)
{
HWND v5; // eax
while ( *msgtbl )
{
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt4(hWnd, (int)v5, a3);
++msgtbl;
}
HWND v5; // eax
while (*msgtbl) {
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt4(hWnd, (int)v5, a3);
++msgtbl;
}
}
// ref: 0x10006A3E
void __fastcall Doom_GetSetWndTxt4(HWND hWnd, int msg, int nFont)
{
HWND v3; // edi
int v4; // eax
int v5; // eax
char String[256]; // [esp+8h] [ebp-100h]
v3 = (HWND)msg;
if ( msg )
{
Doom_GetWindowROP3(hWnd, (HWND)msg);
artfont_SetArtFont(nFont);
v4 = GetWindowLongA(v3, -16);
Doom_PrintStrWithSpn2(v3, v4);
GetWindowTextA(v3, String, 255);
if ( strlen(String) )
{
v5 = GetWindowLongA(v3, -21);
local_SetWndLongStr(v5, String);
SetWindowTextA(v3, &nullcharacter);
}
}
HWND v3; // edi
int v4; // eax
int v5; // eax
char String[256]; // [esp+8h] [ebp-100h]
v3 = (HWND)msg;
if (msg) {
Doom_GetWindowROP3(hWnd, (HWND)msg);
artfont_SetArtFont(nFont);
v4 = GetWindowLongA(v3, -16);
Doom_PrintStrWithSpn2(v3, v4);
GetWindowTextA(v3, String, 255);
if (strlen(String)) {
v5 = GetWindowLongA(v3, -21);
local_SetWndLongStr(v5, String);
SetWindowTextA(v3, &nullcharacter);
}
}
}
// ref: 0x10006AB8
void __fastcall Doom_ParseWndProc5(HWND hWnd, int *msgtbl, int a3)
{
HWND v5; // eax
while ( *msgtbl )
{
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt5(hWnd, (int)v5, a3);
++msgtbl;
}
HWND v5; // eax
while (*msgtbl) {
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt5(hWnd, (int)v5, a3);
++msgtbl;
}
}
// ref: 0x10006AE3
void __fastcall Doom_GetSetWndTxt5(HWND hWnd, int msg, int nFont)
{
HWND v3; // esi
v3 = (HWND)msg;
if ( msg )
{
Doom_AllocAndSetBMP(hWnd, msg, 1);
Doom_GetWindowROP3(hWnd, v3);
artfont_SetArtFont(nFont);
Doom_PrintTextMsg403(v3);
}
HWND v3; // esi
v3 = (HWND)msg;
if (msg) {
Doom_AllocAndSetBMP(hWnd, msg, 1);
Doom_GetWindowROP3(hWnd, v3);
artfont_SetArtFont(nFont);
Doom_PrintTextMsg403(v3);
}
}
// ref: 0x10006B12
void __fastcall Doom_PrintTextMsg403(HWND hWnd)
{
BYTE *v2; // eax
int v3; // edi
int v4; // edi
int v5; // esi
int v6; // esi
char *i; // ebx
int v8; // eax
//char v9; // [esp+3h] [ebp-11Dh]
char String[256]; // [esp+4h] [ebp-11Ch]
struct tagRECT Rect; // [esp+104h] [ebp-1Ch]
LRESULT v12; // [esp+114h] [ebp-Ch]
BYTE *pWidthBin; // [esp+118h] [ebp-8h]
size_t v14; // [esp+11Ch] [ebp-4h]
v2 = (BYTE *)GetWindowLongA(hWnd, -21);
pWidthBin = v2;
if ( v2 && *(_DWORD *)v2 )
{
GetWindowTextA(hWnd, String, 255);
v14 = strlen(String);
v3 = Focus_GetSpinWidthOrZero();
v4 = artfont_GetFontDefWidth() + v3;
GetClientRect(hWnd, &Rect);
v5 = Focus_GetSpinWidthOrZero();
v6 = Rect.right - 2 * (artfont_GetFontDefWidth() + v5);
v12 = SendMessageA(hWnd, 0x403u, 0, 0);
if ( v12 == 1 )
String[v14-1] = 0; // *(&v9 + v14) = 0;
for ( i = String; *i; ++i )
{
if ( artfont_GetFontWidth(i) <= v6 )
break;
}
if ( v12 )
String[v14-1] = 124; // *(&v9 + v14) = 124;
v8 = artfont_GetFontMaxHeight();
artfont_PrintFontStr(i, (DWORD **)pWidthBin, v4, (*((_DWORD *)pWidthBin + 2) - v8) / 2);
}
BYTE *v2; // eax
int v3; // edi
int v4; // edi
int v5; // esi
int v6; // esi
char *i; // ebx
int v8; // eax
//char v9; // [esp+3h] [ebp-11Dh]
char String[256]; // [esp+4h] [ebp-11Ch]
struct tagRECT Rect; // [esp+104h] [ebp-1Ch]
LRESULT v12; // [esp+114h] [ebp-Ch]
BYTE *pWidthBin; // [esp+118h] [ebp-8h]
size_t v14; // [esp+11Ch] [ebp-4h]
v2 = (BYTE *)GetWindowLongA(hWnd, -21);
pWidthBin = v2;
if (v2 && *(_DWORD *)v2) {
GetWindowTextA(hWnd, String, 255);
v14 = strlen(String);
v3 = Focus_GetSpinWidthOrZero();
v4 = artfont_GetFontDefWidth() + v3;
GetClientRect(hWnd, &Rect);
v5 = Focus_GetSpinWidthOrZero();
v6 = Rect.right - 2 * (artfont_GetFontDefWidth() + v5);
v12 = SendMessageA(hWnd, 0x403u, 0, 0);
if (v12 == 1)
String[v14 - 1] = 0; // *(&v9 + v14) = 0;
for (i = String; *i; ++i) {
if (artfont_GetFontWidth(i) <= v6)
break;
}
if (v12)
String[v14 - 1] = 124; // *(&v9 + v14) = 124;
v8 = artfont_GetFontMaxHeight();
artfont_PrintFontStr(i, (DWORD **)pWidthBin, v4, (*((_DWORD *)pWidthBin + 2) - v8) / 2);
}
}
// ref: 0x10006C08
void __fastcall Doom_ParseWndProc6(HWND hWnd, int *msgtbl, int a3)
{
HWND v5; // eax
while ( *msgtbl )
{
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt6(hWnd, (int)v5, a3);
++msgtbl;
}
HWND v5; // eax
while (*msgtbl) {
v5 = GetDlgItem(hWnd, *msgtbl);
Doom_GetSetWndTxt6(hWnd, (int)v5, a3);
++msgtbl;
}
}
// ref: 0x10006C33
void __fastcall Doom_GetSetWndTxt6(HWND hWnd, int msg, int nFont)
{
HWND v3; // esi
v3 = (HWND)msg;
if ( msg )
{
Doom_GetWindowROP3(hWnd, (HWND)msg);
artfont_SetArtFont(nFont);
Doom_PrintTextMsg403(v3);
}
HWND v3; // esi
v3 = (HWND)msg;
if (msg) {
Doom_GetWindowROP3(hWnd, (HWND)msg);
artfont_SetArtFont(nFont);
Doom_PrintTextMsg403(v3);
}
}
// ref: 0x10006C53
void __fastcall Doom_DeleteFreeProcs(HWND hWnd, int *msgtbl)
{
int i; // eax
HWND v5; // eax MAPDST
void **v7; // eax
for ( i = *msgtbl; *msgtbl; i = *msgtbl )
{
v5 = GetDlgItem(hWnd, i);
if ( v5 )
{
v7 = (void **)GetWindowLongA(v5, -21);
local_FreeMemPtr(v7);
SetWindowLongA(v5, -21, 0);
}
++msgtbl;
}
int i; // eax
HWND v5; // eax MAPDST
void **v7; // eax
for (i = *msgtbl; *msgtbl; i = *msgtbl) {
v5 = GetDlgItem(hWnd, i);
if (v5) {
v7 = (void **)GetWindowLongA(v5, -21);
local_FreeMemPtr(v7);
SetWindowLongA(v5, -21, 0);
}
++msgtbl;
}
}

210
DiabloUI/entname.cpp

@ -1,147 +1,137 @@
// ref: 0x10006F7C
LRESULT __stdcall EntName_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int v4; // edx
HWND v5; // eax
HWND v6; // eax
HWND v7; // eax
HWND v9; // eax
int v4; // edx
HWND v5; // eax
HWND v6; // eax
HWND v7; // eax
HWND v9; // eax
v4 = 2;
if ( Msg == 2 )
{
EntName_DelEntNameMsgs(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg <= 0x103 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if ( Msg <= 0x105 )
{
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
switch ( Msg )
{
case 0x110u:
entname_charname = (char *)lParam;
EntName_LoadFocusChkName(hWnd);
return 0;
case 0x111u:
if ( (unsigned short)wParam != 1 )
{
if ( (unsigned short)wParam != 2 )
{
if ( (unsigned short)wParam == 1065 )
EntName_GetMessageName(hWnd, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_11;
}
goto LABEL_18;
case 0x113u:
v7 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v7);
return 0;
}
if ( Msg != 513 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
v5 = GetDlgItem(hWnd, 1056);
if ( local_GetBottomRect(hWnd, v5, (unsigned short)lParam, (unsigned int)lParam >> 16) )
{
LABEL_18:
v4 = 1;
goto LABEL_11;
}
v6 = GetDlgItem(hWnd, 1054);
if ( local_GetBottomRect(hWnd, v6, (unsigned short)lParam, (unsigned int)lParam >> 16) )
{
v4 = 2;
LABEL_11:
EntName_SetCharName(hWnd, v4);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
v4 = 2;
if (Msg == 2) {
EntName_DelEntNameMsgs(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg <= 0x103)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg <= 0x105) {
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
switch (Msg) {
case 0x110u:
entname_charname = (char *)lParam;
EntName_LoadFocusChkName(hWnd);
return 0;
case 0x111u:
if ((unsigned short)wParam != 1) {
if ((unsigned short)wParam != 2) {
if ((unsigned short)wParam == 1065)
EntName_GetMessageName(hWnd, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_11;
}
goto LABEL_18;
case 0x113u:
v7 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v7);
return 0;
}
if (Msg != 513)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
v5 = GetDlgItem(hWnd, 1056);
if (local_GetBottomRect(hWnd, v5, (unsigned short)lParam, (unsigned int)lParam >> 16)) {
LABEL_18:
v4 = 1;
goto LABEL_11;
}
v6 = GetDlgItem(hWnd, 1054);
if (local_GetBottomRect(hWnd, v6, (unsigned short)lParam, (unsigned int)lParam >> 16)) {
v4 = 2;
LABEL_11:
EntName_SetCharName(hWnd, v4);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x1000709E
void __fastcall EntName_DelEntNameMsgs(HWND hWnd)
{
HWND v2; // eax
HWND v2; // eax
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(hWnd, entname_msgtbl3);
Doom_DeleteFreeProcs(hWnd, entname_msgtbl2);
Doom_DeleteFreeProcs(hWnd, entname_msgtbl1);
v2 = GetParent(hWnd);
SelHero_SetStringWithMsg(v2, 0);
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(hWnd, entname_msgtbl3);
Doom_DeleteFreeProcs(hWnd, entname_msgtbl2);
Doom_DeleteFreeProcs(hWnd, entname_msgtbl1);
v2 = GetParent(hWnd);
SelHero_SetStringWithMsg(v2, 0);
}
// ref: 0x100070DB
void __fastcall EntName_LoadFocusChkName(HWND hWnd)
{
HWND v2; // edi
LONG v3; // eax
HWND v4; // ebx
char Buffer[32]; // [esp+Ch] [ebp-20h]
HWND v2; // edi
LONG v3; // eax
HWND v4; // ebx
char Buffer[32]; // [esp+Ch] [ebp-20h]
v2 = GetParent(hWnd);
if ( SelHero_GetHeroIsGood() == 1 )
LoadStringA(ghUiInst, 0x20u, Buffer, 31);
else
LoadStringA(ghUiInst, 0x1Fu, Buffer, 31);
SelHero_SetStringWithMsg(v2, Buffer);
v3 = GetWindowLongA(v2, -21);
SetWindowLongA(hWnd, -21, v3);
Doom_ParseWndProc3(hWnd, entname_msgtbl1, 5);
Doom_ParseWndProcs(hWnd, entname_msgtbl2, 4, 0);
Doom_ParseWndProc5(hWnd, entname_msgtbl3, 2);
Focus_LoadSpinner("ui_art\\focus.pcx");
SDlgSetTimer((int)hWnd, 1, 55, 0);
v4 = GetDlgItem(hWnd, 1065);
SendMessageA(v4, 0x401u, 0xFu, 0);
if ( SelHero_GetHeroIsGood() == 1 )
SendMessageA(v4, 0x404u, 0, (LPARAM)" ,<>%&\\\"?*#/");
v2 = GetParent(hWnd);
if (SelHero_GetHeroIsGood() == 1)
LoadStringA(ghUiInst, 0x20u, Buffer, 31);
else
LoadStringA(ghUiInst, 0x1Fu, Buffer, 31);
SelHero_SetStringWithMsg(v2, Buffer);
v3 = GetWindowLongA(v2, -21);
SetWindowLongA(hWnd, -21, v3);
Doom_ParseWndProc3(hWnd, entname_msgtbl1, 5);
Doom_ParseWndProcs(hWnd, entname_msgtbl2, 4, 0);
Doom_ParseWndProc5(hWnd, entname_msgtbl3, 2);
Focus_LoadSpinner("ui_art\\focus.pcx");
SDlgSetTimer((int)hWnd, 1, 55, 0);
v4 = GetDlgItem(hWnd, 1065);
SendMessageA(v4, 0x401u, 0xFu, 0);
if (SelHero_GetHeroIsGood() == 1)
SendMessageA(v4, 0x404u, 0, (LPARAM) " ,<>%&\\\"?*#/");
}
// ref: 0x100071AC
void __fastcall EntName_SetCharName(HWND hWnd, int a2)
{
char *v4; // ST08_4
HWND v5; // eax
char *v4; // ST08_4
HWND v5; // eax
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
v4 = entname_charname;
v5 = GetDlgItem(hWnd, 1065);
GetWindowTextA(v5, v4, 16);
entname_charname[15] = 0;
SDlgEndDialog(hWnd, (HANDLE)a2);
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
v4 = entname_charname;
v5 = GetDlgItem(hWnd, 1065);
GetWindowTextA(v5, v4, 16);
entname_charname[15] = 0;
SDlgEndDialog(hWnd, (HANDLE)a2);
}
// ref: 0x100071ED
void __fastcall EntName_GetMessageName(HWND hWnd, unsigned int a2, int a3)
{
unsigned int v3; // edx
HWND v5; // eax
unsigned int v3; // edx
HWND v5; // eax
v3 = (a2 >> 16) - 1;
if ( v3 )
{
if ( v3 == 2 )
Doom_ParseWndProc6(hWnd, entname_msgtbl3, 2);
}
else
{
v5 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v5);
}
v3 = (a2 >> 16) - 1;
if (v3) {
if (v3 == 2)
Doom_ParseWndProc6(hWnd, entname_msgtbl3, 2);
} else {
v5 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v5);
}
}
// ref: 0x10007220
void __cdecl EntName_cpp_init()
{
EntName_cpp_float = EntName_cpp_float_value;
EntName_cpp_float = EntName_cpp_float_value;
}
// 1001F424: using guessed type int EntName_cpp_float_value;
// 10029860: using guessed type int EntName_cpp_float;

185
DiabloUI/fade.cpp

@ -1,157 +1,140 @@
// ref: 0x1000722B
void __fastcall Fade_ApplyPaletteRange(int range1, int range2)
{
tagPALETTEENTRY *v4; // eax MAPDST
BYTE *v6; // esi
BYTE v7; // al
tagPALETTEENTRY *v4; // eax MAPDST
BYTE *v6; // esi
BYTE v7; // al
v4 = local_GetArtPalEntry(0);
if ( range1 == range2 )
{
memcpy(fadepal, v4, 0x400u);
}
else if ( range2 )
{
v6 = &fadepal[0].peGreen;
do
{
v7 = range2 * v4->peRed / range1;
++v4;
*(v6 - 1) = v7;
*v6 = range2 * v4[-1].peGreen / range1;
v6 += 4;
*(v6 - 3) = range2 * v4[-1].peBlue / range1;
}
while ( (signed int)v6 < (signed int)&fadepal[256].peGreen );
}
else
{
memcpy(fadepal, v4, 0x400u);
local_ClearPalette(fadepal);
}
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
v4 = local_GetArtPalEntry(0);
if (range1 == range2) {
memcpy(fadepal, v4, 0x400u);
} else if (range2) {
v6 = &fadepal[0].peGreen;
do {
v7 = range2 * v4->peRed / range1;
++v4;
*(v6 - 1) = v7;
*v6 = range2 * v4[-1].peGreen / range1;
v6 += 4;
*(v6 - 3) = range2 * v4[-1].peBlue / range1;
} while ((signed int)v6 < (signed int)&fadepal[256].peGreen);
} else {
memcpy(fadepal, v4, 0x400u);
local_ClearPalette(fadepal);
}
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
}
// ref: 0x100072BE
void __fastcall Fade_UpdatePaletteRange(int range)
{
tagPALETTEENTRY *v2; // eax
tagPALETTEENTRY *v3; // edi
BYTE *v4; // ecx
BYTE v5; // al
HPALETTE v6; // ebx
int v7; // [esp+10h] [ebp-4h]
tagPALETTEENTRY *v2; // eax
tagPALETTEENTRY *v3; // edi
BYTE *v4; // ecx
BYTE v5; // al
HPALETTE v6; // ebx
int v7; // [esp+10h] [ebp-4h]
v2 = local_GetArtPalEntry(0);
memcpy(fadepal, v2, 0x400u);
if ( range > 0 )
{
v7 = range;
do
{
v3 = local_GetArtPalEntry(0);
v4 = &fadepal[0].peGreen;
do
{
v5 = v3->peRed / range;
++v3;
*(v4 - 1) -= v5;
*v4 -= v3[-1].peGreen / range;
v4 += 4;
*(v4 - 3) -= v3[-1].peBlue / range;
}
while ( (signed int)v4 < (signed int)&fadepal[256].peGreen );
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
--v7;
}
while ( v7 );
}
local_ClearPalette(fadepal);
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
local_SetCursorDefault();
SDrawClearSurface(0);
v6 = (HPALETTE)GetStockObject(15);
GetPaletteEntries(v6, 0, 0xAu, fadepal);
GetPaletteEntries(v6, 0xAu, 0xAu, &fadepal[246]);
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
v2 = local_GetArtPalEntry(0);
memcpy(fadepal, v2, 0x400u);
if (range > 0) {
v7 = range;
do {
v3 = local_GetArtPalEntry(0);
v4 = &fadepal[0].peGreen;
do {
v5 = v3->peRed / range;
++v3;
*(v4 - 1) -= v5;
*v4 -= v3[-1].peGreen / range;
v4 += 4;
*(v4 - 3) -= v3[-1].peBlue / range;
} while ((signed int)v4 < (signed int)&fadepal[256].peGreen);
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
--v7;
} while (v7);
}
local_ClearPalette(fadepal);
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
local_SetCursorDefault();
SDrawClearSurface(0);
v6 = (HPALETTE)GetStockObject(15);
GetPaletteEntries(v6, 0, 0xAu, fadepal);
GetPaletteEntries(v6, 0xAu, 0xAu, &fadepal[246]);
SDrawUpdatePalette(0, 0x100u, fadepal, 1);
}
// 1001043C: using guessed type int __stdcall SDrawClearSurface(_DWORD);
// ref: 0x1000739F
BOOL __cdecl Fade_CheckRange5()
{
BOOL result; // eax
BOOL result; // eax
result = 0;
if ( sgbIsFading )
{
if ( sgbFadeRange <= 5 )
result = 1;
}
return result;
result = 0;
if (sgbIsFading) {
if (sgbFadeRange <= 5)
result = 1;
}
return result;
}
// 10029C70: using guessed type int sgbIsFading;
// ref: 0x100073B4
void __cdecl Fade_Range5SetZero()
{
if ( Fade_CheckRange5() )
sgbIsFading = 0;
if (Fade_CheckRange5())
sgbIsFading = 0;
}
// 10029C70: using guessed type int sgbIsFading;
// ref: 0x100073C5
void __fastcall Fade_NoInputAndArt(HWND hWnd, BOOL bShowCurs)
{
HWND v3; // eax
HWND v3; // eax
v3 = GetParent(hWnd);
local_DisableKeyWaitMouse(v3);
if ( bShowCurs )
local_SetCursorArt();
sgbIsFading = 0;
sgbFadeRange = 0;
v3 = GetParent(hWnd);
local_DisableKeyWaitMouse(v3);
if (bShowCurs)
local_SetCursorArt();
sgbIsFading = 0;
sgbFadeRange = 0;
}
// 10029C70: using guessed type int sgbIsFading;
// ref: 0x100073EF
void __fastcall Fade_SetInputWindow(HWND hWnd)
{
HWND v1; // eax
HWND v1; // eax
v1 = GetParent(hWnd);
local_DisableKeyWaitMouse(v1);
v1 = GetParent(hWnd);
local_DisableKeyWaitMouse(v1);
}
// ref: 0x100073FD
void __fastcall Fade_SetFadeTimer(int nTime)
{
if ( !sgbIsFading )
{
SDlgSetTimer(nTime, 16, 50, Fade_TimerFunctionDlg);
sgbIsFading = 1;
}
if (!sgbIsFading) {
SDlgSetTimer(nTime, 16, 50, Fade_TimerFunctionDlg);
sgbIsFading = 1;
}
}
// 10029C70: using guessed type int sgbIsFading;
// ref: 0x10007420
void __stdcall Fade_TimerFunctionDlg(int a1, int a2, int a3, int a4)
{
if ( sgbFadeRange > 5 )
{
SDlgKillTimer(a1, 16);
}
else
{
Fade_ApplyPaletteRange(5, sgbFadeRange);
++sgbFadeRange;
}
if (sgbFadeRange > 5) {
SDlgKillTimer(a1, 16);
} else {
Fade_ApplyPaletteRange(5, sgbFadeRange);
++sgbFadeRange;
}
}
// ref: 0x1000744D
void __cdecl Fade_cpp_init()
{
fade_cpp_float = fade_cpp_float_value;
fade_cpp_float = fade_cpp_float_value;
}
// 1001F428: using guessed type int fade_cpp_float_value;
// 10029868: using guessed type int fade_cpp_float;

310
DiabloUI/focus.cpp

@ -1,12 +1,11 @@
// ref: 0x10007458
void __fastcall Focus_CheckPlayMove(LPARAM lParam)
{
if ( sgbSpinnersLoaded && lParam != dword_10029CA8 )
{
if ( dword_10029CAC )
TitleSnd_PlayMoveSound();
dword_10029CA8 = lParam;
}
if (sgbSpinnersLoaded && lParam != dword_10029CA8) {
if (dword_10029CAC)
TitleSnd_PlayMoveSound();
dword_10029CA8 = lParam;
}
}
// 10029CA4: using guessed type int sgbSpinnersLoaded;
// 10029CA8: using guessed type int dword_10029CA8;
@ -15,115 +14,112 @@ void __fastcall Focus_CheckPlayMove(LPARAM lParam)
// ref: 0x10007482
int __cdecl Focus_GetSpinWidthOrZero()
{
return sgbSpinnersLoaded != 0 ? focus_spin_width : 0;
return sgbSpinnersLoaded != 0 ? focus_spin_width : 0;
}
// 10029CA4: using guessed type int sgbSpinnersLoaded;
// ref: 0x10007492
void __fastcall Focus_BlitSpinner(HWND hWnd1, HWND hWnd2)
{
_DWORD *v2; // edi
LONG v3; // eax MAPDST
int v5; // eax MAPDST
int v7; // eax
struct tagRECT Rect; // [esp+8h] [ebp-18h]
char *v9; // [esp+18h] [ebp-8h]
v9 = (char *)hWnd1;
v2 = (_DWORD *)GetWindowLongA(hWnd1, -21);
v3 = GetWindowLongA(hWnd2, -21);
if ( v2 && v3 && *v2 )
{
if ( *(_DWORD *)v3 )
{
GetWindowRect(hWnd2, &Rect);
ScreenToClient((HWND)v9, (LPPOINT)&Rect);
ScreenToClient((HWND)v9, (LPPOINT)&Rect.right);
SBltROP3(
*(void **)v3,
(void *)(Rect.left + *v2 + Rect.top * v2[1]),
focus_spin_width,
*(_DWORD *)(v3 + 8),
*(_DWORD *)(v3 + 4),
v2[1],
0,
0xCC0020u);
v5 = v2[1];
v7 = *v2 + Rect.top * v5;
v9 = *(char **)(v3 + 4);
SBltROP3(
&v9[*(_DWORD *)v3 - focus_spin_width],
&v9[v7 - focus_spin_width + Rect.left],
focus_spin_width,
*(_DWORD *)(v3 + 8),
(int)v9,
v5,
0,
0xCC0020u);
Focus_CenterSpinFromSide(hWnd2);
}
}
_DWORD *v2; // edi
LONG v3; // eax MAPDST
int v5; // eax MAPDST
int v7; // eax
struct tagRECT Rect; // [esp+8h] [ebp-18h]
char *v9; // [esp+18h] [ebp-8h]
v9 = (char *)hWnd1;
v2 = (_DWORD *)GetWindowLongA(hWnd1, -21);
v3 = GetWindowLongA(hWnd2, -21);
if (v2 && v3 && *v2) {
if (*(_DWORD *)v3) {
GetWindowRect(hWnd2, &Rect);
ScreenToClient((HWND)v9, (LPPOINT)&Rect);
ScreenToClient((HWND)v9, (LPPOINT)&Rect.right);
SBltROP3(
*(void **)v3,
(void *)(Rect.left + *v2 + Rect.top * v2[1]),
focus_spin_width,
*(_DWORD *)(v3 + 8),
*(_DWORD *)(v3 + 4),
v2[1],
0,
0xCC0020u);
v5 = v2[1];
v7 = *v2 + Rect.top * v5;
v9 = *(char **)(v3 + 4);
SBltROP3(
&v9[*(_DWORD *)v3 - focus_spin_width],
&v9[v7 - focus_spin_width + Rect.left],
focus_spin_width,
*(_DWORD *)(v3 + 8),
(int)v9,
v5,
0,
0xCC0020u);
Focus_CenterSpinFromSide(hWnd2);
}
}
}
// ref: 0x10007566
void __fastcall Focus_CenterSpinFromSide(HWND hWnd)
{
struct tagRECT Rect; // [esp+8h] [ebp-10h]
GetClientRect(hWnd, &Rect);
--Rect.bottom;
Rect.left = --Rect.right - focus_spin_width;
InvalidateRect(hWnd, &Rect, 0);
Rect.left = 0;
Rect.right = focus_spin_width - 1;
InvalidateRect(hWnd, &Rect, 0);
struct tagRECT Rect; // [esp+8h] [ebp-10h]
GetClientRect(hWnd, &Rect);
--Rect.bottom;
Rect.left = --Rect.right - focus_spin_width;
InvalidateRect(hWnd, &Rect, 0);
Rect.left = 0;
Rect.right = focus_spin_width - 1;
InvalidateRect(hWnd, &Rect, 0);
}
// ref: 0x100075B7
void __fastcall Focus_GetAndBlitSpin(HWND hWnd, LPARAM lParam)
{
HWND v2; // esi
HWND v2; // esi
v2 = (HWND)lParam;
GetWindowLongA((HWND)lParam, -12);
Focus_BlitSpinner(hWnd, v2);
dword_10029CAC = 1;
v2 = (HWND)lParam;
GetWindowLongA((HWND)lParam, -12);
Focus_BlitSpinner(hWnd, v2);
dword_10029CAC = 1;
}
// 10029CAC: using guessed type int dword_10029CAC;
// ref: 0x100075DC
BOOL __fastcall Focus_DoBlitSpinIncFrame(HWND hWnd1, HWND hWnd2)
{
void **v4; // eax
void **v5; // esi
int v7; // edi
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
if ( !sgbSpinnersLoaded )
return 0;
if ( !hWnd2 )
return 0;
GetWindowLongA(hWnd2, -12);
if ( hWnd1 != GetParent(hWnd2) )
return 0;
Focus_BlitSpinner(hWnd1, hWnd2);
v4 = (void **)GetWindowLongA(hWnd2, -21);
v5 = v4;
if ( !v4 || !*v4 )
return 0;
GetWindowRect(hWnd2, &Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect.right);
if ( SpinnerTransOut[sgnSpinnerFrame] )
{
v7 = ((signed int)v5[2] - focus_spin_height) / 2;
STransBlt(*v5, 0, v7, (int)v5[1], SpinnerTransOut[sgnSpinnerFrame]);
STransBlt(*v5, (int)v5[1] - focus_spin_width, v7, (int)v5[1], SpinnerTransOut[sgnSpinnerFrame]);
Focus_CenterSpinFromSide(hWnd2);
}
if ( ++sgnSpinnerFrame >= 8 )
sgnSpinnerFrame = 0;
return 1;
void **v4; // eax
void **v5; // esi
int v7; // edi
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
if (!sgbSpinnersLoaded)
return 0;
if (!hWnd2)
return 0;
GetWindowLongA(hWnd2, -12);
if (hWnd1 != GetParent(hWnd2))
return 0;
Focus_BlitSpinner(hWnd1, hWnd2);
v4 = (void **)GetWindowLongA(hWnd2, -21);
v5 = v4;
if (!v4 || !*v4)
return 0;
GetWindowRect(hWnd2, &Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect);
ScreenToClient(hWnd1, (LPPOINT)&Rect.right);
if (SpinnerTransOut[sgnSpinnerFrame]) {
v7 = ((signed int)v5[2] - focus_spin_height) / 2;
STransBlt(*v5, 0, v7, (int)v5[1], SpinnerTransOut[sgnSpinnerFrame]);
STransBlt(*v5, (int)v5[1] - focus_spin_width, v7, (int)v5[1], SpinnerTransOut[sgnSpinnerFrame]);
Focus_CenterSpinFromSide(hWnd2);
}
if (++sgnSpinnerFrame >= 8)
sgnSpinnerFrame = 0;
return 1;
}
// 10029C9C: using guessed type int focus_spin_height;
// 10029CA4: using guessed type int sgbSpinnersLoaded;
@ -132,22 +128,19 @@ BOOL __fastcall Focus_DoBlitSpinIncFrame(HWND hWnd1, HWND hWnd2)
// ref: 0x100076C3
void __cdecl Focus_DeleteSpinners()
{
HANDLE *v0; // esi
v0 = SpinnerTransOut;
do
{
if ( *v0 )
{
STransDelete(*v0);
*v0 = 0;
}
++v0;
}
while ( (signed int)v0 < (signed int)&SpinnerTransOut[8] );
dword_10029CAC = 0;
dword_10029CA8 = 0;
sgbSpinnersLoaded = 0;
HANDLE *v0; // esi
v0 = SpinnerTransOut;
do {
if (*v0) {
STransDelete(*v0);
*v0 = 0;
}
++v0;
} while ((signed int)v0 < (signed int)&SpinnerTransOut[8]);
dword_10029CAC = 0;
dword_10029CA8 = 0;
sgbSpinnersLoaded = 0;
}
// 10029CA4: using guessed type int sgbSpinnersLoaded;
// 10029CA8: using guessed type int dword_10029CA8;
@ -156,8 +149,8 @@ void __cdecl Focus_DeleteSpinners()
// ref: 0x100076FA
void __cdecl Focus_ResetSpinToZero()
{
dword_10029CAC = 0;
dword_10029CA8 = 0;
dword_10029CAC = 0;
dword_10029CA8 = 0;
}
// 10029CA8: using guessed type int dword_10029CA8;
// 10029CAC: using guessed type int dword_10029CAC;
@ -165,7 +158,7 @@ void __cdecl Focus_ResetSpinToZero()
// ref: 0x1000770E
void __cdecl Focus_cpp_init()
{
focus_cpp_float = focus_cpp_float_value;
focus_cpp_float = focus_cpp_float_value;
}
// 1001F42C: using guessed type int focus_cpp_float_value;
// 10029CA0: using guessed type int focus_cpp_float;
@ -173,48 +166,45 @@ void __cdecl Focus_cpp_init()
// ref: 0x10007719
void __fastcall Focus_LoadSpinner(const char *pszFileName)
{
HANDLE *v1; // esi
int v2; // ecx
int v3; // eax
int v4; // ebx
int a5[4]; // [esp+4h] [ebp-1Ch]
DWORD data[2]; // [esp+14h] [ebp-Ch]
BYTE *pBuffer; // [esp+1Ch] [ebp-4h]
if ( !sgbSpinnersLoaded )
{
pBuffer = 0;
dword_10029CAC = 0;
dword_10029CA8 = 0;
local_LoadArtImage(pszFileName, &pBuffer, data);
v1 = SpinnerTransOut;
memset(SpinnerTransOut, 0, 0x20u);
if ( pBuffer )
{
v2 = data[0];
focus_spin_width = data[0];
v3 = (signed int)data[1] / 8;
v4 = 0;
focus_spin_height = (signed int)data[1] / 8;
while ( 1 )
{
a5[2] = v2 - 1;
a5[1] = v4 * v3;
a5[0] = 0;
a5[3] = v3 + v4 * v3 - 1;
STransCreateI(pBuffer, v2, v3, 8, (int)a5, 16777466, v1);
++v1;
++v4;
if ( (signed int)v1 >= (signed int)&SpinnerTransOut[8] )
break;
v3 = focus_spin_height;
v2 = focus_spin_width;
}
SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\Focus.cpp", 246, 0);
}
sgnSpinnerFrame = 0;
sgbSpinnersLoaded = 1;
}
HANDLE *v1; // esi
int v2; // ecx
int v3; // eax
int v4; // ebx
int a5[4]; // [esp+4h] [ebp-1Ch]
DWORD data[2]; // [esp+14h] [ebp-Ch]
BYTE *pBuffer; // [esp+1Ch] [ebp-4h]
if (!sgbSpinnersLoaded) {
pBuffer = 0;
dword_10029CAC = 0;
dword_10029CA8 = 0;
local_LoadArtImage(pszFileName, &pBuffer, data);
v1 = SpinnerTransOut;
memset(SpinnerTransOut, 0, 0x20u);
if (pBuffer) {
v2 = data[0];
focus_spin_width = data[0];
v3 = (signed int)data[1] / 8;
v4 = 0;
focus_spin_height = (signed int)data[1] / 8;
while (1) {
a5[2] = v2 - 1;
a5[1] = v4 * v3;
a5[0] = 0;
a5[3] = v3 + v4 * v3 - 1;
STransCreateI(pBuffer, v2, v3, 8, (int)a5, 16777466, v1);
++v1;
++v4;
if ((signed int)v1 >= (signed int)&SpinnerTransOut[8])
break;
v3 = focus_spin_height;
v2 = focus_spin_width;
}
SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\Focus.cpp", 246, 0);
}
sgnSpinnerFrame = 0;
sgbSpinnersLoaded = 1;
}
}
// 10029C9C: using guessed type int focus_spin_height;
// 10029CA4: using guessed type int sgbSpinnersLoaded;
@ -225,22 +215,22 @@ void __fastcall Focus_LoadSpinner(const char *pszFileName)
// ref: 0x100077E9
void __fastcall Focus_SetFocusTimer(HWND hWnd, const char *pszFileName)
{
Focus_LoadSpinner(pszFileName);
SDlgSetTimer((int)hWnd, 1, 55, Focus_SetFocusAndBlit);
Focus_LoadSpinner(pszFileName);
SDlgSetTimer((int)hWnd, 1, 55, Focus_SetFocusAndBlit);
}
// ref: 0x10007804
void __stdcall Focus_SetFocusAndBlit(int hWnd, int a2, int a3, int a4)
{
HWND v1; // eax
HWND v1; // eax
v1 = GetFocus();
Focus_DoBlitSpinIncFrame((HWND)hWnd, v1);
v1 = GetFocus();
Focus_DoBlitSpinIncFrame((HWND)hWnd, v1);
}
// ref: 0x10007818
void __fastcall Focus_KillFocusTimer(HWND hWnd)
{
SDlgKillTimer((int)hWnd, 1);
Focus_DeleteSpinners();
SDlgKillTimer((int)hWnd, 1);
Focus_DeleteSpinners();
}

788
DiabloUI/local.cpp

@ -1,272 +1,251 @@
// ref: 0x10007825
void __cdecl local_InitUiPalette()
{
LOGPALETTE *v0; // eax MAPDST
PALETTEENTRY *v2; // eax
int v3; // ecx
v0 = (LOGPALETTE *)SMemAlloc(0x404u, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 27, 0);
if ( v0 )
{
v0->palVersion = 768;
v0->palNumEntries = 256;
v2 = v0->palPalEntry;
v3 = 0;
do
{
v2[v3].peFlags = 2;
++v3;
}
while ( v3 < 256 );
objPalette = CreatePalette(v0);
SMemFree(v0, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 41, 0);
}
LOGPALETTE *v0; // eax MAPDST
PALETTEENTRY *v2; // eax
int v3; // ecx
v0 = (LOGPALETTE *)SMemAlloc(0x404u, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 27, 0);
if (v0) {
v0->palVersion = 768;
v0->palNumEntries = 256;
v2 = v0->palPalEntry;
v3 = 0;
do {
v2[v3].peFlags = 2;
++v3;
} while (v3 < 256);
objPalette = CreatePalette(v0);
SMemFree(v0, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 41, 0);
}
}
// ref: 0x1000787D
void __cdecl local_DelUiPalette()
{
if ( objPalette )
{
DeleteObject(objPalette);
objPalette = 0;
}
if (objPalette) {
DeleteObject(objPalette);
objPalette = 0;
}
}
// ref: 0x10007895
tagPALETTEENTRY *__fastcall local_GetArtPalEntry(int entry)
{
return &artpal[entry];
return &artpal[entry];
}
// ref: 0x1000789D
void __fastcall local_ClearPalette(PALETTEENTRY *pPal)
{
BYTE *v1; // eax
signed int v2; // ecx
v1 = &pPal->peBlue;
v2 = 256;
do
{
*(v1 - 2) = 0;
*(v1 - 1) = 0;
*v1 = 0;
v1 += 4;
--v2;
}
while ( v2 );
BYTE *v1; // eax
signed int v2; // ecx
v1 = &pPal->peBlue;
v2 = 256;
do {
*(v1 - 2) = 0;
*(v1 - 1) = 0;
*v1 = 0;
v1 += 4;
--v2;
} while (v2);
}
// ref: 0x100078B6
void __cdecl local_ClearSurface()
{
SDrawClearSurface(0);
SDrawClearSurface(0);
}
// 1001043C: using guessed type int __stdcall SDrawClearSurface(_DWORD);
// ref: 0x100078BE
BOOL __fastcall local_LoadArtImage(const char *pszFileName, BYTE **pBuffer, DWORD *pdwSize)
{
BYTE *v4; // eax
DWORD v5; // ecx
DWORD dwHeight; // [esp+10h] [ebp-8h]
DWORD dwWidth; // [esp+14h] [ebp-4h]
*pBuffer = 0;
if ( !SBmpLoadImage(pszFileName, 0, 0, 0, &dwWidth, &dwHeight, 0) )
return 0;
v4 = (BYTE *)SMemAlloc(dwHeight * dwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 93, 0);
v5 = dwWidth;
*pBuffer = v4;
if ( !SBmpLoadImage(pszFileName, 0, v4, dwHeight * v5, 0, 0, 0) )
{
SMemFree(*pBuffer, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 95, 0);
*pBuffer = 0;
return 0;
}
if ( pdwSize )
{
*pdwSize = dwWidth;
pdwSize[1] = dwHeight;
}
return 1;
BYTE *v4; // eax
DWORD v5; // ecx
DWORD dwHeight; // [esp+10h] [ebp-8h]
DWORD dwWidth; // [esp+14h] [ebp-4h]
*pBuffer = 0;
if (!SBmpLoadImage(pszFileName, 0, 0, 0, &dwWidth, &dwHeight, 0))
return 0;
v4 = (BYTE *)SMemAlloc(dwHeight * dwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 93, 0);
v5 = dwWidth;
*pBuffer = v4;
if (!SBmpLoadImage(pszFileName, 0, v4, dwHeight * v5, 0, 0, 0)) {
SMemFree(*pBuffer, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 95, 0);
*pBuffer = 0;
return 0;
}
if (pdwSize) {
*pdwSize = dwWidth;
pdwSize[1] = dwHeight;
}
return 1;
}
// ref: 0x10007944
BOOL __fastcall local_LoadArtWithPal(HWND hWnd, int a2, char *src, int mask, int flags, const char *pszFileName, BYTE **pBuffer, DWORD *pdwSize, BOOL a9)
{
BYTE *v10; // eax
DWORD v11; // ST18_4
HPALETTE v13; // edi
tagPALETTEENTRY pPalEntries[256]; // [esp+Ch] [ebp-40Ch]
DWORD pdwWidth; // [esp+410h] [ebp-8h]
DWORD dwHeight; // [esp+414h] [ebp-4h]
if ( !SBmpLoadImage(pszFileName, 0, 0, 0, &pdwWidth, &dwHeight, 0) )
return 0;
v10 = (BYTE *)SMemAlloc(dwHeight * pdwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 129, 0);
v11 = dwHeight * pdwWidth;
*pBuffer = v10;
if ( !SBmpLoadImage(pszFileName, pPalEntries, v10, v11, 0, 0, 0)
|| !SDlgSetBitmapI(hWnd, a2, src, mask, flags, *pBuffer, 0, pdwWidth, dwHeight, -1) )
{
return 0;
}
if ( !src || !*src )
{
v13 = (HPALETTE)GetStockObject(15);
GetPaletteEntries(v13, 0, 0xAu, pPalEntries);
GetPaletteEntries(v13, 0xAu, 0xAu, &pPalEntries[246]);
memcpy(artpal, pPalEntries, 0x400u);
if ( a9 )
{
SDrawUpdatePalette(0, 255, artpal, 1);
}
else
{
local_ClearPalette(pPalEntries);
SDrawUpdatePalette(0, 256, pPalEntries, 1);
}
}
if ( pdwSize )
{
*pdwSize = pdwWidth;
pdwSize[1] = dwHeight;
}
return 1;
BYTE *v10; // eax
DWORD v11; // ST18_4
HPALETTE v13; // edi
tagPALETTEENTRY pPalEntries[256]; // [esp+Ch] [ebp-40Ch]
DWORD pdwWidth; // [esp+410h] [ebp-8h]
DWORD dwHeight; // [esp+414h] [ebp-4h]
if (!SBmpLoadImage(pszFileName, 0, 0, 0, &pdwWidth, &dwHeight, 0))
return 0;
v10 = (BYTE *)SMemAlloc(dwHeight * pdwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 129, 0);
v11 = dwHeight * pdwWidth;
*pBuffer = v10;
if (!SBmpLoadImage(pszFileName, pPalEntries, v10, v11, 0, 0, 0)
|| !SDlgSetBitmapI(hWnd, a2, src, mask, flags, *pBuffer, 0, pdwWidth, dwHeight, -1)) {
return 0;
}
if (!src || !*src) {
v13 = (HPALETTE)GetStockObject(15);
GetPaletteEntries(v13, 0, 0xAu, pPalEntries);
GetPaletteEntries(v13, 0xAu, 0xAu, &pPalEntries[246]);
memcpy(artpal, pPalEntries, 0x400u);
if (a9) {
SDrawUpdatePalette(0, 255, artpal, 1);
} else {
local_ClearPalette(pPalEntries);
SDrawUpdatePalette(0, 256, pPalEntries, 1);
}
}
if (pdwSize) {
*pdwSize = pdwWidth;
pdwSize[1] = dwHeight;
}
return 1;
}
// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(_DWORD, _DWORD, _DWORD, _DWORD);
// ref: 0x10007A68
void __fastcall local_AdjustRectSize(tagRECT *pRect, int a2, int a3)
{
int v3; // eax
int v4; // edx
v3 = a2 - pRect->left;
pRect->left = a2;
pRect->right += v3 - 1;
v4 = a3 - pRect->top;
pRect->top = a3;
pRect->bottom += v4 - 1;
int v3; // eax
int v4; // edx
v3 = a2 - pRect->left;
pRect->left = a2;
pRect->right += v3 - 1;
v4 = a3 - pRect->top;
pRect->top = a3;
pRect->bottom += v4 - 1;
}
// ref: 0x10007A85
BOOL __fastcall local_SetStaticBmp(HWND hWnd, int nIDDlgItem, BYTE *pBuffer, DWORD *pdwSize)
{
HWND v4; // edi
HWND v5; // ebx
struct tagRECT Rect; // [esp+Ch] [ebp-10h]
v4 = hWnd;
v5 = GetDlgItem(hWnd, nIDDlgItem);
GetWindowRect(v5, &Rect);
ScreenToClient(v4, (LPPOINT)&Rect);
ScreenToClient(v4, (LPPOINT)&Rect.right);
SDlgSetBitmapI(v5, 0, "Static", -1, 1, pBuffer, (int)&Rect, *pdwSize, pdwSize[1], -1);
return 1;
HWND v4; // edi
HWND v5; // ebx
struct tagRECT Rect; // [esp+Ch] [ebp-10h]
v4 = hWnd;
v5 = GetDlgItem(hWnd, nIDDlgItem);
GetWindowRect(v5, &Rect);
ScreenToClient(v4, (LPPOINT)&Rect);
ScreenToClient(v4, (LPPOINT)&Rect.right);
SDlgSetBitmapI(v5, 0, "Static", -1, 1, pBuffer, (int)&Rect, *pdwSize, pdwSize[1], -1);
return 1;
}
// ref: 0x10007AEA
void __cdecl local_cpp_init()
{
local_cpp_float = 0x7F800000;
local_cpp_float = 0x7F800000;
}
// 10029CB8: using guessed type int local_cpp_float;
// ref: 0x10007AF5
BOOL __fastcall local_SetButtonBmp(HWND hWnd, int flags, int a7, void *pBuffer, DWORD *pdwSize)
{
return SDlgSetBitmapI(hWnd, 0, "Button", -1, flags, pBuffer, a7, *pdwSize, pdwSize[1], -1);
return SDlgSetBitmapI(hWnd, 0, "Button", -1, flags, pBuffer, a7, *pdwSize, pdwSize[1], -1);
}
// ref: 0x10007B1B
void __fastcall local_FitButtonDlg(HWND hWnd, int *a2, void *pBuffer, DWORD *pdwSize)
{
int v4; // eax
HWND v5; // esi
struct tagRECT Rect; // [esp+0h] [ebp-1Ch]
int a3; // [esp+14h] [ebp-8h]
int *v9; // [esp+18h] [ebp-4h]
v4 = *a2;
a3 = 0;
v9 = a2;
if ( v4 )
{
do
{
v5 = GetDlgItem(hWnd, v4);
if ( v5 )
{
GetClientRect(v5, &Rect);
local_AdjustRectSize(&Rect, 0, a3);
local_SetButtonBmp(v5, 16, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 64, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 32, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 128, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 1280, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
a3 = Rect.bottom;
}
++v9;
v4 = *v9;
}
while ( *v9 );
}
int v4; // eax
HWND v5; // esi
struct tagRECT Rect; // [esp+0h] [ebp-1Ch]
int a3; // [esp+14h] [ebp-8h]
int *v9; // [esp+18h] [ebp-4h]
v4 = *a2;
a3 = 0;
v9 = a2;
if (v4) {
do {
v5 = GetDlgItem(hWnd, v4);
if (v5) {
GetClientRect(v5, &Rect);
local_AdjustRectSize(&Rect, 0, a3);
local_SetButtonBmp(v5, 16, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 64, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 32, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 128, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
local_AdjustRectSize(&Rect, 0, Rect.bottom);
local_SetButtonBmp(v5, 1280, (int)&Rect, pBuffer, pdwSize);
++Rect.bottom;
++Rect.right;
a3 = Rect.bottom;
}
++v9;
v4 = *v9;
} while (*v9);
}
}
// ref: 0x10007C2E
void __fastcall local_SetWhiteText(HDC hdc)
{
SetTextColor(hdc, 0xFFFFu);
SetTextColor(hdc, 0xFFFFu);
}
// ref: 0x10007C3B
BOOL __fastcall local_GetBottomRect(HWND hWnd1, HWND hWnd2, int width, int height)
{
BOOL result; // eax
struct tagRECT Rect; // [esp+4h] [ebp-10h]
if ( hWnd1
&& hWnd2
&& (GetWindowRect(hWnd2, &Rect),
ScreenToClient(hWnd1, (LPPOINT)&Rect),
ScreenToClient(hWnd1, (LPPOINT)&Rect.right),
width >= Rect.left)
&& width < Rect.right
&& height >= Rect.top )
{
result = height < Rect.bottom;
}
else
{
result = 0;
}
return result;
BOOL result; // eax
struct tagRECT Rect; // [esp+4h] [ebp-10h]
if (hWnd1
&& hWnd2
&& (GetWindowRect(hWnd2, &Rect),
ScreenToClient(hWnd1, (LPPOINT)&Rect),
ScreenToClient(hWnd1, (LPPOINT)&Rect.right),
width >= Rect.left)
&& width < Rect.right
&& height >= Rect.top) {
result = height < Rect.bottom;
} else {
result = 0;
}
return result;
}
// ref: 0x10007C95
void __fastcall local_DlgDoPaint(HWND hWnd)
{
char v2[64]; // [esp+4h] [ebp-40h]
char v2[64]; // [esp+4h] [ebp-40h]
SDlgBeginPaint(hWnd, v2);
SDlgEndPaint(hWnd, v2);
SDlgBeginPaint(hWnd, v2);
SDlgEndPaint(hWnd, v2);
}
// 10010442: using guessed type int __stdcall SDlgEndPaint(_DWORD, _DWORD);
// 10010448: using guessed type int __stdcall SDlgBeginPaint(_DWORD, _DWORD);
@ -274,298 +253,275 @@ void __fastcall local_DlgDoPaint(HWND hWnd)
// ref: 0x10007CB5
void __fastcall local_DoUiWndProc(HWND hWnd, DWORD *pdwMsgTbl)
{
DWORD *v2; // edi
int i; // eax
HWND v5; // eax
HWND v6; // esi
void *v7; // eax
v2 = pdwMsgTbl;
for ( i = *pdwMsgTbl; *v2; i = *v2 )
{
v5 = GetDlgItem(hWnd, i);
v6 = v5;
if ( v5 )
{
v7 = (void *)GetWindowLongA(v5, -4);
SetPropA(v6, "UIWNDPROC", v7);
SetWindowLongA(v6, -4, (LONG)local_PostUiWndProc);
}
++v2;
}
DWORD *v2; // edi
int i; // eax
HWND v5; // eax
HWND v6; // esi
void *v7; // eax
v2 = pdwMsgTbl;
for (i = *pdwMsgTbl; *v2; i = *v2) {
v5 = GetDlgItem(hWnd, i);
v6 = v5;
if (v5) {
v7 = (void *)GetWindowLongA(v5, -4);
SetPropA(v6, "UIWNDPROC", v7);
SetWindowLongA(v6, -4, (LONG)local_PostUiWndProc);
}
++v2;
}
}
// ref: 0x10007D01
LRESULT __stdcall local_PostUiWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT (__stdcall *v4)(HWND, UINT, WPARAM, LPARAM); // ebx
HWND v5; // eax
HWND v6; // eax
HWND v7; // eax
WPARAM v9; // [esp-8h] [ebp-14h]
BOOL v10; // [esp-4h] [ebp-10h]
v4 = (LRESULT (__stdcall *)(HWND, UINT, WPARAM, LPARAM))GetPropA(hWnd, "UIWNDPROC");
switch ( uMsg )
{
case 2u:
RemovePropA(hWnd, "UIWNDPROC");
if ( !v4 )
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
SetWindowLongA(hWnd, -4, (LONG)v4);
goto LABEL_21;
case 0xFu:
local_DlgDoPaint(hWnd);
return 0;
case 0x87u:
return 4;
}
if ( uMsg != 256 )
goto LABEL_21;
switch ( wParam )
{
case 0xDu:
goto LABEL_26;
case 0x1Bu:
v9 = 2;
LABEL_15:
v7 = GetParent(hWnd);
SendMessageA(v7, 0x111u, v9, 0);
goto LABEL_21;
case 0x20u:
LABEL_26:
v9 = 1;
goto LABEL_15;
}
if ( wParam <= 0x24 )
goto LABEL_21;
if ( wParam <= 0x26 )
{
v10 = 1;
}
else
{
if ( wParam > 0x28 )
goto LABEL_21;
v10 = 0;
}
v5 = GetParent(hWnd);
v6 = GetNextDlgGroupItem(v5, hWnd, v10);
SetFocus(v6);
LRESULT(__stdcall * v4)
(HWND, UINT, WPARAM, LPARAM); // ebx
HWND v5; // eax
HWND v6; // eax
HWND v7; // eax
WPARAM v9; // [esp-8h] [ebp-14h]
BOOL v10; // [esp-4h] [ebp-10h]
v4 = (LRESULT(__stdcall *)(HWND, UINT, WPARAM, LPARAM))GetPropA(hWnd, "UIWNDPROC");
switch (uMsg) {
case 2u:
RemovePropA(hWnd, "UIWNDPROC");
if (!v4)
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
SetWindowLongA(hWnd, -4, (LONG)v4);
goto LABEL_21;
case 0xFu:
local_DlgDoPaint(hWnd);
return 0;
case 0x87u:
return 4;
}
if (uMsg != 256)
goto LABEL_21;
switch (wParam) {
case 0xDu:
goto LABEL_26;
case 0x1Bu:
v9 = 2;
LABEL_15:
v7 = GetParent(hWnd);
SendMessageA(v7, 0x111u, v9, 0);
goto LABEL_21;
case 0x20u:
LABEL_26:
v9 = 1;
goto LABEL_15;
}
if (wParam <= 0x24)
goto LABEL_21;
if (wParam <= 0x26) {
v10 = 1;
} else {
if (wParam > 0x28)
goto LABEL_21;
v10 = 0;
}
v5 = GetParent(hWnd);
v6 = GetNextDlgGroupItem(v5, hWnd, v10);
SetFocus(v6);
LABEL_21:
if ( v4 )
return CallWindowProcA(v4, hWnd, uMsg, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
if (v4)
return CallWindowProcA(v4, hWnd, uMsg, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
// ref: 0x10007DE9
void __fastcall local_DoUiWndProc2(HWND hWnd, DWORD *pdwMsgTbl)
{
DWORD *v2; // edi
int i; // eax
HWND v5; // eax
HWND v6; // esi
void *v7; // eax
v2 = pdwMsgTbl;
for ( i = *pdwMsgTbl; *v2; i = *v2 )
{
v5 = GetDlgItem(hWnd, i);
v6 = v5;
if ( v5 )
{
v7 = (void *)GetWindowLongA(v5, -4);
SetPropA(v6, "UIWNDPROC", v7);
SetWindowLongA(v6, -4, (LONG)local_PostUiWndProc2);
}
++v2;
}
DWORD *v2; // edi
int i; // eax
HWND v5; // eax
HWND v6; // esi
void *v7; // eax
v2 = pdwMsgTbl;
for (i = *pdwMsgTbl; *v2; i = *v2) {
v5 = GetDlgItem(hWnd, i);
v6 = v5;
if (v5) {
v7 = (void *)GetWindowLongA(v5, -4);
SetPropA(v6, "UIWNDPROC", v7);
SetWindowLongA(v6, -4, (LONG)local_PostUiWndProc2);
}
++v2;
}
}
// ref: 0x10007E35
LRESULT __stdcall local_PostUiWndProc2(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT (__stdcall *v4)(HWND, UINT, WPARAM, LPARAM); // ebx
WPARAM v5; // ST0C_4
HWND v6; // eax
HWND v8; // [esp+18h] [ebp+Ch]
v4 = (LRESULT (__stdcall *)(HWND, UINT, WPARAM, LPARAM))GetPropA(hWnd, "UIWNDPROC");
switch ( uMsg )
{
case 2u:
RemovePropA(hWnd, "UIWNDPROC");
if ( !v4 )
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
SetWindowLongA(hWnd, -4, (LONG)v4);
break;
case 0xFu:
local_DlgDoPaint(hWnd);
return 0;
case 0x201u:
v8 = GetFocus();
SetFocus(hWnd);
InvalidateRect(v8, 0, 0);
InvalidateRect(hWnd, 0, 0);
UpdateWindow(v8);
UpdateWindow(hWnd);
v5 = (unsigned short)GetWindowLongA(hWnd, -12);
v6 = GetParent(hWnd);
PostMessageA(v6, 0x111u, v5, (LPARAM)hWnd);
return 0;
}
if ( v4 )
return CallWindowProcA(v4, hWnd, uMsg, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
LRESULT(__stdcall * v4)
(HWND, UINT, WPARAM, LPARAM); // ebx
WPARAM v5; // ST0C_4
HWND v6; // eax
HWND v8; // [esp+18h] [ebp+Ch]
v4 = (LRESULT(__stdcall *)(HWND, UINT, WPARAM, LPARAM))GetPropA(hWnd, "UIWNDPROC");
switch (uMsg) {
case 2u:
RemovePropA(hWnd, "UIWNDPROC");
if (!v4)
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
SetWindowLongA(hWnd, -4, (LONG)v4);
break;
case 0xFu:
local_DlgDoPaint(hWnd);
return 0;
case 0x201u:
v8 = GetFocus();
SetFocus(hWnd);
InvalidateRect(v8, 0, 0);
InvalidateRect(hWnd, 0, 0);
UpdateWindow(v8);
UpdateWindow(hWnd);
v5 = (unsigned short)GetWindowLongA(hWnd, -12);
v6 = GetParent(hWnd);
PostMessageA(v6, 0x111u, v5, (LPARAM)hWnd);
return 0;
}
if (v4)
return CallWindowProcA(v4, hWnd, uMsg, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
// ref: 0x10007F04
BOOL __fastcall local_DisableKeyWaitMouse(HWND hWnd)
{
BOOL result; // eax
struct tagMSG Msg; // [esp+8h] [ebp-1Ch]
do
{
while ( PeekMessageA(&Msg, hWnd, 0x100u, 0x108u, 1u) )
;
result = PeekMessageA(&Msg, hWnd, 0x200u, 0x209u, 1u);
}
while ( result );
return result;
BOOL result; // eax
struct tagMSG Msg; // [esp+8h] [ebp-1Ch]
do {
while (PeekMessageA(&Msg, hWnd, 0x100u, 0x108u, 1u))
;
result = PeekMessageA(&Msg, hWnd, 0x200u, 0x209u, 1u);
} while (result);
return result;
}
// ref: 0x10007F46
DWORD *__cdecl local_AllocWndLongData()
{
DWORD *result; // eax
result = (DWORD *)SMemAlloc(0x110u, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 480, 0);
if ( result )
{
*result = 0;
result[1] = 0;
result[2] = 0;
result[3] = 0;
*((_BYTE *)result + 16) = 0;
}
return result;
DWORD *result; // eax
result = (DWORD *)SMemAlloc(0x110u, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 480, 0);
if (result) {
*result = 0;
result[1] = 0;
result[2] = 0;
result[3] = 0;
*((_BYTE *)result + 16) = 0;
}
return result;
}
// ref: 0x10007F72
void __fastcall local_FreeMemPtr(void **p)
{
if ( p )
{
if ( *p )
SMemFree(*p, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 498, 0);
SMemFree(p, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 499, 0);
}
if (p) {
if (*p)
SMemFree(*p, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 498, 0);
SMemFree(p, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 499, 0);
}
}
// ref: 0x10007FA4
void __fastcall local_SetWndLongStr(int WndLongData, const char *pszStr)
{
if ( WndLongData )
{
if ( pszStr )
{
strncpy((char *)(WndLongData + 16), pszStr, 0xFFu);
*(_BYTE *)(WndLongData + 271) = 0;
}
else
{
*(_BYTE *)(WndLongData + 16) = 0;
}
}
if (WndLongData) {
if (pszStr) {
strncpy((char *)(WndLongData + 16), pszStr, 0xFFu);
*(_BYTE *)(WndLongData + 271) = 0;
} else {
*(_BYTE *)(WndLongData + 16) = 0;
}
}
}
// ref: 0x10007FD0
void __cdecl local_LoadArtCursor()
{
DWORD dwHeight; // [esp+8h] [ebp-8h]
DWORD dwWidth; // [esp+Ch] [ebp-4h]
if ( SBmpLoadImage("ui_art\\cursor.pcx", 0, 0, 0, &dwWidth, &dwHeight, 0) )
{
gpCursorArt = (BYTE *)SMemAlloc(dwHeight * dwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 553, 0);
gpCursorArt2 = (BYTE *)SMemAlloc(dwHeight * dwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 554, 0);
if ( SBmpLoadImage("ui_art\\cursor.pcx", 0, gpCursorArt, dwHeight * dwWidth, 0, 0, 0) )
{
gdwCursData[0] = dwWidth;
gdwCursData[1] = dwHeight;
local_InitArtCursor();
}
}
DWORD dwHeight; // [esp+8h] [ebp-8h]
DWORD dwWidth; // [esp+Ch] [ebp-4h]
if (SBmpLoadImage("ui_art\\cursor.pcx", 0, 0, 0, &dwWidth, &dwHeight, 0)) {
gpCursorArt = (BYTE *)SMemAlloc(dwHeight * dwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 553, 0);
gpCursorArt2 = (BYTE *)SMemAlloc(dwHeight * dwWidth, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 554, 0);
if (SBmpLoadImage("ui_art\\cursor.pcx", 0, gpCursorArt, dwHeight * dwWidth, 0, 0, 0)) {
gdwCursData[0] = dwWidth;
gdwCursData[1] = dwHeight;
local_InitArtCursor();
}
}
}
// ref: 0x10008062
void __cdecl local_InitArtCursor()
{
BYTE *v0; // eax
BYTE *v1; // ecx
int i; // esi
char v3; // dl
v0 = gpCursorArt2;
v1 = gpCursorArt;
if ( gpCursorArt2 )
{
if ( gpCursorArt )
{
for ( i = 0; i < gdwCursData[0] * gdwCursData[1]; ++i )
{
v3 = *v1++;
if ( v3 )
*v0 = 0;
else
*v0 = -1;
++v0;
}
}
}
BYTE *v0; // eax
BYTE *v1; // ecx
int i; // esi
char v3; // dl
v0 = gpCursorArt2;
v1 = gpCursorArt;
if (gpCursorArt2) {
if (gpCursorArt) {
for (i = 0; i < gdwCursData[0] * gdwCursData[1]; ++i) {
v3 = *v1++;
if (v3)
*v0 = 0;
else
*v0 = -1;
++v0;
}
}
}
}
// ref: 0x100080AD
void __cdecl local_FreeArtCursor()
{
if ( gpCursorArt )
{
SMemFree(gpCursorArt, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 571, 0);
gpCursorArt = 0;
}
if ( gpCursorArt2 )
{
SMemFree(gpCursorArt2, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 575, 0);
gpCursorArt2 = 0;
}
if (gpCursorArt) {
SMemFree(gpCursorArt, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 571, 0);
gpCursorArt = 0;
}
if (gpCursorArt2) {
SMemFree(gpCursorArt2, "C:\\Src\\Diablo\\DiabloUI\\local.cpp", 575, 0);
gpCursorArt2 = 0;
}
}
// ref: 0x100080F1
void __cdecl local_SetCursorArt()
{
if ( !gpCursorArt )
local_LoadArtCursor();
SDlgSetSystemCursor(gpCursorArt2, gpCursorArt, (int *)gdwCursData, 32512);
if (!gpCursorArt)
local_LoadArtCursor();
SDlgSetSystemCursor(gpCursorArt2, gpCursorArt, (int *)gdwCursData, 32512);
}
// 1001044E: using guessed type int __stdcall SDlgSetSystemCursor(_DWORD, _DWORD, _DWORD, _DWORD);
// ref: 0x1000811B
void __cdecl local_SetCursorDefault()
{
SDlgSetSystemCursor(0, 0, 0, 32512);
SDlgSetSystemCursor(0, 0, 0, 32512);
}
// 1001044E: using guessed type int __stdcall SDlgSetSystemCursor(_DWORD, _DWORD, _DWORD, _DWORD);
// ref: 0x1000812B
void __fastcall local_SetDiabloCursor(HWND hWnd)
{
HCURSOR v2; // eax
int v3; // [esp+4h] [ebp-4h]
HCURSOR v2; // eax
int v3; // [esp+4h] [ebp-4h]
v3 = 0;
local_SetCursorDefault();
v2 = LoadCursorA(ghUiInst, "DIABLOCURSOR");
SDlgSetCursor(hWnd, v2, 32512, &v3);
v3 = 0;
local_SetCursorDefault();
v2 = LoadCursorA(ghUiInst, "DIABLOCURSOR");
SDlgSetCursor(hWnd, v2, 32512, &v3);
}
// 10010454: using guessed type int __stdcall SDlgSetCursor(_DWORD, _DWORD, _DWORD, _DWORD);

327
DiabloUI/mainmenu.cpp

@ -1,30 +1,30 @@
// ref: 0x10008164
void __cdecl MainMenu_cpp_init()
{
mainmenu_cpp_float = mainmenu_cpp_float_value;
mainmenu_cpp_float = mainmenu_cpp_float_value;
}
// 1001F434: using guessed type int mainmenu_cpp_float_value;
// 1002A0D4: using guessed type int mainmenu_cpp_float;
// ref: 0x1000816F
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void (__stdcall *fnSound)(char *file), int a4)
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4)
{
int v4; // eax
int v5; // esi
int v4; // eax
int v5; // esi
menu_item_timer = a4;
TitleSnd_SetSoundFunction(fnSound);
artfont_LoadAllFonts();
menu_version_str[0] = 0;
if ( name )
strncpy(menu_version_str, name, 0x40u);
v4 = (int)SDrawGetFrameWindow();
v5 = SDlgDialogBoxParam(ghUiInst, "MAINMENU_DIALOG", v4, MainMenu_WndProc, 0);
if ( v5 == 5 )
artfont_FreeAllFonts();
if ( pdwResult )
*pdwResult = v5;
return 1;
menu_item_timer = a4;
TitleSnd_SetSoundFunction(fnSound);
artfont_LoadAllFonts();
menu_version_str[0] = 0;
if (name)
strncpy(menu_version_str, name, 0x40u);
v4 = (int)SDrawGetFrameWindow();
v5 = SDlgDialogBoxParam(ghUiInst, "MAINMENU_DIALOG", v4, MainMenu_WndProc, 0);
if (v5 == 5)
artfont_FreeAllFonts();
if (pdwResult)
*pdwResult = v5;
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// 1002A118: using guessed type int menu_item_timer;
@ -32,81 +32,66 @@ BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void (__stdcall *fnS
// ref: 0x100081E3
LRESULT __stdcall MainMenu_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v5; // eax
HWND v5; // eax
if ( Msg <= 0x113 )
{
if ( Msg != 275 )
{
if ( Msg == 2 )
{
MainMenu_KillAndFreeMenu(hWnd);
}
else if ( Msg > 0x103 )
{
if ( Msg <= 0x105 )
{
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, Msg, wParam, lParam);
}
else
{
if ( Msg == 272 )
{
MainMenu_LoadMenuGFX(hWnd);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
if ( Msg == 273 )
{
MainMenu_SetMenuTimer(hWnd);
switch ( HIWORD(wParam) )
{
case 7:
Focus_GetAndBlitSpin(hWnd, lParam);
break;
case 6:
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
break;
case 0:
MainMenu_CheckWParamFocus(hWnd, (unsigned short)wParam);
break;
}
}
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( wParam == 3 && !DiabloUI_GetSpawned() )
{
if ( app_is_active )
MainMenu_DoOptions(hWnd, 6, 0);
else
MainMenu_SetMenuTimer(hWnd);
}
return 0;
}
if ( Msg >= 0x200 )
{
if ( Msg <= 0x202 )
goto LABEL_34;
if ( Msg <= 0x203 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if ( Msg <= 0x205 )
{
LABEL_34:
MainMenu_SetMenuTimer(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg == 2024 )
{
if ( !Fade_CheckRange5() )
Fade_SetFadeTimer((int)hWnd);
return 0;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg <= 0x113) {
if (Msg != 275) {
if (Msg == 2) {
MainMenu_KillAndFreeMenu(hWnd);
} else if (Msg > 0x103) {
if (Msg <= 0x105) {
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, Msg, wParam, lParam);
} else {
if (Msg == 272) {
MainMenu_LoadMenuGFX(hWnd);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
if (Msg == 273) {
MainMenu_SetMenuTimer(hWnd);
switch (HIWORD(wParam)) {
case 7:
Focus_GetAndBlitSpin(hWnd, lParam);
break;
case 6:
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
break;
case 0:
MainMenu_CheckWParamFocus(hWnd, (unsigned short)wParam);
break;
}
}
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (wParam == 3 && !DiabloUI_GetSpawned()) {
if (app_is_active)
MainMenu_DoOptions(hWnd, 6, 0);
else
MainMenu_SetMenuTimer(hWnd);
}
return 0;
}
if (Msg >= 0x200) {
if (Msg <= 0x202)
goto LABEL_34;
if (Msg <= 0x203)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg <= 0x205) {
LABEL_34:
MainMenu_SetMenuTimer(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg == 2024) {
if (!Fade_CheckRange5())
Fade_SetFadeTimer((int)hWnd);
return 0;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// 10029728: using guessed type int app_is_active;
@ -114,117 +99,113 @@ LABEL_34:
// ref: 0x10008354
void __fastcall MainMenu_KillAndFreeMenu(HWND hWnd)
{
void **v2; // eax
void **v2; // eax
Title_KillTitleTimer(hWnd);
Focus_KillFocusTimer(hWnd);
Doom_DeleteFreeProcs(hWnd, menumsgs_5options);
Doom_DeleteFreeProcs(hWnd, menumsgs_1option);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
local_SetCursorDefault();
Title_KillTitleTimer(hWnd);
Focus_KillFocusTimer(hWnd);
Doom_DeleteFreeProcs(hWnd, menumsgs_5options);
Doom_DeleteFreeProcs(hWnd, menumsgs_1option);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
local_SetCursorDefault();
}
// ref: 0x10008391
void __fastcall MainMenu_SetMenuTimer(HWND hWnd)
{
SDlgSetTimer((int)hWnd, 3, 1000 * menu_item_timer, 0);
SDlgSetTimer((int)hWnd, 3, 1000 * menu_item_timer, 0);
}
// 1002A118: using guessed type int menu_item_timer;
// ref: 0x100083A8
void __fastcall MainMenu_LoadMenuGFX(HWND hWnd)
{
DWORD *v2; // eax MAPDST
bool v4; // zf
const char *v5; // eax
HWND v6; // eax
DWORD *v2; // eax MAPDST
bool v4; // zf
const char *v5; // eax
HWND v6; // eax
v2 = local_AllocWndLongData();
if ( v2 )
{
SetWindowLongA(hWnd, -21, (LONG)v2);
v4 = DiabloUI_GetSpawned() == 0;
v5 = "ui_art\\swmmenu.pcx";
if ( v4 )
v5 = "ui_art\\mainmenu.pcx";
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, v5, (BYTE **)v2, v2 + 1, 0);
Fade_NoInputAndArt(hWnd, 1);
}
v6 = GetDlgItem(hWnd, 1042);
SetWindowTextA(v6, menu_version_str);
Doom_ParseWndProc3(hWnd, menumsgs_1option, 1);
Doom_ParseWndProcs(hWnd, menumsgs_5options, 6, 1);
Focus_SetFocusTimer(hWnd, "ui_art\\focus42.pcx");
Title_LoadImgSetTimer(hWnd, "ui_art\\smlogo.pcx");
MainMenu_SetMenuTimer(hWnd);
local_DoUiWndProc2(hWnd, (DWORD *)menumsgs_5options);
v2 = local_AllocWndLongData();
if (v2) {
SetWindowLongA(hWnd, -21, (LONG)v2);
v4 = DiabloUI_GetSpawned() == 0;
v5 = "ui_art\\swmmenu.pcx";
if (v4)
v5 = "ui_art\\mainmenu.pcx";
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, v5, (BYTE **)v2, v2 + 1, 0);
Fade_NoInputAndArt(hWnd, 1);
}
v6 = GetDlgItem(hWnd, 1042);
SetWindowTextA(v6, menu_version_str);
Doom_ParseWndProc3(hWnd, menumsgs_1option, 1);
Doom_ParseWndProcs(hWnd, menumsgs_5options, 6, 1);
Focus_SetFocusTimer(hWnd, "ui_art\\focus42.pcx");
Title_LoadImgSetTimer(hWnd, "ui_art\\smlogo.pcx");
MainMenu_SetMenuTimer(hWnd);
local_DoUiWndProc2(hWnd, (DWORD *)menumsgs_5options);
}
// ref: 0x1000845A
void __fastcall MainMenu_DoOptions(HWND hWnd, int option, int PlaySelect)
{
SDlgKillTimer((int)hWnd, 3);
if ( DiabloUI_GetSpawned() && option == 3 )
{
SelYesNo_SpawnErrDialog(hWnd, 70, 1);
LABEL_7:
SDlgSetTimer((int)hWnd, 3, 1000 * menu_item_timer, 0);
return;
}
if ( option == 2 && !MainMenu_CheckEnoughMemory() )
{
SelYesNo_SpawnErrDialog(hWnd, 78, 1);
goto LABEL_7;
}
Fade_Range5SetZero();
if ( PlaySelect )
TitleSnd_PlaySelectSound();
Fade_UpdatePaletteRange(10);
SDlgEndDialog(hWnd, (HANDLE)option);
SDlgKillTimer((int)hWnd, 3);
if (DiabloUI_GetSpawned() && option == 3) {
SelYesNo_SpawnErrDialog(hWnd, 70, 1);
LABEL_7:
SDlgSetTimer((int)hWnd, 3, 1000 * menu_item_timer, 0);
return;
}
if (option == 2 && !MainMenu_CheckEnoughMemory()) {
SelYesNo_SpawnErrDialog(hWnd, 78, 1);
goto LABEL_7;
}
Fade_Range5SetZero();
if (PlaySelect)
TitleSnd_PlaySelectSound();
Fade_UpdatePaletteRange(10);
SDlgEndDialog(hWnd, (HANDLE)option);
}
// 1002A118: using guessed type int menu_item_timer;
// ref: 0x100084D5
BOOL __cdecl MainMenu_CheckEnoughMemory()
{
struct _MEMORYSTATUS Buffer; // [esp+0h] [ebp-20h]
struct _MEMORYSTATUS Buffer; // [esp+0h] [ebp-20h]
Buffer.dwLength = 32;
GlobalMemoryStatus(&Buffer);
return Buffer.dwTotalPhys > 0xDAC000;
Buffer.dwLength = 32;
GlobalMemoryStatus(&Buffer);
return Buffer.dwTotalPhys > 0xDAC000;
}
// ref: 0x100084FA
void __fastcall MainMenu_CheckWParamFocus(HWND hWnd, WPARAM wParam)
{
HWND v3; // eax
LONG v4; // eax
int v5; // [esp-8h] [ebp-Ch]
HWND v3; // eax
LONG v4; // eax
int v5; // [esp-8h] [ebp-Ch]
switch ( wParam )
{
case 1u:
v3 = GetFocus();
v4 = GetWindowLongA(v3, -12);
SendMessageA(hWnd, 0x111u, v4, 0);
return;
case 2u:
v5 = 5;
goto LABEL_12;
case 0x3E9u:
v5 = 2;
goto LABEL_12;
case 0x3EAu:
v5 = 3;
goto LABEL_12;
case 0x3EBu:
v5 = 4;
LABEL_12:
MainMenu_DoOptions(hWnd, v5, 1);
return;
case 0x414u:
MainMenu_DoOptions(hWnd, 1, 1);
break;
}
switch (wParam) {
case 1u:
v3 = GetFocus();
v4 = GetWindowLongA(v3, -12);
SendMessageA(hWnd, 0x111u, v4, 0);
return;
case 2u:
v5 = 5;
goto LABEL_12;
case 0x3E9u:
v5 = 2;
goto LABEL_12;
case 0x3EAu:
v5 = 3;
goto LABEL_12;
case 0x3EBu:
v5 = 4;
LABEL_12:
MainMenu_DoOptions(hWnd, v5, 1);
return;
case 0x414u:
MainMenu_DoOptions(hWnd, 1, 1);
break;
}
}

479
DiabloUI/okcancel.cpp

@ -1,47 +1,47 @@
// ref: 0x10008F31
BOOL __fastcall OkCancel_DrawString(HWND hWnd, char *str)
{
HDC v3; // edi
void *v4; // eax
int v5; // eax
BOOL result; // eax
LONG v7; // [esp+14h] [ebp-20h]
LONG v8; // [esp+18h] [ebp-1Ch]
struct tagRECT Rect; // [esp+1Ch] [ebp-18h]
HGDIOBJ h; // [esp+2Ch] [ebp-8h]
HDC v3; // edi
void *v4; // eax
int v5; // eax
BOOL result; // eax
LONG v7; // [esp+14h] [ebp-20h]
LONG v8; // [esp+18h] [ebp-1Ch]
struct tagRECT Rect; // [esp+1Ch] [ebp-18h]
HGDIOBJ h; // [esp+2Ch] [ebp-8h]
if ( !str || !*str )
goto LABEL_13;
if ( !hWnd )
goto LABEL_14;
GetClientRect(hWnd, &Rect);
--Rect.right;
--Rect.bottom;
v7 = Rect.right;
v8 = Rect.bottom;
v3 = GetDC(hWnd);
v4 = (void *)SendMessageA(hWnd, 0x31u, 0, 0);
h = SelectObject(v3, v4);
if ( !v3 )
goto LABEL_13;
v5 = strlen(str);
DrawTextA(v3, str, v5, &Rect, 0x410u);
if ( h )
SelectObject(v3, h);
ReleaseDC(hWnd, v3);
if ( Rect.bottom > v8 || Rect.right > v7 )
LABEL_14:
result = 1;
else
LABEL_13:
result = 0;
return result;
if (!str || !*str)
goto LABEL_13;
if (!hWnd)
goto LABEL_14;
GetClientRect(hWnd, &Rect);
--Rect.right;
--Rect.bottom;
v7 = Rect.right;
v8 = Rect.bottom;
v3 = GetDC(hWnd);
v4 = (void *)SendMessageA(hWnd, 0x31u, 0, 0);
h = SelectObject(v3, v4);
if (!v3)
goto LABEL_13;
v5 = strlen(str);
DrawTextA(v3, str, v5, &Rect, 0x410u);
if (h)
SelectObject(v3, h);
ReleaseDC(hWnd, v3);
if (Rect.bottom > v8 || Rect.right > v7)
LABEL_14:
result = 1;
else
LABEL_13:
result = 0;
return result;
}
// ref: 0x10008FEC
void __cdecl OkCancel_cpp_init()
{
OkCancel_cpp_float = OkCancel_cpp_float_value;
OkCancel_cpp_float = OkCancel_cpp_float_value;
}
// 1001F440: using guessed type int OkCancel_cpp_float_value;
// 1002A2E4: using guessed type int OkCancel_cpp_float;
@ -49,254 +49,227 @@ void __cdecl OkCancel_cpp_init()
// ref: 0x10008FF7
LRESULT __stdcall OkCancel_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v5; // ecx
int v6; // edx
HWND v7; // eax
LONG v8; // eax
HWND v9; // eax
HWND v5; // ecx
int v6; // edx
HWND v7; // eax
LONG v8; // eax
HWND v9; // eax
if ( Msg == 2 )
{
ShowCursor(0);
OkCancel_FreeDlgBmp(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg <= 0x103 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if ( Msg <= 0x105 )
{
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg != 272 )
{
if ( Msg != 273 )
{
if ( Msg == 312 && GetWindowLongA((HWND)lParam, -12) == 1038 )
{
local_SetWhiteText((HDC)wParam);
return (LRESULT)GetStockObject(5);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( (unsigned short)wParam == 1 )
{
v7 = GetFocus();
v8 = GetWindowLongA(v7, -12);
v5 = hWnd;
if ( v8 == 1109 )
{
v6 = 1;
goto LABEL_16;
}
}
else
{
if ( (unsigned short)wParam != 2 )
{
if ( (unsigned short)wParam == 1109 )
{
v5 = hWnd;
v6 = 1;
LABEL_16:
OkCancel_PlaySndEndDlg(v5, v6);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v5 = hWnd;
}
v6 = 2;
goto LABEL_16;
}
ShowCursor(1);
if ( !OkCancel_LoadOkCancGFX(hWnd, (DWORD *)lParam) )
SDlgEndDialog(hWnd, (HANDLE)0xFF000000);
return 1;
if (Msg == 2) {
ShowCursor(0);
OkCancel_FreeDlgBmp(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg <= 0x103)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg <= 0x105) {
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg != 272) {
if (Msg != 273) {
if (Msg == 312 && GetWindowLongA((HWND)lParam, -12) == 1038) {
local_SetWhiteText((HDC)wParam);
return (LRESULT)GetStockObject(5);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ((unsigned short)wParam == 1) {
v7 = GetFocus();
v8 = GetWindowLongA(v7, -12);
v5 = hWnd;
if (v8 == 1109) {
v6 = 1;
goto LABEL_16;
}
} else {
if ((unsigned short)wParam != 2) {
if ((unsigned short)wParam == 1109) {
v5 = hWnd;
v6 = 1;
LABEL_16:
OkCancel_PlaySndEndDlg(v5, v6);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v5 = hWnd;
}
v6 = 2;
goto LABEL_16;
}
ShowCursor(1);
if (!OkCancel_LoadOkCancGFX(hWnd, (DWORD *)lParam))
SDlgEndDialog(hWnd, (HANDLE)0xFF000000);
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x10009117
void __fastcall OkCancel_FreeDlgBmp(HWND hWnd)
{
void **v1; // eax MAPDST
void *v3; // eax
void *v4; // eax
void **v1; // eax MAPDST
void *v3; // eax
void *v4; // eax
v1 = (void **)RemovePropA(hWnd, "DLGBMP");
if ( v1 )
{
v3 = *v1;
if ( v3 )
SMemFree(v3, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 48, 0);
v4 = v1[1];
if ( v4 )
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 50, 0);
SMemFree(v1, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 51, 0);
}
v1 = (void **)RemovePropA(hWnd, "DLGBMP");
if (v1) {
v3 = *v1;
if (v3)
SMemFree(v3, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 48, 0);
v4 = v1[1];
if (v4)
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 50, 0);
SMemFree(v1, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 51, 0);
}
}
// ref: 0x10009161
BOOL __fastcall OkCancel_LoadOkCancGFX(HWND hWnd, DWORD *lParam)
{
bool v3; // zf
HWND v4; // edi
tagPALETTEENTRY *v5; // edi
HWND v6; // eax
HWND v7; // edi
BYTE **v8; // edi
HWND v9; // eax
const CHAR *v10; // ST1C_4
HWND v11; // eax
HWND v12; // edi
int a2a; // [esp+Ch] [ebp-20h]
int v15; // [esp+10h] [ebp-1Ch]
int v16; // [esp+14h] [ebp-18h]
DWORD data[2]; // [esp+18h] [ebp-14h]
BYTE **pBuffer; // [esp+20h] [ebp-Ch]
char *pszFileName; // [esp+24h] [ebp-8h]
bool v3; // zf
HWND v4; // edi
tagPALETTEENTRY *v5; // edi
HWND v6; // eax
HWND v7; // edi
BYTE **v8; // edi
HWND v9; // eax
const CHAR *v10; // ST1C_4
HWND v11; // eax
HWND v12; // edi
int a2a; // [esp+Ch] [ebp-20h]
int v15; // [esp+10h] [ebp-1Ch]
int v16; // [esp+14h] [ebp-18h]
DWORD data[2]; // [esp+18h] [ebp-14h]
BYTE **pBuffer; // [esp+20h] [ebp-Ch]
char *pszFileName; // [esp+24h] [ebp-8h]
a2a = 1109;
v15 = 2;
v16 = 0;
pBuffer = (BYTE **)SMemAlloc(8u, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 110, 0);
SetPropA(hWnd, "DLGBMP", pBuffer);
if ( lParam[2] )
{
v3 = lParam[3] == 0;
pszFileName = "ui_art\\lrpopup.pcx";
if ( v3 )
pszFileName = "ui_art\\lpopup.pcx";
}
else if ( lParam[3] )
{
pszFileName = "ui_art\\srpopup.pcx";
}
else
{
pszFileName = "ui_art\\spopup.pcx";
}
v4 = GetParent(hWnd);
if ( (HWND)SDrawGetFrameWindow() == v4 )
{
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, pszFileName, pBuffer, 0, 1);
v5 = local_GetArtPalEntry(0);
SDrawUpdatePalette(0, 0xAu, v5, 0);
SDrawUpdatePalette(0x70u, 0x90u, v5 + 112, 1);
}
else
{
v6 = GetParent(hWnd);
local_LoadArtWithPal(hWnd, (int)v6, "Popup", -1, 1, pszFileName, pBuffer, 0, 1);
}
v7 = GetParent(hWnd);
if ( (HWND)SDrawGetFrameWindow() == v7 )
Fade_SetInputWindow(hWnd);
v8 = pBuffer + 1;
local_LoadArtImage("ui_art\\but_sml.pcx", pBuffer + 1, data);
local_FitButtonDlg(hWnd, &a2a, *v8, data);
v9 = GetDlgItem(hWnd, 1026);
v10 = (const CHAR *)lParam[1];
pBuffer = (BYTE **)v9;
SetWindowTextA(v9, v10);
if ( lParam[4] && OkCancel_DrawString((HWND)pBuffer, (char *)lParam[1]) )
return 0;
if ( *lParam )
{
v11 = GetDlgItem(hWnd, 1038);
v12 = v11;
if ( lParam[4] && OkCancel_DrawString(v11, (char *)*lParam) )
return 0;
if ( v12 )
SetWindowTextA(v12, (LPCSTR)*lParam);
}
return 1;
a2a = 1109;
v15 = 2;
v16 = 0;
pBuffer = (BYTE **)SMemAlloc(8u, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 110, 0);
SetPropA(hWnd, "DLGBMP", pBuffer);
if (lParam[2]) {
v3 = lParam[3] == 0;
pszFileName = "ui_art\\lrpopup.pcx";
if (v3)
pszFileName = "ui_art\\lpopup.pcx";
} else if (lParam[3]) {
pszFileName = "ui_art\\srpopup.pcx";
} else {
pszFileName = "ui_art\\spopup.pcx";
}
v4 = GetParent(hWnd);
if ((HWND)SDrawGetFrameWindow() == v4) {
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, pszFileName, pBuffer, 0, 1);
v5 = local_GetArtPalEntry(0);
SDrawUpdatePalette(0, 0xAu, v5, 0);
SDrawUpdatePalette(0x70u, 0x90u, v5 + 112, 1);
} else {
v6 = GetParent(hWnd);
local_LoadArtWithPal(hWnd, (int)v6, "Popup", -1, 1, pszFileName, pBuffer, 0, 1);
}
v7 = GetParent(hWnd);
if ((HWND)SDrawGetFrameWindow() == v7)
Fade_SetInputWindow(hWnd);
v8 = pBuffer + 1;
local_LoadArtImage("ui_art\\but_sml.pcx", pBuffer + 1, data);
local_FitButtonDlg(hWnd, &a2a, *v8, data);
v9 = GetDlgItem(hWnd, 1026);
v10 = (const CHAR *)lParam[1];
pBuffer = (BYTE **)v9;
SetWindowTextA(v9, v10);
if (lParam[4] && OkCancel_DrawString((HWND)pBuffer, (char *)lParam[1]))
return 0;
if (*lParam) {
v11 = GetDlgItem(hWnd, 1038);
v12 = v11;
if (lParam[4] && OkCancel_DrawString(v11, (char *)*lParam))
return 0;
if (v12)
SetWindowTextA(v12, (LPCSTR)*lParam);
}
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x100092F5
void __fastcall OkCancel_PlaySndEndDlg(HWND hWnd, int a2)
{
TitleSnd_PlaySelectSound();
SDlgEndDialog(hWnd, (HANDLE)a2);
TitleSnd_PlaySelectSound();
SDlgEndDialog(hWnd, (HANDLE)a2);
}
// ref: 0x1000930A
void __fastcall OkCancel_DoOkDialog(HWND hWnd, char *str, int a3)
{
int a5[5]; // [esp+0h] [ebp-14h]
int a5[5]; // [esp+0h] [ebp-14h]
a5[1] = (int)str;
a5[2] = 0;
a5[0] = 0;
a5[4] = 0;
a5[3] = a3;
SDlgDialogBoxParam(ghUiInst, "OK_DIALOG", (int)hWnd, OkCancel_WndProc, (int)a5);
a5[1] = (int)str;
a5[2] = 0;
a5[0] = 0;
a5[4] = 0;
a5[3] = a3;
SDlgDialogBoxParam(ghUiInst, "OK_DIALOG", (int)hWnd, OkCancel_WndProc, (int)a5);
}
// ref: 0x10009342
void __stdcall UiMessageBoxCallback(HWND hWnd, char *lpText, LPCSTR lpCaption, UINT uType)
{
int v4; // eax
unsigned char v5; // sf
unsigned char v6; // of
size_t v7; // eax
char *v8; // eax
int v9; // ecx
int a5[5]; // [esp+0h] [ebp-24h]
int v11; // [esp+14h] [ebp-10h]
void *location; // [esp+18h] [ebp-Ch]
char *szDialog; // [esp+1Ch] [ebp-8h]
char *v14; // [esp+20h] [ebp-4h]
int v4; // eax
unsigned char v5; // sf
unsigned char v6; // of
size_t v7; // eax
char *v8; // eax
int v9; // ecx
int a5[5]; // [esp+0h] [ebp-24h]
int v11; // [esp+14h] [ebp-10h]
void *location; // [esp+18h] [ebp-Ch]
char *szDialog; // [esp+1Ch] [ebp-8h]
char *v14; // [esp+20h] [ebp-4h]
a5[0] = (int)lpCaption;
a5[1] = (int)lpText;
szDialog = "OK_DIALOG";
a5[4] = 1;
if ( uType & 0xF )
szDialog = "OKCANCEL_DIALOG";
a5[3] = (uType & 0xF0) == 16 || (uType & 0xF0) == 48;
v4 = 0;
a5[2] = 0;
while ( 1 )
{
v14 = (char *)SDlgDialogBoxParam(ghUiInst, &szDialog[32 * v4], (int)hWnd, OkCancel_WndProc, (int)a5);
if ( v14 != (char *)0xFF000000 )
break;
v4 = a5[2] + 1;
v6 = __OFSUB__(a5[2] + 1, 2);
v5 = a5[2]++ - 1 < 0;
if ( !(v5 ^ v6) )
{
v7 = strlen(lpText);
v8 = (char *)SMemAlloc(v7 + 256, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 392, 0);
v11 = 0; /* check */
location = v8;
v14 = lpText;
if ( *lpText )
{
v9 = v11;
do
{
if ( *v14 <= 32 )
v9 = 0;
*v8++ = *v14;
if ( ++v9 > 18 )
{
*v8++ = 10;
v9 = 0;
}
++v14;
}
while ( *v14 );
}
*v8 = 0;
a5[1] = (int)location;
v14 = (char *)SDlgDialogBoxParam(ghUiInst, szDialog, (int)hWnd, OkCancel_WndProc, (int)a5);
SMemFree(location, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 416, 0);
if ( v14 == (char *)0xFF000000 )
MessageBoxA(hWnd, lpText, lpCaption, uType);
return;
}
}
a5[0] = (int)lpCaption;
a5[1] = (int)lpText;
szDialog = "OK_DIALOG";
a5[4] = 1;
if (uType & 0xF)
szDialog = "OKCANCEL_DIALOG";
a5[3] = (uType & 0xF0) == 16 || (uType & 0xF0) == 48;
v4 = 0;
a5[2] = 0;
while (1) {
v14 = (char *)SDlgDialogBoxParam(ghUiInst, &szDialog[32 * v4], (int)hWnd, OkCancel_WndProc, (int)a5);
if (v14 != (char *)0xFF000000)
break;
v4 = a5[2] + 1;
v6 = __OFSUB__(a5[2] + 1, 2);
v5 = a5[2]++ - 1 < 0;
if (!(v5 ^ v6)) {
v7 = strlen(lpText);
v8 = (char *)SMemAlloc(v7 + 256, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 392, 0);
v11 = 0; /* check */
location = v8;
v14 = lpText;
if (*lpText) {
v9 = v11;
do {
if (*v14 <= 32)
v9 = 0;
*v8++ = *v14;
if (++v9 > 18) {
*v8++ = 10;
v9 = 0;
}
++v14;
} while (*v14);
}
*v8 = 0;
a5[1] = (int)location;
v14 = (char *)SDlgDialogBoxParam(ghUiInst, szDialog, (int)hWnd, OkCancel_WndProc, (int)a5);
SMemFree(location, "C:\\Src\\Diablo\\DiabloUI\\OkCancel.cpp", 416, 0);
if (v14 == (char *)0xFF000000)
MessageBoxA(hWnd, lpText, lpCaption, uType);
return;
}
}
}

382
DiabloUI/sbar.cpp

@ -1,7 +1,7 @@
// ref: 0x100099B5
void __cdecl Sbar_cpp_init()
{
Sbar_cpp_float = Sbar_cpp_float_value;
Sbar_cpp_float = Sbar_cpp_float_value;
}
// 1001F448: using guessed type int Sbar_cpp_float_value;
// 1002A338: using guessed type int Sbar_cpp_float;
@ -9,203 +9,183 @@ void __cdecl Sbar_cpp_init()
// ref: 0x100099C0
BOOL __fastcall Sbar_CheckIfNextHero(HWND hWnd)
{
_uiheroinfo *v1; // eax
_uiheroinfo *v1; // eax
v1 = (_uiheroinfo *)GetWindowLongA(hWnd, -21);
if ( !v1 || !v1->next )
return 0;
v1->next = 0;
return 1;
v1 = (_uiheroinfo *)GetWindowLongA(hWnd, -21);
if (!v1 || !v1->next)
return 0;
v1->next = 0;
return 1;
}
// ref: 0x100099DC
int __fastcall Sbar_NumScrollLines(HWND hWnd, int width, int height)
{
_DWORD *v4; // eax
_DWORD *v5; // esi
int result; // eax
signed int v7; // ecx
LONG v8; // ebx
LONG v9; // edi
int v10; // [esp-4h] [ebp-1Ch]
struct tagPOINT Point; // [esp+Ch] [ebp-Ch]
_DWORD *v4; // eax
_DWORD *v5; // esi
int result; // eax
signed int v7; // ecx
LONG v8; // ebx
LONG v9; // edi
int v10; // [esp-4h] [ebp-1Ch]
struct tagPOINT Point; // [esp+Ch] [ebp-Ch]
Point.x = width;
Point.y = height;
if ( !hWnd )
return 0;
if ( !IsWindowVisible(hWnd) )
return 0;
v4 = (_DWORD *)GetWindowLongA(hWnd, -21);
v5 = v4;
if ( !v4 )
return 0;
v7 = v4[13];
if ( v7 <= 1 )
v8 = 22;
else
v8 = v4[14] * (v4[3] - v4[9] - 44) / (v7 - 1) + 22;
v9 = v8 + v4[9];
ScreenToClient(hWnd, &Point);
if ( Point.y >= 22 )
{
if ( Point.y >= v8 )
{
if ( Point.y >= v9 )
{
if ( Point.y >= v5[3] - 22 )
{
*v5 = 4;
v10 = 2;
}
else
{
*v5 = 8;
v10 = 4;
}
}
else
{
*v5 = 16;
v10 = 5;
}
}
else
{
*v5 = 2;
v10 = 3;
}
result = v10;
}
else
{
result = 1;
*v5 = 1;
}
return result;
Point.x = width;
Point.y = height;
if (!hWnd)
return 0;
if (!IsWindowVisible(hWnd))
return 0;
v4 = (_DWORD *)GetWindowLongA(hWnd, -21);
v5 = v4;
if (!v4)
return 0;
v7 = v4[13];
if (v7 <= 1)
v8 = 22;
else
v8 = v4[14] * (v4[3] - v4[9] - 44) / (v7 - 1) + 22;
v9 = v8 + v4[9];
ScreenToClient(hWnd, &Point);
if (Point.y >= 22) {
if (Point.y >= v8) {
if (Point.y >= v9) {
if (Point.y >= v5[3] - 22) {
*v5 = 4;
v10 = 2;
} else {
*v5 = 8;
v10 = 4;
}
} else {
*v5 = 16;
v10 = 5;
}
} else {
*v5 = 2;
v10 = 3;
}
result = v10;
} else {
result = 1;
*v5 = 1;
}
return result;
}
// ref: 0x10009A99
void __fastcall Sbar_DrawScrollBar(HWND hWnd, int nIDDlgItem, int width, int height)
{
HWND v4; // eax
LONG v5; // eax MAPDST
bool v7; // zf
int v8; // eax
tagRECT DstRect; // [esp+Ch] [ebp-24h]
tagRECT SrcBuffer; // [esp+1Ch] [ebp-14h]
HWND hWnda; // [esp+2Ch] [ebp-4h]
HWND v4; // eax
LONG v5; // eax MAPDST
bool v7; // zf
int v8; // eax
tagRECT DstRect; // [esp+Ch] [ebp-24h]
tagRECT SrcBuffer; // [esp+1Ch] [ebp-14h]
HWND hWnda; // [esp+2Ch] [ebp-4h]
v4 = GetDlgItem(hWnd, nIDDlgItem);
hWnda = v4;
if ( v4 )
{
v5 = GetWindowLongA(v4, -21);
if ( v5 )
{
if ( *(_DWORD *)(v5 + 4) )
{
v7 = *(_DWORD *)(v5 + 16) == 0;
*(_DWORD *)(v5 + 52) = width;
*(_DWORD *)(v5 + 56) = height;
if ( !v7 )
{
SrcBuffer.left = 0;
DstRect.left = 0;
SrcBuffer.top = 0;
DstRect.top = 0;
DstRect.right = *(_DWORD *)(v5 + 8) - 1;
DstRect.bottom = *(_DWORD *)(v5 + 12) - 1;
SrcBuffer.right = *(_DWORD *)(v5 + 8) - 1;
SrcBuffer.bottom = *(_DWORD *)(v5 + 24) - 1;
SBltROP3Tiled(
*(void **)(v5 + 4),
&DstRect,
*(POINT **)(v5 + 8),
*(_DWORD *)(v5 + 16),
&SrcBuffer,
*(RECT **)(v5 + 20),
0,
0,
0,
0xCC0020u);
if ( *(_DWORD *)(v5 + 28) )
{
if ( width <= 1 )
v8 = 22;
else
v8 = height * (*(_DWORD *)(v5 + 12) - *(_DWORD *)(v5 + 36) - 44) / (width - 1) + 22;
SBltROP3(
(void *)(v8 * *(_DWORD *)(v5 + 8) + *(_DWORD *)(v5 + 4) + 3),
*(void **)(v5 + 28),
18,
*(_DWORD *)(v5 + 36),
*(_DWORD *)(v5 + 8),
*(_DWORD *)(v5 + 32),
0,
0xCC0020u);
SBltROP3(
*(void **)(v5 + 4),
(void *)(*(_DWORD *)(v5 + 40) + 22 * (~*(_BYTE *)v5 & 1) * *(_DWORD *)(v5 + 44)),
*(_DWORD *)(v5 + 8),
22,
*(_DWORD *)(v5 + 8),
*(_DWORD *)(v5 + 44),
0,
0xCC0020u);
SBltROP3(
(void *)(*(_DWORD *)(v5 + 4) + *(_DWORD *)(v5 + 8) * (*(_DWORD *)(v5 + 12) - 22)),
(void *)(*(_DWORD *)(v5 + 40) + 22 * ((~*(_BYTE *)v5 & 4 | 8u) >> 2) * *(_DWORD *)(v5 + 44)),
*(_DWORD *)(v5 + 8),
22,
*(_DWORD *)(v5 + 8),
*(_DWORD *)(v5 + 44),
0,
0xCC0020u);
InvalidateRect(hWnda, 0, 0);
}
}
}
}
}
v4 = GetDlgItem(hWnd, nIDDlgItem);
hWnda = v4;
if (v4) {
v5 = GetWindowLongA(v4, -21);
if (v5) {
if (*(_DWORD *)(v5 + 4)) {
v7 = *(_DWORD *)(v5 + 16) == 0;
*(_DWORD *)(v5 + 52) = width;
*(_DWORD *)(v5 + 56) = height;
if (!v7) {
SrcBuffer.left = 0;
DstRect.left = 0;
SrcBuffer.top = 0;
DstRect.top = 0;
DstRect.right = *(_DWORD *)(v5 + 8) - 1;
DstRect.bottom = *(_DWORD *)(v5 + 12) - 1;
SrcBuffer.right = *(_DWORD *)(v5 + 8) - 1;
SrcBuffer.bottom = *(_DWORD *)(v5 + 24) - 1;
SBltROP3Tiled(
*(void **)(v5 + 4),
&DstRect,
*(POINT **)(v5 + 8),
*(_DWORD *)(v5 + 16),
&SrcBuffer,
*(RECT **)(v5 + 20),
0,
0,
0,
0xCC0020u);
if (*(_DWORD *)(v5 + 28)) {
if (width <= 1)
v8 = 22;
else
v8 = height * (*(_DWORD *)(v5 + 12) - *(_DWORD *)(v5 + 36) - 44) / (width - 1) + 22;
SBltROP3(
(void *)(v8 * *(_DWORD *)(v5 + 8) + *(_DWORD *)(v5 + 4) + 3),
*(void **)(v5 + 28),
18,
*(_DWORD *)(v5 + 36),
*(_DWORD *)(v5 + 8),
*(_DWORD *)(v5 + 32),
0,
0xCC0020u);
SBltROP3(
*(void **)(v5 + 4),
(void *)(*(_DWORD *)(v5 + 40) + 22 * (~*(_BYTE *)v5 & 1) * *(_DWORD *)(v5 + 44)),
*(_DWORD *)(v5 + 8),
22,
*(_DWORD *)(v5 + 8),
*(_DWORD *)(v5 + 44),
0,
0xCC0020u);
SBltROP3(
(void *)(*(_DWORD *)(v5 + 4) + *(_DWORD *)(v5 + 8) * (*(_DWORD *)(v5 + 12) - 22)),
(void *)(*(_DWORD *)(v5 + 40) + 22 * ((~*(_BYTE *)v5 & 4 | 8u) >> 2) * *(_DWORD *)(v5 + 44)),
*(_DWORD *)(v5 + 8),
22,
*(_DWORD *)(v5 + 8),
*(_DWORD *)(v5 + 44),
0,
0xCC0020u);
InvalidateRect(hWnda, 0, 0);
}
}
}
}
}
}
// ref: 0x10009BF1
void __fastcall Sbar_LoadScrBarGFX(HWND hWnd, int nIDDlgItem)
{
DWORD *v2; // eax MAPDST
void *v4; // eax
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
HWND hWnda; // [esp+1Ch] [ebp-4h]
DWORD *v2; // eax MAPDST
void *v4; // eax
struct tagRECT Rect; // [esp+Ch] [ebp-14h]
HWND hWnda; // [esp+1Ch] [ebp-4h]
hWnda = GetDlgItem(hWnd, nIDDlgItem);
if ( hWnda )
{
v2 = (DWORD *)SMemAlloc(0x3Cu, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 221, 0);
if ( v2 )
{
SetWindowLongA(hWnda, -21, (LONG)v2);
*v2 = 0;
GetClientRect(hWnda, &Rect);
v2[2] = Rect.right;
v2[3] = Rect.bottom;
v4 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 230, 0);
v2[1] = (DWORD)v4;
if ( v4 )
{
SDlgSetBitmapI(hWnda, 0, &nullcharacter, -1, 1, v4, 0, v2[2], v2[3], -1);
local_LoadArtImage("ui_art\\sb_bg.pcx", (BYTE **)v2 + 4, v2 + 5);
local_LoadArtImage("ui_art\\sb_thumb.pcx", (BYTE **)v2 + 7, v2 + 8);
local_LoadArtImage("ui_art\\sb_arrow.pcx", (BYTE **)v2 + 10, v2 + 11);
}
}
}
hWnda = GetDlgItem(hWnd, nIDDlgItem);
if (hWnda) {
v2 = (DWORD *)SMemAlloc(0x3Cu, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 221, 0);
if (v2) {
SetWindowLongA(hWnda, -21, (LONG)v2);
*v2 = 0;
GetClientRect(hWnda, &Rect);
v2[2] = Rect.right;
v2[3] = Rect.bottom;
v4 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 230, 0);
v2[1] = (DWORD)v4;
if (v4) {
SDlgSetBitmapI(hWnda, 0, &nullcharacter, -1, 1, v4, 0, v2[2], v2[3], -1);
local_LoadArtImage("ui_art\\sb_bg.pcx", (BYTE **)v2 + 4, v2 + 5);
local_LoadArtImage("ui_art\\sb_thumb.pcx", (BYTE **)v2 + 7, v2 + 8);
local_LoadArtImage("ui_art\\sb_arrow.pcx", (BYTE **)v2 + 10, v2 + 11);
}
}
}
}
// ref: 0x10009CC7
void __cdecl Sbar_cpp_init2()
{
Sbar_cpp_float2 = Sbar_cpp_float_value2;
Sbar_cpp_float2 = Sbar_cpp_float_value2;
}
// 1001F44C: using guessed type int Sbar_cpp_float_value2;
// 1002A344: using guessed type int Sbar_cpp_float2;
@ -213,33 +193,31 @@ void __cdecl Sbar_cpp_init2()
// ref: 0x10009CD2
void __fastcall Sbar_FreeScrollBar(HWND hWnd, int nIDDlgItem)
{
HWND v2; // eax MAPDST
_DWORD *v4; // eax MAPDST
void *v6; // eax
void *v7; // eax
void *v8; // eax
void *v9; // eax
HWND v2; // eax MAPDST
_DWORD *v4; // eax MAPDST
void *v6; // eax
void *v7; // eax
void *v8; // eax
void *v9; // eax
v2 = GetDlgItem(hWnd, nIDDlgItem);
if ( v2 )
{
v4 = (_DWORD *)GetWindowLongA(v2, -21);
if ( v4 )
{
v6 = (void *)v4[1];
if ( v6 )
SMemFree(v6, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 267, 0);
v7 = (void *)v4[4];
if ( v7 )
SMemFree(v7, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 269, 0);
v8 = (void *)v4[7];
if ( v8 )
SMemFree(v8, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 271, 0);
v9 = (void *)v4[10];
if ( v9 )
SMemFree(v9, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 273, 0);
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 275, 0);
SetWindowLongA(v2, -21, 0);
}
}
v2 = GetDlgItem(hWnd, nIDDlgItem);
if (v2) {
v4 = (_DWORD *)GetWindowLongA(v2, -21);
if (v4) {
v6 = (void *)v4[1];
if (v6)
SMemFree(v6, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 267, 0);
v7 = (void *)v4[4];
if (v7)
SMemFree(v7, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 269, 0);
v8 = (void *)v4[7];
if (v8)
SMemFree(v8, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 271, 0);
v9 = (void *)v4[10];
if (v9)
SMemFree(v9, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 273, 0);
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\Sbar.cpp", 275, 0);
SetWindowLongA(v2, -21, 0);
}
}
}

244
DiabloUI/selclass.cpp

@ -1,167 +1,151 @@
// ref: 0x10009D66
LRESULT __stdcall SelClass_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v4; // eax
int v5; // edx
HWND v6; // eax
HWND v7; // eax
HWND v9; // eax
HWND v4; // eax
int v5; // edx
HWND v6; // eax
HWND v7; // eax
HWND v9; // eax
if ( Msg == 2 )
{
SelClass_FreeClassMsgTbl(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg <= 0x103 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if ( Msg <= 0x105 )
{
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg == 272 )
{
SelClass_LoadClassFocus(hWnd);
return 0;
}
if ( Msg != 273 )
{
if ( Msg != 275 )
{
if ( Msg == 513 )
{
v4 = GetDlgItem(hWnd, 1056);
if ( local_GetBottomRect(hWnd, v4, (unsigned short)lParam, (unsigned int)lParam >> 16) )
{
v5 = 1;
LABEL_19:
SelClass_CheckClassSpawn(hWnd, v5);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v6 = GetDlgItem(hWnd, 1054);
if ( local_GetBottomRect(hWnd, v6, (unsigned short)lParam, (unsigned int)lParam >> 16) )
{
LABEL_21:
v5 = 2;
goto LABEL_19;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v7 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v7);
return 0;
}
if ( HIWORD(wParam) == 7 )
{
Focus_GetAndBlitSpin(hWnd, lParam);
}
else
{
if ( HIWORD(wParam) != 6 )
{
v5 = 1;
if ( HIWORD(wParam) == 5 || (_WORD)wParam == 1 )
goto LABEL_19;
if ( (_WORD)wParam != 2 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
goto LABEL_21;
}
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
SelClass_SetDefaultStats(hWnd, (unsigned short)wParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg == 2) {
SelClass_FreeClassMsgTbl(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg <= 0x103)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg <= 0x105) {
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg == 272) {
SelClass_LoadClassFocus(hWnd);
return 0;
}
if (Msg != 273) {
if (Msg != 275) {
if (Msg == 513) {
v4 = GetDlgItem(hWnd, 1056);
if (local_GetBottomRect(hWnd, v4, (unsigned short)lParam, (unsigned int)lParam >> 16)) {
v5 = 1;
LABEL_19:
SelClass_CheckClassSpawn(hWnd, v5);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v6 = GetDlgItem(hWnd, 1054);
if (local_GetBottomRect(hWnd, v6, (unsigned short)lParam, (unsigned int)lParam >> 16)) {
LABEL_21:
v5 = 2;
goto LABEL_19;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v7 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v7);
return 0;
}
if (HIWORD(wParam) == 7) {
Focus_GetAndBlitSpin(hWnd, lParam);
} else {
if (HIWORD(wParam) != 6) {
v5 = 1;
if (HIWORD(wParam) == 5 || (_WORD)wParam == 1)
goto LABEL_19;
if ((_WORD)wParam != 2)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
goto LABEL_21;
}
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
SelClass_SetDefaultStats(hWnd, (unsigned short)wParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x10009EC0
void __fastcall SelClass_FreeClassMsgTbl(HWND hWnd)
{
HWND v2; // eax
HWND v2; // eax
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(hWnd, selclass_msgtbl3);
Doom_DeleteFreeProcs(hWnd, selclass_msgtbl2);
Doom_DeleteFreeProcs(hWnd, selclass_msgtbl1);
v2 = GetParent(hWnd);
SelHero_SetStringWithMsg(v2, 0);
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(hWnd, selclass_msgtbl3);
Doom_DeleteFreeProcs(hWnd, selclass_msgtbl2);
Doom_DeleteFreeProcs(hWnd, selclass_msgtbl1);
v2 = GetParent(hWnd);
SelHero_SetStringWithMsg(v2, 0);
}
// ref: 0x10009EFD
void __fastcall SelClass_LoadClassFocus(HWND hWnd)
{
HWND v1; // edi
HWND v2; // esi
LONG v3; // eax
char Buffer[32]; // [esp+8h] [ebp-20h]
HWND v1; // edi
HWND v2; // esi
LONG v3; // eax
char Buffer[32]; // [esp+8h] [ebp-20h]
v1 = hWnd;
v2 = GetParent(hWnd);
if ( SelHero_GetHeroIsGood() == 1 )
LoadStringA(ghUiInst, 0x20u, Buffer, 31);
else
LoadStringA(ghUiInst, 0x1Fu, Buffer, 31);
SelHero_SetStringWithMsg(v2, Buffer);
v3 = GetWindowLongA(v2, -21);
SetWindowLongA(v1, -21, v3);
local_DoUiWndProc(v1, (DWORD *)selclass_msgtbl3);
Doom_ParseWndProc3(v1, selclass_msgtbl1, 5);
Doom_ParseWndProcs(v1, selclass_msgtbl2, 4, 0);
Doom_ParseWndProcs(v1, selclass_msgtbl3, 2, 1);
Focus_LoadSpinner("ui_art\\focus.pcx");
SDlgSetTimer((int)v1, 1, 55, 0);
v1 = hWnd;
v2 = GetParent(hWnd);
if (SelHero_GetHeroIsGood() == 1)
LoadStringA(ghUiInst, 0x20u, Buffer, 31);
else
LoadStringA(ghUiInst, 0x1Fu, Buffer, 31);
SelHero_SetStringWithMsg(v2, Buffer);
v3 = GetWindowLongA(v2, -21);
SetWindowLongA(v1, -21, v3);
local_DoUiWndProc(v1, (DWORD *)selclass_msgtbl3);
Doom_ParseWndProc3(v1, selclass_msgtbl1, 5);
Doom_ParseWndProcs(v1, selclass_msgtbl2, 4, 0);
Doom_ParseWndProcs(v1, selclass_msgtbl3, 2, 1);
Focus_LoadSpinner("ui_art\\focus.pcx");
SDlgSetTimer((int)v1, 1, 55, 0);
}
// ref: 0x10009FA2
void __fastcall SelClass_SetDefaultStats(HWND hWnd, int a2)
{
char v2; // bl
HWND v4; // eax
_uiheroinfo pInfo; // [esp+8h] [ebp-34h]
_uidefaultstats a2a; // [esp+34h] [ebp-8h]
char v2; // bl
HWND v4; // eax
_uiheroinfo pInfo; // [esp+8h] [ebp-34h]
_uidefaultstats a2a; // [esp+34h] [ebp-8h]
v2 = a2;
SelHero_SetClassStats(a2 - 1062, &a2a);
memset(&pInfo, 0, 0x2Cu);
pInfo.strength = a2a.strength;
pInfo.magic = a2a.magic;
pInfo.dexterity = a2a.dexterity;
pInfo.vitality = a2a.vitality;
pInfo.level = 1;
pInfo.heroclass = v2 - 38;
v4 = GetParent(hWnd);
SelHero_PrintHeroInfo(v4, &pInfo);
v2 = a2;
SelHero_SetClassStats(a2 - 1062, &a2a);
memset(&pInfo, 0, 0x2Cu);
pInfo.strength = a2a.strength;
pInfo.magic = a2a.magic;
pInfo.dexterity = a2a.dexterity;
pInfo.vitality = a2a.vitality;
pInfo.level = 1;
pInfo.heroclass = v2 - 38;
v4 = GetParent(hWnd);
SelHero_PrintHeroInfo(v4, &pInfo);
}
// ref: 0x1000A00D
void __fastcall SelClass_CheckClassSpawn(HWND hWnd, int a2)
{
HWND v4; // eax
HWND v5; // eax
HWND v4; // eax
HWND v5; // eax
if ( DiabloUI_GetSpawned() && a2 == 1 && (v4 = GetFocus(), GetWindowLongA(v4, -12) != 1062) )
{
SelYesNo_SpawnErrDialog(hWnd, 69, 0);
}
else
{
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
if ( a2 == 1 )
{
v5 = GetFocus();
a2 = GetWindowLongA(v5, -12);
}
SDlgEndDialog(hWnd, (HANDLE)a2);
}
if (DiabloUI_GetSpawned() && a2 == 1 && (v4 = GetFocus(), GetWindowLongA(v4, -12) != 1062)) {
SelYesNo_SpawnErrDialog(hWnd, 69, 0);
} else {
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
if (a2 == 1) {
v5 = GetFocus();
a2 = GetWindowLongA(v5, -12);
}
SDlgEndDialog(hWnd, (HANDLE)a2);
}
}
// ref: 0x1000A077
void __cdecl SelClass_cpp_init()
{
SelClass_cpp_float = SelClass_cpp_float_value;
SelClass_cpp_float = SelClass_cpp_float_value;
}
// 1001F450: using guessed type int SelClass_cpp_float_value;
// 1002A348: using guessed type int SelClass_cpp_float;

1132
DiabloUI/selhero.cpp

File diff suppressed because it is too large Load Diff

1195
DiabloUI/sellist.cpp

File diff suppressed because it is too large Load Diff

193
DiabloUI/selload.cpp

@ -1,134 +1,121 @@
// ref: 0x1000E1C2
LRESULT __stdcall SelLoad_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v4; // eax
int v5; // edx
HWND v6; // eax
HWND v7; // eax
HWND v9; // eax
HWND v4; // eax
int v5; // edx
HWND v6; // eax
HWND v7; // eax
HWND v9; // eax
if ( Msg == 2 )
{
SelLoad_DeleteProcsAndSpin(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg <= 0x103 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if ( Msg <= 0x105 )
{
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg == 272 )
{
SelLoad_LoadFocusAndMsg(hWnd);
return 0;
}
if ( Msg != 273 )
{
if ( Msg != 275 )
{
if ( Msg == 513 )
{
v4 = GetDlgItem(hWnd, 1056);
if ( local_GetBottomRect(hWnd, v4, (unsigned short)lParam, (unsigned int)lParam >> 16) )
{
v5 = 1;
LABEL_19:
SelLoad_SelectSndLoad(hWnd, v5);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v6 = GetDlgItem(hWnd, 1054);
if ( local_GetBottomRect(hWnd, v6, (unsigned short)lParam, (unsigned int)lParam >> 16) )
{
LABEL_21:
v5 = 2;
goto LABEL_19;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v7 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v7);
return 0;
}
if ( HIWORD(wParam) == 7 )
{
Focus_GetAndBlitSpin(hWnd, lParam);
}
else
{
if ( HIWORD(wParam) != 6 )
{
v5 = 1;
if ( HIWORD(wParam) == 5 || (_WORD)wParam == 1 )
goto LABEL_19;
if ( (_WORD)wParam != 2 )
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
goto LABEL_21;
}
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg == 2) {
SelLoad_DeleteProcsAndSpin(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg <= 0x103)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg <= 0x105) {
v9 = (HWND)SDrawGetFrameWindow();
SendMessageA(v9, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg == 272) {
SelLoad_LoadFocusAndMsg(hWnd);
return 0;
}
if (Msg != 273) {
if (Msg != 275) {
if (Msg == 513) {
v4 = GetDlgItem(hWnd, 1056);
if (local_GetBottomRect(hWnd, v4, (unsigned short)lParam, (unsigned int)lParam >> 16)) {
v5 = 1;
LABEL_19:
SelLoad_SelectSndLoad(hWnd, v5);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v6 = GetDlgItem(hWnd, 1054);
if (local_GetBottomRect(hWnd, v6, (unsigned short)lParam, (unsigned int)lParam >> 16)) {
LABEL_21:
v5 = 2;
goto LABEL_19;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v7 = GetFocus();
Focus_DoBlitSpinIncFrame(hWnd, v7);
return 0;
}
if (HIWORD(wParam) == 7) {
Focus_GetAndBlitSpin(hWnd, lParam);
} else {
if (HIWORD(wParam) != 6) {
v5 = 1;
if (HIWORD(wParam) == 5 || (_WORD)wParam == 1)
goto LABEL_19;
if ((_WORD)wParam != 2)
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
goto LABEL_21;
}
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x1000E30E
void __fastcall SelLoad_DeleteProcsAndSpin(HWND hWnd)
{
HWND v2; // eax
HWND v2; // eax
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(hWnd, selload_msgtbl3);
Doom_DeleteFreeProcs(hWnd, selload_msgtbl2);
Doom_DeleteFreeProcs(hWnd, selload_msgtbl1);
v2 = GetParent(hWnd);
SelHero_SetStringWithMsg(v2, 0);
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(hWnd, selload_msgtbl3);
Doom_DeleteFreeProcs(hWnd, selload_msgtbl2);
Doom_DeleteFreeProcs(hWnd, selload_msgtbl1);
v2 = GetParent(hWnd);
SelHero_SetStringWithMsg(v2, 0);
}
// ref: 0x1000E34B
void __fastcall SelLoad_LoadFocusAndMsg(HWND hWnd)
{
HWND v2; // edi
LONG v3; // eax
char Buffer[32]; // [esp+8h] [ebp-20h]
HWND v2; // edi
LONG v3; // eax
char Buffer[32]; // [esp+8h] [ebp-20h]
v2 = GetParent(hWnd);
LoadStringA(ghUiInst, 0x1Du, Buffer, 31);
SelHero_SetStringWithMsg(v2, Buffer);
v3 = GetWindowLongA(v2, -21);
SetWindowLongA(hWnd, -21, v3);
local_DoUiWndProc(hWnd, (DWORD *)selload_msgtbl3);
Doom_ParseWndProc3(hWnd, selload_msgtbl1, 5);
Doom_ParseWndProcs(hWnd, selload_msgtbl2, 4, 0);
Doom_ParseWndProcs(hWnd, selload_msgtbl3, 2, 1);
Focus_LoadSpinner("ui_art\\focus16.pcx");
SDlgSetTimer((int)hWnd, 1, 55, 0);
v2 = GetParent(hWnd);
LoadStringA(ghUiInst, 0x1Du, Buffer, 31);
SelHero_SetStringWithMsg(v2, Buffer);
v3 = GetWindowLongA(v2, -21);
SetWindowLongA(hWnd, -21, v3);
local_DoUiWndProc(hWnd, (DWORD *)selload_msgtbl3);
Doom_ParseWndProc3(hWnd, selload_msgtbl1, 5);
Doom_ParseWndProcs(hWnd, selload_msgtbl2, 4, 0);
Doom_ParseWndProcs(hWnd, selload_msgtbl3, 2, 1);
Focus_LoadSpinner("ui_art\\focus16.pcx");
SDlgSetTimer((int)hWnd, 1, 55, 0);
}
// ref: 0x1000E3E2
void __fastcall SelLoad_SelectSndLoad(HWND hWnd, int a2)
{
int v2; // esi
HWND v4; // eax
int v2; // esi
HWND v4; // eax
v2 = a2;
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
if ( v2 == 1 )
{
v4 = GetFocus();
v2 = GetWindowLongA(v4, -12);
}
SDlgEndDialog(hWnd, (HANDLE)v2);
v2 = a2;
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
if (v2 == 1) {
v4 = GetFocus();
v2 = GetWindowLongA(v4, -12);
}
SDlgEndDialog(hWnd, (HANDLE)v2);
}
// ref: 0x1000E41A
void __cdecl SelLoad_cpp_init()
{
SelLoad_cpp_float = SelLoad_cpp_float_value;
SelLoad_cpp_float = SelLoad_cpp_float_value;
}
// 1001F46C: using guessed type int SelLoad_cpp_float_value;
// 1002A4C8: using guessed type int SelLoad_cpp_float;

8
DiabloUI/selregn.cpp

@ -8,11 +8,11 @@ void *SelRegn_1000EF42() { return 0; }
// ref: 0x1000EF56
_uiheroinfo *__fastcall SelRegn_SetNextHero(_uiheroinfo *pNext, _uiheroinfo *pCurrent)
{
_uiheroinfo *result; // eax
_uiheroinfo *result; // eax
result = pCurrent;
pCurrent->next = pNext;
return result;
result = pCurrent;
pCurrent->next = pNext;
return result;
}
// ref: 0x1000EF60

307
DiabloUI/selyesno.cpp

@ -1,12 +1,12 @@
// ref: 0x1000FA49
int __fastcall SelYesNo_YesNoDialog(HWND hWnd, char *dialogstr, char *hero, int nofocus)
{
yesno_dialog_string = dialogstr;
yesno_hero_name = hero;
yesno_remove_focus = nofocus;
yesno_is_popup = 0;
YesNoFunc = 0;
return SDlgDialogBoxParam(ghUiInst, "SELYESNO_DIALOG", (int)hWnd, SelYesNo_WndProc, 0);
yesno_dialog_string = dialogstr;
yesno_hero_name = hero;
yesno_remove_focus = nofocus;
yesno_is_popup = 0;
YesNoFunc = 0;
return SDlgDialogBoxParam(ghUiInst, "SELYESNO_DIALOG", (int)hWnd, SelYesNo_WndProc, 0);
}
// 1002A500: using guessed type int yesno_remove_focus;
// 1002A508: using guessed type int (*YesNoFunc)(void);
@ -15,150 +15,129 @@ int __fastcall SelYesNo_YesNoDialog(HWND hWnd, char *dialogstr, char *hero, int
// ref: 0x1000FA87
LRESULT __stdcall SelYesNo_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND v4; // eax
HWND v5; // eax
int v7; // edx
HWND v8; // eax
LONG v9; // eax
HWND v10; // ecx
HWND v11; // eax
HWND v4; // eax
HWND v5; // eax
int v7; // edx
HWND v8; // eax
LONG v9; // eax
HWND v10; // ecx
HWND v11; // eax
if ( Msg == 2 )
{
SelYesNo_RemoveYNDialog(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if ( Msg > 0x103 )
{
if ( Msg <= 0x105 )
{
v11 = (HWND)SDrawGetFrameWindow();
SendMessageA(v11, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
switch ( Msg )
{
case 0x110u:
SelYesNo_LoadSelYN_GFX(hWnd);
return 0;
case 0x111u:
if ( HIWORD(wParam) == 7 )
{
Focus_GetAndBlitSpin(hWnd, lParam);
}
else if ( HIWORD(wParam) == 6 )
{
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
}
else
{
v7 = 1;
if ( (_WORD)wParam == 1 )
{
v8 = GetFocus();
v9 = GetWindowLongA(v8, -12);
v10 = hWnd;
if ( v9 == 1109 )
v7 = 1;
else
v7 = 2;
}
else
{
if ( (_WORD)wParam == 2 )
{
v7 = 2;
}
else if ( (_WORD)wParam != 1109 )
{
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v10 = hWnd;
}
SelYesNo_DoSelectYesNo(v10, v7);
}
break;
case 0x113u:
v4 = GetFocus();
if ( !Focus_DoBlitSpinIncFrame(hWnd, v4) )
{
v5 = GetDlgItem(hWnd, 1109);
if ( !v5 )
v5 = GetDlgItem(hWnd, 2);
SetFocus(v5);
}
return 0;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
if (Msg == 2) {
SelYesNo_RemoveYNDialog(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
if (Msg > 0x103) {
if (Msg <= 0x105) {
v11 = (HWND)SDrawGetFrameWindow();
SendMessageA(v11, Msg, wParam, lParam);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
switch (Msg) {
case 0x110u:
SelYesNo_LoadSelYN_GFX(hWnd);
return 0;
case 0x111u:
if (HIWORD(wParam) == 7) {
Focus_GetAndBlitSpin(hWnd, lParam);
} else if (HIWORD(wParam) == 6) {
Focus_CheckPlayMove(lParam);
Focus_DoBlitSpinIncFrame(hWnd, (HWND)lParam);
} else {
v7 = 1;
if ((_WORD)wParam == 1) {
v8 = GetFocus();
v9 = GetWindowLongA(v8, -12);
v10 = hWnd;
if (v9 == 1109)
v7 = 1;
else
v7 = 2;
} else {
if ((_WORD)wParam == 2) {
v7 = 2;
} else if ((_WORD)wParam != 1109) {
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
v10 = hWnd;
}
SelYesNo_DoSelectYesNo(v10, v7);
}
break;
case 0x113u:
v4 = GetFocus();
if (!Focus_DoBlitSpinIncFrame(hWnd, v4)) {
v5 = GetDlgItem(hWnd, 1109);
if (!v5)
v5 = GetDlgItem(hWnd, 2);
SetFocus(v5);
}
return 0;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x1000FBC7
void __fastcall SelYesNo_RemoveYNDialog(HWND hWnd)
{
HWND v1; // esi
void **v2; // eax
HWND v3; // eax
HWND v1; // esi
void **v2; // eax
HWND v3; // eax
v1 = hWnd;
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
if ( yesno_remove_focus )
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(v1, yesno_msgtbl1);
Doom_DeleteFreeProcs(v1, yesno_msgtbl2);
if ( yesno_hero_name )
{
v3 = GetParent(v1);
SelHero_SetStringWithMsg(v3, 0);
}
v1 = hWnd;
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
if (yesno_remove_focus)
Focus_DeleteSpinners();
Doom_DeleteFreeProcs(v1, yesno_msgtbl1);
Doom_DeleteFreeProcs(v1, yesno_msgtbl2);
if (yesno_hero_name) {
v3 = GetParent(v1);
SelHero_SetStringWithMsg(v3, 0);
}
}
// 1002A500: using guessed type int yesno_remove_focus;
// ref: 0x1000FC1C
void __fastcall SelYesNo_LoadSelYN_GFX(HWND hWnd)
{
HWND v2; // eax
DWORD *v3; // eax
DWORD *v4; // edi
const char *v5; // eax
char *v6; // ST18_4
HWND v7; // eax
HWND v2; // eax
DWORD *v3; // eax
DWORD *v4; // edi
const char *v5; // eax
char *v6; // ST18_4
HWND v7; // eax
v2 = GetParent(hWnd);
if ( yesno_hero_name )
SelHero_SetStringWithMsg(v2, yesno_hero_name);
v3 = local_AllocWndLongData();
v4 = v3;
if ( v3 )
{
SetWindowLongA(hWnd, -21, (LONG)v3);
if ( yesno_is_popup )
{
if ( DiabloUI_GetSpawned() )
v5 = "ui_art\\swmmpop.pcx";
else
v5 = "ui_art\\mmpopup.pcx";
}
else
{
v5 = "ui_art\\black.pcx";
}
local_LoadArtWithPal(hWnd, 0, "Popup", -1, 1, v5, (BYTE **)v4, v4 + 1, 1);
}
v6 = yesno_dialog_string;
v7 = GetDlgItem(hWnd, 1026);
SetWindowTextA(v7, v6);
Doom_ParseWndProc3(hWnd, yesno_msgtbl2, 3);
Doom_ParseWndProcs(hWnd, yesno_msgtbl1, 4, 1);
if ( yesno_remove_focus )
Focus_LoadSpinner("ui_art\\focus.pcx");
else
Focus_ResetSpinToZero();
SDlgSetTimer((int)hWnd, 1, 55, 0);
local_DoUiWndProc2(hWnd, (DWORD *)yesno_msgtbl1);
v2 = GetParent(hWnd);
if (yesno_hero_name)
SelHero_SetStringWithMsg(v2, yesno_hero_name);
v3 = local_AllocWndLongData();
v4 = v3;
if (v3) {
SetWindowLongA(hWnd, -21, (LONG)v3);
if (yesno_is_popup) {
if (DiabloUI_GetSpawned())
v5 = "ui_art\\swmmpop.pcx";
else
v5 = "ui_art\\mmpopup.pcx";
} else {
v5 = "ui_art\\black.pcx";
}
local_LoadArtWithPal(hWnd, 0, "Popup", -1, 1, v5, (BYTE **)v4, v4 + 1, 1);
}
v6 = yesno_dialog_string;
v7 = GetDlgItem(hWnd, 1026);
SetWindowTextA(v7, v6);
Doom_ParseWndProc3(hWnd, yesno_msgtbl2, 3);
Doom_ParseWndProcs(hWnd, yesno_msgtbl1, 4, 1);
if (yesno_remove_focus)
Focus_LoadSpinner("ui_art\\focus.pcx");
else
Focus_ResetSpinToZero();
SDlgSetTimer((int)hWnd, 1, 55, 0);
local_DoUiWndProc2(hWnd, (DWORD *)yesno_msgtbl1);
}
// 1002A500: using guessed type int yesno_remove_focus;
// 1002A50C: using guessed type int yesno_is_popup;
@ -166,35 +145,33 @@ void __fastcall SelYesNo_LoadSelYN_GFX(HWND hWnd)
// ref: 0x1000FCF6
void __fastcall SelYesNo_DoSelectYesNo(HWND hWnd, int option)
{
HWND v4; // eax
HWND v4; // eax
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
if ( option == 2 )
{
if ( !YesNoFunc )
goto LABEL_6;
YesNoFunc();
}
if ( option == 1 )
{
v4 = GetFocus();
option = GetWindowLongA(v4, -12);
}
TitleSnd_PlaySelectSound();
SDlgKillTimer((int)hWnd, 1);
if (option == 2) {
if (!YesNoFunc)
goto LABEL_6;
YesNoFunc();
}
if (option == 1) {
v4 = GetFocus();
option = GetWindowLongA(v4, -12);
}
LABEL_6:
SDlgEndDialog(hWnd, (HANDLE)option);
SDlgEndDialog(hWnd, (HANDLE)option);
}
// 1002A508: using guessed type int (*YesNoFunc)(void);
// ref: 0x1000FD39
int __fastcall SelYesNo_SelOkDialog(HWND hWnd, char *dialogstr, char *hero, int nofocus)
{
yesno_dialog_string = dialogstr;
yesno_hero_name = hero;
yesno_remove_focus = nofocus;
yesno_is_popup = 0;
YesNoFunc = 0;
return SDlgDialogBoxParam(ghUiInst, "SELOK_DIALOG", (int)hWnd, SelYesNo_WndProc, 0);
yesno_dialog_string = dialogstr;
yesno_hero_name = hero;
yesno_remove_focus = nofocus;
yesno_is_popup = 0;
YesNoFunc = 0;
return SDlgDialogBoxParam(ghUiInst, "SELOK_DIALOG", (int)hWnd, SelYesNo_WndProc, 0);
}
// 1002A500: using guessed type int yesno_remove_focus;
// 1002A508: using guessed type int (*YesNoFunc)(void);
@ -203,15 +180,15 @@ int __fastcall SelYesNo_SelOkDialog(HWND hWnd, char *dialogstr, char *hero, int
// ref: 0x1000FD77
int __fastcall SelYesNo_SpawnErrDialog(HWND hWnd, int string_rsrc, int is_popup)
{
char Buffer[256]; // [esp+4h] [ebp-100h]
char Buffer[256]; // [esp+4h] [ebp-100h]
LoadStringA(ghUiInst, string_rsrc, Buffer, 255);
yesno_is_popup = is_popup;
yesno_remove_focus = 0;
yesno_hero_name = 0;
yesno_dialog_string = Buffer;
YesNoFunc = 0;
return SDlgDialogBoxParam(ghUiInst, "SPAWNERR_DIALOG", (int)hWnd, SelYesNo_WndProc, 0);
LoadStringA(ghUiInst, string_rsrc, Buffer, 255);
yesno_is_popup = is_popup;
yesno_remove_focus = 0;
yesno_hero_name = 0;
yesno_dialog_string = Buffer;
YesNoFunc = 0;
return SDlgDialogBoxParam(ghUiInst, "SPAWNERR_DIALOG", (int)hWnd, SelYesNo_WndProc, 0);
}
// 1002A500: using guessed type int yesno_remove_focus;
// 1002A508: using guessed type int (*YesNoFunc)(void);
@ -220,7 +197,7 @@ int __fastcall SelYesNo_SpawnErrDialog(HWND hWnd, int string_rsrc, int is_popup)
// ref: 0x1000FDE3
void __cdecl SelYesNo_cpp_init()
{
SelYesNo_cpp_float = SelYesNo_cpp_float_value;
SelYesNo_cpp_float = SelYesNo_cpp_float_value;
}
// 1001F478: using guessed type int SelYesNo_cpp_float_value;
// 1002A4FC: using guessed type int SelYesNo_cpp_float;

393
DiabloUI/title.cpp

@ -1,168 +1,155 @@
// ref: 0x1000FDEE
void __fastcall Title_BlitTitleBuffer(HWND hWnd)
{
_DWORD *v2; // edi
int v3; // eax
HANDLE v4; // esi
struct tagRECT Rect; // [esp+Ch] [ebp-18h]
HWND hWnda; // [esp+20h] [ebp-4h]
_DWORD *v2; // edi
int v3; // eax
HANDLE v4; // esi
struct tagRECT Rect; // [esp+Ch] [ebp-18h]
HWND hWnda; // [esp+20h] [ebp-4h]
v2 = (_DWORD *)GetWindowLongA(hWnd, -21);
hWnda = GetDlgItem(hWnd, 1043);
if ( IsWindowVisible(hWnd) && hWnda && v2 && *v2 && titlePHTrans[0] )
{
v3 = titleTransIdx + 1;
titleTransIdx = v3;
if ( !titlePHTrans[v3] || v3 >= 30 )
titleTransIdx = 0;
GetWindowRect(hWnda, &Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect.right);
v4 = GetPropA(hWnd, "TITLE_BUFFER");
if ( v4 )
{
SBltROP3(
*(void **)v4,
(void *)(Rect.left + *v2 + Rect.top * v2[1]),
*((_DWORD *)v4 + 1),
*((_DWORD *)v4 + 2),
*((_DWORD *)v4 + 1),
v2[1],
0,
0xCC0020u);
STransBlt(*(void **)v4, 0, 0, *((_DWORD *)v4 + 1), (HANDLE)titlePHTrans[titleTransIdx]);
InvalidateRect(hWnda, 0, 0);
}
}
v2 = (_DWORD *)GetWindowLongA(hWnd, -21);
hWnda = GetDlgItem(hWnd, 1043);
if (IsWindowVisible(hWnd) && hWnda && v2 && *v2 && titlePHTrans[0]) {
v3 = titleTransIdx + 1;
titleTransIdx = v3;
if (!titlePHTrans[v3] || v3 >= 30)
titleTransIdx = 0;
GetWindowRect(hWnda, &Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect);
ScreenToClient(hWnd, (LPPOINT)&Rect.right);
v4 = GetPropA(hWnd, "TITLE_BUFFER");
if (v4) {
SBltROP3(
*(void **)v4,
(void *)(Rect.left + *v2 + Rect.top * v2[1]),
*((_DWORD *)v4 + 1),
*((_DWORD *)v4 + 2),
*((_DWORD *)v4 + 1),
v2[1],
0,
0xCC0020u);
STransBlt(*(void **)v4, 0, 0, *((_DWORD *)v4 + 1), (HANDLE)titlePHTrans[titleTransIdx]);
InvalidateRect(hWnda, 0, 0);
}
}
}
// 1002A58C: using guessed type int titleTransIdx;
// ref: 0x1000FEED
void __cdecl Title_DeletePhTrans()
{
int *v0; // esi
int *v0; // esi
v0 = (int *)titlePHTrans;
do
{
if ( *v0 )
{
STransDelete((HANDLE)*v0);
*v0 = 0;
}
++v0;
}
while ( (signed int)v0 < (signed int)&titlePHTrans[30] );
v0 = (int *)titlePHTrans;
do {
if (*v0) {
STransDelete((HANDLE)*v0);
*v0 = 0;
}
++v0;
} while ((signed int)v0 < (signed int)&titlePHTrans[30]);
}
// ref: 0x1000FF0F
void __fastcall Title_FreeTransMem(HWND hWnd)
{
void **v2; // eax MAPDST
void *v4; // eax
void **v2; // eax MAPDST
void *v4; // eax
Title_DeletePhTrans();
v2 = (void **)RemovePropA(hWnd, "TITLE_BUFFER");
if ( v2 )
{
v4 = *v2;
if ( v4 )
{
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 114, 0);
*v2 = 0;
}
SMemFree(v2, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 117, 0);
}
Title_DeletePhTrans();
v2 = (void **)RemovePropA(hWnd, "TITLE_BUFFER");
if (v2) {
v4 = *v2;
if (v4) {
SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 114, 0);
*v2 = 0;
}
SMemFree(v2, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 117, 0);
}
}
// ref: 0x1000FF51
void __fastcall Title_SetTitleBMP(HWND hWnd)
{
HWND v1; // eax MAPDST
_DWORD *v2; // esi
void *v3; // eax
struct tagRECT Rect; // [esp+0h] [ebp-18h]
HWND v1; // eax MAPDST
_DWORD *v2; // esi
void *v3; // eax
struct tagRECT Rect; // [esp+0h] [ebp-18h]
Title_FreeTransMem(hWnd);
v1 = GetDlgItem(hWnd, 1043);
if ( v1 )
{
GetClientRect(v1, &Rect);
v2 = (unsigned int *)SMemAlloc(0xCu, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 134, 0);
v3 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 136, 8);
*v2 = (unsigned int)v3;
v2[1] = Rect.right;
v2[2] = Rect.bottom;
SDlgSetBitmapI(v1, 0, 0, -1, 1, v3, 0, Rect.right, Rect.bottom, -1);
SetPropA(hWnd, "TITLE_BUFFER", v2);
}
Title_FreeTransMem(hWnd);
v1 = GetDlgItem(hWnd, 1043);
if (v1) {
GetClientRect(v1, &Rect);
v2 = (unsigned int *)SMemAlloc(0xCu, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 134, 0);
v3 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 136, 8);
*v2 = (unsigned int)v3;
v2[1] = Rect.right;
v2[2] = Rect.bottom;
SDlgSetBitmapI(v1, 0, 0, -1, 1, v3, 0, Rect.right, Rect.bottom, -1);
SetPropA(hWnd, "TITLE_BUFFER", v2);
}
}
// ref: 0x1000FFE8
void __fastcall Title_LoadTitleImage(HWND hWnd, const char *pszFileName)
{
int v3; // edi
_DWORD *v4; // eax
_DWORD *v5; // esi
int v6; // ebx
int a5[4]; // [esp+8h] [ebp-20h]
int data[2]; // [esp+18h] [ebp-10h]
HANDLE *phTransOut; // [esp+20h] [ebp-8h]
BYTE *pBuffer; // [esp+24h] [ebp-4h]
int v3; // edi
_DWORD *v4; // eax
_DWORD *v5; // esi
int v6; // ebx
int a5[4]; // [esp+8h] [ebp-20h]
int data[2]; // [esp+18h] [ebp-10h]
HANDLE *phTransOut; // [esp+20h] [ebp-8h]
BYTE *pBuffer; // [esp+24h] [ebp-4h]
v3 = 0;
pBuffer = 0;
local_LoadArtImage(pszFileName, &pBuffer, (DWORD *)data);
v4 = (unsigned int *)GetPropA(hWnd, "TITLE_BUFFER");
v5 = v4;
if ( pBuffer )
{
if ( v4 )
{
v6 = data[1] / v4[2];
if ( v6 > 30 )
v6 = 30;
if ( v6 > 0 )
{
phTransOut = (HANDLE *)titlePHTrans;
do
{
a5[0] = 0;
a5[2] = v5[1] - 1;
a5[1] = v3 * v5[2];
a5[3] = v5[2] + a5[1] - 1;
STransCreateI(pBuffer, v5[1], v5[2], 8, (int)a5, 16777466, phTransOut);
++phTransOut;
++v3;
}
while ( v3 < v6 );
}
}
SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 197, 0);
}
titleTransIdx = 0;
v3 = 0;
pBuffer = 0;
local_LoadArtImage(pszFileName, &pBuffer, (DWORD *)data);
v4 = (unsigned int *)GetPropA(hWnd, "TITLE_BUFFER");
v5 = v4;
if (pBuffer) {
if (v4) {
v6 = data[1] / v4[2];
if (v6 > 30)
v6 = 30;
if (v6 > 0) {
phTransOut = (HANDLE *)titlePHTrans;
do {
a5[0] = 0;
a5[2] = v5[1] - 1;
a5[1] = v3 * v5[2];
a5[3] = v5[2] + a5[1] - 1;
STransCreateI(pBuffer, v5[1], v5[2], 8, (int)a5, 16777466, phTransOut);
++phTransOut;
++v3;
} while (v3 < v6);
}
}
SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 197, 0);
}
titleTransIdx = 0;
}
// 1002A58C: using guessed type int titleTransIdx;
// ref: 0x1001009E
void __fastcall Title_LoadImgSetTimer(HWND hWnd, const char *pszFileName)
{
Title_SetTitleBMP(hWnd);
Title_LoadTitleImage(hWnd, pszFileName);
Title_BlitTitleBuffer(hWnd);
SDlgSetTimer((int)hWnd, 2, 55, Title_BlitTitleBufFnc);
Title_SetTitleBMP(hWnd);
Title_LoadTitleImage(hWnd, pszFileName);
Title_BlitTitleBuffer(hWnd);
SDlgSetTimer((int)hWnd, 2, 55, Title_BlitTitleBufFnc);
}
// ref: 0x100100CB
void __stdcall Title_BlitTitleBufFnc(int hWnd, int a2, int a3, int a4)
{
Title_BlitTitleBuffer((HWND)hWnd);
Title_BlitTitleBuffer((HWND)hWnd);
}
// ref: 0x100100DC
void __cdecl Title_cpp_init()
{
Title_cpp_float = Title_cpp_float_value;
Title_cpp_float = Title_cpp_float_value;
}
// 1001F47C: using guessed type int Title_cpp_float_value;
// 1002A588: using guessed type int Title_cpp_float;
@ -170,87 +157,74 @@ void __cdecl Title_cpp_init()
// ref: 0x100100E7
void __fastcall Title_KillTitleTimer(HWND hWnd)
{
HWND v1; // esi
HWND v1; // esi
v1 = hWnd;
SDlgKillTimer((int)hWnd, 2);
Title_FreeTransMem(v1);
v1 = hWnd;
SDlgKillTimer((int)hWnd, 2);
Title_FreeTransMem(v1);
}
// ref: 0x100100FA
BOOL __stdcall UiTitleDialog(int a1)
{
int v1; // eax
int v1; // eax
artfont_LoadAllFonts();
v1 = (int)SDrawGetFrameWindow();
SDlgDialogBoxParam(ghUiInst, "TITLESCREEN_DIALOG", v1, Title_MainProc, a1);
return 1;
artfont_LoadAllFonts();
v1 = (int)SDrawGetFrameWindow();
SDlgDialogBoxParam(ghUiInst, "TITLESCREEN_DIALOG", v1, Title_MainProc, a1);
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
// ref: 0x10010126
LRESULT __stdcall Title_MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND v5; // eax
HWND v5; // eax
if ( uMsg <= 0x111 )
{
if ( uMsg != 273 )
{
if ( uMsg != 2 )
{
if ( uMsg == 135 )
return 4;
if ( uMsg != 256 )
{
if ( uMsg > 0x103 )
{
if ( uMsg <= 0x105 )
{
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, uMsg, wParam, lParam);
}
else if ( uMsg == 272 )
{
Title_LoadAllTitleImgs(hWnd, lParam);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_25;
}
Title_KillTimerAndFree(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_25;
}
if ( uMsg != 275 )
{
if ( uMsg != 513 && uMsg != 516 )
{
if ( uMsg == 528 )
{
if ( (_WORD)wParam == 513 || (_WORD)wParam == 516 )
Title_KillAndFadeDlg(hWnd);
}
else if ( uMsg == 2024 )
{
if ( !Fade_CheckRange5() )
Fade_SetFadeTimer((int)hWnd);
return 0;
}
return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam);
}
LABEL_25:
Title_KillAndFadeDlg(hWnd);
return 0;
}
if ( wParam == 1 )
goto LABEL_25;
return 0;
if (uMsg <= 0x111) {
if (uMsg != 273) {
if (uMsg != 2) {
if (uMsg == 135)
return 4;
if (uMsg != 256) {
if (uMsg > 0x103) {
if (uMsg <= 0x105) {
v5 = (HWND)SDrawGetFrameWindow();
SendMessageA(v5, uMsg, wParam, lParam);
} else if (uMsg == 272) {
Title_LoadAllTitleImgs(hWnd, lParam);
PostMessageA(hWnd, 0x7E8u, 0, 0);
return 1;
}
}
return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_25;
}
Title_KillTimerAndFree(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam);
}
goto LABEL_25;
}
if (uMsg != 275) {
if (uMsg != 513 && uMsg != 516) {
if (uMsg == 528) {
if ((_WORD)wParam == 513 || (_WORD)wParam == 516)
Title_KillAndFadeDlg(hWnd);
} else if (uMsg == 2024) {
if (!Fade_CheckRange5())
Fade_SetFadeTimer((int)hWnd);
return 0;
}
return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam);
}
LABEL_25:
Title_KillAndFadeDlg(hWnd);
return 0;
}
if (wParam == 1)
goto LABEL_25;
return 0;
}
// 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD);
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
@ -258,39 +232,38 @@ LABEL_25:
// ref: 0x10010235
void __fastcall Title_KillTimerAndFree(HWND hWnd)
{
void **v2; // eax
void **v2; // eax
Title_KillTitleTimer(hWnd);
Doom_DeleteFreeProcs(hWnd, titlemsgtbl);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
Title_KillTitleTimer(hWnd);
Doom_DeleteFreeProcs(hWnd, titlemsgtbl);
v2 = (void **)GetWindowLongA(hWnd, -21);
local_FreeMemPtr(v2);
}
// ref: 0x1001025A
void __fastcall Title_LoadAllTitleImgs(HWND hWnd, int time)
{
DWORD *v4; // edi
DWORD *v4; // edi
v4 = local_AllocWndLongData();
SetWindowLongA(hWnd, -21, (LONG)v4);
if ( v4 )
{
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, "ui_art\\title.pcx", (BYTE **)v4, v4 + 1, 0);
Fade_NoInputAndArt(hWnd, 0);
}
Doom_ParseWndProc3(hWnd, titlemsgtbl, 3);
Title_LoadImgSetTimer(hWnd, "ui_art\\logo.pcx");
if ( time )
SDlgSetTimer((int)hWnd, 1, 1000 * time, 0);
else
SDlgSetTimer((int)hWnd, 1, 5000, 0);
v4 = local_AllocWndLongData();
SetWindowLongA(hWnd, -21, (LONG)v4);
if (v4) {
local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, "ui_art\\title.pcx", (BYTE **)v4, v4 + 1, 0);
Fade_NoInputAndArt(hWnd, 0);
}
Doom_ParseWndProc3(hWnd, titlemsgtbl, 3);
Title_LoadImgSetTimer(hWnd, "ui_art\\logo.pcx");
if (time)
SDlgSetTimer((int)hWnd, 1, 1000 * time, 0);
else
SDlgSetTimer((int)hWnd, 1, 5000, 0);
}
// ref: 0x100102D7
void __fastcall Title_KillAndFadeDlg(HWND hWnd)
{
Fade_Range5SetZero();
SDlgKillTimer((int)hWnd, 1);
Fade_UpdatePaletteRange(10);
SDlgEndDialog(hWnd, (void *)HANDLE_FLAG_INHERIT);
Fade_Range5SetZero();
SDlgKillTimer((int)hWnd, 1);
Fade_UpdatePaletteRange(10);
SDlgEndDialog(hWnd, (void *)HANDLE_FLAG_INHERIT);
}

16
DiabloUI/titlesnd.cpp

@ -1,33 +1,33 @@
// ref: 0x10010306
void __fastcall TitleSnd_SetSoundFunction(void (__stdcall *func)(char *file))
void __fastcall TitleSnd_SetSoundFunction(void(__stdcall *func)(char *file))
{
gfnSoundFunction = func;
gfnSoundFunction = func;
}
// ref: 0x1001030D
void __cdecl TitleSnd_InitSoundFunc()
{
gfnSoundFunction = 0;
gfnSoundFunction = 0;
}
// ref: 0x10010315
void __cdecl TitleSnd_PlayMoveSound()
{
if ( gfnSoundFunction )
gfnSoundFunction("sfx\\items\\titlemov.wav");
if (gfnSoundFunction)
gfnSoundFunction("sfx\\items\\titlemov.wav");
}
// ref: 0x1001031F
void __cdecl TitleSnd_PlaySelectSound()
{
if ( gfnSoundFunction )
gfnSoundFunction("sfx\\items\\titlslct.wav");
if (gfnSoundFunction)
gfnSoundFunction("sfx\\items\\titlslct.wav");
}
// ref: 0x1001032E
void __cdecl TitleSnd_cpp_init()
{
titlesnd_cpp_float = titlesnd_cpp_float_value;
titlesnd_cpp_float = titlesnd_cpp_float_value;
}
// 1001F480: using guessed type int titlesnd_cpp_float_value;
// 1002A590: using guessed type int titlesnd_cpp_float;

Loading…
Cancel
Save