Current time: 13.04.2024, 23:47 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
Плагины. Обсуждение
» Plugins. Discussion & Questions
Author Message
Berserker Offline
Administrators

Posts: 16471
Post: #346

Костыль в способе чтения и вывода текста в IF:Q?


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
15.03.2021 22:08
Find all posts by this user Quote this message in a reply
Raistlin Away
Moderators

Posts: 1348
Post: #347

Да. Я не разобрался, как правильно выводить сообщения на экран, у функции 0x4F6C00 слишком много параметров.


Создал новый глобальный мод: WoG Ultra Edition
15.03.2021 22:14
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16471
Post: #348

Пиши обёртку:
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
Find all posts by this user Quote this message in a reply
Raistlin Away
Moderators

Posts: 1348
Post: #349

Berserker, большое Вам спасибо!
Вы этот код прямо сейчас написали? Честно говоря, мне даже неудобно как-то - я ожидал простого совета или максимум - примера использования откуда-то ещё...


Создал новый глобальный мод: WoG Ultra Edition
15.03.2021 23:12
Find all posts by this user Quote this message in a reply
XEPOMAHT Offline
Moderators

Posts: 2271
Post: #350

(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
Find all posts by this user Quote this message in a reply
V_Maiko Offline

Posts: 605
Post: #351

Raistlin, Good job! 132 You are our hero of plugin mods! I wonder, what is the new thing that you will come up with? 96-copySpiteful
16.03.2021 00:56
Find all posts by this user Quote this message in a reply
Raistlin Away
Moderators

Posts: 1348
Post: #352

V_Maiko, thank you for your support! 96-copy The new thing that I will come up with is pretty interesting, but for now it is a secret 144
XEPOMAHT, спасибо за код, я попробую. 132


Создал новый глобальный мод: WoG Ultra Edition
16.03.2021 01:50
Find all posts by this user Quote this message in a reply
V_Maiko Offline

Posts: 605
Post: #353

After having used the H3.RMGDescription plugin for a long time, I have always wondered, why is a plugin not implemented to allow introducing seeds like in Minecraft? So players can generate their own maps in a more fun way Rolleyes
16.03.2021 07:25
Find all posts by this user Quote this message in a reply
igrik Offline
Administrators

Posts: 2813
Post: #354

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
Visit this user's website Find all posts by this user Quote this message in a reply
daemon_n Offline
Administrators

Posts: 4338
Post: #355

Raistlin, а я вот не понял, зачем этот плагин, когда есть скрипт отображения экрана героя без схлопывания в эра спкриптс, написанный через un:c. Позволяет и командира проверить, и статус оруженосца, и артефакты в рюкзаке - вообще любую информацию.

igrik, ещё нет шести утра – надеюсь, всё нормально 105


Image: widget.png?style=banner2

Новейший Heroes 3 Launcher
16.03.2021 07:50
Visit this user's website Find all posts by this user Quote this message in a reply
daemon_n Offline
Administrators

Posts: 4338
Post: #356

Raistlin, а можешь сделать именно фиксы отдельно? Сделай, пожалуйста. Не хочется возиться с добавлением новых объектов, а вот фиксы полезные.

Как именно он работают они, кстати?


Image: widget.png?style=banner2

Новейший Heroes 3 Launcher
16.03.2021 22:21
Visit this user's website Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1104
Post: #357

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. Rolleyes

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
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16471
Post: #358

1. Seems like it's HD mod feature. Tried without it?
2. Disappearing only occurs with zvslib.dll dialogs from WoG 3.58. Not wog native dialogs bug, but HD mod implementation changing.
Am I wrong?


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
17.03.2021 15:27
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1104
Post: #359

Berserker, sorry for failing to explain. Right, the second one is not a WND issue. But it can only be fixed by re-writing the zvslib dialogue with WND, so I put my hope in igrik Sorry

The first one is not an HD feature. Tried without HD, the issue persisted.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 17.03.2021 16:10 by Archer30.)
17.03.2021 16:07
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16471
Post: #360

But igrik has rewritten WoG Options dialog. With WND no disappearing should occur. We need igrik's reply.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
17.03.2021 16:44
Find all posts by this user Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Forum Jump:

Powered by MyBB Copyright © 2002-2024 MyBB Group