IPB

Здравствуйте, гость ( Вход | Регистрация )

3 страниц V  < 1 2 3  
Reply to this topicStart new topic
> Моддинг
feanor
сообщение 10 Dec 2009, 14:25
Сообщение #41

laughed as one fey
Сообщений: 12 167
Спасибо сказали: 20605 раз




Цитата
I took a look at heroes2w.exe in a hex editor yesterday. I don't have the exact addresses with me right now, but about 3/4 of the way through the file there's something that looks like a creature data table. Look for "psnt", "arch", "pike", etc. in the code each separated by 26 bytes. I saw some hex values that correspond to attack and defense in there. I saw 0101 a few bytes before "psnt" and 0503 a few bytes before "arch". I really think that's what we're looking for. It'll take a bunch of analysis to figure out exactly how that structure is laid out. Hopefully that'll get someone (or me if no one jumps on it) started.


Цитата
Ok here's what I have so far. I have version 2.1 of the Price of Loyalty expansion. The creature data table starts at address 0xF03F8. Each creature contains 26 bytes, laid out as follows:
Code:

bytes    description
-----    -----------
0-1      cost in gold
2-6      ???
7        base growth per week
8-9      hit points
10      alignment[1]
11      speed
12      attack
13      defense
14      min damage
15      max damage
16      shots
17-21    4-character ID string, plus null char
22      attack-type flags[2]
23      other flags[3]
24-25    padding (all bits zero)

1. Alignment is a value between 0 and 6. 0 = Knight, 1 = Barbarian, 2 = Sorceress, 3 = Warlock, 4 = Wizard, 5 = Necromancer, 6 = Neutral.

2. The attack-type flags are ORed together. The default is 0, meaning a single hex melee creature, 1 = the creature takes up two hexes, 2 = flying, 4 = ranged, 8 = two-hex attack (e.g., Dragons). I expected to see more detail here but there isn't. Liches have a 4 and Hydras have a 1.

3. The only nonzero value I've seen here is 4, and that corresponds to undead.

I haven't yet been able to find any pattern to bytes 2-6 of the structure. There may be a pointer in there to unique functionality for each creature, in which case modding that will probably be impossible. The other thing missing here is the extra resource cost for certain creatures. That might be hardcoded into the game logic somewhere, and thus would likely be unmoddable.

Anyway, that should be more than enough to get some aspiring modders started. I'll post again if I find anything else useful.


Цитата
Bytes 2 to 6 indeed offer the computer a hint about the strength of the unit. It will attack or avoid a fight based on this stuff. Another user pointed to the Fight Value, this might be the name for it. We have two values here:
- four bytes (2 to 5) surprisingly store the strength of the unit (fight value), it's suprising because we have four bytes so the strength can go up to 2 billion or something (whatever max long int is). I put a 01 in the 5th bit of a peasant and with an army of a single peasant all monsters either fled or offered to join my army;
- byte 6 seems to be related to strength too but it's more chaotic and still remains a mistery to me. it seems to go up with creature level but not in the same degree as the Fight Value, also i thought it was a unique code for each unit, but more units happen to have the same value, so it's a mistery for now;

Byte 22 the Attack-type flags as Kristo pointed is byte-coded:
- 1: 2hex
- 2: fly
- 4: ranged
- 8: 2hex attack
but it seems to hold more than this info because if we go up we find
- 16: a bizzare mode when the creature does not take part in battle and vanishes after it, it's not found in the normal state but maybe it's the effect of a spell
- 32 to 128: no visible things here

Byte 23 Other Flags, has other uses than the obvious 4 (undead):
- 1: mirror imaged creature (transparent, 1 HP, same damage)
- 2: red creature (maybe bloodlust? but does not carry the effect of the spell as it has normal attack)
- 4: undead
- 8 and 16: apparently nothing, could be spells that affect the creature but are not graphical
- 32: brown (ressurected? but does not dissapear after battle)
- 64: gray (stoned but can move)
- 128: apparently nothing

Using value 68, i made a "Ghost Peasant" which looked gray and carried the undead flag 

Also, if you look a bit further there are some bits about spells!
Spells occupy 22 bytes but i haven't figured out much. This is how they go:

0-7 Name
8 Zero
9 Level
10 ?
11 ?
12,13 This gives a round value together so i guess it's a 2-byte int, it is not however the damage of the spell (which i couldn't find in those bytes) but maybe a valuation of the power of the spell
14 Mana
15,16,17,18,19 usually 0A but 00 in case of summon elemental and the death spells
20 ?
21 ?


http://www.celestialheavens.com/forums/viewtopic.php?t=5659
Go to the top of the pageAdd Nick
 
+Quote Post
feanor
сообщение 25 Nov 2010, 01:18
Сообщение #42

laughed as one fey
Сообщений: 12 167
Спасибо сказали: 20605 раз




Забавно, но в экзешнике двойки куча отладочной информации вплоть до имен функций.
Соответственно, декомпиляция приводит аж к вот такому виду.
Код
        sprintf((char *)&gText, "covr%04d.icn", *(_DWORD *)(v3 + 12786));
        v2 = resourceManager__GetIcon(gpResourceManager, &gText);
        IconToBitmap(v2, *(_DWORD *)(v3 + 12911), 0, 0, 0, 0, 0, 0, 0x280u, 443, 0);
        resourceManager__Dispose(gpResourceManager, v2);
Go to the top of the pageAdd Nick
 
+Quote Post
feanor
сообщение 25 Nov 2010, 20:46 (Сообщение отредактировал feanor - 25 Nov 2010, 20:46)
Сообщение #43

laughed as one fey
Сообщений: 12 167
Спасибо сказали: 20605 раз




Примерно вот так:
004AF490: 3Bh - байт, отвечающий за номер существа в клятых PoL'овских могильных холмах.
Можно заменить, скажем, на 39h - будут наниматься костяные драконы.
Или на любое другое число из списка:


Спасибо сказали:
Go to the top of the pageAdd Nick
 
+Quote Post
tolich
сообщение 25 Nov 2010, 20:49
Сообщение #44

😸🧡✊✌️
Сообщений: 16 499
Спасибо сказали: 3422 раза




Когда исходники выложишь? crazy.gif


--------------------
Я слежу за тобой!
* tolic.narod.ru

Цитата
Всегда приятно осознавать, что кто-то делает что-то хуже, чем делал бы ты, если бы умел.
Борис "Бонус" Репетур, "От винта!", выпуск 38.
Go to the top of the pageAdd Nick
 
+Quote Post
feanor
сообщение 25 Nov 2010, 20:53
Сообщение #45

laughed as one fey
Сообщений: 12 167
Спасибо сказали: 20605 раз




Hex-Rays же и "Produce C file". Впрочем, если надо - http://df2.ucoz.ru/1245853000-1290707612.rar


Спасибо сказали:
Go to the top of the pageAdd Nick
 
+Quote Post
tolich
сообщение 25 Nov 2010, 21:01
Сообщение #46

😸🧡✊✌️
Сообщений: 16 499
Спасибо сказали: 3422 раза




There were 5 decompilation failure(s) on 1639 function(s) biggrin.gif

Ну, я и не думал, что будет легко. gigi.gif


--------------------
Я слежу за тобой!
* tolic.narod.ru

Цитата
Всегда приятно осознавать, что кто-то делает что-то хуже, чем делал бы ты, если бы умел.
Борис "Бонус" Репетур, "От винта!", выпуск 38.
Go to the top of the pageAdd Nick
 
+Quote Post
feanor
сообщение 25 Nov 2010, 21:05 (Сообщение отредактировал feanor - 25 Nov 2010, 21:06)
Сообщение #47

laughed as one fey
Сообщений: 12 167
Спасибо сказали: 20605 раз




Для ковыряния - нормально. Скомпилить все равно не получится - диалогов нет, строковых секций нет.
Эх, были бы столь забывчивы программисты тройки (:
Go to the top of the pageAdd Nick
 
+Quote Post
tolich
сообщение 25 Nov 2010, 21:30 (Сообщение отредактировал tolich - 25 Nov 2010, 21:42)
Сообщение #48

😸🧡✊✌️
Сообщений: 16 499
Спасибо сказали: 3422 раза




Есть Resource Hacker, есть MSVC 6.0.

Кстати, просматривается интерфейс smackw32.dll lupa.gif


--------------------
Я слежу за тобой!
* tolic.narod.ru

Цитата
Всегда приятно осознавать, что кто-то делает что-то хуже, чем делал бы ты, если бы умел.
Борис "Бонус" Репетур, "От винта!", выпуск 38.
Go to the top of the pageAdd Nick
 
+Quote Post
feanor
сообщение 26 Nov 2010, 00:43
Сообщение #49

laughed as one fey
Сообщений: 12 167
Спасибо сказали: 20605 раз




Йа просто оставлю это здесь.
Патчик для подключения дллки
Код
CPU Disasm
Address   Hex dump                    Command                                        Comments
004DFF6B  E9 6DAE0000             JMP 004EADDD


CPU Dump
Address   Hex dump                                         ASCII
004EADDD  68 F2 AD 4E|00 FF 15 24|A5 53 00 68|10 BB 4E 00| hN.$S.hN.
004EADED  E9 7E 51 FF|FF 68 6F 6F|6B 2E 64 6C|6C 00 00 00| ~Qhook.dll...


Спасибо сказали:
Go to the top of the pageAdd Nick
 
+Quote Post

3 страниц V  < 1 2 3
Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 



Текстовая версия Сейчас: 2 January 2026 - 05:21
Copyright by Алексей Крючков
Strategy Gamez by GrayMage
Programming by Degtyarev Dmitry
  Яндекс.Метрика