Jump to content

User talk:Morgan525: Difference between revisions

From UFOpaedia
Morgan525 (talk | contribs)
Morgan525 (talk | contribs)
Line 68: Line 68:
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-interception-battle (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 routine that sets the amount of ammo for the tank in battlescape.  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.
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-interception-battle (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 routine that sets the amount of ammo for the tank in battlescape.  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 CE version has a problem in that the compiler wrote the calculations. In the original code, everything was handles in multiples of five with bit-shifts to get to 30 or multiples of 30.  I "rewrote" many of these lines to make it simpler to understand (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 manipulates the bits of the ammo number in the post-tatical phase]):
   The DOS version of the game makes it much simpler to adjust the stats, but I have lost the notes on the offsets.  The CE version has a problem in that the compiler wrote the calculations. In the original code, everything was handles in multiples of five with bit-shifts to get to 30 or multiples of 30.  I "rewrote" many of these lines to make it simpler to understand (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 manipulates the bits of the ammo number in the post-tatical phase]):
  <nowiki>TANK/CANNON AMMO ALTERATION
   
<nowiki>TANK/CANNON AMMO ALTERATION
POST-TACTICAL PHASE BASE/CRAFT INVENTORY UPDATE
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
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

Revision as of 08:22, 11 April 2012

I'm also go by "Tycho" on Strategycore forums. I've been learning about disassembly and coding since December of 2011. I guess I started with focusing on sounds. Lately, I have been tinkering with Seb's UFOloader and added a few fixes of my own.

The following is a list of how most events in TACTICAL generate sounds. This data is scattered across throughout the executable in various data arrays. First an event number is passed to the sound subroutine. The program then compares the event with its corresponding entry in another section to determine how to play that sound. 06 is the standard method. 01 plays the sound uninterrupted by other sounds.

Table of Battlescape sound calls

	Play		CAT
Evt# 	Setting		reference           Description
00	00		--		Normal bipedal movement.  Routing refers to tileset and alternates between 1 and 2.
01	01		0E		normal tank move
02	01		00		snakeman move
03	02		--
04	01		0F		Flying unit move
05	01		10		Celatid move
06	01		2F		Silacoid move
07	02		--	
08	02		--
09	02		--
0A	01 		28		hovertank/cyberdisk move
0B	06		04		rifle/pistol shoot
0C	06		16		bullet hit
0D	03		14		sliding door opens. Routine randomly plays 1 of the 2 entries in SAMPLE2.
0E	06		03		normal door opens
0F	02		--
10	06 		0C		big gun shoots
11	06		0D		big gun hits		
12	06		0B		laser gun shoots
13	06		13		laser shot hits
14	06 		12		plasma gun shoots
15	06		13		plasma shot hits
16	06		34		rocket launches
17	06		35		blaster bomb/stun launcher shoots
18	06		0C		small explosion (problem: zombie move)
19	06		05		big explosion
1A	02		--		stun rod  (*problem*)
1B	06		24		psi attack
1C	06		06		mind probe use* 
1D	06		11		reload weapon
1E	06		26		place an item
1F	02		--
20	04		--		death of a male. Routine randomly plays 1 of the 3 sounds in SAMPLE2.
21	06		17		tank destroyed
22	06		0A		sectoid death
23	06		08		snakeman death
24	06		09		etheral death
25	06		06		muton death
26	06		0A		floater death
27	06		07		celatid death
28	06		08		silacoid death
29	06		09		chryssalid death
2A	06		0A		reaper death
2B	06		17		sectopod death
2C	06		17		cyberdisk death
2D	06		30		zombie & reaper attack
2E	06		31		chryssalid attack
2F	06		32		silacoid attack
30	06		30		celatid attack
31	06		27		throw an item
32	05		--		death of a female. Routine randomly plays 1 of the 3 sounds in SAMPLE2.
33	02		--		
34	02
35	02
36	02
37	02

Modding 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-interception-battle (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 routine that sets the amount of ammo for the tank in battlescape. 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 CE version has a problem in that the compiler wrote the calculations. In the original code, everything was handles in multiples of five with bit-shifts to get to 30 or multiples of 30.  I "rewrote" many of these lines to make it simpler to understand (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 manipulates the bits of the ammo number in 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 LOADOUT INFO SENT TO 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) [0x456512: 83 E9 3C // .text:00456512 sub ecx, 3Ch ] TANK STATS start at offset 47573B TANK UFOpaedia info 4752B0~4752CF

Feedback