Bgl_tick18

Hi,

I am attempting to create an animated flag, using one texture switching between differend areas of it... Using the timer BGL_TICK18 as
Code:
Hellas_flag_MasterScale_1 label BGLCODE
    MATERIAL 0,0 ; <255,255,255,255> HELLAS.BMP;;;
BGL_ZBIAS 1
IFMSK flag00, BGL_TICK18,0008h
    DRAW_TRI_BEGIN 0, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag00 label word
    DRAW_TRI_BEGIN 4, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
    DRAW_TRI_BEGIN 8, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
    DRAW_TRI_BEGIN 12, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
    DRAW_TRI_BEGIN 16, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
    DRAW_TRI_BEGIN 20, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
    DRAW_TRI_BEGIN 24, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
    DRAW_TRI_BEGIN 28, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
flagend label word
BGL_ZBIAS 0
    BGL_RETURN
, witch switchs between two parts only...I wish to switch between the 8 differend areas I 've already created, one after the other... the broblem that occurs is that trying differend jumps into my code I managed either to switch between two parts, or between one and all the others together, or one and nothing... my question is... is it possible to switch into one after the other my eight parts, or this timer is been used just as a two parts switcher?..:banghead:
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

You are only doing one check, that is why you can't do 8 switches. Try something like this:

Code:
Hellas_flag_MasterScale_1 label BGLCODE
MATERIAL 0,0 ; <255,255,255,255> HELLAS.BMP;;;
BGL_ZBIAS 1
IFMSK flag00, BGL_TICK18,2000h
    DRAW_TRI_BEGIN 0, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag00 label word
IFMSK flag01, BGL_TICK18,4000h
    DRAW_TRI_BEGIN 4, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag01 label word
IFMSK flag02, BGL_TICK18,6000h
    DRAW_TRI_BEGIN 8, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag02 label word
IFMSK flag03, BGL_TICK18,8000h
    DRAW_TRI_BEGIN 12, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag03 label word
IFMSK flag04, BGL_TICK18,A000h
    DRAW_TRI_BEGIN 16, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag04 label word
IFMSK flag05, BGL_TICK18,C000h
    DRAW_TRI_BEGIN 20, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag05 label word
IFMSK flag06, BGL_TICK18,E000h
    DRAW_TRI_BEGIN 24, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
    BGL_JUMP_32 flagend
flag06 label word
    DRAW_TRI_BEGIN 28, 4
    DRAW_TRI    2,   3,   0 ; poly=2 part=1
    DRAW_TRI    1,   0,   3 ; poly=1 part=1
    DRAW_TRI_END
flagend label word
BGL_ZBIAS 0
BGL_RETURN
I am not sure about the values of the masks, as I did not try them. But it should get close...
 
Hi,

that looks like it works... I had just to write the values as 0002h instead of 2000h etc. Animation is a bit wird, but I will try differends, just to see what happends... if I will get something intresting I will post it...

thanks Arno
 
Need to borrow one question here.
I have three polygons that are going to be shown chronologically. Currently they show as poly1, poly2, poly1, poly3 and then start from beginning. My code is like this:
Code:
    SEPARATION_PLANE di20, HEADING_VECTOR_X, 0, HEADING_VECTOR_Y, 2351032
      IFMSK dia00, BGL_TICK18,0020h
    	DRAW_TRI_BEGIN 0, 4
    	DRAW_TRI    2,   3,   1 ; poly=2 part=1
    	DRAW_TRI    1,   0,   2 ; poly=1 part=1
    	DRAW_TRI_END
    	BGL_JUMP_32 diend
      dia00 label word
      IFMSK dia01, BGL_TICK18,0040h
    	DRAW_TRI_BEGIN 4, 4
    	DRAW_TRI    2,   3,   1 ; poly=2 part=1
    	DRAW_TRI    1,   0,   2 ; poly=1 part=1
    	DRAW_TRI_END
    	BGL_JUMP_32 diend
      dia01 label word
    	DRAW_TRI_BEGIN 8, 4
    	DRAW_TRI    2,   3,   1 ; poly=2 part=1
    	DRAW_TRI    1,   0,   2 ; poly=1 part=1
    	DRAW_TRI_END
di20 label word
This is one of a chain of images shown in the "display" wich is based on distance from viewpoint. So in other words this code results in vert0-3 shown first then vert4-7 then vert0-3 then vert8-11 and starts over again.

Can I make them go vert0-3 -> vert4-7 -> vert8-11?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

It depends on the mask value you use. You now use 20h and 40h. Which means that in all other cases the last one is shown.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
What do you mean with 12 switches? It is probably easier to have a number of checks that is a power of 2, so 8 or 16.
 
Ops, I meant frames. I agree, should be easier to work with power of 2. With 16 I would have a smooth animation among frames. I may just adapt the code below and change the IFMSK condition?
 
I was exactly looking for this.

I want to create a Guard light. It should change the mapping with BGL_TICK18 (left light off right light on than left on right off) in a texture.

But the draw TRI is drawing triangles correct? How can I do the mapping?

Is there any tutorial?

Thanks!
 
Top