Welcome, Guest. Please Login or Register.
February 08, 2010, 14:05:46
Home | FAQ | Member Map | Search | Login | Register | FED2k
Pages: [1]
Print
Author Topic: [Dune 2] Super Dune 2: Conquest Map Vanishing Houses Fix  (Read 976 times)
segra
Desert Warrior

Australia
Offline Offline

Posts: 150



View Profile
« on: March 24, 2009, 17:13:45 »

Hey all,

I have managed to locate the issue on the conquest map, and it turned out to be fairly simple in the end.
so far ive tested with

SuperDune2 Classic  (1.07)
SuperDune2 Original (1.00)

I had to replace a chunk of code, with a looping chunk instead (asm dumps of both are below)

fire up your hex editor... search the exe for
5633C050900EE87000595956B8010050900EE86400595956B8020050900EE85800595956B8040050900EE84C005959

replace with

5031C05650900EE86F005859403D06007CF15890909090909090909090909090909090909090909090909090909090


Basically, a call to the conquest map function is made from the main game loop,
the mission number of the last completed mission is passed into this function

this number is passed into a load "previous map" function, which loops thro each GROUPXX section and draws it to the screen

The problem, resulted due to the the code below... the function "drawMapPiece" is called with the GROUP number, and the TEAM number
for some reason in the original, rather than looping and passing 0 - 5 into this function, the game calls one after the other
for team 0, 1, 2, 4  (value is put in AX).

I simply replaced this chunk of code with a simple loop which calls the function for all teams.


asm dump of modified area:

Original:
          drawLoop:                               ; CODE XREF: drawGroupMapPieces+40j
ovr204:0B7F 56                             push    si              ; int
ovr204:0B80 33 C0                          xor     ax, ax
ovr204:0B82 50                             push    ax              ; teamID
ovr204:0B83 90                             nop
ovr204:0B84 0E                             push    cs
ovr204:0B85 E8 70 00                       call    near ptr drawMapPiece
ovr204:0B88 59                             pop     cx
ovr204:0B89 59                             pop     cx
ovr204:0B8A 56                             push    si              ; int
ovr204:0B8B B8 01 00                       mov     ax, 1
ovr204:0B8E 50                             push    ax              ; teamID
ovr204:0B8F 90                             nop
ovr204:0B90 0E                             push    cs
ovr204:0B91 E8 64 00                       call    near ptr drawMapPiece
ovr204:0B94 59                             pop     cx
ovr204:0B95 59                             pop     cx
ovr204:0B96 56                             push    si              ; int
ovr204:0B97 B8 02 00                       mov     ax, 2
ovr204:0B9A 50                             push    ax              ; teamID
ovr204:0B9B 90                             nop
ovr204:0B9C 0E                             push    cs
ovr204:0B9D E8 58 00                       call    near ptr drawMapPiece
ovr204:0BA0 59                             pop     cx
ovr204:0BA1 59                             pop     cx
ovr204:0BA2 56                             push    si              ; int
ovr204:0BA3 B8 04 00                       mov     ax, 4
ovr204:0BA6 50                             push    ax              ; teamID
ovr204:0BA7 90                             nop
ovr204:0BA8 0E                             push    cs
ovr204:0BA9 E8 4C 00                       call    near ptr drawMapPiece
ovr204:0BAC 59                             pop     cx
ovr204:0BAD 59                             pop     cx
ovr204:0BAE 46                             inc     si



Modified:

ovr204:0B7F             loc_5DC2F:                              ; CODE XREF: sub_5DC22+40j
ovr204:0B7F 50                          push    ax
ovr204:0B80 31 C0                       xor     ax, ax
ovr204:0B82
ovr204:0B82             loop:                                   ; CODE XREF: sub_5DC22+1Dj
ovr204:0B82 56                          push    si
ovr204:0B83 50                          push    ax              ; teamid
ovr204:0B84 90                          nop
ovr204:0B85 0E                          push    cs
ovr204:0B86 E8 6F 00                    call    near ptr drawMapPiece
ovr204:0B89 58                          pop     ax
ovr204:0B8A 59                          pop     cx
ovr204:0B8B 40                          inc     ax
ovr204:0B8C 3D 06 00                    cmp     ax, 6
ovr204:0B8F 7C F1                       jl      short loop
ovr204:0B91 58                          pop     ax
ovr204:0B92 90                          nop
ovr204:0B93 90                          nop
ovr204:0B94 90                          nop
ovr204:0B95 90                          nop
ovr204:0B96 90                          nop
ovr204:0B97 90                          nop
ovr204:0B98 90                          nop
ovr204:0B99 90                          nop
ovr204:0B9A 90                          nop
ovr204:0B9B 90                          nop
ovr204:0B9C 90                          nop
ovr204:0B9D 90                          nop
ovr204:0B9E 90                          nop
ovr204:0B9F 90                          nop
ovr204:0BA0 90                          nop
ovr204:0BA1 90                          nop
ovr204:0BA2 90                          nop
ovr204:0BA3 90                          nop
ovr204:0BA4 90                          nop
ovr204:0BA5 90                          nop
ovr204:0BA6 90                          nop
ovr204:0BA7 90                          nop
ovr204:0BA8 90                          nop
ovr204:0BA9 90                          nop
ovr204:0BAA 90                          nop
ovr204:0BAB 90                          nop
ovr204:0BAC 90                          nop
ovr204:0BAD 90                          nop
ovr204:0BAE 46                          inc     si


Have fun!
« Last Edit: January 01, 2010, 07:57:39 by MrFlibble » Logged
Nyerguds
Swordmaster

Belgium
Offline Offline

Posts: 792



View Profile WWW
« Reply #1 on: March 25, 2009, 01:57:26 »

Man, you're awesome Smiley
Logged

Windwalker
Sandwalker

Offline Offline

Posts: 54


View Profile
« Reply #2 on: March 25, 2009, 06:52:49 »

Yeah you are really deep into it. I almost suspect you are one of the programmers Cheesy
Logged
segra
Desert Warrior

Australia
Offline Offline

Posts: 150



View Profile
« Reply #3 on: March 25, 2009, 15:03:05 »

lol, if i was one of the programmers... i would of been about 7 years old during development Smiley

Logged
MrFlibble
Moderator
Naib

Russian Federation
Offline Offline

Posts: 2478



View Profile
« Reply #4 on: March 27, 2009, 04:20:21 »

Great! Once again, thanks a lot segra! Smiley
Logged

Nyerguds
Swordmaster

Belgium
Offline Offline

Posts: 792



View Profile WWW
« Reply #5 on: March 27, 2009, 10:39:33 »

I doubt there's any sense keeping that ax stored in the stack though, seeing as it gets seriously modified during the original process anyway... no way the code after that is going to assume it still has a value from before this operation
Logged

MrFlibble
Moderator
Naib

Russian Federation
Offline Offline

Posts: 2478



View Profile
« Reply #6 on: March 27, 2009, 13:38:14 »

no way the code after that is going to assume it still has a value from before this operation
Uh, is it going to affect the game in a negative way? 'Cause I don't have time for serious test runs.
Logged

segra
Desert Warrior

Australia
Offline Offline

Posts: 150



View Profile
« Reply #7 on: March 27, 2009, 18:42:15 »

yeah, i just did it anyway.. not really sure why Smiley
Logged
Nyerguds
Swordmaster

Belgium
Offline Offline

Posts: 792



View Profile WWW
« Reply #8 on: March 28, 2009, 11:21:41 »

lol no MrFlibble. He stores the original value of 'ax' so that it's restored after the entire operation. But as I said, there's no way the game wil still need that value anyway. It's just that he could've spared 2 bytes Tongue

Most probably, the code behind this piece will start with assigning a new value to 'ax' anyway Grin
« Last Edit: April 01, 2009, 23:49:54 by Nyerguds » Logged

Pages: [1]
Print
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.263 seconds with 21 queries.