Changeset 1404
- Timestamp:
- May 20, 2012, 2:30:46 PM (11 years ago)
- Location:
- trunk/orbital
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/player.h
r1398 r1404 16 16 : m_type(type), 17 17 m_stick(0), 18 m_damped_stick(0), 19 m_move_rotation(0), 20 m_exhaust_rotation(0), 21 move_rotation_timer(0), 18 22 m_ready(false) 19 23 { … … 53 57 m_options.Push(m_position, vec3(0.f, 0.f, 0.f)); 54 58 m_options.Push(m_position, vec3(0.f, 0.f, 0.f)); 55 56 move_rotation_timer = 0.0f;57 59 } 58 60 … … 96 98 } 97 99 98 damped_stick.x = damped_stick.x + (seconds / (seconds + 0.18f)) * (rightleft -damped_stick.x);99 damped_stick.z = damped_stick.z + (seconds / (seconds + 0.18f)) * (updown -damped_stick.z);100 vec3 applied_stick = vec3(abs( damped_stick.x), 0.0f,damped_stick.z);101 vec3 offset = vec3((( damped_stick.x < 0.0f)?(abs(damped_stick.x) * 30.f):(0.f)), 0.0f, 0.0f);100 m_damped_stick.x = m_damped_stick.x + (seconds / (seconds + 0.18f)) * (rightleft - m_damped_stick.x); 101 m_damped_stick.z = m_damped_stick.z + (seconds / (seconds + 0.18f)) * (updown - m_damped_stick.z); 102 vec3 applied_stick = vec3(abs(m_damped_stick.x), 0.0f, m_damped_stick.z); 103 vec3 offset = vec3(((m_damped_stick.x < 0.0f)?(abs(m_damped_stick.x) * 30.f):(0.f)), 0.0f, 0.0f); 102 104 103 105 for (int i = 0; i < m_options.Count(); i++) … … 124 126 vec3 target_pos = m_position + pos[i] + (move_pos[i] - pos[i]) * applied_stick + offset; 125 127 m_options[i].m1 = m_options[i].m1 + (seconds / (seconds + 0.1f)) * (target_pos - m_options[i].m1); 126 m_options[i].m2[0] = rot[i][0] + ((( damped_stick.x < 0.0f)?(20.0f):(-20.0f)) - rot[i][0]) * abs(damped_stick.x);127 128 if ( damped_stick.x < 0.3f &&damped_stick.x > -0.3f)128 m_options[i].m2[0] = rot[i][0] + (((m_damped_stick.x < 0.0f)?(20.0f):(-20.0f)) - rot[i][0]) * abs(m_damped_stick.x); 129 130 if (m_damped_stick.x < 0.3f && m_damped_stick.x > -0.3f) 129 131 m_options[i].m2[2] += seconds * (i & 1 ? 600.f : -600.f); 130 132 else 131 m_options[i].m2[2] += seconds * (( damped_stick.x < 0.0f)?(600.0f):(-600.0f));132 } 133 134 if ( damped_stick.x > 0.5f ||damped_stick.x < -0.5f)133 m_options[i].m2[2] += seconds * ((m_damped_stick.x < 0.0f)?(600.0f):(-600.0f)); 134 } 135 136 if (m_damped_stick.x > 0.5f || m_damped_stick.x < -0.5f) 135 137 { 136 138 if (move_rotation_timer > 0.8f) 137 m ove_rotation.z +=damped_stick.x * -420.f * seconds;139 m_move_rotation.z += m_damped_stick.x * -420.f * seconds; 138 140 else 139 141 move_rotation_timer += seconds; … … 142 144 { 143 145 move_rotation_timer = 0.0f; 144 m ove_rotation.z -=move_rotation.z * (seconds / (seconds + 0.2f));145 } 146 147 exhaust_rotation.z += 600.0f * seconds;148 149 if (m ove_rotation.z > 180.f)150 m ove_rotation.z -= 360.f;151 else if (m ove_rotation.z < -180.f)152 m ove_rotation.z += 360.f;153 154 if ( exhaust_rotation.z > 180.f)155 exhaust_rotation.z -= 360.f;156 else if ( exhaust_rotation.z < -180.f)157 exhaust_rotation.z += 360.f;158 159 m_rotation = quat::fromeuler_xyz(vec3((( damped_stick.z <= 0.0f)?(damped_stick.z):(0.0f)) * -60.0f, 0.f, damped_stick.x * -50.0f) +move_rotation);146 m_move_rotation.z -= m_move_rotation.z * (seconds / (seconds + 0.2f)); 147 } 148 149 m_exhaust_rotation.z += 600.0f * seconds; 150 151 if (m_move_rotation.z > 180.f) 152 m_move_rotation.z -= 360.f; 153 else if (m_move_rotation.z < -180.f) 154 m_move_rotation.z += 360.f; 155 156 if (m_exhaust_rotation.z > 180.f) 157 m_exhaust_rotation.z -= 360.f; 158 else if (m_exhaust_rotation.z < -180.f) 159 m_exhaust_rotation.z += 360.f; 160 161 m_rotation = quat::fromeuler_xyz(vec3(((m_damped_stick.z <= 0.0f)?(m_damped_stick.z):(0.0f)) * -60.0f, 0.f, m_damped_stick.x * -50.0f) + m_move_rotation); 160 162 161 163 if (m_type == 0) … … 184 186 if (m_type == 0) 185 187 { 186 m_exhaust_mesh.Render(model * mat4::translate(vec3(-4.f,0.f,0.f)) * mat4::fromeuler_xyz( exhaust_rotation * -1.0f));187 m_exhaust_mesh.Render(model * mat4::translate(vec3( 4.f,0.f,0.f)) * mat4::fromeuler_xyz( exhaust_rotation));188 } 189 else 190 m_exhaust_mesh.Render(model * mat4::fromeuler_xyz( exhaust_rotation));188 m_exhaust_mesh.Render(model * mat4::translate(vec3(-4.f,0.f,0.f)) * mat4::fromeuler_xyz(m_exhaust_rotation * -1.0f)); 189 m_exhaust_mesh.Render(model * mat4::translate(vec3( 4.f,0.f,0.f)) * mat4::fromeuler_xyz(m_exhaust_rotation)); 190 } 191 else 192 m_exhaust_mesh.Render(model * mat4::fromeuler_xyz(m_exhaust_rotation)); 191 193 192 194 for (int i = 0; i < m_options.Count(); i++) 193 195 { 194 196 mat4 t = mat4::translate(m_options[i].m1); 195 if (m_stick && m_stick->GetButtonCount() >= 4 196 && m_stick->GetButton(12)) 197 198 bool fire = m_stick && m_stick->GetButtonCount() >= 4 199 && m_stick->GetButton(12); 200 fire = fire || Input::GetButtonState(305 /* Right Ctrl */); 201 if (fire) 197 202 m_laser_mesh.Render(t); 203 198 204 t *= mat4::fromeuler_yxz(m_options[i].m2); 199 205 m_option_mesh.Render(t); … … 208 214 Array<vec3, vec3> m_options; 209 215 210 vec3 damped_stick;211 vec3 m ove_rotation;212 vec3 exhaust_rotation;216 vec3 m_damped_stick; 217 vec3 m_move_rotation; 218 vec3 m_exhaust_rotation; 213 219 float move_rotation_timer; 214 220 -
trunk/orbital/snake.h
r1397 r1404 73 73 if (!m_stick) 74 74 m_stick = Input::TrackStick(); 75 if (m_stick && m_stick->GetButtonCount() >= 4 76 && m_stick->GetButton(12) 77 && (int)m_steer != (int)(m_steer - 2.f * seconds)) 75 bool fire = m_stick && m_stick->GetButtonCount() >= 4 76 && m_stick->GetButton(12); 77 fire = fire || Input::GetButtonState(305 /* Right Ctrl */); 78 if (fire && (int)m_steer != (int)(m_steer - 2.f * seconds)) 78 79 { 79 80 int tohit = (int)RandF(m_nodes.Count() - 2); … … 128 129 129 130 /* Apply damage */ 130 float damage = std::min(m_nodes[i].m4, 30.f * seconds);131 float damage = std::min(m_nodes[i].m4, 80.f * seconds); 131 132 m_nodes[i].m3 -= damage; 132 133 m_nodes[i].m4 -= damage;
Note: See TracChangeset
for help on using the changeset viewer.