Problem with Object.MergeintoBackground in Direct3D

Started by Arlann, Wed 13/04/2016 16:03:48

Previous topic - Next topic

Arlann

Hello,

In my game in development, I've noticed that the function Object.MergeintoBackground,
don't works when the engine run in Direct3D but works fine in DirectRaw.

But in a fresh testing project with the same game settings i don't have this problem with my code.
So i'm looking for the problem in my room structure.

My project use the 3.3.4 AGS version in a 800*600 resolution with 16bit colors.
I call this function in my main room, a scrolling one in 1600*1200.
This room contains 36 objects ID and some of them are animate.
Is it too big for Direct3D ? But it works well in DirectRaw.

A similar bug was fixed in the version 3.2.1.
* Fixed Object.MergeIntoBackground not working with Direct3D driver
Can it be a link with my problem...?

Thanks for your help !

Khris

Hi Arlann, please state what exactly you mean by "doesn't work".
Do you get an error message? Does the game do anything at all when you try to merge?

Arlann

Hi Khris,

Nothing takes place.
The object remains visible in the same place, as if the function is ignored.

Arlann

I specify that I call this function to take advantage of a more precise walkbehind zone for the perspective of this object.
When it works (in directRaw) , the object merge into the background and the character can walk partially above thanks to the walk behind.
When it don't, the object remains visible above the character.

Khris

A quick fix is to manually do what the Merge command does.
Code: ags
  Object *o = oBox;
  DrawingSurface *ds = Room.GetDrawingSurfaceForBackground();
  ds.drawImage(o.X, o.Y - Game.SpriteHeight[o.Graphic], o.Graphic);
  ds.Release();
  o.Visible = false;

If the room is visited multiple times, you'd have to redo this in room_Load, depending on a variable.

Crimson Wizard

#5
Quote from: Arlann on Thu 14/04/2016 06:49:27
I specify that I call this function to take advantage of a more precise walkbehind zone for the perspective of this object.
When it works (in directRaw) , the object merge into the background and the character can walk partially above thanks to the walk behind.
When it don't, the object remains visible above the character.

Arlann, I think you may try achieving same effect by changing Object's Baseline property.
http://www.adventuregamestudio.co.uk/wiki/Object_functions_and_properties#Object.Baseline

Instead of calling Object.MergeintoBackground, decrease Object.Baseline by 1 or more. This will make game "think" that object is positioned higher in the room.

Regarding the "Merge", I will investigate this issue.

Arlann

Quote from: Crimson WizardArlann, I think you may try achieving same effect by changing Object's Baseline property.

Because i'm using an isometric perspective sprite of a shelter, the baseline property doesn't make the effect i need when my character go inside. The walk-behind zone allows me to draw diagonals.


Quote from: KhrisA quick fix is to manually do what the Merge command does.

By making test with your code I am now certain that the problem does not come from the function object. MergeIntoBackground

Sorry for the confusion, but I have just identified my real problem.

I use the sprite of an object to merge in a walk behind zone,
but I had forgotten another identical object at the same place as I used to manage the interactions.
To keep this second object clickable after calling the MergeIntoBackground, I had activated his property ignoreWalkBehind...

And as says it the manual :
QuoteNOTE : enabling this property does not currently work properly when using the Direct3D driver.

Very bad idea, because i can use the hotspot solution instead..

I'm so confused for my mistake, thanks a lot for your help.

SMF spam blocked by CleanTalk