Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,758 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 5 of 5 1 2 3 4 5
Re: Manipulating the function scheduler? [Re: Germanunkol] #388609
12/04/11 22:49
12/04/11 22:49
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Well, Im afraid to say ... I deleted it all! Doh!

It was in a project that I canned due to architecture limitations.
Faulty design from the ground up. So I restarted the entire thing.
Unfortunately, I deleted the main.c that had all this diagnostics in it!!

But Ive rebuilt it from memory for you (and for me later).

Click to reveal..
Code:
#include <acknex.h>
//
void _wait(var);
void _wait_initialize()		{	_wait = wait;	dtimer();	}
#define wait(i) 	do{  char* name; engine_gettaskinfo(0,&name,NULL);  debug_wait(name);	_wait(i);  } while(0)
//
#include "everything else"
//
//
//
STRING* debug_str;
VECTOR  debug_vec;
//
//
void debug_wait(char* function_name)
{
	if(str_cmpi(_str(function_name), _str("function_1")))
	{
		diag("Leaving ");		diag(function_name);
		diag_var(" at %.0f ms\n", dtimer/1000);
	}
	//
	if(str_cmpi(_str(function_name), _str("function_2")))
	{
		diag("Leaving ");		diag(function_name);
		diag_var(" at %.0f ms\n", dtimer/1000);
		diag("targetted entity = i");	diag(_chr(debug_str));	diag("'\n");
	}
	//
	if(str_cmpi(_str(function_name), _str("function_3")))
	{
		diag("Leaving ");		diag(function_name);
		diag_var(" at %.0f ms\n", dtimer/1000);
		diag_var("Position = %.0f, ", debug_vec.x);
			diag_var("%.0f, ", debug_vec.y);		diag_var("%.0f\n", debug_vec.z);
	}
	//
	if(str_cmpi(_str(function_name), _str("function_4")))
	{
		diag("Leaving ");		diag(function_name);
		diag_var(" at %.0f ms\n", dtimer/1000);
		diag_var("Grid-Reference = %.0f, ", debug_vec.x);	diag_var("%.0f\n", debug_vec.y);
	}
	//
	dtimer();	//reset timer REGARDLESS of which function is running
}
//
//
void main()
{
   _wait_initialize();   //this MUST come before any wait's in main!
   ...


This actually contains more example code than my original had at the end.
I put it in to show what I MAY have needed in the future.

Any questions? Feel free to ask!

PS: It looks a bit hard to read here, but put it in SED and it will align nicely.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Manipulating the function scheduler? [Re: EvilSOB] #388610
12/04/11 23:03
12/04/11 23:03
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
NOTE: I havent put it in the above-post example, but it is POSSIBLE to put the
gettaskinfo INSIDE the debug function, but I cant remember the 'numbers'
required to achieve that. Its all to do with what numbers you enter into
the "num" parameter of the gettaskino...

From POOR memory, it goes something like this, just follow the logic...

gettaskinfo( ZERO ,name,NULL) will give you the name of the debug_function.
In my example this would be "debug_wait". Therefore using Zero is useless for our purposes.

gettaskinfo( ONE ,name,NULL) will give you the name of the function the as-yet un-executed wait is in.
In my example this would be the same as the string being passed into the debug_function.
Using this from inside the debug_function streamlines the macro a lot.

gettaskinfo( TWO ,name,NULL) will give you the name of the function that will be called AFTER
the as-yet un-executed wait is called. This has no parallel in my example.
This MAY be useful to you as I believe you wanted ORIGINALLY to know the NEXT function...


PS REMEMBER !!! "default.c" must NOT be included AT ALL or this whole system falls on its face!



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 5 of 5 1 2 3 4 5

Moderated by  old_bill, Tobias 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1