Jump to content

C&C95 player production/building stuff


peterthepigeon

Recommended Posts

While I was munging around in C&C95 using my old trusty tools, T-Search, IDA, and Olly, I found the algorithim where the game determines how long it takes a structure/unit to build.  I have reason to believe the superweapons may have similar logic to this:

 

BYTE bTicksBetweenBuildCall = ( unsigned short )( Cost / 0x6C );

 

That little pup calculates how many ticks must pass before the game calls the continue build algorithm again.  I may be wrong however in the exact wording but that's what I've been able to determine.

 

Now the actual total ticks before it begins the sequence all over again in the build call is 0x6C.  I've determined that you can at most increase the base speed by 4.  Beyond that it doesn't work.

 

Now onto the programmer stuff again.

 

0043C000  |. 8846 02               MOV BYTE PTR DS:[ESI+2],AL
0043C003  |. 80E2 FD               AND DL,0FD
0043C006  |. 8846 03               MOV BYTE PTR DS:[ESI+3],AL

 

AL is the calculated bTicksBetweenBuildCall.

 

0043BDE1     8A4B 02               MOV CL,BYTE PTR DS:[EBX+2]
0043BDE4     FEC9                  DEC CL
0043BDE6  |. 884B 02               MOV BYTE PTR DS:[EBX+2],CL

 

Obviously decrements the stored bTicksBetweenBuildCall until it hits 0.  Then the whole thing starts again.

 

0043BDF2     8A43 03               MOV AL,BYTE PTR DS:[EBX+3]
0043BDF5     42                    INC EDX
0043BDF6     8843 02               MOV BYTE PTR DS:[EBX+2],AL

 

This pup resets the bTicksBetweenBuildCall back to normal and increments the bBuildTicks.

 

Now to explain what I meant earlier, bBuildTicks can only be increased by a max of 4 including the increment.

 

If you also zero the bTicksBetweenBuildCall and add 4 to bBuildTicks, you will achieve maximum producton speed in the game.

 

0043BDE1     32C9                  XOR CL,CL
0043BDE3     90                    NOP
0043BDE4     90                    NOP
0043BDE5     90                    NOP
0043BDE6  |. 884B 02               MOV BYTE PTR DS:[EBX+2],CL
0043BDE9  |.^0F85 55FFFFFF         JNZ C&C95.0043BD44
0043BDEF  |. 66:8B13               MOV DX,WORD PTR DS:[EBX]
0043BDF2     66:83C2 04            ADD DX,4
0043BDF6     8843 02               MOV BYTE PTR DS:[EBX+2],AL

Link to comment
Share on other sites

so... why exactly are you posting interesting disassembly information here, and then immediately perverting it to a cheat?

 

Also... is that player only, or would it also affect the AI?

 

It's to show the maximum possible speed that can be obtained.  As far as I've tested, I haven't determined if it affects the AI or not.  I believe it would however.

Link to comment
Share on other sites

Ah, all right. Just testing the limits of the system, then.

 

I've seen the AI madly produce hundreds of units in my experiments when adding new units to the game (see also, the "Tiberian Sun 100 units bug"). Then again, without that specific bug, I guess they'll stick to the teamtype amounts set in the mission ini files, and the actual build speed wouldn't be that noticeable, with other factors like the AI money possibly holding them back anyway.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...