Weapon Sprites Offsets

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
neoworm
Posts: 1751
Joined: Fri Sep 23, 2005 9:17 am
Location: Czech Republic

Weapon Sprites Offsets

Post by neoworm »

How the... does the weapon sprite offset work?

There are two ways of offseting the sprites.
First is this:

Code: Select all

CMCE B 2 Offset(60, 20)
And second this:

Code: Select all

CMCE B 2 A_WeaponOffset(60, 20)
But I don't get few things about this. I don't know when the offsets are reset outside of A_WeaponReady calls, when offsets are added and when they are absolute.
From CWeapMace from wiki:

Code: Select all

  Fire:
    CMCE B 2 Offset(60, 20) // this offsets the frame from what is specified in Slade
    CMCE B 1 Offset(30, 33) // this adds this offset to previous one or resets and applies new offset?
    CMCE B 2 Offset(8, 45)
    CMCE C 1 Offset(8, 45) // Sprite changed, does it inherit any offsets from previous frame?
    CMCE D 1 Offset(8, 45) // Seems like offseting multiple frames by the same ammout is useless and could be done by changing sprite offsets in Slade, isn't it?
    CMCE E 1 Offset(8, 45)
    CMCE E 1 Offset(-11, 58) A_CMaceAttack
    CMCE F 1 Offset(8, 45)
    CMCE F 2 Offset(-8, 74)
    CMCE F 1 Offset(-20, 96)
    CMCE F 8 Offset(-33, 160)
    CMCE A 2 Offset(8, 75) A_ReFire // all these frames do not move on X axis, but shoudn't they?
    CMCE A 1 Offset(8, 65)
    CMCE A 2 Offset(8, 60)
    CMCE A 1 Offset(8, 55)
    CMCE A 2 Offset(8, 50)
    CMCE A 1 Offset(8, 45)
    Goto Ready
And when using the A_WeaponOffset with WOF_INTERPOLATE parameter, how does the interpolation is supossed to work?
From default defined in Slade to the one defined in function, or from some previous offset inherited from previous frame?
Also is there a way to reset offset defined by A_WeaponOffset function?

I am getting seriously confused and it may be my own fault. But I would appreciate some help.

Return to “Scripting”