Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

do_primitives bug.

14 replies · 3,333 views · Started 16 April 2010

I don't know when it started happening (last I checked was with 1204) but do_primitives gets called twice now with with valid data, and therefore tries to draw everything twice.

edit: doesn't happen all the time. I'll have to narrow it down when I get a chance.

Oh right, I forgot about this. I half fixed some DrawString related issue last I remember, should be fine now I think.

..Actually on second thought I will just question mark this until I can confirm it properly. It's been a while 😉

It's happening all the time for me, with

    if(type >= 0 && type <= 5)
{
al_trace("layer %i\n",type);
do_primitives(bmp, type+1, layer, x, y + playing_field_offset);
}
changed in do_layer, I'm getting 2, 3, 4 and 5 all traced twice each frame.

I would assume so.
Perhaps you might be able to get some time to look at what happens with draw primitives when the screen's scrolling too? I'm re-jiggering scrollscr so that the global script runs while it's moving, and I've made a fairly nasty kludge to get some relative-to-Link coordinates. They work fine with FFCs, but when it comes to draw-primitives they seem to move in a bit of a funky manner in the direction the screen's moving in. I think it might be something to do with drawing to the wrong bitmap but I'm not sure, the co-ordinates are going through sdci ok.

Oh jeez...It's like deciphering ancient hieroglyphics. This might or might not be fixed now.

Can someone test to see if there is any change in drawing behavior on layers? (in particular layers 3-4-5-6, which were the broken layers initially)

Yeah, I just found that out.. >_> I can't figure out what's really going on in draw_screen...

edit: oh shoot, I think I meant temp_buf there. :P ..maybe that works.?

OK, that works for every layer but 1 and 2... hmm...

Well good news - bad news; It's fixed, but it broke scrolling again. (Which I'm not sure even worked to begin with)

This, I don't get:
if(type >= 0 && type <= 5 && x>=0 && y>=0)

There is a bool scrolling var but it isn't used, instead we have that conditional and some other stuff. I'm out of ideas short of rewriting the entire screen drawing code.

It definitely worked when scrolling before - I've been using that myself for a while.
I tried using the scrolling argument, but it didn't work. It always turned out to be false, as I recall. The X and Y checks were to make it draw only once when scrolling. It gets called twice, once for each screen; for one, either X or Y is negative, and for the other, it's positive.
I'll mess around with it some. Maybe I'll get lucky and fix it. Or I'll completely break it, who knows.

Wait, does draw_screen still get called every frame when the screen is scrolling? ..I might be able to hack something in if it does. EDIT- wait, no that's not right. ...I can't make sense of the drawing code at all.. arg!

Hey, I'm actually making some progress here. I think we've been overlooking LinkClass::scrollscr().
I got it drawing while scrolling again without ever doing it twice a frame (haven't checked every layer yet, though), but there are still a couple of frames where it doesn't draw at all. I think I can fix that, but if not, it's at least doing better.

Edit: I think I got it! It's working right in my quest, at least. I'll have to do some more testing to make sure, but it's looking good.