Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (blaurock), 750 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
need hellp : C-script to lite-C #354355
01/17/11 22:29
01/17/11 22:29
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
I try to translate some old code in lite-c, and i do not know how to define rot_angle and rot_speed in this function. What i must use vector pointer, vector, var, entity,...? What is wrong here?

Code:
function rotate_model(rot_angle,rot_speed) {
	if (my.pan == rot_angle) { return; }
	temp.x = ang(rot_angle - my.pan);
	if (temp.x > 0) { result = 1; }
	if (temp.x < 0) { result = -1; }
	my.pan_force = rot_speed * ang(rot_angle - my.pan);
	my.pan_velocity += (time_step * my.pan_force) - (minv(time_step*0.7,1) * my.pan_velocity);
	temp.x = ang(rot_angle.pan - (my.pan + my.pan_velocity));
	if (temp.x > 0 && result == -1) || (temp.x < 0 && result == 1) { my.pan_velocity = ang(rot_angle.pan - my.pan); }
	c_rotate(my,vector(my.pan_velocity * time_step,0,0),IGNORE_PASSABLE|IGNORE_YOU|IGNORE_MODELS|USE_BOX);
}



Last edited by CodeMaster; 01/18/11 00:19.
Re: need hellp : C-script to lite-C [Re: CodeMaster] #354357
01/17/11 23:41
01/17/11 23:41
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
It looks like you could just declare them as vars. Certainly don't declare them as VECTORs or ANGLEs--that would just complicate things, especially because you're only changing my.pan in that function. According to your code vars would be fine--or if you want to be more Lite-C-like, you could use int, double, float, etc.

function rotate_model(var rot_angle, var rot_speed)
{}

Re: need hellp : C-script to lite-C [Re: Logan] #354361
01/17/11 23:52
01/17/11 23:52
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
thank you Logan but i already try this and then i have error "pan is not a member of function"

Re: need hellp : C-script to lite-C [Re: CodeMaster] #354363
01/17/11 23:57
01/17/11 23:57
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
That has to do with rotate_angle. In C-Script you probably defined rotate_angle as var rotate_angle[3];... in Lite-C you'll have to say ANGLE* rotate_angle;.

I had the same confused moment a couple days ago.

Hope that answers your question.

Re: need hellp : C-script to lite-C [Re: Logan] #354365
01/18/11 00:07
01/18/11 00:07
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
nope, rot_angle defined only in brackets in this function anywhere else. I also try define this with ANGLE out of function but wont work

Re: need hellp : C-script to lite-C [Re: CodeMaster] #354367
01/18/11 00:14
01/18/11 00:14
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
What about when you access rotate_angle.pan? That's what I'm talking about. Unless this is supposed to be rot_angle... in which case there's your problem.

Re: need hellp : C-script to lite-C [Re: Logan] #354368
01/18/11 00:16
01/18/11 00:16
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
ohh sorry i made mistake i fix this in my script but not here, this is rot_angle but still wont work

Re: need hellp : C-script to lite-C [Re: CodeMaster] #354372
01/18/11 01:06
01/18/11 01:06
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
So what is it saying exactly?


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