Delmair Posted July 26, 2012 Share Posted July 26, 2012 Okay, I figured it out... I got code that works, but your logos are in the wrong order on the CPS: to correspond to H-A-O, they should be in the order F-S-M. They are in the order S-F-M though :P[edit]Here ya go:You need to do 2 things... first, replace both occurrences ofcmp houseHumanID, 0 ; minimum house ID[...]cmp houseHumanID, 2 ; maximum house IDby compares with 3 and 5 for the respective minimum and maximum. In a DB of your dunex.exe, they should be located at ovr207:0B56 and ovr207:0B9EIn your exe, that's offset 578EA and 578F1 for the first one, and 57932 and 57939 for the second.Then there's the piece where I subtract 3 from the house ID (well, a copy of it)... this is a bit long, since I had to free up some space a bit further in the code, meaning the code in between is moved down a bit. Luckily, there was an opportunity to free up the required bytes only about 15 bytes further :)At 578F7, replace the current code by these bytes:EB14 A1383A BA3800 83E803 F7EA 050800 B103 D3F8 8BF8 B80200 50 50In case you're interested, the actual new code of this is:#eip=61A87 ; 578F7EB14 jmp .skipHouseCodeA1383A mov ax, houseHumanIDBA3800 mov dx, 38h83E803 sub ax, 3 ; NEW INSERTED COMMAND: subtraction to shift FSM to HAOF7EA imul dx050800 add ax, 8B103 mov cl, 3D3F8 sar ax, cl8BF8 mov di, axskipHouseCode:B80200 mov ax, 250 push ax; REMOVED TO GET FREE SPACE: B80200 mov ax, 250 push axAs you see, I removed a command there to free up space to be able to insert the "sub ax, 3" command earlier in the code. That second "mov ax, 2" command wasn't needed anyway, since ax was already put to "2" :)So yeah, this code, and an adaption of your CPS to put the logos in the right order, and you're set. I attached a fixed CPS that worked for me :)Hello all users,I wanted to try playing a campaign Atreides, but using the modified game files DUNEX.exe.I was able to restore the original texts of the missions and orders of mentats editing the yours EXPAND.PAK file...but I can't get the original colors of the three houses (Atreides, Harkonnen and Ordos) in the hall of fame and scores (YOU:, ENEMY:) of the scores at the end of the missions!For example: Nyerguds (or MrFibble if you know how to do), can you create another file FAME.CPS that can adapt to my DUNEX.exe modified?Thanks & Reguards. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted July 26, 2012 Author Share Posted July 26, 2012 I wanted to try playing a campaign Atreides, but using the modified game files DUNEX.exe.I was able to restore the original texts of the missions and orders of mentats editing the yours EXPAND.PAK file...but I can't get the original colors of the three houses (Atreides, Harkonnen and Ordos) in the hall of fame and scores (YOU:, ENEMY:) of the scores at the end of the missions!For example: Nyerguds (or MrFibble if you know how to do), can you create another file FAME.CPS that can adapt to my DUNEX.exe modified?Why don't you just use the original DUNE2.EXE to play the Atreides (or any other of the original Houses) missions? Editing the original stuff back in DUNEX is both a lot of work and quite pointless. Quote Link to comment Share on other sites More sharing options...
Delmair Posted July 26, 2012 Share Posted July 26, 2012 I spoke in private also with Nyerguds... basically because I wanted to play the campaign so that the new units (Fremen Warriors and Sardaukar Trooper) are present in the game. I try to change the original file DUNE2.exe, but is too complicated for my idea...for example, I tried to change the Infrantry transforming the unit into Fremen Warriors with the editor d2editor, but I have found some problems, such as the fact that they non-fired mini-rocket missiles, rather with the machine gun...For this reason (and more others) I decided to use the file DUNEX.exe and not the original DUNE2.exe, thus modifying only the .PAK files as EXPAND.PAK.So, how can I change the bar-color in the hall of fame?These is a image in game: http://desmond.image...jpg&res=landingI played with the Atreides a my scenario and at the end of the mission the scores bar is colored violet (as Sardaukar faction!).It's a shame because I lost hours of work to change almost everything, making the game visually acceptable. P.S. However I'm drnovice's brother, I see that also him has posted in this discussion! :) Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted July 27, 2012 Author Share Posted July 27, 2012 basically because I wanted to play the campaign so that the new units (Fremen Warriors and Sardaukar Trooper) are present in the game. I try to change the original file DUNE2.exe, but is too complicated for my idea...for example, I tried to change the Infrantry transforming the unit into Fremen Warriors with the editor d2editor, but I have found some problems, such as the fact that they non-fired mini-rocket missiles, rather with the machine gun...For this reason (and more others) I decided to use the file DUNEX.exe and not the original DUNE2.exe, thus modifying only the .PAK files as EXPAND.PAK.So, how can I change the bar-color in the hall of fame?Trust me, it's still a lot easier to make the changes you want in DUNE2.EXE rather than go through DUNEX.EXE to clean up all the changes you do not need.The editor alone isn't enough for some things, like the machinegun/rocket combo for infantry. There's a piece of code that makes the Trooper weapon change to rockets from machinegun if the range is greater than 2:seg030:16A6 loc_26D96: ; CODE XREF: scriptFunctionUnitAttack:loc_26D79jseg030:16A6 ; scriptFunctionUnitAttack+250jseg030:16A6 C4 1E 52 62 les bx, scriptUnitGamePtr ; Load Full Pointer to ES:xxseg030:16AA 26 80 7F 02 03 cmp es:[bx+_unitGame.typeIndex], 3 ; Troopersseg030:16AF 74 0B jz short distanceCheck ; Jump if Zero (ZF=1)seg030:16B1 C4 1E 52 62 les bx, scriptUnitGamePtr ; Load Full Pointer to ES:xxseg030:16B5 26 80 7F 02 05 cmp es:[bx+_unitGame.typeIndex], 5 ; Trooperseg030:16BA 75 0C jnz short loc_26DB8 ; Jump if Not Zero (ZF=0)seg030:16BCseg030:16BC distanceCheck: ; CODE XREF: scriptFunctionUnitAttack+260jseg030:16BC 81 7E EC 00 02 cmp [bp+objectDistance], 200h ; Compare Two Operandsseg030:16C1seg030:16C1 loc_26DB1: ; Jump if Less or Equal (ZF=1 | SF!=OF)seg030:16C1 7E 05 jle short loc_26DB8seg030:16C3 C7 46 F8 16 00 mov [bp+weaponTypeIndex], 16hseg030:16C8seg030:16C8 loc_26DB8: ; CODE XREF: scriptFunctionUnitAttack+26Bjseg030:16C8 ; scriptFunctionUnitAttack:loc_26DB1jseg030:16C8 8B 5E F8 mov bx, [bp+weaponTypeIndex]seg030:16CB 83 EB 13 sub bx, 13h ; switch 7 casesseg030:16CEseg030:16CE loc_26DBE: ; Compare Two Operandsseg030:16CE 83 FB 06 cmp bx, 6seg030:16D1 76 03 jbe short loc_26DC6 ; Jump if Below or Equal (CF=1 | ZF=1)seg030:16D3 E9 89 01 jmp loc_26F4F ; defaultYou can see that in the beginning, it checks if the current unit is a Trooper or a Trooper squad; otherwise it skips the code. To extend this to regular infantry, I had to change this part to check if the unit id is less or greater than the range that includes both Trooper and Infantry units' IDs.So I suggest that you simply list what features from DUNEX you want in your Dune II besides the new units. Mind though that This change will also mean that the Atreides will either have no regular infantry at all or only Troopers, and that the infantry spawned from destroyed structures and vehicles should be either turned off completely or replaced by Troopers. Quote Link to comment Share on other sites More sharing options...
Delmair Posted July 28, 2012 Share Posted July 28, 2012 Thanks MrFlibble you for your help, you're great... :)I was able to modify the strings that concerned the ID as you suggested and now my Soldier/Infantry modified into Warrior/s firing mini-rockets. ;)But Raider Trike changed into Sardaukar Trooper when I give orders to Attack it's blocked and don't fire!Maybe it's about to change for them, but I was especially interested in the fact that you (and who helped you to do) have improved the AI in order to make the game more difficult and challenging (remember playing a scenario with the Sardaukar when the Fremen opponent attacked me with 4 Launchers for once!). For this reason I chosen to playing this campaign with modified DUNEX.exe.Regarding the fact that the Soldiers survived out from vehicles exploded and destroyed bases, I saw that you put the odds of this happening to 0%, otherwise it would come out Warrior instead of Soldier and this would not make sense! Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted July 29, 2012 Author Share Posted July 29, 2012 But Raider Trike changed into Sardaukar Trooper when I give orders to Attack it's blocked and don't fire!This is weird, are you sure you copied all the data from the Trooper correctly? (That's how I did that, just replicated data settings of a Trooper and only changed HP, attack, ROF and speed settings).Maybe it's about to change for them, but I was especially interested in the fact that you (and who helped you to do) have improved the AI in order to make the game more difficult and challenging (remember playing a scenario with the Sardaukar when the Fremen opponent attacked me with 4 Launchers for once!). For this reason I chosen to playing this campaign with modified DUNEX.exe.What I did with the AI doesn't have to do with editing the EXE, it's an original option that was build into the game but got never used, the so-called team bug. Basically, the AI did not use attack teams of vehicles in Dune II because the scripts for the teams (found in the scenario files) misspelled team types.What I did though was change priority levels for Turrets and Rocket Turrets via Nyerguds' editor, which forces the AI to attack the player's base defences first (for some reason the priority levels for turrets was exceptionally low in the original game, maybe because turrets don't count as structures by the "all structures destroyed" win/lose trigger). This parameter is called "Threat level" in the editor IIRC. You can experiment with the parameters to accomplish interesting results, the AI in DUNEX is certainly harder because it doesn't ignore base defences which is coupled with attacking by groups of vehicles.Regarding the fact that the Soldiers survived out from vehicles exploded and destroyed bases, I saw that you put the odds of this happening to 0%, otherwise it would come out Warrior instead of Soldier and this would not make sense!Actually I think Segra found the part in the code responsible for what unit should spawn from what. However, with the missile fix you can also transform Infantry into Troopers and Troopers into Fremen to avoid the problem entirely.Here's a chunk that might be responsible for spawning infantry, but I haven't tested it (might be the spawn from infantry squads code):seg031:0D66 loc_290C6: ; CODE XREF: unitTakeDamage+1DAjseg031:0D66 C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:0D69 26 80 7F 02 03 cmp es:[bx+_unitGame.typeIndex], 3 ; Troopersseg031:0D6E 74 0A jz short TrooperInfantry ; Jump if Zero (ZF=1)seg031:0D70 C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:0D73 26 80 7F 02 02 cmp es:[bx+_unitGame.typeIndex], 2 ; Infantryseg031:0D78 75 79 jnz short loc_29153 ; Jump if Not Zero (ZF=0) Quote Link to comment Share on other sites More sharing options...
Delmair Posted July 30, 2012 Share Posted July 30, 2012 Very interesting... :)I noticed that you have imported a different the value "Treat level for AI" with the d2editor. This actually makes the AI ​​more similar to human actions since it first hit the defense turret to avoid being decimated during an attack... simple and ingenious! ;)Thanks for the advice for spawning Infantry, I will try also this...Besides MrFlibble do you know this fantastic scenario editor?http://dunemaps.sourceforge.net/ Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted July 31, 2012 Author Share Posted July 31, 2012 Yeah, that's Segra's editor. Should be mentioned on the Dune II editing tools list. Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 6, 2012 Share Posted August 6, 2012 I still don't understand this function:seg023:0F78 loc_231A8: ; CODE XREF: isFriendly?:loc_231A4jseg023:0F78 83 FA 03 cmp dx, 3 ; DX = objectseg023:0F7B 74 05 jz short isFremen ; Jump if Zero (ZF=1)seg023:0F7D 83 FB 03 cmp bx, 3 ; BX = humanseg023:0F80seg023:0F80 loc_231B0: ; Jump if Not Zero (ZF=0)seg023:0F80 75 0E jnz short notFremenseg023:0F82seg023:0F82 isFremen: ; CODE XREF: isFriendly?+20jseg023:0F82 83 FA 01 cmp dx, 1 ; Compare Two Operandsseg023:0F85seg023:0F85 loc_231B5: ; Jump if Zero (ZF=1)seg023:0F85 74 05 jz short isAtreidesseg023:0F87seg023:0F87 loc_231B7: ; Compare Two Operandsseg023:0F87 83 FB 01 cmp bx, 1seg023:0F8Aseg023:0F8A loc_231BA: ; if object is Fremen, and Human is Atreides, Ret Trueseg023:0F8A 75 02 jnz short notAtreidesseg023:0F8Cseg023:0F8C isAtreides: ; CODE XREF: isFriendly?:loc_231B5jseg023:0F8C EB 10 jmp short retTrue ; Jumpseg023:0F8E ; ---------------------------------------------------------------------------seg023:0F8Eseg023:0F8E notAtreides: ; CODE XREF: isFriendly?:loc_231BAjseg023:0F8E EB DE jmp short retFalse ; Jumpseg023:0F90 ; ---------------------------------------------------------------------------seg023:0F90seg023:0F90 notFremen: ; CODE XREF: isFriendly?:loc_231B0jseg023:0F90 3B 16 2C 3A cmp dx, houseHumanID ; Compare Two Operandsseg023:0F94seg023:0F94 loc_231C4: ; Jump if Zero (ZF=1)seg023:0F94 74 06 jz short objectIsHumanseg023:0F96seg023:0F96 loc_231C6: ; Compare Two Operandsseg023:0F96 3B 1E 2C 3A cmp bx, houseHumanIDseg023:0F9Aseg023:0F9A loc_231CA: ; if object is not human, and house is not human, ret trueseg023:0F9A 75 02 jnz short retTrueseg023:0F9Cseg023:0F9C objectIsHuman: ; CODE XREF: isFriendly?:loc_231C4jseg023:0F9C EB D0 jmp short retFalse ; JumpIn the case where dx=1 (object is Atreides) and bx=1 (human is Atreides) function jump to "notFremen" point, that check if dx and houseHumanID are equal and then if bx is equal to houseHumanID.So if houseHumanID=1 and also dx=1 (object is Atreides) then jump to "objectIsHuman" point, so why return false? It should another check (for example if dx not equal bx) first to return false (non-friendly unit) Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 6, 2012 Share Posted August 6, 2012 I managed to adjust number of Sandworm eating before disappearing! Now if you want, you can set 4, 5, 6, ... even 9 or more eating, both to pre-placed or spawned Sandworms.Do you remember this chunk of code:seg015:0532 83 7E 08 19 cmp [bp+TypeIndex], 19h ; Sandwormseg015:0536 75 08 jnz short notWorm ; Jump if Not Zero (ZF=0)seg015:0538 C4 5E FC les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg015:053B 26 C6 47 58 03 mov es:[bx+_unitGame.HarvesterSpiceCapacity], 3it's reported to capacity of pre-placed Sandworms only, while those spawned have 0 capacity (don't ask me why or even where it's indicated), so:seg030:178C 26 FE 4F 58 dec es:[bx+_unitGame.HarvesterSpiceCapacity]seg030:1790seg030:1790 loc_26E80:seg030:1790 8B 46 08 mov ax, word ptr [bp+scriptData+2]seg030:1793 8B 56 06 mov dx, word ptr [bp+scriptData]seg030:1796 89 46 DC mov word ptr [bp+var_26+2], axseg030:1799 89 56 DA mov word ptr [bp+var_26], dxseg030:179C 83 6E DA 02 sub word ptr [bp+var_26], 2 ; Integer Subtractionseg030:17A0 C4 5E DA les bx, [bp+var_26] ; Load Full Pointer to ES:xxseg030:17A3 26 C7 07 0C 00 mov word ptr es:[bx], 0Chseg030:17A8 C4 1E 52 62 les bx, scriptUnitGamePtr ; Load Full Pointer to ES:xxseg030:17AC 26 80 7F 58 01 cmp es:[bx+_unitGame.HarvesterSpiceCapacity], 1 ; Compare Two Operandsseg030:17B1 7D 13 jge short loc_26EB6 ; Jump if Greater or Equal (SF=OF)seg030:17B3 B8 0A 00 mov ax, 0Ah ; dieseg030:17B6 50 push ax ; actionseg030:17B7 FF 36 54 62 push word ptr scriptUnitGamePtr+2seg030:17BB FF 36 52 62 push word ptr scriptUnitGamePtr ; unitGamePtrseg030:17BF 0E push csseg030:17C0 E8 42 E8 call near ptr unitActionstart ; Call Procedureseg030:17C3 83 C4 06 add sp, 6 ; Addseg030:17C6seg030:17C6 loc_26EB6: ; CODE XREF: scriptFunctionUnitAttack+362jseg030:17C6 A1 54 62 mov ax, word ptr scriptUnitGamePtr+2seg030:17C9 8B 16 52 62 mov dx, word ptr scriptUnitGamePtrseg030:17CD 89 46 FE mov word ptr [bp+unitGamePtr+2], axseg030:17D0 89 56 FC mov word ptr [bp+unitGamePtr], dxseg030:17D3 E9 8B 00 jmp loc_26F51 ; Jumpgame subtract 1 to the capacity and new value is compared to 1: if greater or equal ( >= ) then jump to "loc_26EB6" point, so no action "Die" is performed if value isn't less than 1 (=zero).But if capacity of spawned Sandworms start to 0, you just add 1 to capacity (instead of subtract) and swap jge to jl check so can obtain:seg030:178C 26 FE 47 58 inc es:[bx+_unitGame.HarvesterSpiceCapacity]setting number of eating:seg030:17AC 26 80 7F 58 06 cmp es:[bx+_unitGame.HarvesterSpiceCapacity], 6 ; Compare Two Operandsseg030:17B1 7C 13 jl short loc_26EB6 ; Jump if Lesset voilà le jeux sont fait! ;)Now if we want have the same for pre-placed Sandworms just reset to 0 start of capacity:seg015:053B 26 C6 47 58 00 mov es:[bx+_unitGame.HarvesterSpiceCapacity], 0About control ingame of Sandworms I advice to set these command buttons: Attack: the only command that can redirect Sandworm in a precise point choose by human playerHunt: it will attack anything (enemy or friendly) closer and preciousDie: to remove a worm in an area not requiredArea Guard: less aggressive, it will attack only enemy units approaching to own base 1 Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 6, 2012 Share Posted August 6, 2012 P.S. Thanks to Nyerguds, I found some asm reference very useful... so I studied and I did homework good! :P Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted August 9, 2012 Author Share Posted August 9, 2012 Cool! So basically you're aiming at spawnable Sandworms as a palace weapon? Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 9, 2012 Share Posted August 9, 2012 Yes I thought to change possibility of single Warrior into Sandworm. If object should be placed into rock, simply it doesn't appear in the map. Same thing if there are already TWO Sandworms in the map.Note that Fremen Palace-created units are set to Hunt, so also Sandworm do this.Now I'm looking for the other complex issue: how the Fremen AI works respect Atreides Human.I noticed that "shared visions" doesn't depend (or doesn't only depend) about "AtreFre" chunk of code, because if you change only on isFriendly? function 03 Fremen ID to another faction (e.g. 02 Ordos ID), "shared visions" swap into new faction and Atreides Human no more sees Fremen units, but can see new faction units.I tested a scenario with 03 Fremen ID changing in 02 Ordos ID on isFriendly? function and Ordos units in Hunt/Area Guard command attack Fremen units (now enemy of human) as well. So this can tell us that there isn't a specific chunk of code that change Fremen AI when isFriendly? is refered to their, but it works for all factions, admitted that second 01 Atreides ID checks are set.But the curiosity is that if after you change on "AtreFre" chunk of code, 03 Fremen ID to 02 Ordos ID, Ordos friendly units don't attack more Fremen units, simply do nothing (like when you control Fremen and Atreides AI do nothing). Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted August 9, 2012 Share Posted August 9, 2012 lol, so worms effectively 'harvest' units they eat, then? I still don't understand this function:...In the case where dx=1 (object is Atreides) and bx=1 (human is Atreides) function jump to "notFremen" point, that check if dx and houseHumanID are equal and then if bx is equal to houseHumanID.So if houseHumanID=1 and also dx=1 (object is Atreides) then jump to "objectIsHuman" point, so why return false? It should another check (for example if dx not equal bx) first to return false (non-friendly unit)That's probably just related to internal handling. All stuff from the human-played side is friendly to each other anyway, so I doubt it's normally handled in this function. Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 10, 2012 Share Posted August 10, 2012 The problem is:; if object is Fremen, and Human is Atreides, Ret Trueand; if object is not human, and house is not human, ret trueApparently it seems that all factions are checked and different non-Fremen&non-Atreides AI also needs to check if isFriendly to others AI in the map.But "return true" to funcion means set ax=1 ? So "return false" is ax=0 ?I'm looking for all times isFriendly? function is invoked but I saw that sometimes if code expects friendly faction check is made on jz, other times check is made on jnz...e.g. 1seg002:012C 9A 2A 36 36 28 call unitGameHouseIDGetseg002:0131 59 pop cxseg002:0132 59 pop cxseg002:0133 50 push ax ; objectHouseIDseg002:0134 9A 5B 0F 23 22 call isFriendly? ; Call Procedureseg002:0139 59 pop cxseg002:013A 59 pop cxseg002:013B 0B C0 or ax, ax ; Logical Inclusive ORseg002:013D 74 03 jz short loc_15142 ; Jump if Zero (ZF=1)seg002:013Fseg002:013F loc_1513F: ; Jumpseg002:013F E9 AC 01 jmp unitNextseg002:0142 ; ---------------------------------------------------------------------------seg002:0142seg002:0142 loc_15142: ; CODE XREF: sub_15008+135jseg002:0142 FF 76 F2 push word ptr [bp+unitGamePtr+2]seg002:0145 FF 76 F0 push word ptr [bp+unitGamePtr]seg002:0148 9A 32 06 ED 1D call unitGetTeamPtr ; Call Procedureseg002:014D 59 pop cxseg002:014E 59 pop cxe.g. 2seg023:0B8E 26 8A 47 08 mov al, es:[bx+_unitGame.houseID]seg023:0B92 98 cbw ; AL -> AX (with sign)seg023:0B93 50 push ax ; objectHouseIDseg023:0B94 90 nop ; No Operationseg023:0B95 0E push csseg023:0B96 E8 C2 03 call near ptr isFriendly? ; Call Procedureseg023:0B99 59 pop cxseg023:0B9A 59 pop cxseg023:0B9B 0B C0 or ax, ax ; Logical Inclusive ORseg023:0B9D 75 1C jnz short checkHouseID ; Jump if Not Zero (ZF=0)seg023:0B9Fseg023:0B9F loc_22DCF: ; unit not friendlyseg023:0B9F C4 5E 06 les bx, [bp+unitGamePtr]seg023:0BA2 26 80 7F 4F 08 cmp es:[bx+_unitGame.actionCurrent], 8 ; Compare Two Operandsseg023:0BA7 75 12 jnz short checkHouseID ; Jump if Not Zero (ZF=0)seg023:0BA9 B8 0B 00 mov ax, 0Bh ; Huntseg023:0BAC 50 push ax ; actionseg023:0BAD FF 76 08 push word ptr [bp+unitGamePtr+2]seg023:0BB0 FF 76 06 push word ptr [bp+unitGamePtr] ; unitGamePtrseg023:0BB3 9A 05 00 6F 25 call unitActionstart ; Call Procedureseg023:0BB8 83 C4 06 add sp, 6 ; Addseg023:0BBBseg023:0BBB checkHouseID: ; CODE XREF: sub_22B24+2A9jseg023:0BBB ; sub_22B24+2B3jseg023:0BBB C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg023:0BBE 26 8A 47 08 mov al, es:[bx+_unitGame.houseID]seg023:0BC2 98 cbw ; AL -> AX (with sign)seg023:0BC3 3B 06 2C 3A cmp ax, houseHumanID ; Compare Two Operandsseg023:0BC7 74 11 jz short AtreFre ; Jump if Zero (ZF=1)seg023:0BC9seg023:0BC9 loc_22DF9: ; Load Full Pointer to ES:xxseg023:0BC9 C4 5E 06 les bx, [bp+unitGamePtr]seg023:0BCC 26 80 7F 08 03 cmp es:[bx+_unitGame.houseID], 3 ; Fremenseg023:0BD1 75 11 jnz short loc_22E14 ; Jump if Not Zero (ZF=0)seg023:0BD3 83 3E 2C 3A 01 cmp houseHumanID, 1 ; Atreseg023:0BD8 75 0A jnz short loc_22E14 ; Jump if Not Zero (ZF=0)seg023:0BDAseg023:0BDA AtreFre: ; CODE XREF: sub_22B24+2D3jseg023:0BDA C4 5E 06 les bx, [bp+unitGamePtr] ; unit = fremen and human = atreseg023:0BDD 26 C6 47 09 FF mov es:[bx+_unitGame.houseRevealed], 0FFhseg023:0BE2 EB 0A jmp short Done ; Jump Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted August 10, 2012 Author Share Posted August 10, 2012 BTW regarding the sandworms I remember a curious situation that happened when I was testing something (I think it was v1.07) and needed to lose mission 9 (again, can't remember which House but I think it doesn't matter). So I started that mission, used the units I had to destroy the construction yard, and since you have to wait some time after the beginning of the mission (I think one minute or so) for the lose trigger to kick in, instead of doing nothing I sent all my units upwards to the enemy base. As you remember, there's a sandworm halfway to the Sardaukar base there. When one fo the units bumped into it, the sandworms naturally started eating up all of them that were on the sand. The curious thing here is that it did not disappear after eating three, I think it ate all of the units (six starting units plus some infantry from the destroyed conyard), and then the missions was over.Meaning that some of the gameplay mechanics were no longer in effect after either the destruction of the player's structures, or after the lose trigger conditions were met. Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 10, 2012 Share Posted August 10, 2012 Maybe Lose Flag was already set, but loop has a timeout of every 1 minute; so check to appear message box is made every 1 minute or whatever is set, but in that time some counters (like harvestCapacity used for Sandworms) are expired.I tried to set to Die a personal Sandworm in my test scenario (in starting pre-placed units info of .ini) and it is like Destruct command (do you remeber a my previous post?) apart the fact that it was freezed (no movement and no eating). Because of some events don't provide precisely all situations (so much so that Die is a command called from other events and doesn' t selectable by player or usable from the start as it would be Area Guard or Hunt). Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 10, 2012 Share Posted August 10, 2012 Finally I understand how manage allied AI faction respect human faction! :PIn isFriendly? function definition:seg023:0F78 loc_231A8: ; CODE XREF: isFriendly?:loc_231A4jseg023:0F78 83 FA 03 cmp dx, 3 ; DX = objectseg023:0F7B 74 05 jz short isFremen ; Jump if Zero (ZF=1)seg023:0F7D 83 FB 03 cmp bx, 3 ; BX = humanseg023:0F80seg023:0F80 loc_231B0: ; Jump if Not Zero (ZF=0)seg023:0F80 75 0E jnz short notFremenseg023:0F82seg023:0F82 isFremen: ; CODE XREF: isFriendly?+20jseg023:0F82 83 FA 01 cmp dx, 1 ; Compare Two Operandsseg023:0F85seg023:0F85 loc_231B5: ; Jump if Zero (ZF=1)seg023:0F85 74 05 jz short isAtreidesseg023:0F87seg023:0F87 loc_231B7: ; Compare Two Operandsseg023:0F87 83 FB 01 cmp bx, 1seg023:0F8Aseg023:0F8A loc_231BA: ; if object is Fremen, and Human is Atreides, Ret Trueseg023:0F8A 75 02 jnz short notAtreidesfirst two IDs should indicate allied AI faction, and second two IDs the human faction.So you can change this, e.g. if you want play Harkonnen as human with Sardaukar AI that is allied so:seg023:0F78 83 FA 04 cmp dx, 4 ; DX = objectseg023:0F7B 74 05 jz short isFremen ; Jump if Zero (ZF=1)seg023:0F7D 83 FB 04 cmp bx, 4 ; BX = humanand so:seg023:0F82 83 FA 00 cmp dx, 0 ; Compare Two Operandsseg023:0F85seg023:0F85 loc_231B5: ; Jump if Zero (ZF=1)seg023:0F85 74 05 jz short isAtreidesseg023:0F87seg023:0F87 loc_231B7: ; Compare Two Operandsseg023:0F87 83 FB 00 cmp bx, 0you can see that when you play Harkonnen as human, Sardaukar are your allied and AI works, but is hostile ONLY against Fremen!Why?Because of the first jnz check on "AtreFre" chunk of code:seg023:0BC9 loc_22DF9: ; Load Full Pointer to ES:xxseg023:0BC9 C4 5E 06 les bx, [bp+unitGamePtr]seg023:0BCC 26 80 7F 08 03 cmp es:[bx+_unitGame.houseID], 3 ; Fremenseg023:0BD1 75 11 jnz short loc_22E14 ; Jump if Not Zero (ZF=0)seg023:0BD3 83 3E 2C 3A 01 cmp houseHumanID, 1 ; Atreseg023:0BD8 75 0A jnz short loc_22E14 ; Jump if Not Zero (ZF=0)seg023:0BDAseg023:0BDA AtreFre: ; CODE XREF: sub_22B24+2D3jseg023:0BDA C4 5E 06 les bx, [bp+unitGamePtr] ; unit = fremen and human = atreseg023:0BDD 26 C6 47 09 FF mov es:[bx+_unitGame.houseRevealed], 0FFhseg023:0BE2 EB 0A jmp short Done ; Jumpseg023:0BE4 ; ---------------------------------------------------------------------------seg023:0BE4seg023:0BE4 loc_22E14: ; CODE XREF: sub_22B24+2DDjseg023:0BE4 ; sub_22B24+2E4jseg023:0BE4 C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg023:0BE7 8A 46 F6 mov al, byte ptr [bp+houseRevealed]seg023:0BEA 26 08 47 09 or es:[bx+_unitGame.houseRevealed], al ; Logical Inclusive ORto make allied AI hostile to ALL other AI factions just change jnz check to jz, specifing only human faction:seg023:0BCC 26 80 7F 08 00 cmp es:[bx+_unitGame.houseID], 0 ; Fremenseg023:0BD1 74 11 jz short loc_22E14 ; Jump if Zero (ZF=1)seg023:0BD3 83 3E 2C 3A 00 cmp houseHumanID, 0 ; AtreHowever I don't know anyway why only with human set to 01 Atreides and allied AI set to 03 Fremen that jnz check worked...But the important is that I reached my goal: play Fremen as human with Atreides allied AI working! ;)Enjoy! 1 Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted August 11, 2012 Author Share Posted August 11, 2012 Wow, this is incredibly cool! ^_^ Great find!This can make for some neat Fremen Palace weapon combinations. I was thinking alongside the lines of "reinforcements" as either Atreides Sonic Tanks or 'thopters ;) ( >2 'thopters can really do some damage to the enemy bases, even if protected by turrets, and if they're from an allied faction they don't count in the score if you lose 'em).BTW, I remember that the Fremen AI never builds anything if you're playing as Atreides, so a fully functional allied AI with a base is not possible. Have you addressed this issue yet? Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 11, 2012 Share Posted August 11, 2012 Yes I know about no production of allied AI faction, I think that it is located in "missionloadIni" function (overlays) but I'm not sure.We should ask to segra or trueBrain about this if possible, looking for createUnit function or something similar.Even if I think that giving a Base to allied AI faction will limit operations and resources of human faction, therefore playability and fun in my opinion.MrFibble, now you can use Atreides allied AI in your Fremen campaign of Dune2 eXtended project. ;)P.S. About Palace combo, I like set Fremen/Sandworm spawned to the same faction of human player, so you can control them, and capture enemy turrets, while they are busy to own Sandworms! :P Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 13, 2012 Share Posted August 13, 2012 Any news about Saboteur bugs?In particular:More info on the Saboteur detonation: it is also triggered if the tile of the destination point is concrete' date=' wall, mountain or mountain/rock border, sometimes also spice. Plain rock, sand and sand dunes seem not to cause this problem.On the other hand, the Saboteur sometimes does not detonate when ordered to move into an enemy unit: it just occupies the same cell as the unit it targeted, and can't be selected or given orders unless that unit moves away to another spot. In this stance, the Saboteur can be attacked by either enemy friendly fire, and its explosion will destroy the enemy unit in that cell. Saboteurs can also occupy the same cell as any of the player's own units without destroying them (unless the player's unit occupies a cell that causes the Saboteur to detonate, i.e. concrete).An important thing to note is that this terrain-triggered detonation of the Saboteur is the cause to the bug where the cell the Saboteur exploded can't be built upon or occupied by another unit anymore, and is still marked by a House-colored dot on the minimap. Moreover, the player's units can be ordered to attack this "trace" of the Saboteur, and if another Saboteur is already spawned from the Palace, the player's units will proceed to attack it (even if it is out of sight, in an unrevealed portion of the map).[/quote']Is there anything to fix that can be found into the .exe? Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted August 14, 2012 Author Share Posted August 14, 2012 Is there anything to fix that can be found into the .exe?Sometime ago I've picked some pieces of code in Segra's DB that he marked as related to Saboteur stuff, but haven't really done anything with them.Here's one bit that seems to have something to do with the Saboteur's movement on tiles:seg031:1749 tileCheck: ; CODE XREF: unitMoveToTile+C1jseg031:1749 FF 76 FE push [bp+mapPosition] ; mapPositionseg031:174C 9A 61 00 D0 42 call j_mapTileTypeGet ; Call Procedureseg031:1751 59 pop cxseg031:1752 89 46 F8 mov [bp+tileType], axseg031:1755 83 7E F8 0C cmp [bp+tileType], 0Ch ; buildingseg031:1759 75 05 jnz short loc_29AC0 ; Jump if Not Zero (ZF=0)seg031:175B C7 46 F8 0A 00 mov [bp+tileType], 0Ah ; concreteseg031:1760seg031:1760 loc_29AC0: ; CODE XREF: unitMoveToTile+D6jseg031:1760 8B 46 F8 mov ax, [bp+tileType]seg031:1763 BA 1C 00 mov dx, 1Chseg031:1766 F7 EA imul dx ; Signed Multiplyseg031:1768seg031:1768 loc_29AC8: ; Load Full Pointer to ES:xxseg031:1768 C4 5E FA les bx, [bp+unitDataPtr]seg031:176B 26 03 47 3C add ax, es:[bx+_unitData.MovementType] ; Addseg031:176F 8B D8 mov bx, axseg031:1771 8A 87 36 3A mov al, movementTileData[bx]seg031:1775 B4 00 mov ah, 0seg031:1777 8B F8 mov di, axseg031:1779 C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:177C 26 80 7F 02 06 cmp es:[bx+_unitGame.typeIndex], 6 ; Saboteurseg031:1781 75 09 jnz short loc_29AEC ; Jump if Not Zero (ZF=0)seg031:1783 83 7E F8 0B cmp [bp+tileType], 0Bh ; Compare Two Operandsseg031:1787 75 03 jnz short loc_29AEC ; Jump if Not Zero (ZF=0)seg031:1789 BF FF 00 mov di, 0FFhseg031:178Cseg031:178C loc_29AEC: ; CODE XREF: unitMoveToTile+FEjseg031:178C ; unitMoveToTile+104jseg031:178C C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:178F 26 81 67 04 7F FF and es:[bx+_unitGame.unitState], 0FF7Fh ; Logical ANDseg031:1795 8B 46 F8 mov ax, [bp+tileType]seg031:1798 BA 1C 00 mov dx, 1Chseg031:179B F7 EA imul dx ; Signed Multiplyseg031:179D 8B D8 mov bx, axseg031:179F 83 BF 3C 3A 00 cmp word ptr unk_46E5C[bx], 0 ; Compare Two Operandsseg031:17A4 74 09 jz short loc_29B0F ; Jump if Zero (ZF=1)seg031:17A6seg031:17A6 loc_29B06: ; Load Full Pointer to ES:xxseg031:17A6 C4 5E 06 les bx, [bp+unitGamePtr]seg031:17A9seg031:17A9 loc_29B09: ; Logical Inclusive ORseg031:17A9 26 81 4F 04 80 00 or es:[bx+_unitGame.unitState], _emcState_OnRock?seg031:17AFseg031:17AF loc_29B0F: ; CODE XREF: unitMoveToTile+121jseg031:17AF C4 5E FA les bx, [bp+unitDataPtr] ; Load Full Pointer to ES:xxseg031:17B2 26 8B 47 10 mov ax, es:[bx+_unitData.HitPoints]seg031:17B6 D1 F8 sar ax, 1 ; Shift Arithmetic Rightseg031:17B8 C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:17BBseg031:17BB loc_29B1B: ; Compare Two Operandsseg031:17BB 26 3B 47 0E cmp ax, es:[bx+_unitGame.HitPoints]seg031:17BF 7E 12 jle short loc_29B33 ; Jump if Less or Equal (ZF=1 | SF!=OF)seg031:17C1 C4 5E FA les bx, [bp+unitDataPtr] ; Load Full Pointer to ES:xxseg031:17C4seg031:17C4 loc_29B24: ; Compare Two Operandsseg031:17C4 26 83 7F 3C 04 cmp es:[bx+_unitData.MovementType], 4seg031:17C9 74 08 jz short loc_29B33 ; Jump if Zero (ZF=1)seg031:17CB 8B C7 mov ax, diseg031:17CD B1 02 mov cl, 2seg031:17CF D3 F8 sar ax, cl ; Shift Arithmetic Rightseg031:17D1 2B F8 sub di, ax ; Integer Subtractionseg031:17D3seg031:17D3 loc_29B33: ; CODE XREF: unitMoveToTile+13Cjseg031:17D3 ; unitMoveToTile+146jseg031:17D3 57 push di ; speed2seg031:17D4 FF 76 08 push word ptr [bp+unitGamePtr+2]seg031:17D7 FF 76 06 push word ptr [bp+unitGamePtr] ; unitGamePtrseg031:17DA 90 nop ; No Operationseg031:17DB 0E push csseg031:17DC E8 74 08 call near ptr unitMoveReset ; Call Procedureseg031:17DF 83 C4 06 add sp, 6 ; Addseg031:17E2 C4 5E FA les bx, [bp+unitDataPtr] ; Load Full Pointer to ES:xxseg031:17E5 26 83 7F 3C 05 cmp es:[bx+_unitData.MovementType], 5 ; Undergroundseg031:17EA 74 45 jz short setMoveDest ; Jump if Zero (ZF=1)seg031:17EC C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:17EFseg031:17EF loc_29B4F:seg031:17EF 26 8B 47 0C mov ax, es:[bx+_unitGame.mapTileY]seg031:17F3 26 8B 57 0A mov dx, es:[bx+_unitGame.mapTileX]seg031:17F7 89 46 F2 mov [bp+oldY], axseg031:17FA 89 56 F0 mov [bp+oldX], dxseg031:17FD C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:1800 8B 46 F6 mov ax, [bp+posY]seg031:1803 8B 56 F4 mov dx, [bp+posX]seg031:1806 26 89 47 0C mov es:[bx+_unitGame.mapTileY], axseg031:180A 26 89 57 0A mov es:[bx+_unitGame.mapTileX], dxseg031:180E FF 76 08 push word ptr [bp+unitGamePtr+2]seg031:1811 FF 76 06 push word ptr [bp+unitGamePtr] ; unitGamePtrseg031:1814 B8 01 00 mov ax, 1seg031:1817 50 push ax ; funcPtrIndexseg031:1818seg031:1818 loc_29B78: ; Call Procedureseg031:1818 9A 8E 00 D0 42 call j_sub_566CFseg031:181Dseg031:181D loc_29B7D: ; Addseg031:181D 83 C4 06 add sp, 6seg031:1820seg031:1820 loc_29B80: ; Load Full Pointer to ES:xxseg031:1820 C4 5E 06 les bx, [bp+unitGamePtr]seg031:1823seg031:1823 loc_29B83:seg031:1823 8B 46 F2 mov ax, [bp+oldY]seg031:1826 8B 56 F0 mov dx, [bp+oldX]seg031:1829 26 89 47 0C mov es:[bx+_unitGame.mapTileY], axseg031:182D 26 89 57 0A mov es:[bx+_unitGame.mapTileX], dxseg031:1831seg031:1831 setMoveDest: ; CODE XREF: unitMoveToTile+167jseg031:1831 C4 5E 06 les bx, [bp+unitGamePtr] ; Load Full Pointer to ES:xxseg031:1834 8B 46 F6 mov ax, [bp+posY]seg031:1837 8B 56 F4 mov dx, [bp+posX]seg031:183A 26 89 47 4B mov es:[bx+_unitGame.mapDestY], axseg031:183E 26 89 57 49 mov es:[bx+_unitGame.mapDestX], dxseg031:1842 B8 0A 00 mov ax, 0Ahseg031:1845 50 push ax ; checkHouseIDseg031:1846seg031:1846 loc_29BA6:seg031:1846 FF 76 08 push word ptr [bp+unitGamePtr+2]seg031:1849seg031:1849 loc_29BA9: ; unitGamePtrseg031:1849 FF 76 06 push word ptr [bp+unitGamePtr]seg031:184C 90 nop ; No Operationseg031:184D 0E push csseg031:184E E8 F5 00 call near ptr sub_29CA6 ; Call Procedureseg031:1851 83 C4 06 add sp, 6 ; Addseg031:1854 B8 01 00 mov ax, 1seg031:1857seg031:1857 loc_29BB7: ; Jumpseg031:1857 E9 3B FE jmp loc_299F5seg031:185A ; ---------------------------------------------------------------------------seg031:185Aseg031:185A loc_29BBA: ; CODE XREF: unitMoveToTile:loc_299F5jseg031:185A 5F pop diseg031:185B 5E pop siseg031:185C 8B E5 mov sp, bpseg031:185Eseg031:185E loc_29BBE:seg031:185E 5D pop bpseg031:185F CB retf ; Return Far from Procedureseg031:185F unitMoveToTile endp Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 16, 2012 Share Posted August 16, 2012 Yes I'm looking for research "saboteur" key.I'll try to change some code to remove Saboteur Movement Bug. I also noticed that Sabouter explodes (even on sand!) if last movement tile to arrive to destination is a diagonal movement... this is really bizarre! MrFibble, about to fix decay of the structures, I send you a private message for this topic:http://forum.opendun...ic.php?f=9&t=25In particular can you explain me which of three steps do you change to fix only structures?Thanks Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted August 17, 2012 Author Share Posted August 17, 2012 IIRC the codeC4 5E 06 ; les bx, [bp+06]26 81 4F 04 00 04 ; or es:[bx+4],0400C4 5E FC ; les bx, [bp-04]appears only once in the EXE. I was referring to the line26 81 4F 04 00 04 ; or es:[bx+4],0400which indeed appears thrice (TrueBrain explains why in this post).So you just have to search for the codeC4 5E 06 26 81 4F 04 00 04 C4 5E FCand repalce it withC4 5E 06 90 90 90 90 90 90 C4 5E FCI think the code is the same across all known versions of DUNE2.EXE. Quote Link to comment Share on other sites More sharing options...
drnovice Posted August 17, 2012 Share Posted August 17, 2012 Alright! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.