1. Forum moved (you can use login and pass from old forum)
  2. Many discussions moved to the bugtracker

The 25% TU cap on reaction fire

Discussion in 'X-Com Apocalypse' started by magic9mushroom, Jul 30, 2020.

  1. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    Can someone walk me through where this is in the exe (presumably TACP) and how to remove it? I'd like to remove it for my mod in order to make Security Stations more dangerous in TB.

    I know there was a patcher around for this years ago, but it's been lost and I don't entirely trust patchers anyway. Guidance on how to hex-edit it out would be ideal.
     
    makus likes this.
  2. Skin36

    Skin36 Active Member Official Developer Administrator

    Joined:
    Apr 5, 2015
    Messages:
    30
    Likes Received:
    15
    Best Answers:
    2
    I will try to find.
    --- Post Merged, Sep 7, 2020, Original Post Date: Jul 30, 2020 ---
    OG turret bug fix

    In OG turret does not fire. The game just doesn't give it a go.
    It only has a quarter point return fire at the start of the first turn.
    This is because the turn function is:
    start_turn(AI_control_FULL, side). The game gives a move only for alien whose AI = 99 and XCOM AI = 0, but the turret has AI = 1 and never call.
    I was able to fix this by simply removing the AI condition, leaving only the side in the function to restore turn points. The turret now restores turn points on an XCOM turn.
    As for the aliens, they also set the full turn points, but at the end of the hidden turn they are divided by 4 (for return fire during the xcom turn).
     
    makus likes this.
  3. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    Okay. Could you walk me through how to remove that condition?
     
    makus likes this.
  4. Skin36

    Skin36 Active Member Official Developer Administrator

    Joined:
    Apr 5, 2015
    Messages:
    30
    Likes Received:
    15
    Best Answers:
    2
    need to test it
    --- Post Merged, Sep 7, 2020, Original Post Date: Sep 7, 2020 ---
    or u can replays bytes to 90
     

    Attached Files:

    makus likes this.
  5. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    The code that the image shows doesn't exist in my .exe, and the TACP is a different size to mine so I am not sure it'd be compatible (mine is 3,161,594 bytes).

    Here is my current TACP (modded, including the first hex-edit we discussed).
     

    Attached Files:

    makus likes this.
  6. FilmBoy84

    FilmBoy84 Well-Known Member Official Developer Administrator Tester Researcher Designer/Artist

    Joined:
    Oct 9, 2017
    Messages:
    114
    Likes Received:
    181
    Best Answers:
    9
    Which version of apoc are you using Magic9Mushroom? (UK/EU/NA/RotW CD-ROM or Steam / Gog/ Other Digital Distribution?)

    There is a known issue with the GOG release renaming executables for the 486 architecture (UFO2P4 and TACP4) to the Pentium based versions (UFO2P and TACP) and using one architecture for one executable and another architecture for another

    I have an on-going dialogue with GOG to fix this but for now it's causing a host of problems with GOG Galaxy 2 downloaded games (Pre-GOG Galaxy 2 off-line downloads are fine)

    Forum thread here https://www.gog.com/forum/xcom_series/xcom_apocalypse_serious_distribution_bug_please_fix_gog

    And i have Support Request #602539 running on my account

    This may explain some of the odd issues with file sizes if you're on GOG although bear in mind Skin36's exe above is modified, so it will be a different size naturally
     
    makus likes this.
  7. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    Ugggh, I have a 1,705,790 byte UFO2P so I think I have the issue - and yes, I've had that bug crop up (that's not that serious, though; I did have one instance of a far-worse "savegame has a baked-in crash at midnight", which might or might not be from this).

    Good thing I have an exact changelog for my mod.
     
    makus likes this.
  8. FilmBoy84

    FilmBoy84 Well-Known Member Official Developer Administrator Tester Researcher Designer/Artist

    Joined:
    Oct 9, 2017
    Messages:
    114
    Likes Received:
    181
    Best Answers:
    9
    That's frustrating, yeah, sadly the two versions of the executables for each part of the game is, increasingly, a problem i have to factor in when dealing with people raising issue with "bugs" in the original game

    The fact that it is almost entirely manufactured by GOG-cross naming things and not recognising the difference (or intended purpose) of each version of the program is most frustrating

    Unfortunately this means that not only do you have to obtain the correct executables and support files from the ISO/CUE/BIN to modify, you also have to modify each one to have the functions you require then start a new game with all files present

    Otherwise things go horribly wrong in the mid-late game where the miscommunication of data between each executable becomes noticeable :(
     
    makus likes this.
  9. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    What do you mean by "modify each one to have the functions you require"? Are you talking about the process of unfucking the vanilla game, or specifically my usecase of making a mod?

    Be fair, it doesn't always go "horribly wrong". I've played through three campaigns and two of them finished just fine (the other one crashed reproducibly in the lategame and had to be written off).
     
    makus likes this.
  10. FilmBoy84

    FilmBoy84 Well-Known Member Official Developer Administrator Tester Researcher Designer/Artist

    Joined:
    Oct 9, 2017
    Messages:
    114
    Likes Received:
    181
    Best Answers:
    9
    By modify each one i mean that what changes you make to UFO2P or TACP have to also be made to UFO2P4 and TACP4 whilst respecting their slightly different structures (should you want to release your mod)

    When you start a new game ensure that UFO2P and TACP are from the same architecture and not having one being the as-per-CD-ROM TACP alongside a renamed UFO2P4 appearing as UFO2P for example

    As a general rule, when modifying the original game i will copy the whole contents of the CD-ROM "XCOM3" folder to a location where i want the game to be installed (Usually XCOMA), then run the CD-ROM install using "optimal install", then copy the UFOEXE and TACEXE files from the disk again, overwriting, to ensure that the installer hasn't messed things up on detecting the parent system (as this is also an issue with modern systems where the installer will assume different architecture for each executable as part of the install process)

    Only once i do all of this can i start to modify the TACP and UFO2P executables happy in the knowledge that they are DEFINITELY both the pentium optimised versions and no installer or rogue distribution has messed things up
     
    makus likes this.
  11. BardBun

    BardBun Registered

    Joined:
    Nov 28, 2019
    Messages:
    1
    Likes Received:
    1
    Best Answers:
    0
    Just install the game manually with dosbox (full install) and it should install the correct ufo2p and tac2p files.

    Also it would be good to have the hex values public so that TU bugfix can be used by everyone.
     
    makus likes this.
  12. FilmBoy84

    FilmBoy84 Well-Known Member Official Developer Administrator Tester Researcher Designer/Artist

    Joined:
    Oct 9, 2017
    Messages:
    114
    Likes Received:
    181
    Best Answers:
    9
    As i referred to above, there is a problem with the installer incorrectly identifying architecture on some systems and some DOSBox configurations (DOSBox-X is a particular offender)

    Copying over the files from the CD/ISO after a full install is the only way to make sure that both executables are set-up as they should be without cross-naming
     
    makus likes this.
  13. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    Your description of the problem seems a bit off-base; I checked the TACP I have and it is a renamed TACP4 just like UFO2P is a renamed UFO2P4.

    Not sure if this is because I have a version other than the one you're complaining about, or what, but I know I get the storage-alchemy bug.

    EDIT: Over on UFOpaedia you say that Apoc'd is designed for the renamed UFO2P4 and won't work on the real UFO2P. How can that be, if it's only renamed in some late distributions?
     
    makus likes this.
  14. FilmBoy84

    FilmBoy84 Well-Known Member Official Developer Administrator Tester Researcher Designer/Artist

    Joined:
    Oct 9, 2017
    Messages:
    114
    Likes Received:
    181
    Best Answers:
    9
    That wasn't written by me (though i edited some of the page earlier)

    I need to clear the whole thing up TBH as it's apparent some TACP/UFO2P issues are listed as "Original Game Bugs" where they are only a result of bad installs... Will aim to organise the whole page over the coming weeks as it's a wordy mess anyway :)
     
    makus likes this.
  15. Skin36

    Skin36 Active Member Official Developer Administrator

    Joined:
    Apr 5, 2015
    Messages:
    30
    Likes Received:
    15
    Best Answers:
    2
    the address did not match because you actually have a tacp4p file. But this does not make any difference for the game, these files have a difference only in the representation of the processor address registers. I patched your file, try testing it.
    --- Post Merged, Sep 8, 2020, Original Post Date: Sep 8, 2020 ---
    I will soon complete a universal patcher that will understand the file size and make the correct changes.
     

    Attached Files:

    makus and FilmBoy84 like this.
  16. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    The 25% TU cap is not a bug in the usual sense; it's AFAIK an intentional feature, just one that some would prefer to do without (the Security Station TU non-replenishment, a separate issue, is probably not intended).

    There are two checks capping TU at 25% of max: one at the start of a battle (ensuring that the aliens have 25% TU on the first X-Com turn) and one at the end of turn (ensuring that your soldiers have no more than 25% TU during the alien turn and aliens have no more than 25% TU on your turn).

    I chose to remove the second one but not the first one in the mod I'm making (removing the first results in UFO/TFTD-like behaviour, where the aliens have maximum TU on the first turn and therefore lightning reflexes).

    In TACP the first one is at offset 0x11372b and the second one is at offset 0x116184. In TACP4 (which some distributions of Apocalypse rename to TACP) the first one is at offset 0x11172b and the second one is at offset 0x1140f3. In any case, to remove the specified check from the specified .exe, change the 11 bytes starting there from "c1 fa 1f c1 e2 02 1b c2 c1 f8 02" to "90 90 90 90 90 90 90 90 90 90 90" (a NOP slide). Skin36 says that removes the division by 4, so that the cap doesn't do anything.
     
    makus likes this.
  17. Skin36

    Skin36 Active Member Official Developer Administrator

    Joined:
    Apr 5, 2015
    Messages:
    30
    Likes Received:
    15
    Best Answers:
    2
    In fact, there is no 25% limit. It is removed during the alien turn. This restriction applies only to the player's turn.
     
    makus likes this.
  18. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    I'm sorry, I don't know what you mean. Could you explain more precisely?
     
    makus likes this.
  19. Skin36

    Skin36 Active Member Official Developer Administrator

    Joined:
    Apr 5, 2015
    Messages:
    30
    Likes Received:
    15
    Best Answers:
    2
    At the beginning of the game, the TU points for the aliens are divided by 4, since the first turn is for the player. Further, in the turn of the aliens, everything happens the other way around, the player's action points are divided by 4, and the aliens have a full one. Then, everything repeats. This is to limit the return fire of the reaction. The only problem is with the turret, it does not replenish its points, since it does not have its own turn to turn (we fixed this). Division by 4 is not necessary to correct!
     
    makus likes this.
  20. magic9mushroom

    magic9mushroom Registered

    Joined:
    Jul 3, 2020
    Messages:
    17
    Likes Received:
    15
    Best Answers:
    0
    That's basically what I said, though. I said that the 25% limit is not a bug but gave instructions in case someone else wanted to get rid of it (plenty of people don't like it).
     
    makus likes this.

Share This Page