Difference between revisions of "User:Morgan525"
Line 8: | Line 8: | ||
By default most bug fixes and video pitch are enabled; For the rest, you need to activate them in the ini file. To use, just unpack the zip file in your XCOM directory, edit the ini file with any simple text editor, like Window's notepad, and start the TFTDextender.exe file. It looks for a file named "UFO Defense.exe" (you can arrange that in the ini file). Of course, if your computer fries while you're using it, I don't take any responsability... | By default most bug fixes and video pitch are enabled; For the rest, you need to activate them in the ini file. To use, just unpack the zip file in your XCOM directory, edit the ini file with any simple text editor, like Window's notepad, and start the TFTDextender.exe file. It looks for a file named "UFO Defense.exe" (you can arrange that in the ini file). Of course, if your computer fries while you're using it, I don't take any responsability... | ||
Do not hesitate to report any problem you encounter with it, I'll try to help you fix it. | Do not hesitate to report any problem you encounter with it, I'll try to help you fix it. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Modding the Tank/Cannon into a Tank/Chaingun== | ==Modding the Tank/Cannon into a Tank/Chaingun== |
Revision as of 01:36, 14 July 2012
I'm also known as "Tycho" on Strategycore forums. I've been learning about disassembly and C++ coding since December of 2011 because I wanted to mod the tank/cannon into a chaingun. I started playing with DOSbox but switched to the CE version and began focusing on its sound problems. I have tinkered with Seb76's UFOloader, added those fixes of my own, and rearranged Seb's INI file to make it less overwhelming to new users. I started helping Kyrub in his quest to convert UFOextender into one for Terror From the Deep but I guess I am now the main person doing it. You can find it here: File:TFTDextender.zip, as well as the original File:UFOLoader.zip.
TFTDextender
This section is about the loader I've been working on that is a conversion of the UFOloader which adds functionalities/fixes to the TFTD Collector's Edition (MS Windows version). The extender patches the program in memory, it does not modify the executable. The advantage is that it won't change the file on disk so there is little risk of destroying your game installation (still, it is wise to do a backup of your game folder before using this).
- You need the VC2008 runtime to run this program. If you don't already have it installed, you can get it here. Also if you want to use the mp3 patch, you need to have Windows Media Player installed.
- Some changes will be recorded to a game's save files so be aware of this fact when you change options and wonder why some changes don't work on games already in progress. Some changes will require you to restart the loader to have them take full effect.
By default most bug fixes and video pitch are enabled; For the rest, you need to activate them in the ini file. To use, just unpack the zip file in your XCOM directory, edit the ini file with any simple text editor, like Window's notepad, and start the TFTDextender.exe file. It looks for a file named "UFO Defense.exe" (you can arrange that in the ini file). Of course, if your computer fries while you're using it, I don't take any responsability... Do not hesitate to report any problem you encounter with it, I'll try to help you fix it.
Modding the Tank/Cannon into a Tank/Chaingun
Many people have questions about this. It's fairly easy to change the ammo type of the Tank/Cannon turrent and damage into a AP/rifle and then giving the turret autofire. The real problem is changing the amount of ammo in the tank and not cause problems with the amount of ammo in your base stores. In the executable there are various places that handle updating the amount of ammo for the various events: adding a tank onto a craft(checking if the base has the proper amount of ammo for the tank and removing that amount from base stores, if so), removing the tank from a craft (adding the ammo back to base stores), post-tactical (adding the remaining ammo from the tank into base stores and attempting to add the tank back onto the craft), and post base-defense (adding the remaining ammo to base stores.) In addition, there is the line that sets the amount of ammo for the tank in unitref.dat. If you miss any of these areas, your ammo supply quickly spirals out of control or you get no benefit for the changes you have made.
The DOS version of the game makes it much simpler to adjust the stats, but I have lost the notes on the offsets. The problem with the CE version is the way the compiler wrote the calculations. In the code, the value was calculated by using multiples of five with bit-shifts to get to 30. This means you can't choose any amount for your ammo. I rewrote these lines to make it simpler to understand and give more freedom to choose the value(Feel free to use these changes. I gave my tank 60 rounds {3Ch}. However, unless you want to deduce for yourself how to modify the proper locations, don't increase the amount of ammo over 63. [This has to do with how the game uses bit-shifts to calculate remaining ammo during the post-tatical phase]):
TANK/CANNON AMMO ALTERATION POST-TACTICAL PHASE BASE/CRAFT INVENTORY UPDATE 0x449C53: B8 3C 00 00 00 0F AF C2 90 90 3B F0 7D 2C 66 0F B6 D2 66 01 17 B8 89 88 88 88 F7 EE 03 D6 C7 44 24 10 01 00 00 00 C1 FA 05 8B C2 C1 E8 1F 03 D0 88 55 2C 66 0F B6 D2 66 29 17 66 0F B6 45 00 8B D0 C1 E2 0B 2B D0 C1 E2 04 03 D0 C1 E2 02 66 02 91 1A 01 00 00 90 90 .text:00449C53 mov eax, 3Ch .text:00449C58 imul eax, edx .text:00449C5B nop .text:00449C5C nop .text:00449C5D cmp esi, eax .text:00449C5F jge short loc_449C8D .text:00449C61 movzx dx, dl .text:00449C65 add [edi], dx .text:00449C68 mov eax, 88888889h .text:00449C6D imul esi .text:00449C6F add edx, esi .text:00449C71 mov [esp+30h+var_20], 1 .text:00449C79 sar edx, 5 .text:00449C7C mov eax, edx .text:00449C7E shr eax, 1Fh .text:00449C81 add edx, eax .text:00449C83 mov [ebp+2Ch], dl .text:00449C86 movzx dx, dl .text:00449C8A sub [edi], dx .text:00449C8D movzx ax, byte ptr [ebp+0] .text:00449C92 mov edx, eax .text:00449C94 shl edx, 0Bh .text:00449C97 sub edx, eax .text:00449C99 shl edx, 4 .text:00449C9C add edx, eax .text:00449C9E shl edx, 2 .text:00449CA1 db 66h .text:00449CA1 add dl, [ecx+11Ah] .text:00449CA8 nop .text:00449CA9 nop 0x449DFA: B8 3C 00 00 00 0F AF C2 3B F0 7D 2E 90 90 66 0F B6 D2 66 01 17 B8 89 88 88 88 F7 EE 03 D6 C7 44 24 10 01 00 00 00 C1 FA 05 8B C2 C1 E8 1F 03 D0 88 55 00 66 0F B6 D2 66 29 17 66 0F B6 45 00 8B D0 C1 E2 0B 2B D0 C1 E2 04 03 D0 C1 E2 02 66 01 91 1A 01 00 00 90 90 .text:00449DFA mov eax, 3Ch .text:00449DFF imul eax, edx .text:00449E02 cmp esi, eax .text:00449E04 jge short loc_449E34 .text:00449E06 nop .text:00449E07 nop .text:00449E08 movzx dx, dl .text:00449E0C add [edi], dx .text:00449E0F mov eax, 88888889h .text:00449E14 imul esi .text:00449E16 add edx, esi .text:00449E18 mov [esp+30h+var_20], 1 .text:00449E20 sar edx, 5 .text:00449E23 mov eax, edx .text:00449E25 shr eax, 1Fh .text:00449E28 add edx, eax .text:00449E2A mov [ebp+0], dl .text:00449E2D movzx dx, dl .text:00449E31 sub [edi], dx .text:00449E34 movzx ax, byte ptr [ebp+0] .text:00449E39 mov edx, eax .text:00449E3B shl edx, 0Bh .text:00449E3E sub edx, eax .text:00449E40 shl edx, 4 .text:00449E43 add edx, eax .text:00449E45 shl edx, 2 .text:00449E48 add [ecx+11Ah], dx .text:00449E4F nop .text:00449E50 nop [TANK/CHAINGUN AMMO AMOUNT SET IN unitref.dat FOR TACTICAL] 0x44ED27: C6 45 76 3C .text:0044ED27 mov byte ptr [ebp+76h], 3Ch [TANK/CHAINGUN AMMO CHECK IN BASE INVENTORY AND ALTERATION OF AMOUNT] 0x456410: 66 83 84 90 1A 01 00 00 3C .text:00456410 add word ptr [eax+edx*4+11Ah], 3Ch 0x4564F1: 66 83 F9 3C .text:004564F1 cmp cx, 3Ch 0x456512: 83 C1 C4 .text:00456512 add ecx, 0FFFFFFC4h (add ecx, -3Ch) [Alternate option] 0x456512: 83 E9 3C .text:00456512 sub ecx, 3Ch TANK STATS start at offset 47573B TANK UFOpaedia info 4752B0~4752CF
Comparison of Damage routines
To explain, first the memory address of the Xcraft weapon is loaded to eax. Then the damage value is read from (eax+6) and loaded into bx. This value is sent to the random function where the value generated is returned through eax. Thereafter, the base value (ebx) is added to the random value (eax) for a range of 100-200%. The value of eax has edx subtracted from it (after extensive testing of several encounters and having edx displayed for each attack, edx always seems to be 0). eax is bit-shifted 1 space to the right {divided by two} and the final amount added to the amount of damage the craft has sustained (edi+0Ah). The result is that Xcraft weapons do 50-100% damage.
In the UFO case: the memory location for the UFO stats are set in ecx. Then the UFO weapon power is read (ecx+16h) and put into dx. Then this value is sent to the random funtion and again returned through eax (or ax as is the case here). ecx is set to zero and the random value is checked to see if zero was generated [cmp(compare) ax, cx]. If this is true, the program jumps past the section to assign damage to the Xcraft.
- The main routine for interdiction in DOS1.4 version is from 330B0~336A8.