| 1120 | #define NUM_ANIM_FRAMES 30 |
| 1121 | |
| 1122 | void CWorldObjectsGenericDialog::UpdateObjectView(void) { |
| 1123 | CWnd *objwnd; |
| 1124 | RECT rect; |
| 1125 | int x, y, bm_handle, w, h; |
| 1126 | static int frame = 0, spin_frame = 0; |
| 1127 | static int last_object = -1; |
| 1128 | static int last_render_handle = -1; |
| 1129 | static int object_dir = 0; |
| 1130 | |
| 1131 | if (m_current == -1) |
| 1132 | return; |
| 1133 | |
| 1134 | if (object_dir == 0) { |
| 1135 | frame++; |
| 1136 | if (frame == NUM_ANIM_FRAMES) { |
| 1137 | frame = NUM_ANIM_FRAMES - 1; |
| 1138 | object_dir = 1; |
| 1139 | } |
| 1140 | } else { |
| 1141 | frame--; |
| 1142 | if (frame == -1) { |
| 1143 | frame = 0; |
| 1144 | object_dir = 0; |
| 1145 | } |
| 1146 | } |
| 1147 | |
| 1148 | objwnd = GetDlgItem(IDC_GENERIC_OBJECTVIEW); |
| 1149 | objwnd->GetWindowRect(&rect); |
| 1150 | ScreenToClient(&rect); |
| 1151 | |
| 1152 | Desktop_surf->attach_to_window((unsigned)m_hWnd); |
| 1153 | |
| 1154 | w = rect.right - rect.left; |
| 1155 | h = rect.bottom - rect.top; |
| 1156 | |
| 1157 | int render_handle; |
| 1158 | |
| 1159 | if (m_lod == 0) |
| 1160 | render_handle = Object_info[m_current].render_handle; |
| 1161 | else if (m_lod == 1) |
| 1162 | render_handle = Object_info[m_current].med_render_handle; |
| 1163 | else |
| 1164 | render_handle = Object_info[m_current].lo_render_handle; |
| 1165 | |
| 1166 | if (last_object != m_current || last_render_handle != render_handle) { |
| 1167 | Desktop_surf->clear(rect.left, rect.top, w, h); |
| 1168 | last_object = m_current; |
| 1169 | last_render_handle = render_handle; |
| 1170 | } |
| 1171 | |
| 1172 | bm_handle = render_handle; |
| 1173 | |
| 1174 | if (bm_handle == -1) |
| 1175 | return; |
| 1176 | |
| 1177 | vector zero_vector; |
| 1178 | vector view_vector = {0, 0, -20}; |
| 1179 | matrix id_matrix, rot_matrix; |
nothing calls this directly
no test coverage detected