Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function void draw_cube_rot_axis (void)
- {
- int x, y, z, d, t1, t2, t3, a, b, c;
- int e = fixeddiv(2.0, sqrt_3);
- int height = fixedmul(0.82, 56.0 + getVariable(radius));
- thing_remove(getVariable(projectile_tag));
- if(getVariable(rot_axis) && getVariable(radius)>34.65 && getVariable(pr_num))
- {
- //-----------------------------------------------------------------------------------------------
- x = fixedmul(cos(getVariable(azimuth)), sin(getVariable(polar_angle)));
- y = fixedmul(sin(getVariable(azimuth)), sin(getVariable(polar_angle)));
- z = cos(getVariable(polar_angle));
- //-----------------------------------------------------------------------------------------------
- a = fixeddiv(X_rot[2][1073] - X_rot[0][1073], e);
- b = fixeddiv(Y_rot[2][1073] - Y_rot[0][1073], e);
- c = fixeddiv(Z_rot[2][1073] - Z_rot[0][1073], e);
- d = -(fixedmul(a, X_rot[2][1073])+fixedmul(b, Y_rot[2][1073])+fixedmul(c, Z_rot[2][1073]));
- t1 = fixeddiv(-d, fixedmul(a, x)+fixedmul(b, y)+fixedmul(c, z));
- log(s:"t1 = ", f:t1);
- if(t1<0) t1=-t1;
- //-----------------------------------------------------------------------------------------------
- a = fixeddiv(X_rot[2][1073] - X_rot[3][1073], e);
- b = fixeddiv(Y_rot[2][1073] - Y_rot[3][1073], e);
- c = fixeddiv(Z_rot[2][1073] - Z_rot[3][1073], e);
- d = -(fixedmul(a, X_rot[2][1073])+fixedmul(b, Y_rot[2][1073])+fixedmul(c, Z_rot[2][1073]));
- t2 = fixeddiv(-d, fixedmul(a, x)+fixedmul(b, y)+fixedmul(c, z));
- log(s:"t2 = ", f:t2);
- if(t2<0) t2=-t2;
- //-----------------------------------------------------------------------------------------------
- a = fixeddiv(X_rot[2][1073] - X_rot[6][1073], e);
- b = fixeddiv(Y_rot[2][1073] - Y_rot[6][1073], e);
- c = fixeddiv(Z_rot[2][1073] - Z_rot[6][1073], e);
- d = -(fixedmul(a, X_rot[2][1073])+fixedmul(b, Y_rot[2][1073])+fixedmul(c, Z_rot[2][1073]));
- t3 = fixeddiv(-d, fixedmul(a, x)+fixedmul(b, y)+fixedmul(c, z));
- log(s:"t3 = ", f:t3);
- if(t3<0) t3=-t3;
- //-----------------------------------------------------------------------------------------------
- if(t1<t2)d = t1; else d = t2;
- if(d<t3)t1 = d; else t1 = t3;
- //-----------------------------------------------------------------------------------------------
- //if(1.0 - t1 > 0.001) good use t1; else draw to corner vertex;
- if(1.0 - t1 > 0.001)
- {
- x = fixedmul(x, t1);
- y = fixedmul(y, t1);
- z = fixedmul(z, t1);
- e = (getVariable(radius)/20)>>16;
- if(e>0)
- {
- for(t2 = 0; t2<e; t2++)
- {
- t3 = fixeddiv(t2 << 16, (e-t2-1) << 16);
- a=fixeddiv(0.0 + fixedmul(t3, x), 1.0+t3);
- b=fixeddiv(0.0 + fixedmul(t3, y), 1.0+t3);
- c=fixeddiv(0.0 + fixedmul(t3, z), 1.0+t3);
- Spawnprojectile(2, projectile_class[3], 0, 1, 0, 0, getVariable(projectile_tag));
- SetActorVelocity(getVariable(projectile_tag), 0.0, 0.0, 0.0, false, false);
- SetActorPosition(getVariable(projectile_tag), GetActorX(1)+fixedmul(getVariable(radius), a),
- GetActorY(1)+fixedmul(getVariable(radius), b),
- GetActorZ(1)+height+FixedMul(getVariable(radius), fixedmul(c, 0.82)), 0);
- }
- SetActorPosition(getVariable(projectile_tag), GetActorX(1)+fixedmul(getVariable(radius), x),
- GetActorY(1)+fixedmul(getVariable(radius), y),
- GetActorZ(1)+height+FixedMul(getVariable(radius), fixedmul(z, 0.82)), 0);
- }
- }
- else draw_sphere_rot_axis();
- }
- else if(getVariable(rot_axis) && getVariable(pr_num))log(s:"Radius is too little");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement