Difference between revisions of "User talk:Morgan525"

From UFOpaedia
Jump to navigation Jump to search
Line 1: Line 1:
==Other Random Sound Information==
 
<nowiki>
 
 
406100-subroutine for melee attacks
 
406110- set default melee sound event to 1A
 
(4067C8)data base of melee attacks
 
value offset sound event #
 
00 461B2 2F
 
01 461BC 2E
 
02 461C6 2D
 
03 461E7 skip
 
04 461E7 skip
 
05 461E7 skip
 
06 461E7 skip
 
07 461C6 2D
 
 
Reference points for unit movement sound event IDs. [this word referenced]
 
.data:0046D1A0  00 00  00 00  01 00  01 00  00 00  00 00 [00 00] 00 00 
 
.data:0046D1B0  [00 00] 00 00 [00 00] 00 00  [01 00] 01 00 [00 00] 00 00 
 
.data:0046D1C0  [02 00] 01 00 [00 00] 00 00  [00 00] 00 00 [04 00] 01 00 
 
.data:0046D1D0  [05 00] 01 00 [06 00] 01 00  [00 00] 00 00 [00 00] 00 00 
 
.data:0046D1E0  [00 00] 00 00 [0A 00] 01 00  [00 00] 00 00 [00 00] 00 00 
 
.data:0046D1F0  [18 00] 01 00  01 00  00 00  01 00  0B 00  0C 00  01 00
 
 
data set for death scream per unit.
 
0.data:0046B644 word_46B644    dw  20h                  ; DATA XREF: sub_40E450+55�r
 
1.data:0046B646                db  20h
 
2.data:0046B648                db  20h
 
3.data:0046B64A                db  21h
 
4.data:0046B64C                db  22h
 
5.data:0046B64E                db  23h
 
6.data:0046B650                db  24h
 
7.data:0046B652                db  25h
 
8.data:0046B654                db  26h
 
9.data:0046B656                db  27h
 
A.data:0046B658                db  28h
 
B.data:0046B65A                db  29h
 
C.data:0046B65C                db  2Ah
 
D.data:0046B65E                db  2Bh
 
E.data:0046B660                db  2Ch
 
F.data:0046B662                db  20h
 
10.data:0046B664                db  32h
 
11.data:0046B666                db  20h
 
 
 
SUBROUTINE              USED FOR
 
 
404650+1AE PSI ATTACK EFX
 
406100+4F9 TERRORIST MELEE ATTACK EFX
 
40B420+111 EXPLOSION EFX
 
40B420+24F EXPLOSION EFX?
 
40E450+73 DEATH SCREAM EFX
 
40F2C0+285 PLACE ITEM EFX
 
4110E0+E0 ITEM USE EFX
 
4110E0+901 SHOT HIT EFX
 
419660+1A5 PLACE ITEM (INVENTORY) EFX
 
419660+346 RELOAD EFX
 
41DCC0+D1 STUN ROD ATTACK EFX
 
41EE10+8C PSI ATTACK EFX
 
41F0F0+8C PSI ATTACK EFX
 
41FD10+8B MIND PROBE EFX
 
421140+13 DOORS EFX
 
4247D0+27A NON-WALK MOVE EFX
 
4247D0+4D4 WALK MOVE EFX
 
42A630+B7 GMTATICS.MID
 
42A6F0+18 GMLOSE.MID
 
42B6F0+E9 GMWIN.MID
 
43D8C0+E GEOSCAPE OPEN WINDOW EFX
 
4407D0+2E ?
 
4407D0+9C GMGEOx.MID
 
445B00+BC GMINTER.MID
 
4467C0+1C1 X-COM CRAFT LEFT WEAPON EFX
 
4467C0+233 X-COM CRAFT RIGHT WEAPON EFX
 
446DA0+267 UFO HIT EFX
 
4470B0+F2 UNKNOWN INTERCEPTION EVENT (CRAFT CRASH EFX?)
 
447EE0+32 GMSTORY.MID
 
448390+28F ??
 
448390+2DD BASE DEFENSE (EVENT 9)
 
448390+3DC ?0A (BASE DEFENSE?)
 
448390+3F1 ?0A
 
448390+406 ?0A
 
44A220+15 GMSTORY.MID
 
44C940+10 GMDEFEND.MID
 
44CD40+26 GMBASE.MID
 
44D030+D GMDEFEND.MID
 
44D3C0+E GMMARS.MID
 
44D690+10 GMMARS.MID
 
44DACO+10 GMBASE.MID
 
450F10+91 BLEEP (1)
 
45DCA0+17 ??
 
</nowiki>
 
 
 
==Modding Tank/Cannon into a Tank/Chaingun==
 
==Modding Tank/Cannon into a Tank/Chaingun==
  

Revision as of 10:23, 26 April 2012

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 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 FOR TACTICAL REFERENCE]
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 

Functions used in UFOloader's new interception routines

For those that might want to know how accuracy is calculated with the new options for interception turned on:

X-Craft Accuracy

[(1+((3-(.5*(difficulty level-1)))/UFOsize)/2 ] * Weapon Accuracy ....... [beginner=1..superhuman=5]

Diff	Ship Size				
	VS	S	M	L	VL
begin	0.8	0.875	1	1.25	2
exp	0.75	0.8125	0.91667	1.125	1.75
vet	0.7	0.75	0.83333	1	1.5
Genius	0.65	0.6875	0.75	0.875	1.25
Super	0.6	0.625	0.66667	0.75	1
         

UFO Accuracy

60 + (difficulty level *3) - [Cautious Mode bonus (10)]

Comparison of Damage routines

Xcraft-dam-routine.GIF


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.

UFO-dam-routine.GIF

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.

Feedback

Any questions or feedback one may have....