Edit buy button

rhaul

Warlord
Joined
Mar 25, 2010
Messages
243
Location
Madrid
@darkpanda ,if you can't do it, let me know. I would only have one more request to ask.

Within the city, we have the option of being able to finish a construction with our money by clicking on the blue button with the name "buy".

In the French version, this button is longer to be able to put a word with more characters.
I would like to be able to also lengthen that button to put a word in Spanish. I think there is no unit image wider and bigger than for example the battleship on the screenshot., therefore, the blue button should have a maximum of 6 characters so that it does not overlap with the image of the unit.

French version


I would only need to widen that button so that it occupies 6 characters, the issue of including the characters is up to me.
 
Last edited:
Hi there,

I saw your request but didn't act on it until now.

I just took a look at CIV.EXE, and I think there's really no room at all to modify this string:

upload_2022-4-7_22-2-3.png


Here they are just regular C-style \00-terminated strings, and in-game, CIV.EXE will reference to the beginning of each string with a direct hard-coded reference to the string address. The only way to change this would be to shorten other strings around to make room for your extra chars, and then we still need to modify all hard-coded references to modified strings to account for their new positions.
 
@darkpanda ,Don't worry about the characters, I'll take care of that, what I need is for the blue button to lengthen so that I can enter the 6 characters. I'll give you an example and you will see that my problem is not the number of letters but that the blue "button" is not long enough to be able to visualize the letters.

Surely the letters that come out of the blue "button" because of their color are blurred with the dark blue background, since it is the same color (dark blue) as the letters.

 
Ok then, there you you have it, it's all hard-coded to pixel values:

upload_2022-4-7_23-52-40.png


Basically what you want is to change 294 to a lower value, so that the BUY button box is larger to the left.

The current width in pixels is 311 - 294 = 17 pixels.

If we try to double this, we need to substract an additional 17 from 294, so let's replace 294 by 294 - 17 = 277.

In hex: 294 = 0x126 and 277 = 0x115

In CIV.EXE, look for B8 26 01, then replace it with B8 15 01

It is at address 0x10D82
 
@darkpanda You're the best...

Thanks to your explanation I have modified the button a bit to adapt it to the new word.
Would you also mind telling me the byte string for the "rename" and "more" buttons. The "exit" button could try to adjust it.

- "rename" would need to lengthen the button to the right
- "more" and "exit" I don't know if it is better to modify the buttons to the right or left.

 
Last edited:
Would you also mind telling me the byte string for the "rename" and "more" buttons. The "exit" button could try to adjust it.

- "rename" would need to lengthen the button to the right
- "more" and "exit" I don't know if it is better to modify the buttons to the right or left.

@darkpanda I take advantage of the fact that I think you are less busy to ask you if you were able to watch some of this.
 
Sorry for low priority on your request...

Here is what I found:

upload_2022-4-23_17-55-50.png


upload_2022-4-23_17-58-7.png


So if you need to move the boxes, it is about changing x1 and/or x2 for each label:
  • MORE
    • x1 = 287 -> "mov ax, 287" = B8 1F 01 -> only 1 occurence in CIV.EXE
    • x2 = 315 -> "mov ax, 315" = B8 3B 01 -> only 1 occurence in CIV.EXE
  • RENAME
    • x1 = 231 -> "mov ax, 231" = B8 E7 00 -> multiple occurences, in EN47405 it is at 0x119A1
    • x2 = 272 -> "mov ax, 272" = B8 10 01 -> multiple occurences, in EN47405 it is at 0x1414A
  • EXIT
    • x1 = 284 -> "mov ax, 284" = B8 1C 01 -> multiple occurences, in EN47405 it is at 0x11981
    • x2 = 316 -> "mov ax, 316" = B8 3C 01 -> multiple occurences, in EN47405 it is at 0x12415

Does this help ?
 
Sorry for low priority on your request...

Don't worry, I know you have a lot of homework on this forum right now.

Did you see that I have uploaded version 2.0 of the translation? I have added you to the collaborations (Also in the patch installer).
https://forums.civfanatics.com/resources/civ-esp-v2-0-spanish-translation-traducción-al-español.29768/



Does this help ?

I'm going to look now, but I'm sure it'll be fine.

I have another problem, now I have the bigger button ("PAGAR") but the mouse pointer action area is not active in the enlarged part of the button. Could you take a look at it?
 
Last edited:
Ok I think I got this one : in fact, even in the original CIV the "click" area for "BUY" is not well adjusted... You can see when clicking on the left side of the B letter, the BUT dialog does not pop up, instead the city screen leaves to main map screen.

So, I didn't test this but if I'm correct the click area for BUY is starting at position 296 (0x128) for all English versions. There are several occurences of "28 01" byte sequence in CIV.EXE, and if I am correct, the correct one to change is the first one in all versions:
Code:
CIV_EN_47401
      seg007:4AB5 (0x11B14) - 2801
CIV_EN_47403
      seg007:4BDC (0x114DB) - 2801
CIV_EN_47404
      seg007:4BE2 (0x114E1) - 2801
CIV_EN_47405
      seg007:4BE6 (0x11CF5) - 2801

So you would want to modify this value to a lower value to extend the mouse click area.

Tell me if this helps
 
You are a genius, I do not know if this expression in English has the same meaning as in Spanish but I hope it is understood. If one day you want to nationalize Spanish, know that we would appreciate it and you would be much more than welcome.

I will include this modification for the next version of the translation 2.1
 
Top Bottom