HI, about Win CE and better performance

Previous topic - Next topic

Slydog

#15
I think your poly deform is from your STARTPOLY mode.
In the deformed version (using one STARTPOLY command), you use Mode 2.
In the other, you use Mode 0.

In Mode 0 (FAN), your points will look like this:
2  1
3  4

In Mode 2 (STRIP), your points will look like this:
1  3
2  4

Since Mode 0 works, try changing your code to:  (I moved your 1st POLYVECTOR to the 3rd position)
Code (glbasic) Select
         FOR n = 0 TO BOUNDS(puntos[],0)-1
            POLYVECTOR puntos[n].x,puntos[n].y+5,puntos[n].frame*5,(puntos[n].color*5)+5,RGB(255,255,255)
            POLYVECTOR puntos[n].x+5,puntos[n].y+5,(puntos[n].frame*5)+5,(puntos[n].color*5)+5,RGB(255,255,255)
            POLYVECTOR puntos[n].x,puntos[n].y,puntos[n].frame*5,puntos[n].color*5,RGB(255,255,255)
            POLYVECTOR puntos[n].x+5,puntos[n].y,(puntos[n].frame*5)+5,puntos[n].color*5,RGB(255,255,255)
            POLYNEWSTRIP
         NEXT


Not that it will make much of a difference, but you could pre-calculate the white RGB into a local variable before the loop and use that in the POLYVECTOR command, saves calling RGB() four times per loop.

[Edit]
And changing your sprite matrix into a fixed size should speed up your code some, but I'm not sure how much.
How slow is C at reallocating memory and copying the data to the new location, if that's how it's done?
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

When using large lists (enemies, particels) I usually go for static arrays and an couter variable.
That way I can remove an object by copying the last object at the position of the one to be deleted and DEC the counter.