EUD Tutorial: The Rock Sprite, and removing unwanted sprites & images - Ar3sgice/eudtools GitHub Wiki

The Rock Sprite is a kind of iscript bug. Without EUD, usually it only happens when using SetDoodadState on non-doodad units.

How to solve the rock sprite problem

If we have access to iscript.bin editing, the ideal way is to fix the iscript that goes wrong.

However, since in EUD we cannot edit iscript, what we have to do is

MemoryAddr(0x0066f57c, Set To, 276);

Set Image 589 (The ashworld doodad) iscript index to 276 (ShieldsOverlay).

This way it plays an nonexistent frame (removes graphic in SC:R) and quickly removes the sprite.

For real doodads, since they are preplaced before EUD is set, their iscripts won't be modified and we can see them correctly.

How to remove other sprites and images

For sprites (sprol & sprul), you can change their Image Index to 589 after doing above. Then they won't bother you anymore.

For images (imgol * imgul), you can change their iscript index to 386 (AcidSpores_6_9_Overlay).

The script plays frames 204 to 255 (obviously, no other image has that kind of frame count) and essentially removes the graphic. The only drawback is that it loops back (not suitable for sprites). If we use it on image overlays, they will be removed when the main image is removed.

Why the Rock Sprite happens

The Rock Sprite appears because Starcraft tries to run iscript offset 0. In many occasions, instead of treating 0's in iscript headers as "No Animation", or outright crashing, Starcraft tries to play nonexistent script anyways.

Iscript Zero decompiles as this:

IscriptZeroInit:
    __e6
    __97
    playfram        0x00    # frame set 0
    ... (repeated 455 times) ...
    playfram        0x00    # frame set 0
    playfram        0xffff  # frame set 3855
    playfram        0x5300  # frame set 1249
    __43            
    __50        
    __45        
    sprol           0 0 132 # AshWorldDoodadRock1 (thingy\tileset\AshWorld\rock01.grp)
    wait            32
    __79        
    turncwise       121
    turncwise       121
    playfram        0x2000  # frame set 481
    __79        
    turncwise       121
    turncwise       121
    turncwise       121
    turncwise       121
    playfram        0x8400  # frame set 1987
    wait            32
    __79        
    playfram        0x00    # frame set 0
    playfram        0x7920  # frame set 1824
Engines_GlowHeaderInit:
    engset          0
    wait            1
    engset          1
    wait            1
    goto            Engines_GlowHeaderInit

The "sprol 0 0 132" command places the rock sprite 132 pixels above the current sprite.

Prior to Remastered, it crashes Starcraft for most cases since they play engset but are not engines. In Remastered this only cause the graphics to be removed, plus creating the Rock Sprite.