User Tag List

Results 1 to 5 of 5

Thread: [std.zh]CenterX and CenterY functions disrespect offset values

  1. #1
    Gel
    Join Date
    Dec 2012
    Posts
    18
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    480
    Level
    7
    vBActivity - Bars
    Lv. Percent
    90%

    Not A Bug [std.zh]CenterX and CenterY functions disrespect offset values

    As title says CenterX and CenterY functions from std.zh outright ignore HitXOffset and HitYOffset variables. I use those offsets as workaround for edge-of-the-screen limitation for lweapons in stdWeapons.zh. And CenterX and CenterY functions return wrong values, which can lead to bugs and glitches in scripted weapons. Exists in ZC 2.5.2

  2. #2
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.7%
    Are you calling CenterX/Y with those offsets in the function call, as a calculation?

    Code:
    int x = x+ HitXOffset;
    CenterX(x);
    ...or did you anticipate that the various offsets would be auto-tabulated?

    ...or, most likely, do you want the return value adjusted by HitX/YOffset?

    Pretty much, do you need:
    CenterX(x+HitXOffset)
    or
    CenterX(x) + HitXOffset

    I could make it do either, as CenterX(lweapon l) with overloads for eweapon, item, and item; as well as CenterLinkX(bool offsets)

    The Center* functions are one of the things going into locale too. It's annoying to type the 're' backwards, and can lead to invisible script errors.

  3. #3
    Gel
    Join Date
    Dec 2012
    Posts
    18
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    480
    Level
    7
    vBActivity - Bars
    Lv. Percent
    90%
    ...or, most likely, do you want the return value adjusted by HitX/YOffset?

    Pretty much, do you need:
    CenterX(x+HitXOffset)
    or
    CenterX(x) + HitXOffset

    I could make it do either, as CenterX(lweapon l) with overloads for eweapon, item, and item; as well as CenterLinkX(bool offsets)

    The Center* functions are one of the things going into locale too. It's annoying to type the 're' backwards, and can lead to invisible script errors.[/QUOTE]

    Pretty much like this. Thanks for advice. Now the thread should be marked as "Not a bug".

  4. #4
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.7%
    Quote Originally Posted by Alucard View Post
    Pretty much like this. Thanks for advice. Now the thread should be marked as "Not a bug".
    Which way would you find best?

    CenterX(x+HitXOffset)
    or
    CenterX(x) + HitXOffset

    The value would be different, and I'm thinking that returning CenterX(x) + HitXOffset is what is best, but may not be what you want. I hope that it is. I'll give you both versions, and you can tell me which one works as you want.

    Code:
    int CenterX(lweapon anLWeapon, bool trueoffset) { 
    	if ( trueoffset ) return anLWeapon->X+8*anLWeapon->TileWidth + anLWeapon->HitXOffset;
    	else return CenterX(anLWeapon);
    }
    int CenterY(lweapon anLWeapon, bool trueoffset) {
    	if ( trueoffset ) return anLWeapon->Y+8*anLWeapon->TileHeight + anLWeapon->HitYOffset;
    	else return CenterX(anLWeapon);
    }
    I only now realised that both of these returns are identical, as I forgot to remove the + Hit*Offset in the else statement. :p

    Fixed.

    Tell me if this works for you, or if you need HitXOffset to be adjusted by TileWidth, and so forth.

  5. #5
    Gel
    Join Date
    Dec 2012
    Posts
    18
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    480
    Level
    7
    vBActivity - Bars
    Lv. Percent
    90%
    Quote Originally Posted by ZoriaRPG View Post
    Which way would you find best?

    CenterX(x+HitXOffset)
    or
    CenterX(x) + HitXOffset

    The value would be different, and I'm thinking that returning CenterX(x) + HitXOffset is what is best, but may not be what you want. I hope that it is. I'll give you both versions, and you can tell me which one works as you want.

    Code:
    int CenterX(lweapon anLWeapon, bool trueoffset) { 
    	if ( trueoffset ) return anLWeapon->X+8*anLWeapon->TileWidth + anLWeapon->HitXOffset;
    	else return CenterX(anLWeapon) + anLWeapon->HitXOffset;
    }
    int CenterY(lweapon anLWeapon, bool trueoffset) {
    	if ( trueoffset ) return anLWeapon->Y+8*anLWeapon->TileHeight + anLWeapon->HitYOffset;
    	else return CenterX(anLWeapon) + anLWeapon->HitYOffset;
    }
    CenterX(x) + HitXOffset

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social