Problem with scroll.camera=id in recent bennu releases

Started by handsource-dyko, December 20, 2012, 06:01:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

handsource-dyko

I think I found a problem with scroll.camera=id in recent versions of bennu.
In the current development version  V1.8 of malvado I use bennu revision Jul-9-2012, and in the editor (mapedit) the handcursor no longer scrolls the screen. This process affects the scroll (ctype=c_scroll) and it's id is assigned to the scroll camera. I get the same behaviour with the very latest bennu release (nov-09-2012).

When I test it with an older bennu version from 2011 that I used with malvado V1.7 everything is fine. My code hasn't changed, I tested the same, dev version with three mentioned versions.

Strangely, in the game, I don't get this behaviour, execept with the latest version. Therefore I put my development version on dropbox wich includes everything including the three different bennu versions and two test compilation batch files, me-test.bat and mv-test.bat.

with me-test.bat you can compile mapedit and select the desired bennu version. mv-test.bat is for the game itself, and also has the same three version choices. I wonder if the behaviour of the scroll camera has changed or if I have spotted a bug...... ::)



https://www.dropbox.com/s/jy31v2xq2h45f8r/malvado2012-V.1.8.zip

panreyes


handsource-dyko

I just tried, it doesn't work. :-\ Would have been a nice fix though.

handsource-dyko

The strange thing is, that when I test the scroll.camera with a simple test program, everything is fine. But, the two most recent releases (both from november 2012) create a window as big as the monitor's resolution when no screenmode is specified. It just puzzles me why it has always worked fine with older versions, it just seems to be broken in newer versions. (without making any changes in my scrolling code). The sprite moves out of the scroll, normally the scroll should follow the sprite (because the sprite controls it) but the scroll's coordinates don't seem to update.  ::) :(

handsource-dyko

Back to the game, I noticed that when I set the scale_mode to NONE, everything's fine. But when I use NORMAL2X or any of the other scale modes, the camera does not track the player sprite. Only when there is no scale mode active, it works right.

In the editor, I don't use any scalemodes, but I still get this wrong behaviour. It doens't seem to matter if I change the resolution. I am mystified. It used to work fine for years and now it's suddenly broken. I know there are some changes lately with set_mode and the default resolution of the window, but I think a geniune bug has slipped in here.

panreyes


Hello! +1 here.


There's no problem when using scale_resolution, but with graph_mode=mode_2xscale everything goes nuts.


Try this little code:

Begin
graph_mode=mode_2xscale;
set_mode(640,480,32);
frame;
graph=new_map(640,480,32);
drawing_map(0,graph);
drawing_color(rgba(255,0,0,255));
draw_box(0,0,640,480);
put_screen(0,graph);
while(!key(_esc)) frame; end
End

handsource-dyko

The scale resolution solves the issue with the game as long as there's no scale mode filter beeing used. But with the editor, it remains a problem. It doesn't work at all. The screen doesn't scroll.

The editor also has a mode when you press "scroll lock" to manually scroll the screen by changing the internal x0, y0 coordinates of the scroll. The scroll doesn't move any more, and the value doesn't update, while it normally should. When I compile the editor with an old bennu version from 2011, the internal scroll coordinates update just fine and the screen scrolls. But with a more recent version, it doesn't happen.

handsource-dyko

#7
I've found the problem! :) It was caused by the arguments of the define region function for the scroll. In the editor, I use graphic_info to get the dimensions for the scroll window from level's foreground map. Like this:


// Initializes scroll
start_scroll(0,stage.fpgfile,stage.fg,stage.bg,1,4); //LOCK=4
say("created scroll");
   
// Defines scroll region after which it will move
//scroll.region1=define_region(1,0,30,graphic_info(stage.fpgfile,stage.fg,G_WIDTH),graphic_info(stage.fpgfile,stage.fg,G_HEIGHT));
     


This worked fine in older bennu versions from 2011 and older, but in the later ones it causes an issue.
I stumbled on this by simply trying:


scroll.region1=define_region(1,0,30,1024,300);


instead. Now this works fine, so I guess I'll have to create a workaround, or maybe the graphic_info function has been altered?

Update:

I found out that graphic_info returns 3840 for the witdth and 300 for the height. These values are correct for bitmap size, but the region
width may not be bigger then 1024 (screen resolution) or else it goes bezerk. This didn't happen in older versions, so be carefull.
There is a treshold for the value, the bigger you make it, the more the sprite gets out of focus, untill it can actually go out of the visible screen
area and take a long time to scroll the scroll.

Turns out, that this wasn't a bug, but an obscure coincidence causing seemingly erratic behaviour.