Iran Posted June 22, 2015 Share Posted June 22, 2015 The special draw laser exception is part of a BuildingClass function which handles animations and sound effects. 0x0041D058 BuildingClass__Fire_Animation?? For turret this is called: .text:0041D10E 084 call play_anim For Obelisk this is called: .text:0041D34B 094 call draw_line Both buildings call: .text:0041D137 07C call Sound_Effect(VocType,ulong,int,HousesType) It handles the Obelisk firing sound. Link to comment Share on other sites More sharing options...
Jacko Posted June 22, 2015 Share Posted June 22, 2015 Wow this is pretty cool If you could attatch this feature to units does that mean you could create (entirely for comedy or ridiculousness) a laser tank? Link to comment Share on other sites More sharing options...
Iran Posted June 23, 2015 Share Posted June 23, 2015 I just said it wasn't possible, it's only avaiable for BuildingClass objects so buildings. Link to comment Share on other sites More sharing options...
Nyerguds Posted June 23, 2015 Share Posted June 23, 2015 Pssh. Either it's in the vtable in a place where you can override it, or it isn't and you can hook it into the relevant functions. Sure it's possible; just needs some work to either make versions that works for the other types, or adapt the buildings one to work for all types. I mean, it was already shown that giving laser to the turret also draws the beam, so it's clearly filtered on weapon or projectile ID, not on actual structure ID. More interesting... the origin point of the laser could lead me to the firing offsets of stuff, something which I've been planning to look into for quite a while now. Link to comment Share on other sites More sharing options...
Iran Posted June 23, 2015 Share Posted June 23, 2015 BuildingClass objects are extended TechnoClass objects so if the function uses the extended part it will crash. But you can try. Link to comment Share on other sites More sharing options...
Nyerguds Posted June 23, 2015 Share Posted June 23, 2015 It seems that this function is already the building-specific implementation/override of that FireAnimation function on TechnoClass. So basically this means the laser code needs to be ported to the other functions. [edit] And indeed, the code checks on the specific Laser weapon projectile: .text:0041D191 07C cmp eax, 0Ch ; 12 = laser shot projectile .text:0041D194 07C jnz dont_draw_laser Link to comment Share on other sites More sharing options...
Nyerguds Posted June 23, 2015 Share Posted June 23, 2015 I'm honestly amazed how different all these functions are. But it should be possible to make a copy of the laser drawing code and call it from the others. Simply using the structures one doesn't seem to work since the code accesses certain things directly on the object instead of calling the getter on the vtable to fetch them. (like the *Type blueprint object to get the weapon info from) Link to comment Share on other sites More sharing options...
peterthepigeon Posted July 3, 2015 Author Share Posted July 3, 2015 CPU Disasm Address Hex dump Command Comments 0041D1B5 |. 8D46 2F LEA EAX,[ESI+2F] 0041D1B8 |. 31D2 XOR EDX,EDX 0041D1BA |. C640 02 00 MOV BYTE PTR DS:[EAX+2],0 0041D1BE |. 66:8910 MOV WORD PTR DS:[EAX],DX 0041D1C1 |. 8A50 02 MOV DL,BYTE PTR DS:[EAX+2] 0041D1C4 |. 8D5D BC LEA EBX,[LOCAL.20] 0041D1C7 |. 8850 03 MOV BYTE PTR DS:[EAX+3],DL 0041D1CA |. 8D55 B8 LEA EDX,[LOCAL.21] 0041D1CD |. B8 C0DD5300 MOV EAX,0053DDC0 0041D1D2 |. E8 5D540100 CALL 00432634 ; [C&C95.00432634 0041D1D7 |. 85C0 TEST EAX,EAX 0041D1D9 |. 0F84 45020000 JE 0041D424 0041D1DF |. 803D 041E5400 00 CMP BYTE PTR DS:[541E04],0 0041D1E6 |. 0F85 38020000 JNE 0041D424 0041D1EC |. 8D4D AC LEA ECX,[LOCAL.24] 0041D1EF |. 8D5D A8 LEA EBX,[LOCAL.25] 0041D1F2 |. 8B55 B8 MOV EDX,DWORD PTR SS:[LOCAL.21] 0041D1F5 |. B8 C0DD5300 MOV EAX,0053DDC0 0041D1FA |. E8 A9520100 CALL 004324A8 ; [C&C95.004324A8 0041D1FF |. 8D4D B4 LEA ECX,[LOCAL.22] 0041D202 |. 8D5D B0 LEA EBX,[LOCAL.23] 0041D205 |. 8B55 BC MOV EDX,DWORD PTR SS:[LOCAL.20] 0041D208 |. B8 C0DD5300 MOV EAX,0053DDC0 0041D20D |. E8 96520100 CALL 004324A8 ; [C&C95.004324A8 0041D212 |. 8B5D A8 MOV EBX,DWORD PTR SS:[LOCAL.25] 0041D215 |. 8B4D B0 MOV ECX,DWORD PTR SS:[LOCAL.23] 0041D218 |. 8B7D AC MOV EDI,DWORD PTR SS:[LOCAL.24] 0041D21B |. A1 ECDE5300 MOV EAX,DWORD PTR DS:[53DEEC] 0041D220 |. 8B55 B4 MOV EDX,DWORD PTR SS:[LOCAL.22] 0041D223 |. 01C3 ADD EBX,EAX 0041D225 |. 01C1 ADD ECX,EAX 0041D227 |. A1 F0DE5300 MOV EAX,DWORD PTR DS:[53DEF0] 0041D22C |. 895D A8 MOV DWORD PTR SS:[LOCAL.25],EBX 0041D22F |. 894D B0 MOV DWORD PTR SS:[LOCAL.23],ECX 0041D232 |. 01C7 ADD EDI,EAX 0041D234 |. 01C2 ADD EDX,EAX 0041D236 |. B8 001C5400 MOV EAX,00541C00 0041D23B |. 897D AC MOV DWORD PTR SS:[LOCAL.24],EDI 0041D23E |. 8955 B4 MOV DWORD PTR SS:[LOCAL.22],EDX 0041D241 |. E8 EAC80A00 CALL 004C9B30 ; [C&C95.004C9B30 0041D246 |. 8B45 A8 MOV EAX,DWORD PTR SS:[LOCAL.25] 0041D249 |. 40 INC EAX 0041D24A |. 8945 D0 MOV DWORD PTR SS:[LOCAL.15],EAX 0041D24D |. 8B45 AC MOV EAX,DWORD PTR SS:[LOCAL.24] 0041D250 |. 8945 D4 MOV DWORD PTR SS:[LOCAL.14],EAX 0041D253 |. 8B45 B0 MOV EAX,DWORD PTR SS:[LOCAL.23] 0041D256 |. 8B3D 2C275A00 MOV EDI,DWORD PTR DS:[5A272C] 0041D25C |. 8945 98 MOV DWORD PTR SS:[LOCAL.29],EAX 0041D25F |. 8B45 B4 MOV EAX,DWORD PTR SS:[LOCAL.22] 0041D262 B6 7D MOV DH,7D 0041D264 |. 8945 94 MOV DWORD PTR SS:[LOCAL.30],EAX 0041D267 |. 8B47 1C MOV EAX,DWORD PTR DS:[EDI+1C] 0041D26A |. 8875 FC MOV BYTE PTR SS:[LOCAL.4],DH 0041D26D |. E8 CEC80A00 CALL 004C9B40 ; [C&C95.004C9B40 0041D272 |. 85C0 TEST EAX,EAX 0041D274 |. 74 22 JE SHORT 0041D298 0041D276 |. 3B7F 1C CMP EDI,DWORD PTR DS:[EDI+1C] 0041D279 |. 74 18 JE SHORT 0041D293 0041D27B |. 8B4F 08 MOV ECX,DWORD PTR DS:[EDI+8] 0041D27E |. 8B47 04 MOV EAX,DWORD PTR DS:[EDI+4] 0041D281 |. 51 PUSH ECX ; /Arg2 0041D282 |. 8B5F 10 MOV EBX,DWORD PTR DS:[EDI+10] ; | 0041D285 |. 8B57 1C MOV EDX,DWORD PTR DS:[EDI+1C] ; | 0041D288 |. 50 PUSH EAX ; |Arg1 0041D289 |. 8B4F 14 MOV ECX,DWORD PTR DS:[EDI+14] ; | 0041D28C |. 89F8 MOV EAX,EDI ; | 0041D28E |. E8 35C50A00 CALL 004C97C8 ; \C&C95.004C97C8 0041D293 |> B8 01000000 MOV EAX,1 0041D298 |> 85C0 TEST EAX,EAX 0041D29A |. 74 1F JE SHORT 0041D2BB 0041D29C |. 31C0 XOR EAX,EAX 0041D29E |. 8A45 FC MOV AL,BYTE PTR SS:[LOCAL.4] 0041D2A1 |. 50 PUSH EAX 0041D2A2 |. 8B55 94 MOV EDX,DWORD PTR SS:[LOCAL.30] 0041D2A5 |. 52 PUSH EDX 0041D2A6 |. 8B5D 98 MOV EBX,DWORD PTR SS:[LOCAL.29] 0041D2A9 |. 53 PUSH EBX 0041D2AA |. 8B4D D4 MOV ECX,DWORD PTR SS:[LOCAL.14] 0041D2AD |. 51 PUSH ECX 0041D2AE |. 8B45 D0 MOV EAX,DWORD PTR SS:[LOCAL.15] 0041D2B1 |. 50 PUSH EAX 0041D2B2 |. 57 PUSH EDI 0041D2B3 E8 28100B00 CALL 004CE2E0 0041D2B8 |. 83C4 18 ADD ESP,18 0041D2BB |> 8B47 1C MOV EAX,DWORD PTR DS:[EDI+1C] 0041D2BE |. E8 8DC90A00 CALL 004C9C50 ; [C&C95.004C9C50 0041D2C3 |. 85C0 TEST EAX,EAX 0041D2C5 |. 74 16 JE SHORT 0041D2DD 0041D2C7 |. 8B57 1C MOV EDX,DWORD PTR DS:[EDI+1C] 0041D2CA |. 39D7 CMP EDI,EDX 0041D2CC |. 74 0F JE SHORT 0041D2DD 0041D2CE |. 837F 20 00 CMP DWORD PTR DS:[EDI+20],0 0041D2D2 |. 74 09 JE SHORT 0041D2DD 0041D2D4 |. 8B4A 24 MOV ECX,DWORD PTR DS:[EDX+24] 0041D2D7 |. 85C9 TEST ECX,ECX 0041D2D9 |. 75 02 JNE SHORT 0041D2DD 0041D2DB |. 890F MOV DWORD PTR DS:[EDI],ECX 0041D2DD |> 8B45 A8 MOV EAX,DWORD PTR SS:[LOCAL.25] 0041D2E0 |. 48 DEC EAX 0041D2E1 |. 8945 E0 MOV DWORD PTR SS:[LOCAL.11],EAX 0041D2E4 |. 8B45 AC MOV EAX,DWORD PTR SS:[LOCAL.24] 0041D2E7 |. 8945 A4 MOV DWORD PTR SS:[LOCAL.26],EAX 0041D2EA |. 8B45 B0 MOV EAX,DWORD PTR SS:[LOCAL.23] 0041D2ED |. 8B3D 2C275A00 MOV EDI,DWORD PTR DS:[5A272C] 0041D2F3 |. 8945 C8 MOV DWORD PTR SS:[LOCAL.17],EAX 0041D2F6 |. 8B45 B4 MOV EAX,DWORD PTR SS:[LOCAL.22] 0041D2F9 B3 7D MOV BL,7D 0041D2FB |. 8945 C4 MOV DWORD PTR SS:[LOCAL.18],EAX 0041D2FE |. 8B47 1C MOV EAX,DWORD PTR DS:[EDI+1C] 0041D301 |. 885D F4 MOV BYTE PTR SS:[LOCAL.6],BL 0041D304 |. E8 37C80A00 CALL 004C9B40 ; [C&C95.004C9B40 0041D309 |. 85C0 TEST EAX,EAX 0041D30B |. 74 23 JE SHORT 0041D330 0041D30D |. 8B47 1C MOV EAX,DWORD PTR DS:[EDI+1C] 0041D310 |. 39C7 CMP EDI,EAX 0041D312 |. 74 17 JE SHORT 0041D32B 0041D314 |. 8B57 08 MOV EDX,DWORD PTR DS:[EDI+8] 0041D317 |. 52 PUSH EDX ; /Arg2 0041D318 |. 8B5F 04 MOV EBX,DWORD PTR DS:[EDI+4] ; | 0041D31B |. 8B4F 14 MOV ECX,DWORD PTR DS:[EDI+14] ; | 0041D31E |. 53 PUSH EBX ; |Arg1 0041D31F |. 89C2 MOV EDX,EAX ; | 0041D321 |. 89F8 MOV EAX,EDI ; | 0041D323 |. 8B5F 10 MOV EBX,DWORD PTR DS:[EDI+10] ; | 0041D326 |. E8 9DC40A00 CALL 004C97C8 ; \C&C95.004C97C8 0041D32B |> B8 01000000 MOV EAX,1 0041D330 |> 85C0 TEST EAX,EAX 0041D332 |. 74 1F JE SHORT 0041D353 0041D334 |. 31C0 XOR EAX,EAX 0041D336 |. 8A45 F4 MOV AL,BYTE PTR SS:[LOCAL.6] 0041D339 |. 50 PUSH EAX 0041D33A |. 8B4D C4 MOV ECX,DWORD PTR SS:[LOCAL.18] 0041D33D |. 51 PUSH ECX 0041D33E |. 8B45 C8 MOV EAX,DWORD PTR SS:[LOCAL.17] 0041D341 |. 50 PUSH EAX 0041D342 |. 8B55 A4 MOV EDX,DWORD PTR SS:[LOCAL.26] 0041D345 |. 52 PUSH EDX 0041D346 |. 8B5D E0 MOV EBX,DWORD PTR SS:[LOCAL.11] 0041D349 |. 53 PUSH EBX 0041D34A |. 57 PUSH EDI 0041D34B E8 900F0B00 CALL 004CE2E0 0041D350 83C4 18 ADD ESP,18 0041D353 8B47 1C MOV EAX,DWORD PTR DS:[EDI+1C] 0041D356 |. E8 F5C80A00 CALL 004C9C50 0041D35B |. 85C0 TEST EAX,EAX 0041D35D |. 74 16 JE SHORT 0041D375 0041D35F |. 8B4F 1C MOV ECX,DWORD PTR DS:[EDI+1C] 0041D362 |. 39CF CMP EDI,ECX 0041D364 |. 74 0F JE SHORT 0041D375 0041D366 |. 837F 20 00 CMP DWORD PTR DS:[EDI+20],0 0041D36A |. 74 09 JE SHORT 0041D375 0041D36C |. 8B51 24 MOV EDX,DWORD PTR DS:[ECX+24] 0041D36F |. 85D2 TEST EDX,EDX 0041D371 |. 75 02 JNE SHORT 0041D375 0041D373 8917 MOV DWORD PTR DS:[EDI],EDX 0041D375 8B45 A8 MOV EAX,DWORD PTR SS:[EBP-58] 0041D378 8945 DC MOV DWORD PTR SS:[EBP-24],EAX 0041D37B 8B45 AC MOV EAX,DWORD PTR SS:[EBP-54] 0041D37E 8945 A0 MOV DWORD PTR SS:[EBP-60],EAX 0041D381 8B45 B0 MOV EAX,DWORD PTR SS:[EBP-50] 0041D384 8B3D 2C275A00 MOV EDI,DWORD PTR DS:[5A272C] 0041D38A 8945 9C MOV DWORD PTR SS:[EBP-64],EAX 0041D38D 8B45 B4 MOV EAX,DWORD PTR SS:[EBP-4C] 0041D390 B7 03 MOV BH,3 0041D392 |. 8945 C0 MOV DWORD PTR SS:[LOCAL.19],EAX 0041D395 |. 8B47 1C MOV EAX,DWORD PTR DS:[EDI+1C] 0041D398 |. 887D F8 MOV BYTE PTR SS:[LOCAL.5],BH 0041D39B |. E8 A0C70A00 CALL 004C9B40 ; [C&C95.004C9B40 0041D3A0 |. 85C0 TEST EAX,EAX 0041D3A2 |. 74 22 JE SHORT 0041D3C6 0041D3A4 |. 3B7F 1C CMP EDI,DWORD PTR DS:[EDI+1C] 0041D3A7 |. 74 18 JE SHORT 0041D3C1 0041D3A9 |. 8B4F 08 MOV ECX,DWORD PTR DS:[EDI+8] 0041D3AC |. 8B47 04 MOV EAX,DWORD PTR DS:[EDI+4] 0041D3AF |. 51 PUSH ECX ; /Arg2 0041D3B0 |. 8B5F 10 MOV EBX,DWORD PTR DS:[EDI+10] ; | 0041D3B3 |. 8B57 1C MOV EDX,DWORD PTR DS:[EDI+1C] ; | 0041D3B6 |. 50 PUSH EAX ; |Arg1 0041D3B7 |. 8B4F 14 MOV ECX,DWORD PTR DS:[EDI+14] ; | 0041D3BA |. 89F8 MOV EAX,EDI ; | 0041D3BC |. E8 07C40A00 CALL 004C97C8 ; \C&C95.004C97C8 0041D3C1 |> B8 01000000 MOV EAX,1 0041D3C6 |> 85C0 TEST EAX,EAX 0041D3C8 |. 74 1F JE SHORT 0041D3E9 0041D3CA |. 31C0 XOR EAX,EAX 0041D3CC 8A45 F8 MOV AL,BYTE PTR SS:[EBP-8] 0041D3CF 50 PUSH EAX 0041D3D0 8B55 C0 MOV EDX,DWORD PTR SS:[EBP-40] 0041D3D3 |. 52 PUSH EDX 0041D3D4 8B5D 9C MOV EBX,DWORD PTR SS:[EBP-64] 0041D3D7 53 PUSH EBX 0041D3D8 8B4D A0 MOV ECX,DWORD PTR SS:[EBP-60] 0041D3DB |. 51 PUSH ECX 0041D3DC |. 8B45 DC MOV EAX,DWORD PTR SS:[LOCAL.12] 0041D3DF |. 50 PUSH EAX 0041D3E0 |. 57 PUSH EDI 0041D3E1 E8 FA0E0B00 CALL 004CE2E0 0041D3E6 |. 83C4 18 ADD ESP,18 I practically gave it away earlier :/ http://cnc-comm.com/community/index.php?topic=3150.msg26759#msg26759 Green lasers. Link to comment Share on other sites More sharing options...
peterthepigeon Posted July 4, 2015 Author Share Posted July 4, 2015 bzzzzzz Link to comment Share on other sites More sharing options...
Iran Posted July 5, 2015 Share Posted July 5, 2015 Well played Link to comment Share on other sites More sharing options...
peterthepigeon Posted July 5, 2015 Author Share Posted July 5, 2015 Pssh. Either it's in the vtable in a place where you can override it, or it isn't and you can hook it into the relevant functions. Sure it's possible; just needs some work to either make versions that works for the other types, or adapt the buildings one to work for all types. I mean, it was already shown that giving laser to the turret also draws the beam, so it's clearly filtered on weapon or projectile ID, not on actual structure ID. More interesting... the origin point of the laser could lead me to the firing offsets of stuff, something which I've been planning to look into for quite a while now. Entry replacement, couple of byte patches and presto, it works. Easy peasy. Well played Quite. Link to comment Share on other sites More sharing options...
Iran Posted July 5, 2015 Share Posted July 5, 2015 You modified the vtable? Link to comment Share on other sites More sharing options...
peterthepigeon Posted July 6, 2015 Author Share Posted July 6, 2015 You modified the vtable? Vtables and jumptables yes. Link to comment Share on other sites More sharing options...
Nyerguds Posted July 7, 2015 Share Posted July 7, 2015 Really? I tried that and it crashed on Structure properties that were accessed directly on the object in that code instead of going through the vtable's getters. What exactly did you change? I'm interested in doing this to fix the Laser Orca I implemented for the special Playstation mission. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now