MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / UpdateShipView

Method UpdateShipView

editor/WorldObjectsPlayerDialog.cpp:814–897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812#define NUM_ANIM_FRAMES 30
813
814void CWorldObjectsPlayerDialog::UpdateShipView(void) {
815 int n = D3EditState.current_ship;
816 CWnd *shipwnd;
817 RECT rect;
818 int x, y, bm_handle, w, h, render_handle;
819 static int frame = 0, spin_frame = 0;
820 static int last_ship = -1;
821 static int last_model_handle = -1;
822 static int ship_dir = 0;
823
824 if (Num_ships < 1)
825 return;
826
827 if (ship_dir == 0) {
828 frame++;
829 if (frame == NUM_ANIM_FRAMES) {
830 frame = NUM_ANIM_FRAMES - 1;
831 ship_dir = 1;
832 }
833 } else {
834 frame--;
835 if (frame == -1) {
836 frame = 0;
837 ship_dir = 0;
838 }
839 }
840
841 shipwnd = GetDlgItem(IDC_SHIPVIEW);
842 shipwnd->GetWindowRect(&rect);
843 ScreenToClient(&rect);
844
845 Desktop_surf->attach_to_window((unsigned)m_hWnd);
846
847 w = rect.right - rect.left;
848 h = rect.bottom - rect.top;
849
850 if (m_lod == 0)
851 render_handle = Ships[n].model_handle;
852 else if (m_lod == 1)
853 render_handle = Ships[n].med_render_handle;
854 else
855 render_handle = Ships[n].lo_render_handle;
856
857 if (last_ship != n || last_model_handle != render_handle) {
858 Desktop_surf->clear(rect.left, rect.top, w, h);
859 last_ship = n;
860 last_model_handle = Ships[n].model_handle;
861 }
862
863 bm_handle = render_handle;
864
865 if (bm_handle == -1)
866 return;
867
868 vector zero_vector;
869 vector view_vector = {0, 0, -20};
870 matrix id_matrix, rot_matrix;
871 poly_model *pm = GetPolymodelPointer(bm_handle);

Callers

nothing calls this directly

Calls 14

GetPolymodelPointerFunction · 0.85
vm_MakeZeroFunction · 0.85
StartEditorFrameFunction · 0.85
DrawPolygonModelFunction · 0.85
EndEditorFrameFunction · 0.85
attach_to_windowMethod · 0.80
vm_MakeIdentityFunction · 0.50
vm_AnglesToMatrixFunction · 0.50
clearMethod · 0.45
createMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected