|
| 1 | +# OpCode: 0x00D4 |
| 2 | + |
| 3 | +| Information | Notes | |
| 4 | +|--- |--- | |
| 5 | +| **OpCode** | `D4 ??` <br> `D4 ?? ?? ?? ?? ??` <br> `D4 ?? ?? ?? ?? ?? ?? ??` <br> `D4 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??` | |
| 6 | +| **OpCode Size** | `2`, `6`, `8`, `12` | |
| 7 | +| **Sets `RetFlag`?** | `No` | |
| 8 | +| **Sets `ExecPointer`?** | `Yes` | |
| 9 | + |
| 10 | +## Description |
| 11 | + |
| 12 | +Handles multiple sub-opcodes. These appear to be related to opening the map and querying the user for input. |
| 13 | + |
| 14 | +## Pseudo Code |
| 15 | + |
| 16 | +```cpp |
| 17 | +void __thiscall FUNC_XiEvent_OpCode_0x00D4(xievent_t* this) |
| 18 | +{ |
| 19 | + const auto ptr = this->ExecPointer; |
| 20 | + |
| 21 | + switch (this->EventData[this->ExecPointer + 1]) |
| 22 | + { |
| 23 | + case 0x00: |
| 24 | + { |
| 25 | + this->ExecPointer++; |
| 26 | + |
| 27 | + // Tests if the PTR_g_pYkWndMapMain window is created, if it is, tests if it was created with type '6'.. |
| 28 | + // Function returns true if the window is not created, or is not type 6.. |
| 29 | + if (FUNC_TestWndMapMain(6)) |
| 30 | + { |
| 31 | + // Calls the opcode 0x0024 helper to open the query window.. |
| 32 | + if (FUNC_XiEvent_OpCode_0x0024_(this)) |
| 33 | + { |
| 34 | + FUNC_OpenMap2(6, PTR_pGlobalNowZone->UnknownValue, -1, 1, 1); |
| 35 | + |
| 36 | + // Allocates and prepares the PTR_TalkpQW object.. |
| 37 | + PTR_TalkpQW = FUNC_CreateTalkpQWObject(PTR_g_TkMenuMng); |
| 38 | + |
| 39 | + if (PTR_TalkpQW) |
| 40 | + PTR_TalkpQW->UnknownCallback = FUNC_UnknownCallback; |
| 41 | + } |
| 42 | + else |
| 43 | + { |
| 44 | + this->ExecPointer = ptr; |
| 45 | + this->RetFlag = 1; |
| 46 | + } |
| 47 | + } |
| 48 | + else |
| 49 | + { |
| 50 | + this->ExecPointer = ptr; |
| 51 | + this->RetFlag = 1; |
| 52 | + } |
| 53 | + |
| 54 | + return; |
| 55 | + } |
| 56 | + |
| 57 | + case 0x01: |
| 58 | + { |
| 59 | + int32_t buff[8]{}; |
| 60 | + std::memset(&buff, 0xFF, sizeof(buff)); |
| 61 | + |
| 62 | + const auto val1 = FUNC_XiEvent_getworkofs_(this, 2); |
| 63 | + LOWORD(buff[0]) = FUNC_XiEvent_getworkofs_(this, 4); |
| 64 | + HIWORD(buff[0]) = FUNC_XiEvent_getworkofs_(this, 6); |
| 65 | + |
| 66 | + // Allocates and prepares the PTR_TalkpQW object.. |
| 67 | + PTR_TalkpQW = FUNC_CreateTalkpQWObject(PTR_g_TkMenuMng); |
| 68 | + |
| 69 | + // Copies the buff data into the PTR_TalkpQW memory.. |
| 70 | + if (PTR_TalkpQW) |
| 71 | + FUNC_TalkpQW_CopyData(PTR_TalkpQW, val1, buff); |
| 72 | + |
| 73 | + this->ExecPointer += 8; |
| 74 | + return; |
| 75 | + } |
| 76 | + |
| 77 | + case 0x02: |
| 78 | + { |
| 79 | + this->ExecPointer++; |
| 80 | + |
| 81 | + // Calls the opcode 0x0024 helper to open the query window.. |
| 82 | + if (FUNC_XiEvent_OpCode_0x0024_(this)) |
| 83 | + { |
| 84 | + // Allocates and prepares the PTR_TalkpQW object.. |
| 85 | + PTR_TalkpQW = FUNC_CreateTalkpQWObject(PTR_g_TkMenuMng); |
| 86 | + |
| 87 | + if (PTR_TalkpQW) |
| 88 | + PTR_TalkpQW->UnknownCallback = FUNC_UnknownCallback; |
| 89 | + } |
| 90 | + else |
| 91 | + { |
| 92 | + this->ExecPointer = ptr; |
| 93 | + this->RetFlag = 1; |
| 94 | + } |
| 95 | + |
| 96 | + return; |
| 97 | + } |
| 98 | + |
| 99 | + case 0x03: |
| 100 | + { |
| 101 | + int32_t buff[8]{}; |
| 102 | + std::memset(&buff, 0xFF, sizeof(buff)); |
| 103 | + std::memset(&buff[1], 0x00, 0x1C); |
| 104 | + |
| 105 | + const auto val1 = FUNC_XiEvent_getworkofs_(this, 2); |
| 106 | + |
| 107 | + BYTE2(buff[0]) = 0; |
| 108 | + LOWORD(buff[0]) = FUNC_XiEvent_getworkofs_(this, 4); |
| 109 | + HIBYTE(buff[0]) = 0; |
| 110 | + |
| 111 | + // Allocates and prepares the PTR_TalkpQW object.. |
| 112 | + PTR_TalkpQW = FUNC_CreateTalkpQWObject(PTR_g_TkMenuMng); |
| 113 | + |
| 114 | + // Copies the buff data into the PTR_TalkpQW memory.. |
| 115 | + if (PTR_TalkpQW) |
| 116 | + FUNC_TalkpQW_CopyData(PTR_TalkpQW, val1, buff); |
| 117 | + |
| 118 | + this->ExecPointer += 6; |
| 119 | + return; |
| 120 | + } |
| 121 | + |
| 122 | + case 0x04: |
| 123 | + case 0x05: |
| 124 | + { |
| 125 | + int32_t buff[8]{}; |
| 126 | + std::memset(&buff, 0xFF, sizeof(buff)); |
| 127 | + std::memset(&buff[1], 0x00, 0x1C); |
| 128 | + |
| 129 | + const auto val1 = FUNC_XiEvent_getworkofs_(this, 2); |
| 130 | + |
| 131 | + BYTE2(buff[0]) = 1; |
| 132 | + LOWORD(buff[0]) = FUNC_XiEvent_getworkofs_(this, 4); |
| 133 | + HIBYTE(buff[0]) = this->EventData[this->ExecPointer + 1] != 5 ? 0 : 2; |
| 134 | + |
| 135 | + buff[1] = FUNC_XiEvent_getworkofs_(this, 6); |
| 136 | + buff[2] = FUNC_XiEvent_getworkofs_(this, 8); |
| 137 | + buff[3] = FUNC_XiEvent_getworkofs_(this, 10); |
| 138 | + |
| 139 | + // Allocates and prepares the PTR_TalkpQW object.. |
| 140 | + PTR_TalkpQW = FUNC_CreateTalkpQWObject(PTR_g_TkMenuMng); |
| 141 | + |
| 142 | + // Copies the buff data into the PTR_TalkpQW memory.. |
| 143 | + if (PTR_TalkpQW) |
| 144 | + FUNC_TalkpQW_CopyData(PTR_TalkpQW, val1, buff); |
| 145 | + |
| 146 | + this->ExecPointer += 12; |
| 147 | + return; |
| 148 | + } |
| 149 | + |
| 150 | + default: |
| 151 | + this->ExecPointer = ptr; |
| 152 | + return; |
| 153 | + } |
| 154 | +} |
| 155 | +``` |
| 156 | +
|
| 157 | +--- |
| 158 | +
|
| 159 | +_This data is current as of Feb. 28, 2022 retail client._ |
0 commit comments