drawspriteq

O Ilusionista

Captain 100K
What, exactily, "drawspriteq" does? For what I understand, its the same of drawsprite, but we can draw the sprite to a new screen (needs allocscreen first). Is this right?

Because I am having a conflict between the shadowtrail effect x my hud. Since I use drawsprite to show the sprite to the screen (as the normal method bugs the mirror effect), the hud is getting affected by the shadowtrail (alpha and remap, for example).

So, maybe if I use drawspriteq this problem gets solved.
 
This is another one of those features Utunnels wrote some documentation to, but it was a little confusing. As you say, so far as I know you allocate a screen, place items into it and then draw the screen in its entirety. Essentially it's an object oriented approach to direct draw graphics.

I know it works because he's demoed it, but I haven't tried it myself to really get a good handle on how to use it.

DC
 
I almost got it. In Updated.c:
void oncreate()
{
      void hud_scr = getglobalvar("hud_scr");
      if(!hud_scr){
      hud_scr = allocscreen(openborvariant("hResolution"),openborvariant("vResolution"));
      setglobalvar("hudscreen",hud_scr);
  }
}

then in main ov updated.c:

drawspriteq(getglobalvar("hudscreen"),0,0,0,8000,-100);

So far, no crashes. But I still can't see the sprite :(
 
Seems like there was a drawscreen() function somewhere.

DC

Edit: Here's some code I found that uses it - whether it uses it right I'm not sure.

Code:
#include "data/scripts/define.h"
void getScr()
{
	void scr = getscriptvar(0);
	if(!scr){
		scr = allocscreen(480,272);
		setscriptvar(0,scr);
		setscriptvar(1,loadsprite("data/bgs/ring/screen000.gif"));

	}
	return scr;
}
void main()
{
	if(getindexedvar(ZOOM_SWI)){return;}else{}
	void count=getscriptvar(2);
	void current_time=openborvariant("elapsed_time");
	if(!count){
		count=current_time;
		setscriptvar(2,current_time);
	}else{}
	void scr = getScr();
	void maxz=openborvariant("PLAYER_MAX_Z")+600;
	//if(openborvariant("game_paused"))return;
	if(current_time - count>12)
	{
		clearscreen(scr);
		drawspriteq(scr,0,openborconstant("MIN_INT"),maxz,0,0);
		setscriptvar(2,current_time);
	}
	//Set drawMethod
	changedrawmethod(NULL(),"reset",1);
	changedrawmethod(NULL(),"enabled",1);
	changedrawmethod(NULL(),"scalex",43);
	changedrawmethod(NULL(),"scaley",52);
	//Draw the resized customized screen to main screen.
	void x=263-openborvariant("xpos")/2;
	void y=33;
	drawscreen(scr,x,y,1);
	changedrawmethod(NULL(),"scalex",256);
	changedrawmethod(NULL(),"scaley",328);
	changedrawmethod(NULL(),"alpha",2);
	drawsprite(getscriptvar(1),x,y,2);
	changedrawmethod(NULL(),"enabled", 0);
}
void clear()
{
	void scr = getindexedvar(0);
	if(scr){
		free(scr);
		free(getscriptvar(1));
	}
}

Volcanic also makes heavy use of drawing screen graphics. I don't know if he uses screen allocation or not to do it, but check out his Rocket Viper mods and you might find some help in there.

DC
 
duh, I am stupid :) I was thinking about where the engine would actually draws it. Yeah, there is a drawscreen() function.
The original post is here: http://www.chronocrash.com/forum/index.php?topic=529.msg3752#msg3752

I tried to use this:
drawscreen(getglobalvar("hudscreen"),0,0, 8000);

But the screen just got black
0cRTG5O.png


edit: hum, maybe I need to copy all those drawmethods, like "enable", etc
 
I dug into the source code and I found the drawspriteq synthax:

Code:
drawspriteq(vscreen, 0, MIN_INT, MAX_INT, dx, dy)
I still need to try it more to make it work.

Btw, I found some things I never saw before, like:
-getgfxproperty
-finditem
-adjustwalkanimation
-pickups
-waypoints

Is there any documentation about this?

edit: DUH, the synthax was at uTunnels post:

drawspriteq draws the already sorted sprite queue to a screen. So usually you call it in updated.c, when the main update loop has already done sorting all stuff.

drawspriteq(screen, 0, min, max, dx, dy)

screen -  a screen or leave it NULL for your main screen
0 - reserved
min - min layer (aka min z)
max - max layer (aka max z)
dx - x offset
dy - y offset

Openbor constants MIN_INT and MAX_INT are like their names, smallest and biggest integer value possible.

Reset property for drawmethod just resets the drawmethod, clearing all values you changed before. And enabled is the switch to turn it on/off, this is optional but just in case.
 
well, I tried with the drawmethods, but the results are the same:

changedrawmethod(NULL(),"reset",1);
changedrawmethod(NULL(),"enabled",1);
drawscreen(getglobalvar("hudscreen"),0,0, 8000);
changedrawmethod(NULL(),"alpha",2);
drawspriteq(getglobalvar("hudscreen"),0,0,0,8000,-100);
changedrawmethod(NULL(),"enabled", 0);

I think I will scrap this idea, I have another way to solve this - by taking off the mirror effect (which causes all the trouble) or using the hud as a timebg icon.

Thanks anyway.
 
yeah I know that code, I was planing to use it in some stage.

The problem is: all of this is so time consuming and so frustating that it is draining all my motivation to work on my mod.
I am about to just scrap the whole mirror stage and just put it back when the bug is fixed. I have other options, but each option will take some cool detail from the game - and everyone loses :(

But thanks for your help, DC
 
Back
Top Bottom