Jump to content
Sign in to follow this  
n4gix

Odd Behavior of Sprite Element...

Recommended Posts

Has anyone any idea why a perfectly normal SPRITE in this ADI will work perfectly on the 2d panel, but shift RIGHT so badly when used in the VC?The background, sprite and sprite's mask are all 300x300 pixels.http://img116.imageshack.us/img116/2171/c400adi2dvcow4.jpgThere's nothing wierd in the code that could account for this oddity that I can find:// -----------------------------------------------------------------FLOAT64 FSAPI stbyadipitch_cb( PELEMENT_SPRITE pelement ){ SINT16 val_y = (SINT16)stbyadi_pitch.var_value.n; if (panel_lights == 1) { LUMINOUS_IMAGE(pelement) ; } else { DELUMINOUS_IMAGE(pelement) ; } if (val_y < -25.0) val_y = -25.0; if (val_y > 25.0) val_y = 25.0; return val_y;}MAKE_SPRITE( stbyadipitch_scale, ADI_HORIZSCALE, stbyadi_list8, stbyadi_fail2, IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE | IMAGE_BILINEAR_COLOR, 0, 0, 0, 150, 150, 1, 1, MODULE_VAR_NONE, NULL, 0.000000, ATTITUDE_INDICATOR_PITCH_DEGREES, stbyadipitch_cb, 2.000000, ATTITUDE_INDICATOR_BANK_DEGREES, NULL, -1.000000 )PELEMENT_HEADER stbyadi_list9[] ={ &stbyadipitch_scale.header, NULL};


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

I have had problems with the IMAGE_USE_BILINEAR_COLOR, so you might try dumping that flag.I assume it is in your model, so not a texture issue in the model.I saw a post recently on the FSPS forum too, but don't think there was a solution posted in that article.

Share this post


Link to post
Share on other sites

Thanks, I'll give it a try. Other ADIs I've programmed didn't use this flag, and they work fine. You may have just found my problem... off to test quickly, since my fingers are in the code right now anyway... ;)EDIT: Nope... no change in behavior. I tried the gauge in the C172's VC and just the opposite happens: the 'oval horizon element' shifts to the LEFT instead of the right......this is bizzare. :(


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Ok, only other suggestion I have is that in the SDK it said MASKs must be 256. Now I have created other sizes, but perhaps the reason has to do with the VC.I changed my MASKS to 256, and if you like, I'll send you a .gau that has my attitude indicator and you can try it in your VC.Patrick

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

>//------------------------------------------------------------->FLOAT64 FSAPI stbyadipitch_cb( PELEMENT_SPRITE pelement )>{> SINT16 val_y = (SINT16)stbyadi_pitch.var_value.n;> if (panel_lights == 1)> {> LUMINOUS_IMAGE(pelement) ;> }> else> {> DELUMINOUS_IMAGE(pelement) ;> }> if (val_y < -25.0)> val_y = -25.0;> if (val_y > 25.0)> val_y = 25.0;>> return val_y;>}>>MAKE_SPRITE( stbyadipitch_scale,> ADI_HORIZSCALE,> stbyadi_list8,> stbyadi_fail2,> IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE |>IMAGE_BILINEAR_COLOR,> 0,> 0, 0,> 150, 150,> 1, 1,> MODULE_VAR_NONE, NULL, 0.000000,> ATTITUDE_INDICATOR_PITCH_DEGREES,>stbyadipitch_cb, 2.000000,> ATTITUDE_INDICATOR_BANK_DEGREES, NULL,>-1.000000 )>>PELEMENT_HEADER stbyadi_list9[] =>{> &stbyadipitch_scale.header,> NULL>};This is my pitch section:MAKE_SPRITE( attitude_pitch, // Name BMP_GAUGE_ATTITUDE_PITCH, // Res_ID attitude_horiz_list, // Next list attitude_fail, // Failure record IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE | IMAGE_USE_LUMINOUS, 0, // ASI flags 0, 0, // Mask x,y on BG 128, 128, // Sprite x,y center on bg 1.0, 1.0, // Sprite scaling factors // X Source_var, callback, scale MODULE_VAR_NONE, NULL, 0, // Y Source_var, callback, scale ATTITUDE_INDICATOR_PITCH_DEGREES, Attitude_Pitch_cb, 1, // O Source_var, callback, scale ATTITUDE_INDICATOR_BANK_DEGREES, Attitude_Bank_cb, -1)but I haven't put it in a VC just yet to test it there.Is it due to using a SINT16 that gets cast to a FLOAT64 (unsigned double)?Patrick

Share this post


Link to post
Share on other sites

Well, I've tried using this already, to no avail:FLOAT64 val_y = (FLOAT64)stbyadi_pitch.var_value.n;I'm out of ideas... :-hang


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

>Ok, only other suggestion I have is that in the SDK it said>MASKs must be 256. Now I have created other sizes, but>perhaps the reason has to do with the VC.>>I changed my MASKS to 256, and if you like, I'll send you a>.gau that has my attitude indicator and you can try it in your>VC.Yeah, I've read that in the SDK many times about how masks "must" be 256^2, but I've used all manner of sizes that weren't 256^2 and they worked just fine.I know it's not a model or VC poly issue, because 12 different ADIs I've tried work just great! BTW, the sprite mask in the Cess182rg.gau is 108x99!!! So much for following their OWN bloody SDK, eh? ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

> SINT16 val_y = (SINT16)stbyadi_pitch.var_value.n;Try this:FLOAT64 FSAPI stbyadipitch_cb(PELEMENT_SPRITE pelement){ FLOAT64 val_y = pelement->var_value.n;Patrick

Share this post


Link to post
Share on other sites

>> SINT16 val_y = (SINT16)stbyadi_pitch.var_value.n;>>Try this:>>FLOAT64 FSAPI stbyadipitch_cb(PELEMENT_SPRITE pelement)>{> FLOAT64 val_y = pelement->var_value.n;For a SPRITE that would be:FLOAT64 val_y = pelement->source_var_y.var_value.n;However, it makes absolutely no difference at all...Still investigating! Thanks for the sample .gau file. It works fine, as expected.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

I finally figured out the problem...Because of the size of the gauge, the VC entry had to be -25 pixels for the X origin, which normally isn't a problem, but......it 'pushes' the SPRITE element to the right by 25 pixels!Solution is simple. Since I've eliminated the bezel, I need only trim all gauge elements by 25 pix on each side and recalculate the center points for rotation.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...