Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (Grant), 999 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Convert to Lite C problems #376654
07/05/11 14:49
07/05/11 14:49
Joined: Nov 2009
Posts: 201
Logitek Offline OP
Member
Logitek  Offline OP
Member

Joined: Nov 2009
Posts: 201
Hello,

I have some problems with converting C-Script into Lite C.

I hope you can help me to fix some problems.

The big problem are the old wdl templates.

I thought it would be easier and faster to translate it into Lite C than to write a new code for my C-Script project. Because I changed too many things in the template scripts and the other script parts are using these parts.

However, I already changed the most parts of my long script.
Only some template code parts are a problem for me.

My first problem is the camera update code and the expression <<: Syntax error

Code:
// init bit-field value used to check to see if this camera is active 
camera1stPerson01_bit_check = 1 << camera1stPerson01_id;



Both are defined with:

Code:
#define	camera1stPerson01_id = 1

var	camera1stPerson01_bit_check;
// used in bit-compairs to check is this camera is active



What would be the correct syntax in Lite C?

Re: Convert to Lite C problems [Re: Logitek] #376655
07/05/11 15:04
07/05/11 15:04
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
change
Code:
#define	camera1stPerson01_id = 1

to
Code:
#define	camera1stPerson01_id 1



Re: Convert to Lite C problems [Re: MrGuest] #376656
07/05/11 15:10
07/05/11 15:10
Joined: Nov 2009
Posts: 201
Logitek Offline OP
Member
Logitek  Offline OP
Member

Joined: Nov 2009
Posts: 201
Thank you for your fast reply.

It works.

My first problem is solved. Again thank you.

My second problem is a little bit complicater I think.

I will post it in a few minutes.

Re: Convert to Lite C problems [Re: Logitek] #376657
07/05/11 15:24
07/05/11 15:24
Joined: Nov 2009
Posts: 201
Logitek Offline OP
Member
Logitek  Offline OP
Member

Joined: Nov 2009
Posts: 201
My second problem:

menu01_action1_ptr: function not found

This is readable in the acklog.txt
4 times in a row.

I think that code is really outdated.

I have defined it with:

Code:
function* menu01_action1_ptr();
function* menu01_action2_ptr();
function* menu01_action3_ptr();
function* menu01_action4_ptr();



The original does not work and it was:
Code:
action* menu01_action1_ptr();
action* menu01_action2_ptr();
action* menu01_action3_ptr();
action* menu01_action4_ptr();



And this function is calling the listed functions above:

Code:
// Desc: assign the appopreate action to this menu item
function	menu01_set_action_main(item,cmd)
{
	if(1 == item)
	{
		menu01_action1_ptr = menu01_rtn_action_main(cmd);
	}
	if(2 == item)
	{
		menu01_action2_ptr = menu01_rtn_action_main(cmd);
	}
	if(3 == item)
	{
		menu01_action3_ptr = menu01_rtn_action_main(cmd);
	}
	if(4 == item)
	{
		menu01_action4_ptr = menu01_rtn_action_main(cmd);
	}
}



Any ideas?

Re: Convert to Lite C problems [Re: Logitek] #376663
07/05/11 16:03
07/05/11 16:03
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
Try writing only "function" or "var" instead of "function*".

Also, in the function that sets the pointers, you actually call the function "menu01_rtn_action_main" and assign its return value to the pointers instead of assigning the functions themselves. Unless that function returns a function pointer, you'll have to remove the (cmd) to assign a pointer of that function itself.

Re: Convert to Lite C problems [Re: Lukas] #376666
07/05/11 16:19
07/05/11 16:19
Joined: Nov 2009
Posts: 201
Logitek Offline OP
Member
Logitek  Offline OP
Member

Joined: Nov 2009
Posts: 201
Only function instead of function* does not work. I have already tried this.

I will try to understand your other ideas.

We will see. I will let you know.

Thank you.

Re: Convert to Lite C problems [Re: Logitek] #376672
07/05/11 17:25
07/05/11 17:25
Joined: Nov 2009
Posts: 201
Logitek Offline OP
Member
Logitek  Offline OP
Member

Joined: Nov 2009
Posts: 201
Beside this problem I have a third big problem. That is the last listed problem until now.

I have a function in the template script called: Camera1stPerson01_Init()

This function contains the call: Camera1stPerson01_Update();
And the second call: Camera1stPerson01_Update_View(view_number);

And the first one looks like that:

Code:
function Camera1stPerson01_Update()
{
	proc_mode = PROC_LATE;
	vec_set(camera1stPerson01_pos_vec,cameraTarget_pos_vec);
	vec_set(camera1stPerson01_ang_vec,cameraTarget_ang_vec);
}



I got the error message: W1501 Empty Pointer



And this is defined before:

Code:
VECTOR* camera1stPerson01_pos_vec;
ANGLE* camera1stPerson01_ang_vec;

VECTOR* cameraTarget_pos_vec; 
ANGLE* cameraTarget_ang_vec;



I have tried it with VECTOR* and VECTOR. Also ANGLE* and ANGLE.
In the original it was a Var[3]

I got also a crash in the second function one second later:

Error E1513: Crash in Camera1stPerson01_Update_View

Code:
function	Camera1stPerson01_Update_View(view_number)
{
	if(view_number == 0)
	{
		// update main view (camera)
		vec_set(camera.x,camera1stPerson01_pos_vec.x);
		vec_set(camera.pan,camera1stPerson01_ang_vec.pan);

		#ifdef camera1stPerson01_hide_focus_b
		
		//if(1==camera1stPerson01_hide_focus_b)
		//{	// hide the target entity from view if inside
  			//camera.genius = cameraTarget_ent;  // camera.genius does not work with new collision
			if(cameraTarget_ent != NULL) {
				 // cameraTarget_ent.invisible = on; 
				 set (cameraTarget_ent, INVISIBLE);
				 }
		//}
		#else
		//else
		//{	// show the target entity no matter what
			camera.genius = 0;
		//}
		#endif

		// is this an avatar view?
		#ifdef camera1stPerson01_avatar_q
				cameraTarget_avatar_view_q = 1;
		#else
				cameraTarget_avatar_view_q = 0;
	#endif
	}



Why did I get the meesage for an empty pointer?
I thought vec_set is an easy instruction.
It never made problems in C-Script.
What could be my problem?

Re: Convert to Lite C problems [Re: Logitek] #376677
07/05/11 18:17
07/05/11 18:17
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
You have to use VECTOR and ANGLE, or define is like this: VECTOR* camera1stPerson01_pos_vec = {x=0; y=0; z=0}
Otherwise, you just create a pointer.

Are you sure Camera1stPerson01_Update is the function that crashes, even if you use VECTOR and ANGLE? Did you try using sys_marker or error() messages before and after the function call?

I don't see where exactly Camera1stPerson01_Update_View might crash. It is kinda messy with all the commented lines.

Re: Convert to Lite C problems [Re: Lukas] #376679
07/05/11 18:26
07/05/11 18:26
Joined: Nov 2009
Posts: 201
Logitek Offline OP
Member
Logitek  Offline OP
Member

Joined: Nov 2009
Posts: 201
I think I have tried something like
VECTOR* camera1stPerson01_pos_vec = {x=0; y=0; z=0;}

I will try it again tommorrow.

Today I have tried a lot. And I always got an error in Camera1stPerson01_Update.

I have solved other problems. But these ones are a little bit hard for me, because I was working most time in C-Script.

Oh, I found something in the online manuel of A8. I don't saw it in the A7 manual. It has something to do with the function pointers of my second problem I have listed. It should be possible to solve that problem with float. But I have to check it.

I will let you know tommorrow.

Thank you for your help.

Re: Convert to Lite C problems [Re: Logitek] #376749
07/06/11 12:22
07/06/11 12:22
Joined: Nov 2009
Posts: 201
Logitek Offline OP
Member
Logitek  Offline OP
Member

Joined: Nov 2009
Posts: 201
Thank you for your help. It was right with the VECTOR. That was the problem. Now I have solved it. I think that I have solved also problem nr. 2. I got no error. But I am not sure if it is working, because it is only available in level one and not earlier in the main menu or at the credits level. We will see.

Next problem that I have:

E1005 Out of Memory! after or near the end of level_load. I can see that on the loading bar.

Very interessting: Because in the C-Script version it does not happen. I can be sure, that no model or sound or something like that is defective. Otherwise it would not run in C-Script.

I will try to reduce the nexus value to 200 now. But I am sure that will not solve the problem.

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | 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