| Berserker   
   
   Posts: 16785
 
 |  | 
	| 15.03.2021 22:08 |  | 
	
		| Berserker   
   
   Posts: 16785
 
 | 
			| 
 
				Пиши обёртку: 
Code:
 TMesType =(
 MES_MES         = 1,
 MES_QUESTION    = 2,
 MES_RMB_HINT    = 4,
 MES_CHOOSE      = 7,
 MES_MAY_CHOOSE  = 10
 );
 
 function Msg
 (
 const Mes:          string;
 MesType:      TMesType  = MES_MES;
 Pic1Type:     integer   = NO_PIC_TYPE;
 Pic1SubType:  integer   = 0;
 Pic2Type:     integer   = NO_PIC_TYPE;
 Pic2SubType:  integer   = 0;
 Pic3Type:     integer   = NO_PIC_TYPE;
 Pic3SubType:  integer   = 0
 ): integer;
 
 var
 MesStr:     pchar;
 MesTypeInt: integer;
 Res:        integer;
 
 begin
 MesStr     := pchar(Mes);
 MesTypeInt := ORD(MesType);
 
 asm
 MOV ECX, MesStr
 PUSH Pic3SubType
 PUSH Pic3Type
 PUSH -1
 PUSH -1
 PUSH Pic2SubType
 PUSH Pic2Type
 PUSH Pic1SubType
 PUSH Pic1Type
 PUSH -1
 PUSH -1
 MOV EAX, $4F6C00
 MOV EDX, MesTypeInt
 CALL EAX
 MOV EAX, [WND_MANAGER]
 MOV EAX, [EAX + $38]
 MOV Res, EAX
 end; // .asm
 
 result := MSG_RES_OK;
 
 if MesType = MES_QUESTION then begin
 if Res = 30726 then begin
 result := MSG_RES_CANCEL;
 end // .if
 end else if MesType in [MES_CHOOSE, MES_MAY_CHOOSE] then begin
 case Res of
 30729: result := MSG_RES_LEFTPIC;
 30730: result := MSG_RES_RIGHTPIC;
 else
 result := MSG_RES_CANCEL;
 end; // .SWITCH Res
 end; // .elseif
 end; // .function Msg
 
 procedure ShowMessage (const Mes: string);
 begin
 Msg(Mes);
 end;
 
 function Ask (const Question: string): boolean;
 begin
 result := Msg(Question, MES_QUESTION) = MSG_RES_OK;
 end;
 Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
 Поддержать проект
 
 |  | 
	| 15.03.2021 22:50 |  | 
	
		| XEPOMAHT   
   
   Posts: 2481
 
 | 
			| 
 
				 (15.03.2021 23:12)Raistlin Wrote:  Честно говоря, мне даже неудобно как-то - я ожидал простого совета или максимум - примера использования откуда-то ещё... 
Вызывай эту воговскую функцию и не парься (в с этим MoP ещё сильнее упрощено):
 
Code:
 int Message(const char *zmes,int n,int showtime)/*
 1-сообщение
 2-запрос
 4-инфа по правой мышке
 7-просьба выбрать
 10-можно и выбрать и отказаться
 */
 {
 STARTNA(__LINE__, 0)
 if (MainWindow == 0)
 {
 MessageBox(0, zmes, "Heroes of Might and Magic III", 0);
 RETURN(0);
 }
 
 __asm{
 mov  ecx,zmes
 push 0         // SType 3 : 0
 push -1        // Type 3  : -1
 push showtime  //0
 push -1        // Par ???
 push 0         // SType 2
 push -1        // Type 2
 push 0         // SType 1
 push -1        // Type 1
 push -1        // y
 push -1        // x
 mov eax,0x4f6C00
 mov edx,n
 call eax
 }
 __asm{
 mov eax,0x6992D0
 mov ecx,[eax]
 mov eax,[ecx+0x38]
 mov IDummy,eax
 }
 RETURN(IDummy);
 }
 |  | 
	| 16.03.2021 00:09 |  | 
	
		| igrik   
   Posts: 2821
 
 | 
			| 
 
				Raistlin, при использовании patcher_x86.hpp и заголовочника HoMM3.h вообще не нужно писать ASM код, и всё становится куда проще:
 
Универсальная обёртка с использованием условий по умолчанию:
 
Code:
 _bool_ f_MsgBox(char* text, int style = 1, int x = -1, int y = -1, int pic1Type = -1, int pic1Subtype = 0, int pic2Type = -1, int pic2Subtype = 0, int unk = -1, int showTime = 0, int pic3Type = -1, int pic3Subtype = 0){
 CALL_12(void, __fastcall, 0x4F6C00, text, style, x, y, pic1Type, pic1Subtype, pic2Type, pic2Subtype, unk, showTime, pic3Type, pic3Subtype);
 return (o_WndMgr->result_dlg_item_id);
 }
 
Примеры вызовов:
 
Code:
 f_MsgBox(message); // просто сообщение с текстомif(f_MsgBox(message, 4) {...}) // вопрос с текстом, в условии
 f_MsgBox(message, 1, -1, -1, pic1Type, pic1Subtype); // показ сообщения с одной картинкой (id картинок см.IF:Q)
 f_MsgBox(message, 7, -1, -1, pic1Type, pic1Subtype, pic2Type, pic2Subtype); // сообщение с выбором из 2х картинок
 daemon_n, просто проснулся раньше обычного. ХЗ, старею походу... 
 game bug fixes extended.dll  ||  My Plugins  ||  My GitHub
 |  | 
	| 16.03.2021 07:47 |  | 
	
		| Archer30   
   
   Posts: 1192
 
 | 
			| 
 
				Hello! Looking for help from igrik  with WoG Native Dialog . I understand these problems have been reported, but I just hope they can be fixed in the near future.    
1. Keypad support. Currently, the keypad has no use with input dialogues from WoG Native Dialog. 
2. Disappearing WoG Option dialogue. As I understand after HD 5.2 RC11 the WoG dialogue support of OpenGL gets worse, as a result, the WoG Option dialogue disappear immediately (Details ). Switching to non-OpenGL mode could resolve the issue, but it's not ideal - I simply can't play H3 without the great performance in OpenGL.
			
 Latest ERA mods and scripts in development -  My GitHub
 |  | 
	| 17.03.2021 12:07 |  | 
	
		| Berserker   
   
   Posts: 16785
 
 |  | 
	| 17.03.2021 15:27 |  | 
	
		| Berserker   
   
   Posts: 16785
 
 |  | 
	| 17.03.2021 16:44 |  |