bool screen_main::draw() { if (bkgs[0] < 128) bkg[1]->draw(bkgs[0] + 512,0,0); bkg[1]->draw(bkgs[0],0,0); bkg[1]->draw(bkgs[0]-512,0,0); bkg[2]->setRotate(sin_deg(t_frms) * 3.0); bkg[2]->draw(0,fabs(sin_deg(t_frms) * 3.0),0); bkg[3]->draw(bkgs[1],0,0); bkg[3]->draw(bkgs[1]-640,0,0); bkg[4]->draw(bkgs[2],0,0); bkg[4]->draw(bkgs[2]-768,0,0); gear->setRotate(cur_pos * 1.2); gear->setColor(255,0,0,0); gear->draw((menu_pos - 1.0) * 160 + 4,cur_pos + 4,0); gear->setColor(255,255,255,255); gear->draw((menu_pos - 1.0) * 160,cur_pos,0); title->draw_all(0); cursor->draw((menu_pos - 1.0) * 160,cur_pos,0); for (int8_t i=0; i<12; i++) moji1->draw_frame((menu_pos - 1.0) * 160,i * 24, 0,i,0); moji2.draw_frame((menu_pos - 1.0) * 160,title_punkt * 24, 0,title_punkt,0); return true; }
poSphere3D::poSphere3D( int _numRows, int _numColumns, float _radius ) : poMesh3D(_numRows,_numColumns) { radius = _radius; float dA = 360.f / (float)(numColumns-1); float dB = 180.f / (float)(numRows-1); for( int i=0; i<numRows; i++ ) { for( int j=0; j<numColumns; j++ ) { int N = getVertexIndex(i,j); if ( N==-1 || N < 0 || N >= (int)vertexList.size() ) { printf("ERROR\n"); continue; } float A = -1.f * dA * j; float B = 90 - dB * i; vertexList[N].position.set( cos_deg(B)*cos_deg(A)*radius, sin_deg(B)*radius, cos_deg(B)*sin_deg(A)*radius ); } } calculateNormals(); }
void background_16::draw_near() { decor[2].sy = 0.1 * (6.0 + sin_deg(angle * 2)); decor[2].sx = 2; render(&decor[2]); decor[2].sx = -2; render(&decor[2]); }
void frame_box_move_rotate(frame_box *src, int16_t angle, int16_t x_c, int16_t y_c, frame_box *dst1, frame_box *dst2) { float sin_ = sin_deg(angle); float cos_ = cos_deg(angle); if ( sin_ < 0.0 ) { if ( cos_ < 0.0 ) { dst1->x1 = x_c + ((src->x2 - x_c) * cos_) - ((src->y1 - y_c) * sin_); dst1->y1 = y_c + ((src->x2 - x_c) * sin_) + ((src->y1 - y_c) * cos_); dst1->x2 = x_c + ((src->x1 - x_c) * cos_) - ((src->y2 - y_c) * sin_); dst1->y2 = y_c + ((src->x1 - x_c) * sin_) + ((src->y2 - y_c) * cos_); dst2->x1 = -((src->y2 - src->y1) * sin_); dst2->y1 = (src->y2 - src->y1) * cos_; dst2->x2 = -(cos_ * (src->x2 - src->x1)); dst2->y2 = -(sin_ * (src->x2 - src->x1)); } else { dst1->x1 = x_c + ((src->x1 - x_c) * cos_) - ((src->y1 - y_c) * sin_); dst1->y1 = y_c + ((src->x1 - x_c) * sin_) + ((src->y1 - y_c) * cos_); dst1->x2 = x_c + ((src->x2 - x_c) * cos_) - ((src->y2 - y_c) * sin_); dst1->y2 = y_c + ((src->x2 - x_c) * sin_) + ((src->y2 - y_c) * cos_); dst2->x1 = (src->x2 - src->x1) * cos_; dst2->y1 = (src->x2 - src->x1) * sin_; dst2->x2 = -(sin_ * (src->y2 - src->y1)); dst2->y2 = cos_ * (src->y2 - src->y1); } } else { if ( cos_ < 0.0 ) { dst1->x1 = x_c + ((src->x2 - x_c) * cos_) - ((src->y2 - y_c) * sin_); dst1->y1 = y_c + ((src->y2 - y_c) * cos_) + ((src->x2 - x_c) * sin_); dst1->x2 = x_c + ((src->x1 - x_c) * cos_) - ((src->y1 - y_c) * sin_); dst1->y2 = y_c + ((src->y1 - y_c) * cos_) + ((src->x1 - x_c) * sin_); dst2->x1 = -((src->x2 - src->x1) * cos_); dst2->y1 = -((src->x2 - src->x1) * sin_); dst2->x2 = sin_ * (src->y2 - src->y1); dst2->y2 = -(cos_ * (src->y2 - src->y1)); } else { dst1->x1 = x_c + ((src->x1 - x_c) * cos_) - ((src->y2 - y_c) * sin_); dst1->y1 = y_c + ((src->y2 - y_c) * cos_) + ((src->x1 - x_c) * sin_); dst1->x2 = x_c + ((src->x2 - x_c) * cos_) - ((src->y1 - y_c) * sin_); dst1->y2 = y_c + ((src->y1 - y_c) * cos_) + ((src->x2 - x_c) * sin_); dst2->x1 = (src->y2 - src->y1) * sin_; dst2->y1 = -((src->y2 - src->y1) * cos_); dst2->x2 = cos_ * (src->x2 - src->x1); dst2->y2 = sin_ * (src->x2 - src->x1); } } }
/***************************************************************************** * Bounce the ball. *****************************************************************************/ void BounceBall( double delta_t ) { GLfloat sign; GLfloat deg; if ( override_pos ) return; /* Bounce on walls */ if ( ball_x > (BOUNCE_WIDTH/2 + WALL_R_OFFSET ) ) { ball_x_inc = -0.5f - 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX; deg_rot_y_inc = -deg_rot_y_inc; } if ( ball_x < -(BOUNCE_HEIGHT/2 + WALL_L_OFFSET) ) { ball_x_inc = 0.5f + 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX; deg_rot_y_inc = -deg_rot_y_inc; } /* Bounce on floor / roof */ if ( ball_y > BOUNCE_HEIGHT/2 ) { ball_y_inc = -0.75f - 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX; } if ( ball_y < -BOUNCE_HEIGHT/2*0.85 ) { ball_y_inc = 0.75f + 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX; } /* Update ball position */ ball_x += ball_x_inc * ((float)delta_t*ANIMATION_SPEED); ball_y += ball_y_inc * ((float)delta_t*ANIMATION_SPEED); /* * Simulate the effects of gravity on Y movement. */ if ( ball_y_inc < 0 ) sign = -1.0; else sign = 1.0; deg = (ball_y + BOUNCE_HEIGHT/2) * 90 / BOUNCE_HEIGHT; if ( deg > 80 ) deg = 80; if ( deg < 10 ) deg = 10; ball_y_inc = sign * 4.f * (float) sin_deg( deg ); }
void background_16::draw_mid() { decor[0].az = angle/5; decor[1].az = angle/5; render(&decor[0]); render(&decor[1]); float scl[4] = {0.8,1.2,1.2,0.8}; float px[4] = {190,546,852,1209}; float py[4] = {511,582,582,511}; for (int8_t i=0; i<4; i++) { decor[3].sy = decor[3].sx = scl[i] + 0.1 * sin_deg(i * 90 + angle * ( i + 4)); decor[3].x = px[i]; decor[3].y = py[i]; render(&decor[3]); } }
/***************************************************************************** * Draw a faceted latitude band of the Boing ball. * * Parms: long_lo, long_hi * Low and high longitudes of slice, resp. *****************************************************************************/ void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi ) { vertex_t vert_ne; /* "ne" means south-east, so on */ vertex_t vert_nw; vertex_t vert_sw; vertex_t vert_se; vertex_t vert_norm; GLfloat lat_deg; static int colorToggle = 0; /* * Iterate thru the points of a latitude circle. * A latitude circle is a 2D set of X,Z points. */ for ( lat_deg = 0; lat_deg <= (360 - STEP_LATITUDE); lat_deg += STEP_LATITUDE ) { /* * Color this polygon with red or white. */ if ( colorToggle ) glColor3f( 0.8f, 0.1f, 0.1f ); else glColor3f( 0.95f, 0.95f, 0.95f ); #if 0 if ( lat_deg >= 180 ) if ( colorToggle ) glColor3f( 0.1f, 0.8f, 0.1f ); else glColor3f( 0.5f, 0.5f, 0.95f ); #endif colorToggle = ! colorToggle; /* * Change color if drawing shadow. */ if ( drawBallHow == DRAW_BALL_SHADOW ) glColor3f( 0.35f, 0.35f, 0.35f ); /* * Assign each Y. */ vert_ne.y = vert_nw.y = (float) cos_deg(long_hi) * RADIUS; vert_sw.y = vert_se.y = (float) cos_deg(long_lo) * RADIUS; /* * Assign each X,Z with sin,cos values scaled by latitude radius indexed by longitude. * Eg, long=0 and long=180 are at the poles, so zero scale is sin(longitude), * while long=90 (sin(90)=1) is at equator. */ vert_ne.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_se.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo )); vert_nw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_sw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo )); vert_ne.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_se.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo )); vert_nw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_sw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo )); /* * Draw the facet. */ glBegin( GL_POLYGON ); CrossProduct( vert_ne, vert_nw, vert_sw, &vert_norm ); glNormal3f( vert_norm.x, vert_norm.y, vert_norm.z ); glVertex3f( vert_ne.x, vert_ne.y, vert_ne.z ); glVertex3f( vert_nw.x, vert_nw.y, vert_nw.z ); glVertex3f( vert_sw.x, vert_sw.y, vert_sw.z ); glVertex3f( vert_se.x, vert_se.y, vert_se.z ); glEnd(); #if BOING_DEBUG printf( "----------------------------------------------------------- \n" ); printf( "lat = %f long_lo = %f long_hi = %f \n", lat_deg, long_lo, long_hi ); printf( "vert_ne x = %.8f y = %.8f z = %.8f \n", vert_ne.x, vert_ne.y, vert_ne.z ); printf( "vert_nw x = %.8f y = %.8f z = %.8f \n", vert_nw.x, vert_nw.y, vert_nw.z ); printf( "vert_se x = %.8f y = %.8f z = %.8f \n", vert_se.x, vert_se.y, vert_se.z ); printf( "vert_sw x = %.8f y = %.8f z = %.8f \n", vert_sw.x, vert_sw.y, vert_sw.z ); #endif } /* * Toggle color so that next band will opposite red/white colors than this one. */ colorToggle = ! colorToggle; /* * This circular band is done. */ return; }
void c_scene_fx::func10() { switch(get_seq()) { case 1: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); for (int8_t i = 0; i < 4; i++) scene_add_effect(parent, 101, x,y,dir,1); } if (process()) active = false; break; case 2: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); for (int8_t i = 0; i < 6; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 3; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } if (process()) active = false; break; case 3: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); scene_add_effect(parent, 100, x,y,dir,1); for (int8_t i = 0; i < 8; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 6; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } if (process()) active = false; break; case 4: if ( get_elaps_frames() == 0) { angZ = scene_rand_rng(360); scene_add_effect(parent, 104, x,y,dir,1); for (int8_t i = 0; i < 10; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 6; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } if (process()) active = false; break; case 5: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); for (int8_t i = 0; i < 4; i++) scene_add_effect(parent, 101, x,y,dir,1); } if (process()) active = false; break; case 6: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); for (int8_t i = 0; i < 6; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 3; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } if (process()) active = false; break; case 7: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); scene_add_effect(parent, 100, x,y,dir,1); for (int8_t i = 0; i < 8; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 3; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } scaleY = scaleX += 0.1; if (process()) active = false; break; case 8: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); scene_add_effect(parent, 100, x,y,dir,1); for (int8_t i = 0; i < 10; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 5; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } scaleY = scaleX += 0.1; if (process()) active = false; break; case 9: case 10: case 11: case 12: if ( get_elaps_frames() == 0 ) angZ = scene_rand_rng(40) - 20; if (process()) active = false; break; case 13: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); scene_add_effect(parent, 105, x,y,dir,1); for (int8_t i = 0; i < 4; i++) scene_add_effect(parent, 102, x,y,dir,1); } if (process()) active = false; break; case 14: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); scene_add_effect(parent, 106, x,y,dir,1); for (int8_t i = 0; i < 6; i++) scene_add_effect(parent, 102, x,y,dir,1); } if (process()) active = false; break; case 15: case 16: case 38: if ( get_elaps_frames() == 0 ) angZ = scene_rand_rng(360); if (process()) active = false; break; case 50: if ( get_elaps_frames() == 0 ) for (int8_t i = 0; i < 4; i++) scene_add_effect(parent, 101, x,y,dir,1); if (process()) active = false; break; case 51: if ( get_elaps_frames() == 0 ) for (int8_t i = 0; i < 4; i++) scene_add_effect(parent, 103, x,y,dir,1); if (process()) active = false; break; case 52: if ( get_elaps_frames() == 0 ) { scene_play_sfx(37); for (int8_t i = 0; i < 3; i++) scene_add_effect(parent, 101, x,y,dir,1); } if (process()) active = false; break; case 53: if ( get_elaps_frames() == 0 ) { scene_play_sfx(38); scene_add_effect(parent, 104, x,y,dir,1); for (int8_t i = 0; i < 16; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 8; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } for (int8_t i = 0; i < 6; i++) scene_add_effect(parent, 200, x,y,dir,1); for (int8_t i = 0; i < 10; i++) scene_add_effect(parent, 201, x,y,dir,1); } angZ += 5; scaleX += 0.3; scaleY += 0.3; if (c_A >= 10) { c_A -= 10; c_R -= 10; c_G -= 10; if (process()) active = false; } else active = false; break; case 54: if ( get_elaps_frames() == 0 ) { scene_play_sfx(25); scene_add_effect(parent, 104, x,y,dir,1); for (int8_t i = 0; i < 8; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 4; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } scaleX += 0.3; scaleY += 0.3; if (c_A >= 10) { c_A -= 10; if (process()) active = false; } else active = false; break; case 58: case 59: scaleY = scaleX += 0.4; if (c_A >= 20) { c_A -= 20; if (process()) active = false; } else active = false; break; case 61: if ( get_elaps_frames() == 0 ) scene_play_sfx(43); scaleX += 0.3; scaleY += 0.3; if (c_A >= 20) { c_A -= 20; c_R -= 20; c_G -= 20; if (process()) active = false; } else active = false; break; case 62: if (get_elaps_frames() == 0) { scene_play_sfx(45); scene_add_effect(parent, 113,x,y,dir,1); } scaleX+=0.2; scaleY+=0.2; if (c_A >= 25) { c_A -= 25; c_R -= 25; c_G -= 25; if (process()) active = false; } else active = false; break; case 63: if ( get_elaps_frames() == 0 ) { scene_play_sfx(43); scene_add_effect(parent,60,x,y,dir,-1); } scaleX += 0.1; scaleY += 0.15; if (process()) active = false; break; case 64: if ( get_elaps_frames() == 0 ) { scene_play_sfx(50); scene_add_effect(parent, 104, x,y,dir,1); for (int8_t i = 0; i < 16; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 8; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } scaleX += 0.3; scaleY += 0.3; if (c_A >= 10) { c_A -= 10; if (process()) active = false; } else active = false; break; case 65: case 66: case 67: case 68: if ( get_elaps_frames() == 0 ) { scene_add_effect(parent, 104, x,y,dir,1); for (int8_t i = 0; i < 16; i++) scene_add_effect(parent, 101, x,y,dir,1); for (int8_t i = 0; i < 8; i++) { scene_add_effect(parent, 102, x,y,dir,1); scene_add_effect(parent, 103, x,y,dir,1); } } scaleX += 0.3; scaleY += 0.3; if (c_A >= 10) { c_A -= 10; if (process()) active = false; } else active = false; break; case 69: if ( get_elaps_frames() == 0 ) scene_play_sfx(35); scaleX += 0.3; scaleY += 0.3; angZ -= 25; if (c_A >= 15) { c_A -= 15; c_R -= 15; c_G -= 15; if (process()) active = false; } else active = false; break; case 70: if ( get_elaps_frames() == 0 ) scene_play_sfx(53); scaleX += 0.3; scaleY += 0.3; angZ -= 25; if (c_A >= 15) { c_A -= 15; c_R -= 15; c_G -= 15; if (process()) active = false; } else active = false; break; case 71: if ( get_elaps_frames() == 0 ) scene_play_sfx(54); if ( get_frame() == 0 ) scaleY = scaleX *= 0.8; else if (get_frame() == 1) { scaleY = scaleX += 0.3; angZ -= 25; if (c_A >= 15) { c_A -= 15; c_B -= 15; } else { active = false; } } if (active && process()) active = false; break; case 100: scaleX += 0.5; scaleY += 0.5; if (c_A >= 20) { c_A -= 20; c_R -= 20; c_G -= 20; if (process()) active = false; } else active = false; break; case 101: v_inerc--; y += v_inerc; x += h_inerc; if ( v_inerc < 0.0 && y < 0.0 ) if ( scene_rand_rng(100) < 15 ) v_inerc = (-v_inerc) * 0.5; if (c_A > 20) { scaleX *= 0.8; scaleY *= 0.8; c_A -= 20; c_R -= 20; c_G -= 20; if (scaleX <= 0 || process()) active=false; } else active = false; break; case 102: case 103: x += h_inerc*dir; y += v_inerc; if (c_A > 10) { scaleY *= 0.98; scaleX += 0.05; c_A -= 10; if (process()) active = false; } else active = false; break; case 104: scaleX += 1.25; scaleY += 1.25; if (c_A >= 20) { c_A -= 20; c_R -= 20; c_G -= 20; if (process()) active = false; } else active = false; break; case 105: scaleY = scaleX += 0.15; if (c_A > 15) { c_A -= 15; c_R -= 15; c_G -= 15; if (process()) active = false; } else active = false; break; case 60: case 106: scaleX += 0.4; scaleY += 0.4; if (c_A >= 20) { c_A -= 20; c_R -= 20; c_G -= 20; if (process()) active = false; } else active = false; break; case 112: case 137: { c_meta *chr = parent; if ( chr ) { x = chr->getX(); y = chr->getY()+100; par1 -= 0.3; if (par1 < 1.0) par1 = 1.0; par2 += 3.0; if (get_seq() == 137) { angZ ++; scaleY = scaleX = (sin_deg(par2) * 0.1 + 1.1) * par1; } else { angZ --; scaleY = scaleX = (sin_deg(par2) * 0.1 + 1.0) * par1; } if (get_frame() == 0) { if (chr->chrt->damage_limit < 100 || chr->chrt->get_seq() == 99) if ( chr->chrt->field_4C2 <= 0) { set_frame(1); break; } } if (get_frame() == 1) { if (c_A > 20) { c_A -= 20; c_R -= 20; c_G -= 20; } else active = false; } if (active && process() ) active = false; } else active = false; } break; case 113: scaleX+=0.4; scaleY+=0.4; if (c_A >= 15) { c_A -= 15; c_R -= 15; c_G -= 15; if (process()) active = false; } else active = false; break; case 115: if ( get_elaps_frames() == 0 ) { angZ = scene_rand_rng(360); scaleX = 2.0; scaleY = 2.0; } angZ += 2; if (get_frame() == 41) { if (c_A >= 5) c_A -= 5; else active = false; } if (active && process()) active = false; break; case 123: if ( get_elaps_frames() == 0 ) v_inerc = -10; if (c_A >= 15) { y += v_inerc; c_A -= 15; c_R -= 15; c_G -= 15; if (process()) active = false; } else active = false; break; case 124: if ( get_elaps_frames() == 0 ) h_inerc = -10.0; if ( c_A >= 15 ) { x += dir * h_inerc; c_A -= 15; c_R -= 15; c_G -= 15; if (process()) active = false; } else active = false; break; case 125: scaleX += 0.2; scaleY += 0.2; if (c_A >= 25) { c_A -= 25; c_R -= 25; c_G -= 25; if (process()) active = false; } else active = false; break; case 136: scaleX -= 0.005; scaleY += 0.02; y += 15; c_A = sin_deg(get_elaps_frames() * 6) * 255.0; if (get_elaps_frames() * 6 >= 180) active = false; if (active && process()) active = false; break; case 131: case 132: case 133: case 134: case 139: if (get_elaps_frames() == 0) v_inerc = 20; v_inerc--; if (v_inerc < 1) v_inerc = 1; scaleX += 0.1; if (scaleX > 1) scaleX = 1; scaleY = scaleX; if (get_elaps_frames() >= 60) { if (c_A > 15) c_A -= 15; else active = false; } y += v_inerc; if (active && process()) active = false; break; case 140: scaleX += par1 * 0.5; par1 *= 0.94; if (c_A >= 5) { c_A -= 5; c_R -= 5; c_G -= 5; if (process()) active = false; } else active = false; break; case 141: scaleY = scaleX *= 0.85; if (c_A >= 15) { c_A -= 15; c_R -= 15; c_G -= 15; if (process()) active = false; } else active = false; break; case 135: case 142: scaleY = scaleX += 0.3; if (c_A >= 15) { c_A -= 15; if (process()) active = false; } else active = false; break; case 150: case 152: case 154: scaleY = scaleX += 0.15; if (c_A >= 15) { c_A -= 15; if (process()) active = false; } else active = false; break; case 151: case 153: case 155: if (par1 == 0) { if (c_A >= 240) { c_A = 255; par1 = 1.0; y += 10; if (process()) active = false; break; } c_A += 15; } else { if (c_A < 15) { active = false; break; } c_A -= 15; } y += 10; if (active && process()) active = false; break; case 160: if ( get_elaps_frames() >= 25 ) { if (c_A >= 15 ) c_A -= 15; else { active = false; break; } } if (get_elaps_frames() % 6 == 0) scene_add_effect(parent,161,x,y,dir,-1); angZ += 6; v_inerc -= 0.3; h_inerc *= 0.96; if ( v_inerc + y <= 0 && v_inerc < 0 ) v_inerc = -v_inerc; x += h_inerc * dir; y += v_inerc; if ( process() ) active = false; break; case 161: if ( c_A >= 15 ) { c_A -= 15; v_inerc -= 0.005; y += v_inerc; if (process()) active = false; } else active = false; break; case 162: case 163: case 164: if (c_A >= par1) { angZ += par2; c_A -= par1; v_inerc -= 0.3; h_inerc *= 0.92; if (y + v_inerc <= 0 && v_inerc < 0) v_inerc = -v_inerc; x += h_inerc * dir; y += v_inerc; if (process()) active = false; } else active = false; break; case 165: if (c_A >= 15) { c_A -= 15; angZ -= 15; scaleY = scaleX += 0.3; if (process()) active = false; } else active = false; break; case 200: if ( get_elaps_frames() == 0 ) set_vec_speed(scene_rand_rng(180),scene_rand_rng(10) + 5); angZ += 6; v_inerc -= 0.5; if (scene_rand_rng(100) < 20) scene_add_effect(parent,202,x,y,dir,1); if (v_inerc < 0 && y < 0) { if (scene_rand_rng(100) < 20) v_inerc = (-v_inerc) * 0.5; set_elaps_frames(60); } if ( get_elaps_frames() <= 60 || c_A >= 15 ) { if( get_elaps_frames() > 60 ) c_A -= 15; x += h_inerc * dir; y += v_inerc; if ( process() ) active = false; } else { //HACK /*if ( weather == 21 ) { weather_time += 40; if ( weather_time > 999 ) weather_time = 999; } else if ( weather_time >= 41 ) { weather_time -= 40; } else { weather_time = 1; }*/ scene_play_sfx(26); active = false; } break; case 201: if ( get_elaps_frames() == 0 ) set_vec_speed(scene_rand_rng(180),scene_rand_rng(8)+4); angZ -= 12; v_inerc -= 0.25; if (scene_rand_rng(100) < 10) scene_add_effect(parent, 202, x,y,dir,1); if ( v_inerc < 0.0 && y < 0.0 ) { if ( scene_rand_rng(100) < 20 ) v_inerc = (-v_inerc) * 0.5; set_elaps_frames(60); } if ( get_elaps_frames() <= 60 || c_A >= 15 ) { if( get_elaps_frames() > 60 ) c_A -= 15; x += h_inerc * dir; y += v_inerc; if ( process() ) active = false; } else { //HACK /*if ( weather == 21 ) { weather_time += 5; if ( weather_time > 999 ) weather_time = 999; } else if ( weather_time >= 6 ) { weather_time -= 5; } else { weather_time = 1; }*/ scene_play_sfx(26); active = false; } break; case 202: if ( get_elaps_frames() == 0 ) set_vec_speed(scene_rand_rng(180),1.0); v_inerc -= 0.05; if ( scaleX > 0.0 ) { scaleX -= 0.01; scaleY -= 0.01; } if ( c_A >= 15 ) { c_A -= 15; c_B -= 10; c_G -= 10; y += v_inerc; x += h_inerc * dir; if ( process() ) active = false; } else active = false; break; case 126: case 127: case 128: case 129: case 138: if (process()) active = false; break; default: active = false; } }
void ball::calculateNewDeltasByAngle() { //angle = atan(tan(angle)); dx = speed_mult * cos_deg(angle); dy = speed_mult * sin_deg(angle); }