Corrected the colony ship production table by Gowron at 0x18E2B8 (9*12 bytes i.e. for production values 0-8 only). Consequently the vanilla code should be: (or just avoid using/editing production values 9+)
Code: Select all
00469AF4 cmp edi, 9
00469DC4 mov edi, 8
00469DC9 jmp 00469AFD
By default production value 0 is unused due to the missing terraforming ability, but could be used with e.g. this bio tech modification:
viewtopic.php?p=24497&sid=f325f6163b2d0 ... fe5#p24497
Or change my above code example at 00469DC4 to 'mov edi, 0' i.e. production values 9+ will use table entry 0.
Colonies Starting Pop and Buildings - experimental code (test code for main building fixes)
New 12 byte entry structure of the colony ship production table at 0x18E2B8: (for production values 0-8)
Bytes:
- 1-4 starting population (unchanged)
=> Number of main buildings:
5 - Food
6 - Industry
7 - Energy
8 - Research
9 - Intel
10 - Race specific bonus buildings (see below)
=> AI bonuses:
11 - AI starting pop bonus (i.e. +value from byte 1-4)
12 - 1= AI extra starting shipyard
At asm-469DEB i.e. 0x
691EB (5 zero bytes) = race specific bonus area (1 byte each, card-rom)
Area IDs for race specific extra buildings:
0 - Food
1 - Industry
2 - Energy
3 - Research
4 - Intel
e.g. 00 00 00 01 00 -> klingons extra Industry, all other extra Food (cf. byte 10 above for number of extra buildings)
The starting buildings are always the latest upgrades (unless the number is 0). IIRC a request/idea by Dr_Breen.
Code: Select all
trek.exe at 0x68F54 - 0x6902E new code 0xDB bytes:
0F B6 42 4C 89 44 24 0C 6B FF 0C 81 C7 BC 04 59 00 33 F6 89 74 24 10 80 3F 00 74 4C 8B 44 24 0C 8D 54 24 20 6B CE 03 C1 E1 06 BB 20 51 44 00 2B D9 90 FF D3 90 90 0F B6 94 24 85 00 00 00 8B 44 24 0C E8 E5 9A FE FF 48 90 90 3C 08 7E 02 B0 08 33 C9 0F B7 5C 24 70 03 D8 8B 45 0C 8B D3 E8 39 C2 FD FF 41 3A 0F 7C F1 47 FE 44 24 10 8B 74 24 10 83 FE 05 7C A1 74 44 90 90 90 90 8B 8C 24 E4 01 00 00 83 79 04 01 75 53 0F B6 07 01 41 40 80 7F 01 01 75 47 8B 41 44 E8 93 0A FD FF 8B D0 8B 45 0C E8 F5 C1 FD FF EB 33 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8B 44 24 0C 0F B6 B0 EB 9D 46 00 E9 4B FF FF FF 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
-ASM Code-
00469B54 0FB642 4C MOVZX EAX, BYTE [EDX+4C] // race ID
00469B58 894424 0C MOV [ESP+C], EAX // store race ID
00469B5C 6BFF 0C IMUL EDI, EDI ,0C // colony ship production
00469B5F 81C7 BC045900 ADD EDI, 005904BC // production table+4
00469B65 33F6 XOR ESI, ESI // area ID
00469B67 897424 10 MOV DWORD PTR SS:[ESP+10], ESI // loop count
00469B6B 803F 00 CMP BYTE [EDI], 0 // if number/marker 0...
00469B6E 74 4C JE SHORT 469BBC // ...check next
00469B70 8B4424 0C MOV EAX, [ESP+C] // race ID
00469B74 8D5424 20 LEA EDX, [ESP+20] // address for edifice.bst entry
00469B78 6BCE 03 IMUL ECX,ESI, 3
00469B7B C1E1 06 SHL ECX, 6
00469B7E BB 20514400 MOV EBX, 00445120
00469B83 2BD9 SUB EBX, ECX
00469B85 90 NOP
00469B86 FFD3 CALL EBX // load T1 building edifice.bst entry
00469B88 90 NOP
00469B89 90 NOP
00469B8A 0FB69424 85000000 MOVZX EDX, BYTE [ESP+85] // Tech req. type
00469B92 8B4424 0C MOV EAX, [ESP+C] // race ID
00469B96 E8 E59AFEFF CALL 453680 // get tech level
00469B9B 48 DEC EAX // current tech level -1
00469B9C 90 NOP
00469B9D 90 NOP
00469B9E 3C 08 CMP AL, 8 // max upgrades for main buildings
00469BA0 7E 02 JLE SHORT 469BA4
00469BA2 B0 08 MOV AL, 8 // max upgrades for main buildings
00469BA4 33C9 XOR ECX, ECX
00469BA6 0FB75C24 70 MOVZX EBX, WORD [ESP+70] // tech 1 building ID
00469BAB 03D8 ADD EBX, EAX // add tech factor
00469BAD 8B45 0C MOV EAX, [EBP+C] // system ID
00469BB0 8BD3 MOV EDX, EBX // building ID
00469BB2 E8 39C2FDFF CALL 445DF0 // add building
00469BB7 41 INC ECX
00469BB8 3A0F CMP CL, BYTE [EDI]
00469BBA ^7C F1 JL SHORT 469BAD // add buildings loop
00469BBC 47 INC EDI
00469BBD FE4424 10 INC BYTE [ESP+10]
00469BC1 8B7424 10 MOV ESI, [ESP+10]
00469BC5 83FE 05 CMP ESI, 5
00469BC8 ^7C A1 JL SHORT 469B6B // loop next area
00469BCA 74 44 JE SHORT 469C10 // goto load race bonus area
00469BCC 90 NOP
00469BCD 90 NOP
00469BCE 90 NOP
00469BCF 90 NOP
00469BD0 8B8C24 E4010000 MOV ECX, [ESP+1E4] // systInfo
00469BD7 8379 04 01 CMP DWORD [ECX+4], 1 // AI system?
00469BDB 75 53 JNZ SHORT 469C30 // exit if player
00469BDD 0FB607 MOVZX EAX,BYTE [EDI] // AI pop bonus
00469BE0 0141 40 ADD [ECX+40], EAX // add extra pop
00469BE3 807F 01 01 CMP BYTE [EDI+1], 1 // AI shipyard marker
00469BE7 75 47 JNZ SHORT 469C30
00469BE9 8B41 44 MOV EAX, [ECX+44] // race ID
00469BEC E8 930AFDFF CALL 43A684 // get yard ID
00469BF1 8BD0 MOV EDX, EAX
00469BF3 8B45 0C MOV EAX, [EBP+C] // system ID
00469BF6 E8 F5C1FDFF CALL 445DF0 // add building
00469BFB EB 33 JMP SHORT 469C30 // exit
00469BFD 90 NOP
00469BFE 90 NOP
00469BFF 90 NOP
00469C00 90 NOP
00469C01 90 NOP
00469C02 90 NOP
00469C03 90 NOP
00469C04 90 NOP
00469C05 90 NOP
00469C06 90 NOP
00469C07 90 NOP
00469C08 90 NOP
00469C09 90 NOP
00469C0A 90 NOP
00469C0B 90 NOP
00469C0C 90 NOP
00469C0D 90 NOP
00469C0E 90 NOP
00469C0F 90 NOP
00469C10 8B4424 0C MOV EAX, [ESP+C] // race ID
00469C14 0FB6B0 EB9D4600 MOVZX ESI, BYTE [EAX+469DEB] // race bonus area
00469C1B ^E9 4BFFFFFF JMP 469B6B
00469C20 90 NOP
00469C21 90 NOP
00469C22 90 NOP
00469C23 90 NOP
00469C24 90 NOP
00469C25 90 NOP
00469C26 90 NOP
00469C27 90 NOP
00469C28 90 NOP
00469C29 90 NOP
00469C2A 90 NOP
00469C2B 90 NOP
00469C2C 90 NOP
00469C2D 90 NOP
00469C2E 90 NOP
To disable newest upgrade feature:
Code: Select all
00469BAB 03D8 ADD EBX, EAX
-> Nop 9090
To adapt upgrade feature to reduced upgrades mods: (code is shared for all main buildings!)
Code: Select all
00469B9B 48 DEC EAX // current tech level -1
00469B9C 9090 NOP
-> e.g. 'dec eax' & 'shr eax,1' = [tech level-1]/2 for BoP (4 upgrades instead of vanilla 8)
00469B9E 3C 08 CMP AL, 8 // max upgrades for main buildings
00469BA2 B0 08 MOV AL, 8 // max upgrades for main buildings
-> e.g. set 4 for BoP, 0 if no upgrades
To change location of the colony ship production table at 0x18E2B8: (only two values)
Code: Select all
00469B0D 8B0485 B8045900 MOV EAX, [EAX*4+5904B8] // old pop pointer
00469B5F 81C7 BC045900 ADD EDI, 005904BC // new building pointer to 5904B8+4
Edit by Tethys (11/09/2014)
To turn AI bonuses into human player bonuses, at 0x68FDB: (remove jump by overwriting 2 bytes with 90 90)
Code: Select all
00469BDB 75 53 JNZ SHORT 469C30 // exit if player
becomes
00469BDB 90 90 NOP //
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.