War2.ru Slogan
News: New responsive forum theme available!
Click here to switch! More info here!


Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Welcome to the forums! We're glad to have you here! :) You can register your account here, then feel free to introduce yourself in the Server.War2.ru board & let us know who you are on the server.

Warcraft 1 modding 7769  87

Grunt Posts: 58 Karma: +8/-0 ***

Zelya

  • Grunt
  • ***
  • Posts: 58
    • View Profile
Re: Warcraft 1 modding
« Reply #75 on: August 13, 2019, 05:31:31 AM »
@Storycraft

There are two fonts in War1. Their resources are 215 and 216 (both are compressed).

The font header is next:

//This is index of the first ASCII code in font. In original resources it set to 0x20 (space).
byte FisrtCharIndex;

//In bytes: 4 pixels = 1 byte
byte Width;

//bytes = pixels
byte Height;

//Don't know. Has value 2 for both of fonts
byte Unused;

Then you have 2bit bitmap with character images. Each byte encodes 4 horizontal pixels. Font ends with 128th character and I don't remember if you can enhance it to 256 (maybe yes).



Peon Posts: 14 Karma: +0/-0 **

Storycraft

  • Peon
  • **
  • *
  • Posts: 14
    • View Profile
Re: Warcraft 1 modding
« Reply #76 on: August 13, 2019, 07:15:16 AM »
@ Zelya
Thank you for the advice. Hmm ... 216 was the Blizzard logo image.
213=large font file
214=small font file ... Is it right?
Where is 0x21 (!) or 0x41 (A)? Perhaps I misunderstood what you meant  :sweat:

Grunt Posts: 58 Karma: +8/-0 ***

Zelya

  • Grunt
  • ***
  • Posts: 58
    • View Profile
Re: Warcraft 1 modding
« Reply #77 on: August 13, 2019, 08:06:01 AM »
@Storycraft

Sorry, my fault! Yes it should be 213 and 214!

I don't know why, but Blizzard pass ResourceId + 2 as a function argument. And then just subtract 2 inside function. Some kind of obfuscation?
Peon Posts: 14 Karma: +0/-0 **

Storycraft

  • Peon
  • **
  • *
  • Posts: 14
    • View Profile
Re: Warcraft 1 modding
« Reply #78 on: August 13, 2019, 04:52:42 PM »

It seems difficult to interpret and modify the font header and enhance from (32-128) to (32-256). This is way over my head.
Maybe it is better to wait for Unicode support of WinWar  :slight_smile:
Grunt Posts: 58 Karma: +8/-0 ***

Zelya

  • Grunt
  • ***
  • Posts: 58
    • View Profile
Re: Warcraft 1 modding
« Reply #79 on: August 15, 2019, 05:46:19 AM »
To add UTF I need much more character images. I wanted to support user-defined 8-bit code pages, like CP437 (most known ASCII code page) and CP866 (Cyrillic). But now, I don't know.
Is there acceptable Korean ASCII code page?

PS
Also game chat and save names will support English (ASCII 32 - 128) only to be compatible with original.
Peon Posts: 14 Karma: +0/-0 **

Storycraft

  • Peon
  • **
  • *
  • Posts: 14
    • View Profile
Re: Warcraft 1 modding
« Reply #80 on: August 15, 2019, 06:18:30 PM »
Is there acceptable Korean ASCII code page?

It is bad readability, but it's enough to play. I modified to extend 213 and 214, but WC1 doesn't read 128-255. It seems there is no solution to use with 128-255.
Grunt Posts: 58 Karma: +8/-0 ***

Zelya

  • Grunt
  • ***
  • Posts: 58
    • View Profile
Re: Warcraft 1 modding
« Reply #81 on: August 16, 2019, 05:08:32 AM »
@Storycraft
I mean that I'm not sure about UTF in WinWar. But if you can prepare resource with acceptable Korean ASCII codepage (128-255), we can test it in WinWar any time you want.
Peon Posts: 14 Karma: +0/-0 **

Storycraft

  • Peon
  • **
  • *
  • Posts: 14
    • View Profile
Re: Warcraft 1 modding
« Reply #82 on: August 16, 2019, 08:31:25 AM »
@Zelya
I see, I hope WinWar support the 128-255 letters of ASCII code.




By mistake, I put 213 in data.war instead of 214, and an unexpected result came out. Lowercase letters is available.

issues occurred:
1. I don't know how to edit top value(y position) of "msg:" on bottom panel.
2. WC1 crashes on score screen. I have modified height value of the header part "20 03 0A 02" to "20 03 06 02" (based on the knowhow you provided), this problem was solved.

height pixels
06,07 = ok
08,09,0A = crash
Grunt Posts: 58 Karma: +8/-0 ***

Zelya

  • Grunt
  • ***
  • Posts: 58
    • View Profile
Re: Warcraft 1 modding
« Reply #83 on: August 16, 2019, 08:41:35 AM »
@Storycraft
>>I see, I hope WinWar support the 128-255 letters of ASCII code
Not now, but it easy to support. So, lets say: yes.


>> 1. I don't know how to edit top value(y position) of "msg:" on bottom panel.
In version 1.22 it's here:

cseg01:0002B716                 mov     ebx, ecx
cseg01:0002B718                 mov     edx, 5
cseg01:0002B71D                 mov     eax, 1
cseg01:0002B722                 call    w_PrintString 

Where eax is X and edx Y are offsets inside bottom frame.

>>2. WC1 crashes on score screen.
Looks like you try to print big letters outside some frame. Have no time now for investigation, maybe later.

Peon Posts: 14 Karma: +0/-0 **

Storycraft

  • Peon
  • **
  • *
  • Posts: 14
    • View Profile
Re: Warcraft 1 modding
« Reply #84 on: August 17, 2019, 10:26:04 AM »
I don't know about this logic but, for this issue, i got it, solved by modifying one letter - lower case 'm'  :fro: This makes WC1 possible to display lowercase letters and 10 pixels font available.

The position of the "msg:" frame is (73,193), and I want to move this to (73,190)... y position -3

2B718 ~ 2B71D
HEX= 6B C1 0A 59 C3 25
DEC= 107 193 10 89 195 37

37>>73 reverse?
C1>>193

This hex code seems to be related to "msg:" frame's position. I modified this number but nothing happens(even change them all to "00")
Grunt Posts: 58 Karma: +8/-0 ***

Zelya

  • Grunt
  • ***
  • Posts: 58
    • View Profile
Re: Warcraft 1 modding
« Reply #85 on: August 19, 2019, 04:56:26 AM »
 @Storycraft
Sorry still have no time.
Please post me in PM your e-mail. I'll send you War1 disassembled file compatible with IDA 7.0 free. I think it can help you.
Peon Posts: 14 Karma: +0/-0 **

Storycraft

  • Peon
  • **
  • *
  • Posts: 14
    • View Profile
Re: Warcraft 1 modding
« Reply #86 on: August 19, 2019, 08:49:20 AM »
oh, never mind. I finished well. WC1 Korean translation now available. Thanks anyway  :slight_smile:
and I look forward to playing WinWar soon.
Grunt Posts: 58 Karma: +8/-0 ***

Zelya

  • Grunt
  • ***
  • Posts: 58
    • View Profile
Re: Warcraft 1 modding
« Reply #87 on: August 27, 2019, 12:36:07 PM »
place where they meet
So you need to parse structure I named s_LevelData.

This structure with size 0xBB8 bytes. And can be get from

1. Game resources during new game starting (for example resource 117 is the first human mission)
2. From a save file (starting from 0x5AA)

To find AttackAi data you need go to offset 0xdc of this structure (0x5AA+0xDC=0x686 in save file). This is common heap for different arrays.
The first one is Palette animation. You should skip it with next pattern: if the first byte is not 0, you should take 3 bytes. Repeat until value will be 0.
For example, if you have data 0a 72 77 0a 79 7e 00 46 00 05, you should skip first value (0a 72 77), second value (0a 79 7e), and one byte 00. So your offset is 7.

Now you are in AttackAi data block. It consist of two arrays. The first one is different routes for attack. The second array is route points.
So the first array members are quite simple, they have only two fields, like this:

Int16 Percent;
UInt16 Offset;

The first field is a chance that new unit will chose this route. The second is Offset for points array, starting from AttackAi data.

If Percent is -1, this mean that the first section is over, and now you are in points section.
Each point has three fields:

Int16 UnitsCnt;
Int16 PosX;
Int16 PosY;

PosX, PosY - x, y coordinates of this point. UnitsCnt - is the number of Ai units on this point right now (0 - in the data.war)

If the first field (UnitsCnt) is -1, the current array is finished and you are starting the next array for the next route. Double -1, -1 means that AttackAi  data is over.

So, now you have all the possible routes for Ai.

Now you need a field 0xA2 from s_LevelData (0x5AA+0xA2=0x686 in save file). This is simple UInt16 number, which indicate current units count for each Ai attack group. As soon as UnitsCnt at one point will be equals or bigger than this number, the group will go to the next point.

Field 0xA2 can grow during the game, up to field 0xC0 value (0x5AA+0xC0=0x686) This is also UInt16 number and it is the maximum limit per group for AI attack.

If you want, I can give you timer values to understand how quickly AI increases groups limit.