Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==============================================================
- // ORBITER MODULE: Atlantis
- // Part of the ORBITER SDK
- // Copyright (C) 2001-20012 Martin Schweiger
- // All rights reserved
- //
- // Atlantis.cpp
- // Reference implementation of Atlantis (Space Shuttle) vessel
- // class module
- //
- // RMS, grappling and MMU capabilities by Robert Conley
- // ==============================================================
- #define STRICT 1
- #define ORBITER_MODULE
- #include "Atlantis.h"
- #include "PlBayOp.h"
- //#include "AscentAP.h"
- #include "DlgCtrl.h"
- #include "meshres.h"
- #include "meshresods.h"
- #include "RMS2meshres.h"
- #include "meshres_vc_hi.h"
- #include "resource.h"
- #include <stdio.h>
- #include <fstream>
- #include <UltraMath.h>
- #include <CameraMFD_API.h>
- #ifdef _DEBUG
- // D. Beachy: for BoundsChecker debugging
- extern int GrowStack();
- #endif
- #define LOADBMP(id) (LoadBitmap (g_Param.hDLL, MAKEINTRESOURCE (id)))
- // ==============================================================
- // Global (class-wide) parameters
- GDIParams g_Param;
- char *ActionString[5] = {"STOPPED", "ISCLOSED", "ISOPEN", "CLOSE", "OPEN"};
- HELPCONTEXT g_hc = {
- "html/vessels/Atlantis.chm",
- 0,
- "html/vessels/Atlantis.chm::/Atlantis.hhc",
- "html/vessels/Atlantis.chm::/Atlantis.hhk"
- };
- // ==============================================================
- // Local prototypes
- BOOL CALLBACK Atlantis_DlgProc (HWND, UINT, WPARAM, LPARAM);
- BOOL CALLBACK RMS_DlgProc (HWND, UINT, WPARAM, LPARAM);
- BOOL CALLBACK LIGHT_DlgProc(HWND, UINT, WPARAM, LPARAM);
- BOOL CALLBACK PAYLOADOPERATION_DlgProc(HWND, UINT, WPARAM, LPARAM);
- BOOL CALLBACK EVA_DlgProc(HWND, UINT, WPARAM, LPARAM);
- //extern void GetSRB_State (double met, double &thrust_level, double &prop_level);
- // 1. vertical lift component (wings and body)
- int tpir(const double* list, int n_items, double target) {
- // char buf[64];
- if (target<list[0]) return 0;
- if (target >= list[n_items - 1]) return n_items - 2;
- // sprintf(oapiDebugString(),"target %f n_items %d ",target,n_items);
- for (int i = 1; i<n_items; i++) {
- if (i>10) {
- // sprintf(buf,"list[%d] %.2f ",i,list[i]);
- // strcat(oapiDebugString(),buf);
- }
- if (list[i] >= target) {
- //sprintf(buf,"result %d",i-1);
- //strcat(oapiDebugString(),buf);
- return i - 1;
- }
- }
- // sprintf(buf,"result %d",-46);
- // strcat(oapiDebugString(),buf);
- return -46;
- }
- double linterp(double x0, double y0, double x1, double y1, double x) {
- double t = (x - x0) / (x1 - x0);
- return y0*(1 - t) + y1*t;
- }
- double listerp(const double* listx, const double* listy, int n_items, double x) {
- int i = tpir(listx, n_items, x);
- // sprintf(oapiDebugString(),"i %d x0 %f y0 %f x1 %f y1 %f x %f",i,listx[i],listy[i],listx[i+1],listy[i+1],x);
- return linterp(listx[i], listy[i], listx[i + 1], listy[i + 1], x);
- }
- double tableterp(const double* table, const double* listrow, int n_row, const double* listcol, int n_col, double rowlookup, double collookup) {
- int i_row = tpir(listrow, n_row, rowlookup);
- double row0 = listerp(listcol, &table[i_row*n_col], n_col, collookup);
- double row1 = listerp(listcol, &table[(i_row + 1)*n_col], n_col, collookup);
- double t = (rowlookup - listrow[i_row]) / (listrow[i_row + 1] - listrow[i_row]);
- double result = row0*(1 - t) + row1*t;
- // sprintf(oapiDebugString(),"rowlookup %f collookup %f i_row %d row0 %f row1 %f t %f result %f",rowlookup,collookup,i_row,row0,row1,t,result);
- return result;
- // return 0;
- }
- const double RollOff = 10 * 47.880259;
- const double PitchOff = 40 * 47.880259;
- const double YawOff = 1.0;
- const int n_mach = 21;
- const double mach[n_mach] = { 0.25, 0.4, 0.6, 0.8, 0.85, 0.9, 0.92, 0.95, 0.98, 1.05, 1.1, 1.2, 1.3, 1.5, 2, 2.5, 3, 4, 5, 8, 10 };
- const int n_aoa1 = 19;
- const double aoa1[n_aoa1] = { -10, -5, -2.5, 0, 2.5, 5, 7.5, 10, 12.5, 15, 17.5, 20, 22.5, 25, 30, 35, 40, 45, 50 };
- const double clBase[n_aoa1][n_mach] = { { -0.50280, -0.51097, -0.52957, -0.58454, -0.59773, -0.61005, -0.62831, -0.65514, -0.65616, -0.64808, -0.64225, -0.61158, -0.57681, -0.48844, -0.36885, -0.31514, -0.29383, -0.22874, -0.19854, -0.18641, -0.18641 },
- { -0.25906, -0.27397, -0.28670, -0.32761, -0.33790, -0.34601, -0.35039, -0.35897, -0.36172, -0.36027, -0.35685, -0.33449, -0.30454, -0.25188, -0.19695, -0.16705, -0.16922, -0.13893, -0.12424, -0.12402, -0.12402 },
- { -0.15202, -0.16199, -0.17186, -0.19155, -0.19632, -0.20588, -0.21553, -0.21485, -0.19888, -0.20310, -0.19292, -0.18275, -0.16776, -0.12989, -0.09888, -0.10456, -0.10514, -0.10050, -0.09081, -0.08913, -0.08913 },
- { -0.05000, -0.05000, -0.05500, -0.06500, -0.06200, -0.06000, -0.06000, -0.06000, -0.05500, -0.04700, -0.03600, -0.02500, -0.02300, -0.01500, -0.01700, -0.04290, -0.03700, -0.04430, -0.04724, -0.05540, -0.05540 },
- { 0.06214, 0.06212, 0.07201, 0.06176, 0.06652, 0.07101, 0.07563, 0.08498, 0.09414, 0.10315, 0.10796, 0.10460, 0.10295, 0.09317, 0.08416, 0.02995, 0.02048, 0.01111, 0.00642, -0.02023, -0.02023 },
- { 0.17453, 0.17448, 0.17928, 0.18859, 0.19295, 0.20356, 0.21579, 0.23947, 0.24762, 0.25552, 0.25513, 0.25014, 0.24043, 0.21606, 0.16125, 0.10468, 0.08600, 0.06174, 0.04301, 0.01774, 0.01774 },
- { 0.29705, 0.29691, 0.30657, 0.31963, 0.31838, 0.32413, 0.34997, 0.38783, 0.38955, 0.39173, 0.39121, 0.38627, 0.37178, 0.32805, 0.24173, 0.18906, 0.15609, 0.11881, 0.09656, 0.05965, 0.05965 },
- { 0.40448, 0.40924, 0.41674, 0.44384, 0.44172, 0.44572, 0.47690, 0.51887, 0.52899, 0.53602, 0.53054, 0.51767, 0.49146, 0.42874, 0.33103, 0.27135, 0.22528, 0.18185, 0.15220, 0.10604, 0.10604 },
- { 0.51599, 0.52757, 0.54905, 0.56480, 0.56566, 0.56794, 0.58585, 0.64660, 0.66026, 0.66393, 0.66357, 0.63927, 0.61835, 0.54671, 0.41958, 0.35229, 0.29513, 0.24730, 0.21351, 0.16115, 0.16115 },
- { 0.63581, 0.65002, 0.67426, 0.68162, 0.67309, 0.68323, 0.70567, 0.76535, 0.77783, 0.78377, 0.77863, 0.75952, 0.72567, 0.64381, 0.50777, 0.43483, 0.36604, 0.31897, 0.27892, 0.22632, 0.22632 },
- { 0.77676, 0.78385, 0.79709, 0.79087, 0.77995, 0.79401, 0.81577, 0.86501, 0.89069, 0.89596, 0.89086, 0.85608, 0.83073, 0.74311, 0.60244, 0.52033, 0.44227, 0.39229, 0.35079, 0.29998, 0.29998 },
- { 0.91657, 0.92529, 0.92851, 0.89578, 0.87690, 0.89485, 0.91619, 0.96428, 0.99805, 1.00286, 1.00255, 0.95636, 0.92538, 0.83834, 0.68871, 0.60168, 0.52215, 0.46559, 0.42351, 0.36492, 0.35587 },
- { 1.00634, 1.01512, 1.01007, 0.93184, 0.91266, 0.92074, 0.95994, 1.00227, 1.04837, 1.06699, 1.06660, 1.03541, 1.00114, 0.91858, 0.76904, 0.67886, 0.60751, 0.53159, 0.49654, 0.44356, 0.43474 },
- { 1.08364, 1.08846, 1.04489, 0.92283, 0.90795, 0.93837, 0.96751, 1.02232, 1.07579, 1.10328, 1.11188, 1.09985, 1.07176, 0.99205, 0.84561, 0.76551, 0.68386, 0.61884, 0.57019, 0.51805, 0.50936 },
- { 1.30045, 1.30623, 1.25395, 1.10747, 1.08961, 1.12612, 1.16109, 1.22686, 1.29103, 1.32402, 1.33434, 1.31990, 1.28619, 1.19054, 0.99835, 0.91867, 0.84307, 0.76946, 0.72044, 0.66845, 0.64465 },
- { 1.51313, 1.51986, 1.45902, 1.28858, 1.26781, 1.31028, 1.35097, 1.42751, 1.50217, 1.54055, 1.55256, 1.53576, 1.49654, 1.38524, 1.16162, 1.06891, 0.97219, 0.89530, 0.84607, 0.79881, 0.78382 },
- { 1.69584, 1.70339, 1.63520, 1.44418, 1.42090, 1.46850, 1.51411, 1.59988, 1.68356, 1.72658, 1.74004, 1.72121, 1.67725, 1.55251, 1.30189, 1.19799, 1.07919, 1.00341, 0.96129, 0.91017, 0.88400 },
- { 1.82367, 1.83178, 1.75845, 1.55304, 1.52800, 1.57919, 1.62823, 1.72047, 1.81045, 1.85672, 1.87119, 1.85095, 1.80367, 1.66953, 1.40002, 1.28828, 1.15575, 1.07904, 1.03683, 0.98747, 0.96803 },
- { 1.91170, 1.92021, 1.84334, 1.62801, 1.60176, 1.65542, 1.70683, 1.80353, 1.89785, 1.94635, 1.96152, 1.94030, 1.89074, 1.75012, 1.46761, 1.35047, 1.21154, 1.13113, 1.08629, 1.03514, 1.02007 } };
- const double cdBase[n_aoa1][n_mach] = { { 0.11485, 0.11975, 0.13521, 0.16897, 0.18654, 0.19703, 0.20867, 0.22925, 0.25227, 0.26933, 0.27358, 0.27477, 0.27037, 0.25326, 0.21167, 0.18859, 0.17640, 0.15782, 0.14843, 0.14122, 0.14122 },
- { 0.07985, 0.08119, 0.08489, 0.09953, 0.10785, 0.11831, 0.12552, 0.14223, 0.16817, 0.18470, 0.18942, 0.19259, 0.19067, 0.18445, 0.15837, 0.14100, 0.13105, 0.11936, 0.11165, 0.10501, 0.10501 },
- { 0.07170, 0.07263, 0.07517, 0.08323, 0.08675, 0.09887, 0.10710, 0.12269, 0.14461, 0.16251, 0.16647, 0.17013, 0.16958, 0.16572, 0.14245, 0.12598, 0.11599, 0.10538, 0.09795, 0.09067, 0.09067 },
- { 0.06740, 0.06610, 0.07020, 0.07630, 0.08000, 0.09070, 0.09900, 0.11450, 0.13460, 0.15410, 0.15840, 0.16140, 0.16110, 0.15770, 0.13490, 0.11860, 0.10680, 0.09430, 0.08760, 0.08000, 0.08000 },
- { 0.06687, 0.05747, 0.07011, 0.07557, 0.08048, 0.09309, 0.10180, 0.11702, 0.13644, 0.16935, 0.16376, 0.16502, 0.16395, 0.15852, 0.13500, 0.11632, 0.10399, 0.08937, 0.08226, 0.07359, 0.07359 },
- { 0.07038, 0.07096, 0.07350, 0.08175, 0.08916, 0.10574, 0.11515, 0.13127, 0.15286, 0.17724, 0.18173, 0.18139, 0.17763, 0.16938, 0.14189, 0.12068, 0.10700, 0.09063, 0.08096, 0.07142, 0.07140 },
- { 0.08056, 0.06145, 0.08464, 0.10038, 0.10990, 0.12750, 0.13806, 0.15696, 0.18221, 0.20398, 0.20794, 0.20709, 0.20226, 0.18364, 0.15579, 0.13301, 0.11677, 0.09815, 0.08634, 0.07402, 0.07348 },
- { 0.09599, 0.09775, 0.10146, 0.13088, 0.14389, 0.16155, 0.17477, 0.19588, 0.22487, 0.24256, 0.24485, 0.24298, 0.23613, 0.21755, 0.17850, 0.15244, 0.13324, 0.11238, 0.09853, 0.08216, 0.08059 },
- { 0.10625, 0.12444, 0.13381, 0.17827, 0.19090, 0.21031, 0.22196, 0.24823, 0.27902, 0.29479, 0.29645, 0.29055, 0.28325, 0.25989, 0.20958, 0.17951, 0.15649, 0.13380, 0.11760, 0.09780, 0.09544 },
- { 0.15784, 0.16278, 0.18832, 0.23803, 0.25555, 0.27066, 0.28350, 0.31191, 0.34859, 0.35909, 0.35895, 0.35301, 0.34037, 0.30958, 0.24932, 0.21476, 0.18711, 0.16342, 0.14482, 0.12245, 0.11931 },
- { 0.21346, 0.21758, 0.26637, 0.30939, 0.31973, 0.34168, 0.35577, 0.38252, 0.41746, 0.43401, 0.43355, 0.42081, 0.40809, 0.37008, 0.30079, 0.25990, 0.22679, 0.20107, 0.18106, 0.15697, 0.15302 },
- { 0.26859, 0.29389, 0.35519, 0.38857, 0.39759, 0.42137, 0.43584, 0.46452, 0.50331, 0.51932, 0.52016, 0.50090, 0.48367, 0.43922, 0.35911, 0.31286, 0.27582, 0.24672, 0.22523, 0.19614, 0.19178 },
- { 0.36651, 0.37144, 0.43592, 0.45493, 0.46003, 0.48172, 0.50467, 0.53313, 0.57864, 0.59902, 0.59994, 0.58377, 0.56200, 0.51308, 0.42462, 0.37380, 0.33639, 0.29758, 0.27765, 0.24878, 0.24394 },
- { 0.45537, 0.45790, 0.50401, 0.50538, 0.51675, 0.54316, 0.56348, 0.59974, 0.65071, 0.67457, 0.67979, 0.67010, 0.64751, 0.59368, 0.49836, 0.44700, 0.40275, 0.36614, 0.33893, 0.30876, 0.30372 },
- { 0.62879, 0.63228, 0.69595, 0.69784, 0.71354, 0.75001, 0.77807, 0.82814, 0.89852, 0.93146, 0.93867, 0.92529, 0.89410, 0.81977, 0.67501, 0.61723, 0.56977, 0.52265, 0.49216, 0.45821, 0.44343 },
- { 0.85388, 0.85863, 0.94509, 0.94766, 0.96898, 1.01850, 1.05660, 1.12460, 1.22017, 1.26491, 1.27470, 1.25653, 1.21417, 1.11323, 0.91665, 0.83819, 0.76478, 0.70975, 0.67287, 0.63575, 0.62404 },
- { 1.11596, 1.12216, 1.23516, 1.23852, 1.26638, 1.33111, 1.38090, 1.46976, 1.59467, 1.65315, 1.66594, 1.64219, 1.58683, 1.45491, 1.19800, 1.09545, 0.99301, 0.92759, 0.89082, 0.84440, 0.82113 },
- { 1.40622, 1.41403, 1.55642, 1.56065, 1.59576, 1.67732, 1.74007, 1.85204, 2.00944, 2.08312, 2.09924, 2.06932, 1.99956, 1.83333, 1.50959, 1.38037, 1.24741, 1.16885, 1.12550, 1.07445, 1.05430 },
- { 1.74092, 1.75059, 1.92688, 1.93211, 1.97558, 2.07655, 2.15424, 2.29286, 2.48772, 2.57894, 2.59890, 2.56185, 2.47549, 2.26969, 1.86890, 1.70892, 1.54432, 1.44706, 1.38996, 1.33019, 1.31104 } };
- const double cmBase[n_aoa1][n_mach] = { { 0.03200, 0.03400, 0.04000, 0.05900, 0.06800, 0.09000, 0.10100, 0.12600, 0.14000, 0.15800, 0.16250, 0.16200, 0.14800, 0.01300, 0.04200, 0.00450, -0.01800, -0.02940, -0.03370, -0.03500, -0.03500 },
- { 0.03000, 0.03200, 0.03650, 0.04900, 0.05400, 0.06100, 0.06700, 0.08200, 0.09800, 0.11400, 0.11800, 0.11200, 0.09200, 0.06000, 0.01750, -0.00800, -0.01800, -0.02700, -0.03070, -0.03280, -0.03280 },
- { 0.02900, 0.03050, 0.03470, 0.04450, 0.04700, 0.04500, 0.05300, 0.06200, 0.07800, 0.08400, 0.08200, 0.07200, 0.05800, 0.03700, 0.00800, -0.01144, -0.01850, -0.02550, -0.02800, -0.03000, -0.03000 },
- { 0.02800, 0.29000, 0.03300, 0.04000, 0.04000, 0.03500, 0.03800, 0.04200, 0.05500, 0.05500, 0.04700, 0.03400, 0.02500, 0.01400, -0.01300, -0.01480, -0.01900, -0.02310, -0.02400, -0.02700, -0.02700 },
- { 0.02700, 0.02750, 0.03050, 0.03600, 0.03800, 0.03500, 0.02200, 0.02000, 0.03100, 0.02400, 0.01500, 0.00600, -0.00100, -0.00700, -0.01300, -0.01940, -0.01970, -0.02100, -0.02200, -0.02350, -0.02350 },
- { 0.02600, 0.02600, 0.02800, 0.03150, 0.03200, 0.02250, 0.01600, 0.00000, 0.00500, -0.00300, -0.01050, -0.02000, -0.02350, -0.02500, -0.02380, -0.02300, -0.02050, -0.01880, -0.02000, -0.01900, -0.01900 },
- { 0.02400, 0.02400, 0.02400, 0.02250, 0.02200, 0.02000, 0.01200, -0.01600, -0.01500, -0.02200, -0.02900, -0.04000, -0.04400, -0.04100, -0.03360, -0.02480, -0.02150, -0.01820, -0.01810, -0.01560, -0.01550 },
- { 0.02300, 0.02200, 0.02050, 0.01800, 0.01700, 0.01500, 0.00400, -0.02700, -0.03000, -0.03400, -0.04000, -0.05400, -0.06000, -0.05500, -0.03850, -0.02740, -0.02250, -0.01830, -0.01660, -0.01250, -0.01200 },
- { 0.02300, 0.02250, 0.02100, 0.01700, 0.01200, 0.00750, -0.00600, -0.04000, -0.04200, -0.04500, -0.04900, -0.06100, -0.07200, -0.07000, -0.04300, -0.03100, -0.02400, -0.01910, -0.01560, -0.00990, -0.00970 },
- { 0.02400, 0.02200, 0.01600, 0.00600, 0.00050, -0.00250, -0.01800, -0.05000, -0.05200, -0.05800, -0.06200, -0.07200, -0.08300, -0.08200, -0.04720, -0.03510, -0.02700, -0.02010, -0.01520, -0.00725, -0.00780 },
- { 0.01900, 0.01600, 0.00900, -0.00600, -0.01100, -0.01000, -0.02800, -0.05650, -0.06300, -0.07000, -0.07400, -0.08200, -0.09000, -0.09100, -0.05160, -0.03950, -0.03000, -0.02150, -0.01510, -0.00493, -0.00600 },
- { 0.01400, 0.00800, -0.00400, -0.00500, -0.01000, -0.00300, -0.03000, -0.06000, -0.07200, -0.07700, -0.08100, -0.08800, -0.09300, -0.09700, -0.05810, -0.04400, -0.03400, -0.02310, -0.01550, -0.00300, -0.00600 },
- { 0.01050, 0.01000, 0.00600, 0.00260, 0.02000, 0.02000, -0.01200, -0.03500, -0.04700, -0.06100, -0.06800, -0.08000, -0.09100, -0.09500, -0.06150, -0.05000, -0.03700, -0.02350, -0.01700, -0.00400, -0.00620 },
- { 0.10000, 0.01200, 0.03300, 0.08000, 0.09000, 0.09000, 0.08700, 0.07000, 0.02000, -0.02300, -0.04200, -0.06400, -0.07700, -0.08200, -0.06490, -0.05530, -0.04200, -0.02780, -0.01840, -0.00590, -0.00800 },
- { 0.12007, 0.01441, 0.03962, 0.09606, 0.10807, 0.10807, 0.10446, 0.08405, 0.02401, -0.02762, -0.05043, -0.07685, -0.09246, -0.09846, -0.05180, -0.06640, -0.05400, -0.03720, -0.02700, -0.01350, -0.01500 },
- { 0.15655, 0.01879, 0.05166, 0.12524, 0.14089, 0.14089, 0.13619, 0.10958, 0.03131, -0.03601, -0.06575, -0.10019, -0.12054, -0.12837, -0.06753, -0.08657, -0.06600, -0.04850, -0.03940, -0.02570, -0.02600 },
- { 0.19818, 0.02378, 0.06540, 0.15855, 0.17837, 0.17837, 0.17242, 0.13873, 0.03964, -0.04558, -0.08324, -0.12684, -0.15260, -0.16251, -0.08550, -0.10960, -0.08300, -0.06140, -0.05300, -0.04290, -0.04100 },
- { 0.24466, 0.02936, 0.08074, 0.19573, 0.22020, 0.22020, 0.21286, 0.17126, 0.04893, -0.05627, -0.10276, -0.15658, -0.18839, -0.20062, -0.10555, -0.13530, -0.10000, -0.07580, -0.06750, -0.06150, -0.06100 },
- { 0.32582, 0.03910, 0.10752, 0.26066, 0.29324, 0.29324, 0.28346, 0.22807, 0.06516, -0.07494, -0.13684, -0.20852, -0.25088, -0.26717, -0.14056, -0.18018, -0.13317, -0.10094, -0.08330, -0.08190, -0.08200 } };
- const int n_trimExt = 3;
- const double trimExt[n_trimExt] = { -11.7, 0, 22.5 };
- const double cmTrim[n_trimExt][n_mach] = { { 0.0158, 0.016, 0.0179, 0.0204, 0.020165, 0.01993, 0.020866, 0.02149, 0.01803, 0.01574, 0.0136, 0.0148, 0.01141, 0.00981, 0.00578, 0.004215, 0.00265, 0.00603, 0.00791, 0.012, 0.015 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { -0.0424, -0.0442, -0.0488, -0.05562, -0.0559, -0.05618, -0.058004, -0.05922, -0.05222, -0.05241, -0.04894, -0.04195, -0.03722, -0.02979, -0.02112, -0.016505, -0.01189, -0.0328, -0.0442, -0.061, -0.065 } };
- const double OrbiterS = 2690 * 0.3048*0.3048;
- const double Orbiterb = 78.056*0.3048; //Turns out span is not used...
- const double Orbiterc = 39.56*0.3048; //...but chord is
- const double OrbiterA = Orbiterb*Orbiterb / OrbiterS; //Has to be passed, doesn't have to be correct
- void FlatPlateCoeff(double aoa, double *cl, double *cm, double *cd) {
- *cl = 1.2*sin(aoa * 2);
- *cd = 2 * sin(aoa);
- *cm = 0;
- }
- /*
- void VLiftCoeff (VESSEL *v, double aoa, double M, double Re, void* lv, double *cl, double *cm, double *cd) {
- if(M<mach[0])M=mach[0];
- if(M>mach[n_mach-1])M=mach[n_mach-1];
- static const int nabsc=11;
- static const double cmAoA[nabsc]={ -75.0, -60.0, -45.0, -30.0, -15.0, 0.0, 15.0, 30.0, 45.0, 60.0, 75.0 };
- static const double CM[nabsc] = { 0, 0, 0.002, 0.004, 0.0025,0.0012, 0,-0.0012,-0.0007, 0, 0};
- double bfDeploy=-22.5*v->GetControlSurfaceLevel(AIRCTRL_ELEVATORTRIM); //In data book, aft end of body flap up
- //"up trim" is negative. In Orbiter, this is positive.
- if(aoa*180.0/PI<aoa1[0] || aoa*180.0/PI>aoa1[n_aoa1-1]) {
- FlatPlateCoeff(aoa,cl,cm,cd);
- sprintf(oapiDebugString(),"FlatPlate AoA: %f Cl: %f Cd: %f Cm: %f",aoa*180.0/PI,*cl,*cd,*cm);
- } else {
- *cl=tableterp(&clBase[0][0], aoa1, n_aoa1, mach, n_mach, aoa*180.0/PI,M);
- *cd=tableterp(&cdBase[0][0], aoa1, n_aoa1, mach, n_mach, aoa*180.0/PI,M);
- *cm=listerp(cmAoA,CM,nabsc,aoa);
- // *cm=tableterp(&cmBase[0][0], aoa1, n_aoa1, mach, n_mach, aoa*180.0/PI,M);
- // *cm+=tableterp(&cmTrim[0][0], trimExt, n_trimExt, mach, n_mach, bfDeploy,M);
- sprintf(oapiDebugString(),"TableM: %f TableAoA: %f Cl: %f Cd: %f Cm: %f bf: %f",M,aoa*180.0/PI,*cl,*cd,*cm,bfDeploy);
- }
- }
- */
- void VLiftCoeff(VESSEL* vv, double aoa, double M, double Re, void* stuff, double *cl, double *cm, double *cd){
- Atlantis* v = (Atlantis*)vv;
- if (M<mach[0])M = mach[0];
- if (M>mach[n_mach - 1])M = mach[n_mach - 1];
- double Tablecl = tableterp(&clBase[0][0], aoa1, n_aoa1, mach, n_mach, aoa*180.0 / PI, M);
- double Tablecd = tableterp(&cdBase[0][0], aoa1, n_aoa1, mach, n_mach, aoa*180.0 / PI, M);
- static const double step = RAD*15.0;
- static const double istep = 1.0 / step;
- static const int nabsc = 25;
- // -180 -165 -150 -135 -120 -105 -90 -75.0 -60.0 -45.0 -30.0 -15.0 0.0 15.0 30.0 45.0 60.0 75.0 90.0 105.0 120.0 135.0 150.0 165.0 180.0
- static const double CL[nabsc] = { 0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1 };
- static const double CM[nabsc] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.002, 0.004, 0.0025, 0.0012, 0, -0.0012, -0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- // lift and moment coefficients from -180 to 180 in 15 degree steps.
- // This uses a documented lift slope of 0.0437/deg, everything else is rather ad-hoc
- // change for drag increase at high Mach:
- // Subsonic Equivalents
- double Cl0, Cl1, Cd0, Cd1, Cd2;
- if (M >= 5.0) {
- Cl0 = -0.207040;
- Cl1 = 1.675600;
- Cd0 = 0.078540;
- // Cd1 = -0.352900;
- // Cd2 = 2.039960;
- // at 40 deg Alpha, Cd = .078540 - .24637 + .994252 = .826422 Cl = .96275
- // want to reduce it 15%
- // at 25 deg, it's ok (Cd = .3129)
- // then, Cd1p = (.1142-.1904*(Cd40p - Cd0))/.0798
- // Cd2p = (.2344-.4363*Cd1p)/.1904
- // Cl1p = (Cl40p-.5241)/.2618
- // Cl0p = .5241 - Cl1p*.4363
- // Cd40p = .7025 (Baseline -15%)
- Cd1 = -0.05767;
- Cd2 = 1.3632;
- // add 5% (Cd40p = .86774)
- // Cd1 = -0.4519;
- // Cd2 = 2.2666;
- *cl = Cl0 + Cl1*aoa;
- *cd = Cd0 + Cd1*aoa + Cd2*aoa* aoa;
- }
- int idx = max(0, min(23, (int)((aoa + PI)*istep)));
- double d = (aoa + PI)*istep - idx;
- *cm = (CM[idx] + (CM[idx + 1] - CM[idx])*d);
- if (M<1.25) {
- *cl = CL[idx] + (CL[idx + 1] - CL[idx])*d;
- // *cd = 0.05 + oapiGetInducedDrag (*cl, 2.266, 0.75);
- *cd = 0.05 + oapiGetInducedDrag(*cl, 2.266, 0.75);
- }
- else if (M<5.0) {
- *cl = CL[idx] + (CL[idx + 1] - CL[idx])*d;
- // *cd = 0.09 + oapiGetInducedDrag (*cl, 2.266, 0.5);
- *cd = 0.09 + oapiGetInducedDrag(*cl, 2.266, 0.75);
- }
- // sprintf(oapiDebugString(),"P%d Y%d R%d TableM: %f TableAoA: %f Table Cl: %f AFCS Cl: %f Table Cd: %f AFCS Cd: %f",v->PitchActive,v->YawActive,v->RollActive,M,aoa*180.0/PI,Tablecl,*cl,Tablecd,*cd);
- *cl = Tablecl;
- *cd = Tablecd;
- // *cm=tableterp(&cmBase[0][0], aoa1, n_aoa1, mach, n_mach, aoa*180.0/PI,M);
- // *cm+=tableterp(&cmTrim[0][0], trimExt, n_trimExt, mach, n_mach, bfDeploy,M);
- }
- // 2. horizontal lift component (vertical stabiliser and body)
- void HLiftCoeff(double beta, double M, double Re, double *cl, double *cm, double *cd)
- {
- static const double step = RAD*22.5;
- static const double istep = 1.0 / step;
- static const int nabsc = 17;
- static const double CL[nabsc] = { 0, 0.2, 0.3, 0.2, 0, -0.2, -0.3, -0.2, 0, 0.2, 0.3, 0.2, 0, -0.2, -0.3, -0.2, 0 };
- beta += PI;
- int idx = max(0, min(15, (int)(beta*istep)));
- double d = beta*istep - idx;
- *cl = CL[idx] + (CL[idx + 1] - CL[idx])*d;
- *cm = 0.0;
- *cd = 0.02 + oapiGetInducedDrag(*cl, 1.5, 0.6);
- }
- // ==============================================================
- // Specialised vessel class Atlantis
- // ==============================================================
- // --------------------------------------------------------------
- // Constructor
- // --------------------------------------------------------------
- Atlantis::Atlantis(OBJHANDLE hObj, int fmodel)
- : VESSEL4(hObj, fmodel)
- {
- #ifdef _DEBUG
- // D. Beachy: for BoundsChecker debugging
- GrowStack();
- #endif
- int i;
- plop = new PayloadBayOp(this);
- // ascap = new AscentAP (this);
- // ascapMfdId = RegisterAscentApMfd ();
- status = 3;
- gear_status = AnimState::CLOSED;
- gear_proc = 0.0;
- ldoor_drag = rdoor_drag = 0.0;
- spdb_status = AnimState::CLOSED;
- spdb_proc = 0.0;
- //light
- flood1_status = 0;
- flood2_status = 0;
- flood3_status = 0;
- flood4_status = 0;
- flood5_status = 0;
- flood6_status = 0;
- floodon = 0;
- aft_light_status = 0;
- rmslight_status = 0;
- docklight_status = 0;
- Shuttlechutereleased = 0;
- wheelbrake = 0;
- spintable = 0;
- spintable1 = 0;
- spintable4 = 0;
- spintable5 = 0;
- rotchange = 0;
- rotchange1 = 0;
- rotchange4 = 0;
- rotchange5 = 0;
- //met
- GMTmode = 0;
- Testmode = 0;
- METmode = 1;
- FGMTmode = 0;
- FTestmode = 0;
- FMETmode = 1;
- MET = 0;
- switchtimer = 0;
- AFTtimer_state[0] = 0;
- AFTtimer_state[1] = 0;
- AFTtimer_state[2] = 0;
- AFTtimer_state[3] = 0;
- AFTtimer_state[4] = 0;
- AFTtimer_state[5] = 0;
- AFTtimer_state[6] = 0;
- AFTtimer_state[7] = 0;
- AFTtimer_state[8] = 0;
- Ftimer_state[0] = 0;
- Ftimer_state[1] = 0;
- Ftimer_state[2] = 0;
- Ftimer_state[3] = 0;
- Ftimer_state[4] = 0;
- Ftimer_state[5] = 0;
- Ftimer_state[6] = 0;
- Ftimer_state[7] = 0;
- Ftimer_state[8] = 0;
- //etimer
- time = 0;
- clk = 0.0;
- Etimer_state[0] = 0;
- Etimer_state[1] = 0;
- Etimer_state[2] = 0;
- Etimer_state[3] = 0;
- TimerStart = 0;
- up = false;
- ETest = 0;
- TimerReset = 0;
- Minutes2set = 0;
- Minutes1set = 0;
- Minutes4set = 0;
- Minutes3set = 0;
- FRONTMINUTE2_proc = 0;
- FRONTMINUTE1_proc = 0;
- FRONTSECOND2_proc = 0;
- FRONTSECOND1_proc = 0;
- //
- timeAFT = 0;
- clkAFT = 0.0;
- EtimerAFT_state[0] = 0;
- EtimerAFT_state[1] = 0;
- EtimerAFT_state[2] = 0;
- EtimerAFT_state[3] = 0;
- TimerStartAFT = 0;
- upAFT = false;
- ETestAFT = 0;
- TimerResetAFT = 0;
- Minutes2setAFT = 0;
- Minutes1setAFT = 0;
- Minutes4setAFT = 0;
- Minutes3setAFT = 0;
- AFTMINUTE2_proc = 0;
- AFTMINUTE1_proc = 0;
- AFTSECOND2_proc = 0;
- AFTSECOND1_proc = 0;
- A2Test = 0;
- PANELa2pwr = 1;//pwr is on
- currentHudMode = 0;
- //
- engine_light_level = 0.0;
- COLOUR4 col_diff = {1,0.8,0.8,0};
- COLOUR4 col_zero = {0,0,0,0};
- //engine_light = AddPointLight (_V(0,0,-25), 300, 2e-4, 0, 4e-4, col_diff, col_zero, col_zero);
- //engine_light->SetIntensityRef (&engine_light_level);
- ARM_OPERATING_SPEED = .005;
- OV = 103;
- LoadMeshes();
- reset_sat = false;
- render_cockpit = false;
- rmsspeed = 5;
- //for (i = 0; i < 6; i++)
- // mfdbright[i] = 1.0;
- // propellant resources
- ph_oms = CreatePropellantResource (ORBITER_MAX_PROPELLANT_MASS); // OMS propellant
- SetDefaultPropellantResource (ph_oms); // display OMS tank level in generic HUD
- // Orbiter engines
- CreateSSME(); // main thrusters
- CreateOMS(); // OMS thrusters (activated only after tank separation)
- CreateRCS(); // Reaction control system (activated only after tank separation)
- // Animations
- DefineAnimations();
- // Aerodynamics
- CreateAirfoils();
- //hDockODS = CreateDock(ORBITER_DOCKPOS, _V(0, 1, 0), _V(0, 0, -1)); //dock for ods
- // CreateDock(_V(0.0, -.8, 10.5), _V(0, 1, 0), _V(0, 0, -1));
- // hDockET = CreateDock (_V(0.0,-2.48, 8.615), _V(0,-1,0), _V(0,0,1));
- //dock for eva
- //pET = NULL; // ET reference
- center_arm = false;
- arm_moved = arm_scheduled = armOBSS_moved =false;
- //bManualSeparate = false;
- // do_eva = false;
- do_plat = false;
- do_cargostatic = false;
- vis = NULL;
- cargo_static_ofs =_V(0,0,0);
- //
- spbrkx = 0;
- EXT_proc = 0;
- ORIGINAL = 0;
- MIDMODEL = 0;
- EVA1 = 0;
- EVA2 = 0;
- EVA3 = 0;
- EVA4 = 0;
- NOKU = 0;
- NOWIRE = 0;
- GRAB = 0;
- distattach = 0;
- geararmed = 0;
- EXT_status = HATCH_UP;
- OBSS_status = HATCH_UP;
- DOCKRING_status = HATCH_UP;
- DOCKRING_proc = 0;
- Armtilt_status = HATCH_UP;
- Armtilt_proc = 0;
- CHUTE_status = HATCH_DOWN;
- CHUTE_proc = 1;
- OBSS_proc = 0;
- DRAGCHUTEDEPLOYED = 0;
- ODS = 0;
- EXTAIRLOCK = 0;
- SETD_status = HATCH_UP;
- PETD_status = HATCH_UP;
- SETD_proc = 0;
- PETD_proc = 0;
- ssmestow_status = HATCH_UP;
- ssmestow_proc = 0;
- ADTA_status = HATCH_UP;
- ADTA_proc = 0;
- IUS_check = IUS_STOP;
- ius_proc = 0;
- mfd1pwr = 0;
- mfd2pwr = 0;
- mfdApwr = 0;
- mfd0pwr = 0;
- firstStep = true;
- // default arm status: stowed
- rmsspeed = 0;
- arm_sy = 0.5;
- arm_sp = 0.0;
- arm_ep = 0.0;
- arm_wp = 0.5;
- arm_wy = 0.5;
- arm_wr = 0.5;
- spdb_on = 0;
- spdb_off = 0;
- spdb_plus = 0;
- spdb_minus = 0;
- RMSSELECT = 0;
- storerms = 0;
- recallstored = 0;
- rmsexecute = 0;
- RMSDIALOG = 0;
- //ku
- elevation = 0;
- //
- //
- //scn read if payload mass is used or not set to zero
- PMASS0 = 0;
- PMASS1 = 0;
- PMASS2 = 0;
- PMASS3 = 0;
- //VCCAM
- VCCAM = 0;
- KURATE = 0;
- KUAZ = 0;
- KUEL = 0;
- //payload mass set to 0
- MASS1 = 0.0;
- MASS2 = 0.0;
- MASS3 = 0.0;
- MASS0 = 0.0;
- //new
- ft_pad_att_pos = _V(0, 0.7, 11.321);
- ft_pad_att1_pos = _V(0, 0.7, 11.321);
- ft_pad_att2_pos = _V(0, 0.7, 11.321);
- ft_pad_att3_pos = _V(0, 0.7, 11.321);
- ft_pad_att_dir = _V(0, 1, 0);// _V(0, 1, 0), _V(0, 0, -1),
- ft_pad_att1_dir = _V(0, 1, 0);
- ft_pad_att2_dir = _V(0, 1, 0);
- ft_pad_att3_dir = _V(0, 1, 0);
- ft_pad_att_rot = _V(0, 0, -1);
- ft_pad_att1_rot = _V(0, 0, -1);
- ft_pad_att2_rot = _V(0, 0, -1);
- ft_pad_att3_rot = _V(0, 0, -1);
- //rms new
- arm1_Bp = arm2_Bp = arm3_Bp = arm4_Bp = arm6_Bp = 0.0;
- arm1_By = arm2_By = arm3_By = arm4_By = 0.0;
- arm1_ep = arm2_ep = arm3_ep = arm4_ep = arm6_ep = 0.0;
- arm1_Ar = arm2_Ar = arm3_Ar = arm4_Ar = 0.0;
- arm1_Ap = arm2_Ap = arm3_Ap = arm4_Ap = 0.0;
- arm1_Ay = arm2_Ay = arm3_Ay = arm4_Ay = 0.0;
- systart = .5;
- spstart = 0.0136;
- epstart = 0.0123;
- wrstart = .6;
- wystart = .5;
- wpstart = .5;
- arm6_By = .5;
- arm6_Ap = 0.5;
- arm6_Ar = 0.5;
- arm6_Ay = 0.5;
- Seqindex = 0;
- update_vectors = true;
- //arm_tip[0] = _V(-2.26,1.71,-6.5);
- //arm_tip[1] = _V(-2.26,1.71,-7.5);
- //arm_tip[2] = _V(-2.26,2.71,-6.5);
- arm_tip[0] = RMS_EE_POS;
- arm_tip[1] = RMS_EE_POS + _V(0.0, 0.0, -1.0); // to calculate EE attachment direction (-Z coordinate of attachment point is negative, so subtract 1 here)
- arm_tip[2] = RMS_EE_POS + RMS_Z_AXIS; // to calculate rot vector for attachment
- //arm_tip[3] = RMS_EE_POS + RotateVectorZ(_V(0.0, -1.0, 0.0), RMS_ROLLOUT_ANGLE); // to calculate arm_ee_rot (rot vector in IK frame)
- arm_tip[3] = RMS_EE_CAM_POS; // to calculate EE camera position
- arm_tip[4] = RMS_EE_LIGHT_POS;
- arm_tip[5] = RMS_ELBOW_CAM_POS;
- //RMS elbow camera
- camRMSElbowLoc[0] = RMS_ELBOW_CAM_POS;
- camRMSElbowLoc[1] = camRMSElbowLoc[0] + _V(0, 0, -1);
- camRMSElbowLoc[2] = camRMSElbowLoc[0] + RMS_ELBOW_CAM_AXIS;
- armobss_tip[0] = OBSS_POS;
- armobss_tip[1] = OBSS_POS + _V(0.0, 1.0, 0.0);
- armobss_tip[2] = OBSS_POS + _V(0.0, 0.0, 1.0);
- arm_ius[0] = pl1_ofs;
- arm_ius[1] = pl1_ofs + _V(0.0, 0.0, 1.0);
- arm_ius[2] = pl1_ofs + _V(1.0, 0.0, 0.0);
- stow_time = 0;
- //RMSDIALOG = 3;
- //dockpos = _V(0.0, 2.40, 10.15);
- ringpos = _V(0.0, 2.259, 10.141);
- olddockpos = 2.0;
- SPIN0 = 0;
- //USEIUS
- USEIUS = 0;
- NOSLIDEWIRE = 0;
- tiltvalue = 10;
- tilt = 0;
- spintable_vel = 0;
- spintable_phi = 0;
- // Entry particle stream
- PARTICLESTREAMSPEC rps = {
- 0, 20, 20, 0, 0.03, 0.5, 100, 3, PARTICLESTREAMSPEC::DIFFUSE,
- PARTICLESTREAMSPEC::LVL_FLAT, 1, 1, PARTICLESTREAMSPEC::ATM_PLIN, 6e7, 12e7
- };
- AddReentryStream (&rps);
- vccameracase = 4;
- //CAMERA
- PBCAMERA = 0;
- MAX_PLB_CAM_PAN = 65;
- MAX_PLB_CAM_TILT = 170;
- CAMRATE = .1;
- a = 0.0;
- b = 0.0;
- c = 0.0;
- for (int i = 0; i < 4; i++) {
- camYaw[i] = 0;
- camPitch[i] = 0;
- }
- camera_moved = false;
- //eva
- CREW1 = 0;
- CREW2 = 0;
- CREW3 = 0;
- CREW4 = 0;
- strcpy(crew2_name, "Eva_2");
- strcpy(crew2_cfg, "SHUTTLEEVA2");
- strcpy(crew1_name, "Eva_1");
- strcpy(crew1_cfg, "SHUTTLEEVA1");
- strcpy(crew3_name, "Eva_3");
- strcpy(crew3_cfg, "SHUTTLEEVA3");
- strcpy(crew4_name, "Eva_4");
- strcpy(crew4_cfg, "SHUTTLEEVA4");
- //ascentApDlg = 0;
- cameraMFD[0] = cameraMFD[1] = cameraMFD[2] = nullptr;
- // oapi::Font* font1 = oapiCreateFont(50, true, "*Seven Segment");
- // oapi::Font* font2 = oapiCreateFont(40, true, "*Seven Segment");
- // oapi::Font* font3 = oapiCreateFont(-11, true, "Arial");
- //gBlackBrush = oapiCreateBrush(0x000000);
- }
- // --------------------------------------------------------------
- // Destructor
- // --------------------------------------------------------------
- Atlantis::~Atlantis ()
- {
- // UnregisterMFDMode (ascapMfdId);
- // if (ascentApDlg) delete ascentApDlg;
- // delete ascap;
- delete plop;
- int i;
- for (i = 0; i < 6; i++) delete rms_anim[i];
- }
- void Atlantis::SelectCockpitView(int CAM)
- {
- /* if (CAM == 0) {
- SetCameraDefaultDirection(_V(0, 0, 1));
- SetCameraOffset(_V(-0.67, 2.55, 14.4));
- oapiCameraSetCockpitDir(0, 0);
- }
- if (CAM == 1) {
- SetCameraDefaultDirection(_V(0, 0, -1));
- SetCameraOffset(_V(-1.850, 1.8, 11.750));
- oapiCameraSetCockpitDir(0, 0);
- }
- if (CAM == 2){
- SetCameraDefaultDirection(_V(0, 0, 1));
- SetCameraOffset(_V(-2.2, 1.8, -6.250));
- oapiCameraSetCockpitDir(0, 0);
- };
- if (CAM == 3){
- SetCameraDefaultDirection(_V(0, 0, 1));
- SetCameraOffset(_V(2.2, 1.8, -6.250));
- oapiCameraSetCockpitDir(0, 0);
- };
- if (CAM == 4){
- SetCameraDefaultDirection(_V(0, 0, -1));
- SetCameraOffset(_V(1.850, 1.8, 11.750));
- oapiCameraSetCockpitDir(0, 0);
- };
- if (CAM == 5){
- SetCameraDefaultDirection(_V(0, 1, 0));
- SetCameraOffset(KEELCAM);
- oapiCameraSetCockpitDir(0, 0);
- };
- if (CAM == 8){
- SetCameraDefaultDirection(_V(0, 1, 0));
- SetCameraOffset(_V(0, 1.27, 10.138));
- // sprintf(oapiDebugString(), "armtip3x %2.2f armtip3y %2.2f armtip3z %2.2f", arm_tip[5].x, arm_tip[5].y, arm_tip[5].z);
- oapiCameraSetCockpitDir(0, 0);
- }
- /*
- if (CAM == 6){
- VECTOR3 dir = camRMSElbowLoc[1] - camRMSElbowLoc[0];
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- VECTOR3 orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- double angle = SignedAngle(orbiter_cam_rot, camRMSElbowLoc[2] - camRMSElbowLoc[0], dir);
- SetCameraDefaultDirection(dir, angle);
- SetCameraOffset(camRMSElbowLoc[0]);
- oapiCameraSetCockpitDir(0.0, 0.0);
- }
- if (CAM == 7){ //ee view
- // calculate rotation angle for EE cam
- VECTOR3 dir = arm_tip[1] - arm_tip[0];
- // if camera is pointing straight up or down, make it slightly offset from (0,1,0) vector
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- VECTOR3 orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- double angle = SignedAngle(orbiter_cam_rot, arm_tip[2] - arm_tip[0], dir);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f dir: %f %f %f dot_prod: %f Angle: %f %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, dir.x, dir.y, dir.z, dot_prod, angle, angle*DEG);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f cam dir: %f %f %f dir: %f %f %f Angle: %f %f length: %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, arm_tip[2].x-arm_tip[0].x, arm_tip[2].y-arm_tip[0].y, arm_tip[2].z-arm_tip[0].z, dir.x, dir.y, dir.z, angle, angle*DEG, length(dir));
- //sprintf_s(oapiDebugString(), 255, "dot_prod: %f Angle: %f %f", dot_prod, angle, angle*DEG);
- SetCameraOffset( arm_tip[4] );
- //STS()->SetCameraDefaultDirection (arm_tip[1]-arm_tip[0], 0.0);
- SetCameraDefaultDirection(dir, angle);
- oapiCameraSetCockpitDir(0.0, 0.0);
- }
- /*
- //SetCameraDefaultDirection(_V(0, 0, -1));
- VECTOR3 dir = arm_tip[1] - arm_tip[0];
- //oapiAnnotationSetText(nhCameraLabel, "LEE camera");
- // double CalculateCameraRotationAngle(VECTOR3& dir, const VECTOR3& rot);
- SetCameraOffset(arm_tip[5]);
- Cameraangle = (arm_tip[2] - arm_tip[0]);
- SetCameraDefaultDirection(dir);
- sprintf(oapiDebugString(), "armtip3x %2.2f armtip3y %2.2f armtip3z %2.2f Cam_x %2.2f Cam_y %2.2f Cam_z %2.2f", arm_tip[5].x, arm_tip[5].y, arm_tip[5].z, dir.x, dir.y, dir.z);
- //sprintf(oapiDebugString(), "armtip3x %2.2f armtip3y %2.2f armtip3z %2.2f", Cameraangle.x, Cameraangle.y, Cameraangle.z);
- oapiCameraSetCockpitDir(0, 0);
- };
- //SetCameraDefaultDirection(_V(0, 1, 0));
- //SetCameraOffset(_V(0, 1.27, 10.138));
- // sprintf(oapiDebugString(), "armtip3x %2.2f armtip3y %2.2f armtip3z %2.2f", arm_tip[5].x, arm_tip[5].y, arm_tip[5].z);
- //oapiCameraSetCockpitDir(0, 0);
- */
- }
- // --------------------------------------------------------------
- // Load the meshes for cockpit and exterior
- // --------------------------------------------------------------
- void Atlantis::LoadMeshes()
- {
- // Retrieve mesh handles
- hOrbiterCockpitMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\EARLYVCMFDCCTV3EXTERNAL"); // mesh 0
- //which orbitermesh
- if ((OV == 102) && (ORIGINAL == 0) && (MIDMODEL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ColumbiaLATE2016H2");//new shuttlebody2/8/20
- else if ((OV == 104) && (ORIGINAL == 0) && (MIDMODEL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Atlantis\\Atlantis2016H1");//new shuttlebody2/8/20
- else if ((OV == 99) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Challenger\\Challengerlate2016H2");//new shuttlebody2/8/20
- else if ((OV == 99) && (ORIGINAL == 1)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Challenger\\ChallengerORG2016H2");//new shuttlebody2/8/20
- else if ((OV == 103) && (ORIGINAL == 0)&& (MIDMODEL==0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Discovery\\Discoverylate2016H2");//new shuttlebody2/8/20
- else if ((OV == 105) && (ORIGINAL == 0))hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Endeavour\\Endeavour2016h");//new shuttlebody2/8/20
- else if (OV == 108)hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Constellation\\Constellation2016g");//new shuttlebody2/8/20
- else if (OV == 109)hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Constellation\\ConstellationUSA2016F"); //new shuttlebody2/8/20
- else if (OV == 107)hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Intrepid\\Intrepid2016F");//new shuttlebody2/8/20
- else if (OV == 106 )hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Constitution\\Constitution2016F");//new shuttlebody1/27/20
- else if ((OV == 103) && (ORIGINAL == 1) && (MIDMODEL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Discovery\\DiscoveryORG2016H2");//new shuttlebody2/8/20
- else if ((OV == 105) && (ORIGINAL == 1))hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Endeavour\\EndeavourORG2016h");//new shuttlebody2/8/20
- else if ((OV == 102) && (ORIGINAL == 1) && (MIDMODEL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ColumbiaORG2016H7");//new shuttlebody2/8/20
- else if ((OV == 104) && (ORIGINAL == 1)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Atlantis\\AtlantisORG2016H2");//new shuttlebody2/8/20
- else if ((OV == 103) && (MIDMODEL == 1) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Discovery\\DiscoveryMID2016H2");//new shuttlebody2/8/20
- else if ((OV == 102) && (ORIGINAL == 1) && (MIDMODEL == 1)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\Columbiamid2016G");//new shuttlebody2/8/20
- else if ((OV == 102) && (ORIGINAL == 0) && (MIDMODEL == 1)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\Columbiamid2016G");//new shuttlebody2/8/20
- //new fictional
- else if ((OV == 98) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSPATHFINDER2016B");////new shuttlebody1/27/20
- else if ((OV == 149) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSSHUTTLETWA2016B");//new shuttlebody1/27/20
- else if ((OV == 121) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSSHUTTLEUSAF2016B");//new shuttlebody1/27/20
- else if ((OV == 111) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSSHUTTLEENDEAVOURUSA2016B"); //new shuttlebody1/27/20
- else if ((OV == 112) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSSHUTTLEATLANTISUSAF2016B");//new shuttlebody1/27/20
- else if ((OV == 101) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSENTERPRISE2016B");//new shuttlebody1/27/20
- else if ((OV == 140) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSAMERICA2016B");//new shuttlebody1/27/20
- else if ((OV == 141) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSDESTINY2016B");//new shuttlebody1/27/20
- else if ((OV == 142) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSEXPLORER2016B");//new shuttlebody1/27/20
- else if ((OV == 143) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSDAEDALUS2016B");//new shuttlebody1/27/20
- else if ((OV == 007) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSMOONRAKER2016B"); //new shuttlebody1/27/20
- else if ((OV == 130) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSVENTURE");//new shuttlebody1/27/20
- else if ((OV == 131) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSVENTURE1");//new shuttlebody1/27/20
- else if ((OV == 132) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSVENTURE2");//new shuttlebody1/27/20
- else if ((OV == 133) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSVENTURE3");//new shuttlebody1/27/20
- else if ((OV == 134) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSVENTURE4");//new shuttlebody1/27/20
- else if ((OV == 135) && (ORIGINAL == 0)) hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\STSVENTURE5");//new shuttlebody1/27/20
- else hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Discovery\\DiscoveryORG2016H2");//new shuttlebody2/8/20
- //mesh 1
- hOrbiterVCMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\EARLYvcmfdCCTV3MET21");//mesh 2
- hOrbiterODSMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\NEWODS3");//mesh 3
- hOrbiterRMS1Mesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\RMS4A");//mesh 4
- hOrbiterdragchuteMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\shuttlechutedeployed");//mesh 3
- //hOrbiterdragchutereleasedMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\shuttlechutereleased");//mesh 3
- hOrbiterMPMobss = oapiLoadMeshGlobal("2016SPACESHUTTLE\\OBSSMPM");
- hOrbiterEXTAIRLOCK = oapiLoadMeshGlobal("2016SPACESHUTTLE\\EXTERNALAIRLOCK4");
- hOrbiterKU = oapiLoadMeshGlobal("2016SPACESHUTTLE\\KU_BAND_ANTENNAnew");
- hOrbiterSLIDEWIRE = oapiLoadMeshGlobal("2016SPACESHUTTLE\\SLIDEWIRE");
- hOrbiterSHUTTLEWIRE = oapiLoadMeshGlobal("2016SPACESHUTTLE\\SHUTTLEWIRE");
- hOrbiterTHERMALCOVER = oapiLoadMeshGlobal("2016SPACESHUTTLE\\THERMALCOVER");
- hOrbiterDRAGCHUTEHUD = oapiLoadMeshGlobal("2016SPACESHUTTLE\\DRAGCHUTEHUD");
- // Load meshes
- mesh_cockpit = AddMesh(hOrbiterCockpitMesh);//mesh 0
- SetMeshVisibilityMode(mesh_cockpit, MESHVIS_EXTERNAL);
- mesh_orbiter = AddMesh(hOrbiterMesh);//mesh 1
- SetMeshVisibilityMode(mesh_orbiter, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
- //SetMeshVisibilityMode(mesh_orbiter, MESHVIS_COCKPIT);
- mesh_vc = AddMesh(hOrbiterVCMesh);//mesh 2
- SetMeshVisibilityMode(mesh_vc, MESHVIS_VC) ;
- mesh_ODS = AddMesh(hOrbiterODSMesh);//mesh 3
- SetMeshVisibilityMode(mesh_ODS, MESHVIS_NEVER);
- mesh_RMS1 = AddMesh(hOrbiterRMS1Mesh);//mesh 4
- SetMeshVisibilityMode(mesh_RMS1, MESHVIS_NEVER);
- mesh_DRAGCHUTE = AddMesh(hOrbiterdragchuteMesh);//mesh 5
- SetMeshVisibilityMode(mesh_DRAGCHUTE, MESHVIS_NEVER);
- mesh_EXTAIRLOCK = AddMesh(hOrbiterEXTAIRLOCK);//mesh 6
- SetMeshVisibilityMode(mesh_EXTAIRLOCK, MESHVIS_NEVER);
- //mesh_DRAGCHUTERELEASED = AddMesh(hOrbiterdragchutereleasedMesh);//mesh 6
- //SetMeshVisibilityMode(mesh_DRAGCHUTERELEASED, MESHVIS_NEVER);
- mesh_MPMOBSS = AddMesh(hOrbiterMPMobss);//mesh7
- SetMeshVisibilityMode(mesh_MPMOBSS, MESHVIS_NEVER);
- mesh_KU = AddMesh(hOrbiterKU);//mesh8
- SetMeshVisibilityMode(mesh_KU, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
- mesh_SLIDEWIRE = AddMesh(hOrbiterSLIDEWIRE);//mesh9
- SetMeshVisibilityMode(mesh_SLIDEWIRE, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
- mesh_SHUTTLEWIRE = AddMesh(hOrbiterSHUTTLEWIRE);//mesh10
- SetMeshVisibilityMode(mesh_SHUTTLEWIRE, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
- mesh_THERMALCOVER = AddMesh(hOrbiterTHERMALCOVER);//mesh11
- SetMeshVisibilityMode(mesh_THERMALCOVER, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
- mesh_DRAGCHUITEHUD = AddMesh(hOrbiterDRAGCHUTEHUD);//mesh11
- SetMeshVisibilityMode(mesh_DRAGCHUITEHUD, MESHVIS_NEVER);
- //ShiftMesh(2, _V(0.01, -0.0380, -.4125));
- //ShiftMesh(4, _V(-.2, 0, 0));
- // Optonal meshes
- mesh_cargo = NULL;
- mesh_platform = NULL;
- // Visual handle
- vis = NULL;
- }
- // --------------------------------------------------------------
- // Initialise the thrusters for the shuttle main engines
- // --------------------------------------------------------------
- void Atlantis::CreateSSME()
- {
- // Not connected to a propellant resource - they connect to the ET's tank as long
- // as it is attached (checked in clbkPreStep)
- th_main[0] = CreateThruster (THRUSTREF_SSME0, THRUSTGIMBAL_LAUNCH, ORBITER_MAIN_THRUST, NULL, ORBITER_MAIN_ISP0, ORBITER_MAIN_ISP1);
- th_main[1] = CreateThruster (THRUSTREF_SSME1, THRUSTGIMBAL_LAUNCH, ORBITER_MAIN_THRUST, NULL, ORBITER_MAIN_ISP0, ORBITER_MAIN_ISP1);
- th_main[2] = CreateThruster (THRUSTREF_SSME2, THRUSTGIMBAL_LAUNCH, ORBITER_MAIN_THRUST, NULL, ORBITER_MAIN_ISP0, ORBITER_MAIN_ISP1);
- thg_main = CreateThrusterGroup (th_main, 3, THGROUP_MAIN);
- gimbal_pos = THRUSTGIMBAL_LAUNCH; // the initial pitch gimbal setting positions the SSMEs to cancel pitch moment in launch configuration
- SURFHANDLE tex_main = oapiRegisterExhaustTexture ("Exhaust_atsme");
- for (int i = 0; i < 3; i++)
- AddExhaust (th_main[i], 30.0, 2.0, tex_main);
- }
- // --------------------------------------------------------------
- // Initialise the thrusters for the orbital maneuvering system
- // --------------------------------------------------------------
- void Atlantis::CreateOMS()
- {
- //contrail_tex = oapiRegisterParticleTexture("Exhaust_atrcs");
- th_oms[0] = CreateThruster (THRUSTREF_OMSL, THRUSTDIR_OMSL, ORBITER_OMS_THRUST, ph_oms, ORBITER_OMS_ISP0, ORBITER_OMS_ISP1);
- th_oms[1] = CreateThruster (THRUSTREF_OMSR, THRUSTDIR_OMSR, ORBITER_OMS_THRUST, ph_oms, ORBITER_OMS_ISP0, ORBITER_OMS_ISP1);
- // we don't yet define a thruster group for the OMS engines
- // They will be assigned to the MAIN group as soon as the ET is jettisoned
- for (int i = 0; i < 2; i++)
- AddExhaust(th_oms[i], 2.5, 0.6); //2.5, 0.6
- PARTICLESTREAMSPEC OMSex = {
- 0, .5, 1000, 5, .01, .1, 0, 0, PARTICLESTREAMSPEC::EMISSIVE,
- PARTICLESTREAMSPEC::LVL_LIN, 0, 1,
- PARTICLESTREAMSPEC::ATM_FLAT, 0.5, 1.0
- };
- AddExhaustStream(th_oms[0], _V(-2.8, 3.5, -13.5), &OMSex);
- AddExhaustStream(th_oms[1], _V(2.8, 3.5, -13.5), &OMSex);
- }
- // --------------------------------------------------------------
- // Attitude controls (RCS) during orbital phase
- // Inactive by default. Activated with EnableRCS(true)
- // --------------------------------------------------------------
- void Atlantis::CreateRCS()
- {
- SURFHANDLE tex_rcs = oapiRegisterExhaustTexture ("Exhaust_atrcs");
- const double eh = 6.0; // exhaust length scale
- const double ew1 = 0.4, ew2 = 0.8; // exhaust width scales
- // set of attitude thrusters (idealised). The arrangement is such that no angular
- // momentum is created in linear mode, and no linear momentum is created in rotational mode.
- THRUSTER_HANDLE th_att_rot[4], th_att_lin[4];
- th_att_rot[0] = th_att_lin[0] = CreateThruster (_V(0,0, 15.5), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[1] = th_att_lin[3] = CreateThruster (_V(0,0,-15.5), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[2] = th_att_lin[2] = CreateThruster (_V(0,0, 15.5), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[3] = th_att_lin[1] = CreateThruster (_V(0,0,-15.5), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- CreateThrusterGroup (th_att_rot, 2, THGROUP_ATT_PITCHUP);
- CreateThrusterGroup (th_att_rot+2, 2, THGROUP_ATT_PITCHDOWN);
- CreateThrusterGroup (th_att_lin, 2, THGROUP_ATT_UP);
- CreateThrusterGroup (th_att_lin+2, 2, THGROUP_ATT_DOWN);
- AddExhaust (th_att_rot[0], eh, ew1, _V( 1.60,-0.20, 18.78), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F2D
- AddExhaust (th_att_rot[0], eh, ew1, _V( 1.68,-0.18, 18.40), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F4D
- AddExhaust (th_att_rot[0], eh, ew1, _V(-1.55,-0.20, 18.78), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F1D
- AddExhaust (th_att_rot[0], eh, ew1, _V(-1.63,-0.18, 18.40), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F3D
- AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.30), _V(0, 1,0), tex_rcs);//L4U
- AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.70), _V(0, 1,0), tex_rcs);//L2U
- AddExhaust(th_att_rot[1], eh, ew1, _V(-3.46, 3.20, -11.906), _V(0, 1, 0), tex_rcs);//L1U
- AddExhaust (th_att_rot[1], eh, ew1, _V( 3.43, 3.20,-12.30), _V(0, 1,0), tex_rcs);//R4U
- AddExhaust (th_att_rot[1], eh, ew1, _V( 3.43, 3.20,-12.70), _V(0, 1,0), tex_rcs);//R2U
- AddExhaust(th_att_rot[1], eh, ew1, _V(3.43, 3.20, -11.906), _V(0, 1, 0), tex_rcs);//R1U
- AddExhaust (th_att_rot[2], eh, ew1, _V(-0.4 , 1.10, 18.3 ), _V(0, 1,0), tex_rcs);//F1U
- AddExhaust (th_att_rot[2], eh, ew1, _V( 0.0 , 1.15 ,18.3 ), _V(0, 1,0), tex_rcs);//F3U
- AddExhaust (th_att_rot[2], eh, ew1, _V( 0.4 , 1.10, 18.3 ), _V(0, 1,0), tex_rcs);//F2U
- AddExhaust(th_att_rot[3], eh, ew1, _V(-3.15, 1.3769, -12.126), _V(-0.2844, -0.9481, -0.1422), tex_rcs);//L4D
- AddExhaust(th_att_rot[3], eh, ew1, _V(-3.15, 1.4302, -12.459), _V(-0.2844, -0.9481, -0.1422), tex_rcs);//L2D
- AddExhaust(th_att_rot[3], eh, ew1, _V(-3.15, 1.5034, -12.805), _V(-0.2844, -0.9481, -0.1422), tex_rcs);//L3D
- AddExhaust(th_att_rot[3], eh, ew1, _V(3.15, 1.3769, -12.126), _V(0.2844, -0.9481, -0.1422), tex_rcs);//R4D
- AddExhaust(th_att_rot[3], eh, ew1, _V(3.15, 1.4302, -12.459), _V(0.2844, -0.9481, -0.1422), tex_rcs);//R2D
- AddExhaust(th_att_rot[3], eh, ew1, _V(3.15, 1.5034, -12.805), _V(0.2844, -0.9481, -0.1422), tex_rcs);//R3D
- th_att_rot[0] = th_att_lin[0] = CreateThruster (_V(0,0, 15.5), _V(-1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[1] = th_att_lin[3] = CreateThruster (_V(0,0,-15.5), _V( 1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[2] = th_att_lin[2] = CreateThruster (_V(0,0, 15.5), _V( 1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[3] = th_att_lin[1] = CreateThruster (_V(0,0,-15.5), _V(-1,0,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- CreateThrusterGroup (th_att_rot, 2, THGROUP_ATT_YAWLEFT);
- CreateThrusterGroup (th_att_rot+2, 2, THGROUP_ATT_YAWRIGHT);
- CreateThrusterGroup (th_att_lin, 2, THGROUP_ATT_LEFT);
- CreateThrusterGroup (th_att_lin+2, 2, THGROUP_ATT_RIGHT);
- AddExhaust (th_att_rot[0], eh, ew2, _V( 1.8 ,-0.3 , 18.0 ), _V( 1,0,0), tex_rcs);//F4R
- AddExhaust (th_att_rot[0], eh, ew2, _V( 1.75, 0.1 , 18.05), _V( 1,0,0), tex_rcs);//F2R
- AddExhaust (th_att_rot[2], eh, ew2, _V(-1.7 ,-0.3 , 18.0 ), _V(-1,0,0), tex_rcs);//F1L
- AddExhaust (th_att_rot[2], eh, ew2, _V(-1.65,-0.1 , 18.05), _V(-1,0,0), tex_rcs);//F3L
- AddExhaust(th_att_rot[1], eh, ew2, _V(-4.0, 2.35, -11.919), _V(-1, 0, 0), tex_rcs);//L4L
- AddExhaust(th_att_rot[1], eh, ew2, _V(-4.0, 2.35, -12.219), _V(-1, 0, 0), tex_rcs);//L2L
- AddExhaust(th_att_rot[1], eh, ew2, _V(-4.0, 2.35, -12.592), _V(-1, 0, 0), tex_rcs);//L3L
- AddExhaust(th_att_rot[1], eh, ew2, _V(-4.0, 2.35, -12.932), _V(-1, 0, 0), tex_rcs);//L1L
- AddExhaust(th_att_rot[3], eh, ew2, _V(4.0, 2.35, -11.919), _V(1, 0, 0), tex_rcs);//R4R
- AddExhaust(th_att_rot[3], eh, ew2, _V(4.0, 2.35, -12.219), _V(1, 0, 0), tex_rcs);//R2R
- AddExhaust(th_att_rot[3], eh, ew2, _V(4.0, 2.35, -12.592), _V(1, 0, 0), tex_rcs);//R3R
- AddExhaust(th_att_rot[3], eh, ew2, _V(4.0, 2.35, -12.932), _V(1, 0, 0), tex_rcs);//R1R
- th_att_rot[0] = CreateThruster (_V( 2.7,0,0), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[1] = CreateThruster (_V(-2.7,0,0), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[2] = CreateThruster (_V(-2.7,0,0), _V(0, 1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_rot[3] = CreateThruster (_V( 2.7,0,0), _V(0,-1,0), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- CreateThrusterGroup (th_att_rot, 2, THGROUP_ATT_BANKLEFT);
- CreateThrusterGroup (th_att_rot+2, 2, THGROUP_ATT_BANKRIGHT);
- AddExhaust (th_att_rot[0], eh, ew1, _V( 1.60,-0.20, 18.78), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F2D
- AddExhaust (th_att_rot[0], eh, ew1, _V( 1.68,-0.18, 18.40), _V( 0.4339,-0.8830,-0.1793), tex_rcs);//F4D
- AddExhaust (th_att_rot[2], eh, ew1, _V(-1.55,-0.20, 18.78), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F1D
- AddExhaust (th_att_rot[2], eh, ew1, _V(-1.63,-0.18, 18.40), _V(-0.4339,-0.8830,-0.1793), tex_rcs);//F3D
- AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.30), _V(0, 1,0), tex_rcs);//L4U
- AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-12.70), _V(0, 1,0), tex_rcs);//L2U
- AddExhaust (th_att_rot[1], eh, ew1, _V(-3.46, 3.20,-13.10), _V(0, 1,0), tex_rcs);//L1U
- AddExhaust (th_att_rot[3], eh, ew1, _V( 3.43, 3.20,-12.30), _V(0, 1,0), tex_rcs);//R4U
- AddExhaust (th_att_rot[3], eh, ew1, _V( 3.43, 3.20,-12.70), _V(0, 1,0), tex_rcs);//R2U
- AddExhaust (th_att_rot[3], eh, ew1, _V( 3.43, 3.20,-13.10), _V(0, 1,0), tex_rcs);//R1U
- AddExhaust (th_att_rot[2], eh, ew1, _V(-3.1 , 1.55,-12.45), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L4D
- AddExhaust (th_att_rot[2], eh, ew1, _V(-3.1 , 1.6 ,-12.8 ), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L2D
- AddExhaust (th_att_rot[2], eh, ew1, _V(-3.1 , 1.65,-13.15), _V(-0.2844,-0.9481,-0.1422), tex_rcs);//L3D
- AddExhaust (th_att_rot[0], eh, ew1, _V( 3.15, 1.55,-12.45), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R4D
- AddExhaust (th_att_rot[0], eh, ew1, _V( 3.15, 1.6 ,-12.8 ), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R2D
- AddExhaust (th_att_rot[0], eh, ew1, _V( 3.15, 1.65,-13.15), _V( 0.2844,-0.9481,-0.1422), tex_rcs);//R3D
- th_att_lin[0] = CreateThruster (_V(0,0,-16), _V(0,0, 1), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- th_att_lin[1] = CreateThruster (_V(0,0, 16), _V(0,0,-1), ORBITER_RCS_THRUST, NULL, ORBITER_RCS_ISP0, ORBITER_RCS_ISP1);
- CreateThrusterGroup (th_att_lin, 1, THGROUP_ATT_FORWARD);
- CreateThrusterGroup (th_att_lin+1, 1, THGROUP_ATT_BACK);
- AddExhaust (th_att_lin[0], eh, ew1, _V(-3.59, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//L1A
- AddExhaust (th_att_lin[0], eh, ew1, _V(-3.27, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//L3A
- AddExhaust (th_att_lin[0], eh, ew1, _V( 3.64, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//R1A
- AddExhaust (th_att_lin[0], eh, ew1, _V( 3.27, 2.8 ,-13.6 ), _V(0,0,-1), tex_rcs);//R3A
- AddExhaust (th_att_lin[1], eh, ew1, _V( 0.0 , 0.75, 19.2 ), _V(0, 0.0499, 0.9988), tex_rcs);//F3F
- AddExhaust (th_att_lin[1], eh, ew1, _V(-0.4 , 0.7 , 19.2 ), _V(0, 0.0499, 0.9988), tex_rcs);//F1F
- AddExhaust (th_att_lin[1], eh, ew1, _V( 0.4 , 0.7 , 19.2 ), _V(0, 0.0499, 0.9988), tex_rcs);//F2F
- }
- // --------------------------------------------------------------
- // Initialise airfoils, aerodynamic control surfaces and drag elements
- // --------------------------------------------------------------
- void Atlantis::CreateAirfoils ()
- {
- CreateAirfoil (LIFT_VERTICAL, _V(0,0,-0.5), VLiftCoeff, 20, 270, 2.266);
- CreateAirfoil (LIFT_HORIZONTAL, _V(0,0,-4), HLiftCoeff, 20, 50, 1.5);
- CreateControlSurface (AIRCTRL_ELEVATOR, 5.0, 1.5, _V( 0, 0, -15), AIRCTRL_AXIS_XPOS, anim_elev);
- CreateControlSurface (AIRCTRL_RUDDER, 2.0, 1.5, _V( 0, 3, -16), AIRCTRL_AXIS_YPOS, anim_rudder);
- CreateControlSurface (AIRCTRL_AILERON, 3.0, 1.5, _V( 7,-0.5,-15), AIRCTRL_AXIS_XPOS, anim_raileron);
- CreateControlSurface (AIRCTRL_AILERON, 3.0, 1.5, _V(-7,-0.5,-15), AIRCTRL_AXIS_XNEG, anim_laileron);
- CreateControlSurface2(AIRCTRL_ELEVATORTRIM, 5, 1.75, _V(0, 0, -17), AIRCTRL_AXIS_XPOS, anim_bf);
- CreateVariableDragElement (&spdb_proc, 5, _V(0, 7.5, -14)); // speedbrake drag
- CreateVariableDragElement (&gear_proc, 2, _V(0,-3,0)); // landing gear drag
- CreateVariableDragElement (&rdoor_drag, 7, _V(2.9,0,10)); // right cargo door drag
- CreateVariableDragElement (&ldoor_drag, 7, _V(-2.9,0,10)); // right cargo door drag
- }
- // --------------------------------------------------------------
- // Airfoil coefficient function
- // Return lift, moment and zero-lift drag coefficients as a
- // function of angle of attack
- // 1. vertical lift component (wings and body)
- // --------------------------------------------------------------
- void Atlantis::VLiftCoeff (double aoa, double M, double Re, double *cl, double *cm, double *cd)
- {
- static const double step = RAD*15.0;
- static const double istep = 1.0/step;
- static const int nabsc = 25;
- static const double CL[nabsc] = {0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1};
- static const double CM[nabsc] = { 0, 0, 0, 0, 0, 0, 0, 0, 0,0.002,0.004, 0.0025,0.0012, 0,-0.0012,-0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- // lift and moment coefficients from -180 to 180 in 15 degree steps.
- // This uses a documented lift slope of 0.0437/deg, everything else is rather ad-hoc
- aoa += PI;
- int idx = max (0, min (23, (int)(aoa*istep)));
- double d = aoa*istep - idx;
- *cl = CL[idx] + (CL[idx+1]-CL[idx])*d;
- *cm = CM[idx] + (CM[idx+1]-CM[idx])*d;
- *cd = 0.06 + oapiGetInducedDrag (*cl, 2.266, 0.6);
- }
- // --------------------------------------------------------------
- // Airfoil coefficient functions
- // Return lift, moment and zero-lift drag coefficients as a
- // function of slip angle (beta)
- // 2. horizontal lift component (vertical stabiliser and body)
- // --------------------------------------------------------------
- void Atlantis::HLiftCoeff (double beta, double M, double Re, double *cl, double *cm, double *cd)
- {
- static const double step = RAD*22.5;
- static const double istep = 1.0/step;
- static const int nabsc = 17;
- static const double CL[nabsc] = {0, 0.2, 0.3, 0.2, 0, -0.2, -0.3, -0.2, 0, 0.2, 0.3, 0.2, 0, -0.2, -0.3, -0.2, 0};
- beta += PI;
- int idx = max (0, min (15, (int)(beta*istep)));
- double d = beta*istep - idx;
- *cl = CL[idx] + (CL[idx+1]-CL[idx])*d;
- *cm = 0.0;
- *cd = 0.02 + oapiGetInducedDrag (*cl, 1.5, 0.6);
- }
- // --------------------------------------------------------------
- // Enable/disable Space Shuttle Main Engines
- // --------------------------------------------------------------
- bool Atlantis::EnableSSME (bool enable)
- {
- PROPELLANT_HANDLE hProp = NULL;
- if (enable) {
- // if (pET) hProp = pET->GetPropHandle();
- //else return false; // can't activate without attached ET
- }
- for (DWORD i = 0; i < 3; i++)
- SetThrusterResource (th_main[i], hProp);
- if (enable) {
- if (GetGroupThrusterCount (THGROUP_MAIN) != 3) {
- // switch MAIN group to SSME
- DelThrusterGroup (THGROUP_MAIN);
- thg_main = CreateThrusterGroup (th_main, 3, THGROUP_MAIN);
- }
- SetDefaultPropellantResource (hProp);
- }
- return true;
- }
- // --------------------------------------------------------------
- // Enable/disable Orbital Maneuvering System
- // --------------------------------------------------------------
- void Atlantis::EnableOMS (bool enable)
- {
- PROPELLANT_HANDLE hProp = (enable ? ph_oms : NULL);
- for (DWORD i = 0; i < 2; i++)
- SetThrusterResource (th_oms[i], hProp);
- if (enable) {
- if (GetGroupThrusterCount (THGROUP_MAIN) > 2) {
- // switch MAIN group to OMS
- DelThrusterGroup (THGROUP_MAIN);
- thg_main = CreateThrusterGroup (th_oms, 2, THGROUP_MAIN);
- }
- SetDefaultPropellantResource (ph_oms);
- }
- }
- // --------------------------------------------------------------
- // Enable/disable Reaction Control System
- // --------------------------------------------------------------
- void Atlantis::EnableRCS (bool enable)
- {
- PROPELLANT_HANDLE hProp = (enable ? ph_oms : NULL);
- DWORD i;
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_PITCHUP); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_PITCHUP, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_PITCHDOWN); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_PITCHDOWN, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_YAWLEFT); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_YAWLEFT, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_YAWRIGHT); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_YAWRIGHT, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_BANKLEFT); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_BANKLEFT, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_BANKRIGHT); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_BANKRIGHT, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_UP); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_UP, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_DOWN); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_DOWN, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_LEFT); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_LEFT, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_RIGHT); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_RIGHT, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_FORWARD); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_FORWARD, i), hProp);
- for (i = 0; i < GetGroupThrusterCount (THGROUP_ATT_BACK); i++)
- SetThrusterResource (GetGroupThruster (THGROUP_ATT_BACK, i), hProp);
- bool enable_as = (GetAttitudeMode() == RCS_NONE || enable == false);
- SetADCtrlMode (enable_as ? 7 : 0);
- }
- // --------------------------------------------------------------
- // Define animation sequences for moving parts
- // --------------------------------------------------------------
- void Atlantis::DefineAnimations (void)
- {
- UINT midx = 1; // mesh index for all external animations
- UINT vidx = 2; // mesh index for all VC animations
- UINT ridx = 4; // mesh index for all rms animations
- // ***** 1. Cargo door and radiator animations *****
- ANIMATIONCOMPONENT_HANDLE doorparentR, doorparentL,RADPARENTL,RADPARENTR;
- static UINT RCargoDoorGrp[10] = { GRP_cargodooroutR, GRP_cargodoorinright, GRP_radiatorBRnew, GRP_rightdoorpipe, GRP_sillraillright,GRP_cargodoorhookright,GRP_MID_FWD_HO,GRP_MID_AFT_HO,GRP_FWD_HOOKS,GRP_AFT_HOOKS };
- static MGROUP_ROTATE RCargoDoor (midx, RCargoDoorGrp, 10,
- _V(2.84, 1.284, 0), _V(0,0,1), (float)(-175.5*RAD));
- static UINT LCargoDoorGrp[6] = { GRP_cargodooroutL, GRP_cargodoorinleft, GRP_radiatorBLnew, GRP_leftdoorpipe, GRP_sillrailleft,GRP_cargodoorhookleft };
- static MGROUP_ROTATE LCargoDoor (midx, LCargoDoorGrp, 6,
- _V(-2.84, 1.284, 0), _V(0,0,1), (float)(175.5*RAD));
- static UINT LCargoDoorhingeGrp[2] = { GRP_leftdoormech2, GRP_leftdoormech3 };
- static MGROUP_ROTATE LCargoDoorHINGE(midx, LCargoDoorhingeGrp, 2,
- _V(-2.689438, 1.166027, 0), _V(0, 0, 1), (float)(90*RAD));
- //static UINT RCargoDoorhinge1Grp[1] = { GRP_rightdoormech1 };
- //static MGROUP_TRANSLATE RCargoDoorHINGE1(midx, RCargoDoorhinge1Grp, 3, _V(0, .1, 0));
- //static UINT LCargoDoorhinge1Grp[1] = { GRP_leftdoormech1 };
- //static MGROUP_TRANSLATE LCargoDoorHINGE1(midx, LCargoDoorhinge1Grp, 1, _V(0, .1, 0));
- static UINT LCargoDoorhinge1Grp[1] = { GRP_leftdoormech1 };
- static MGROUP_ROTATE LCargoDoorHINGE1(midx, LCargoDoorhinge1Grp, 1,
- _V(-2.594612, 1.028044, 0), _V(0, 0, 1), (float)(-90 * RAD));
- static UINT RCargoDoorhingeGrp[2] = { GRP_rightdoormech2, GRP_rightdoormech3 };
- static MGROUP_ROTATE RCargoDoorHINGE(midx, RCargoDoorhingeGrp, 2,
- _V(2.689438, 1.166027, 0), _V(0, 0, 1), (float)(-90*RAD));
- static UINT RCargoDoorhinge1Grp[1] = { GRP_rightdoormech1 };
- static MGROUP_ROTATE RCargoDoorHINGE1(midx, RCargoDoorhinge1Grp, 1,
- _V(2.594612, 1.028044, 0), _V(0, 0, 1), (float)(90 * RAD));
- anim_door = CreateAnimation(0);
- // doorparentR = AddAnimationComponent(anim_door, 0, .8, &RCargoDoorHINGE1);//swing out
- doorparentR = AddAnimationComponent(anim_door, 0.0, 0.4632, &RCargoDoorHINGE);//swing out
- doorparentL = AddAnimationComponent(anim_door, 0.5368, 1.0, &LCargoDoorHINGE);//swing out
- AddAnimationComponent(anim_door, 0.0, 0.4632, &RCargoDoorHINGE1, doorparentR);
- AddAnimationComponent(anim_door, 0.5368, 1.0, &LCargoDoorHINGE1, doorparentL);
- //AddAnimationComponent(anim_door, 0.0, 0.4632, &RCargoDoorHINGE);
- //AddAnimationComponent(anim_door, 0.5368, 1.0, &LCargoDoorHINGE);
- //SetDirection(arm_tip[1]-arm_tip[0]);
- RADPARENTR = AddAnimationComponent(anim_door, 0.0, 0.4632, &RCargoDoor);
- RADPARENTL = AddAnimationComponent(anim_door, 0.5368, 1.0, &LCargoDoor);
- static UINT RRadiatorGrp[1] = {GRP_radiatorFRnew};
- static MGROUP_ROTATE RRadiator (midx, RRadiatorGrp, 1,
- _V(2.686, 1.508, 0), _V(0, 0, 1), (float)(35.5*RAD));
- static UINT LRadiatorGrp[1] = {GRP_radiatorFLnew};
- static MGROUP_ROTATE LRadiator (midx, LRadiatorGrp, 1,
- _V(-2.686, 1.508, 0), _V(0, 0, 1), (float)(-35.5*RAD));
- anim_PRADIATOR = CreateAnimation(0);
- anim_SRADIATOR = CreateAnimation(0);
- AddAnimationComponent(anim_PRADIATOR, 0, 1, &RRadiator,RADPARENTR);
- AddAnimationComponent(anim_SRADIATOR, 0, 1, &LRadiator,RADPARENTL);
- // ***** 2. Landing gear animation *****
- static UINT LNosewheelDoorGrp[1] = {GRP_Lnosedoor};
- static MGROUP_ROTATE LNosewheelDoor (midx, LNosewheelDoorGrp, 1,
- _V(-0.78, -2.15, 17), _V(0, 0.195, 0.981), (float)(-60.0*RAD));
- static UINT RNosewheelDoorGrp[1] = {GRP_Rnosedoor};
- static MGROUP_ROTATE RNosewheelDoor (midx, RNosewheelDoorGrp, 1,
- _V(0.78, -2.15, 17), _V(0, 0.195, 0.981), (float)(60.0*RAD));
- static UINT NosewheelGrp[2] = {GRP_nosewheel,GRP_nosegear};
- static MGROUP_ROTATE Nosewheel (midx, NosewheelGrp, 2,
- _V(0.0, -1.95, 17.45), _V(1, 0, 0), (float)(109.0*RAD));
- static UINT RGearDoorGrp[1] = {GRP_geardoorR};
- static MGROUP_ROTATE RGearDoor (midx, RGearDoorGrp, 1,
- _V(4.35, -2.64, -1.69), _V(0, 0.02, 0.9), (float)(96.2*RAD));
- static UINT LGearDoorGrp[1] = {GRP_geardoorL};
- static MGROUP_ROTATE LGearDoor (midx, LGearDoorGrp, 1,
- _V(-4.35, -2.64, -1.69), _V(0, 0.02, 0.9), (float)(-96.2*RAD));
- static UINT MainGearGrp[4] = {GRP_wheelR,GRP_gearR,GRP_wheelL,GRP_gearL};
- static MGROUP_ROTATE MainGear (midx, MainGearGrp, 4,
- _V(0, -2.66, -3.68), _V(1, 0, 0), (float)(94.5*RAD));
- anim_gear = CreateAnimation (0);
- AddAnimationComponent (anim_gear, 0, 0.5, &LNosewheelDoor);
- AddAnimationComponent (anim_gear, 0, 0.5, &RNosewheelDoor);
- AddAnimationComponent (anim_gear, 0.4, 1.0, &Nosewheel);
- AddAnimationComponent (anim_gear, 0, 0.5, &RGearDoor);
- AddAnimationComponent (anim_gear, 0, 0.5, &LGearDoor);
- AddAnimationComponent (anim_gear, 0.4, 1.0, &MainGear);
- //LANDINGGEAR INDICATORS/
- anim_LEFTGEARARMON = CreateAnimation(0);
- anim_LEFTGEARDN = CreateAnimation(0);
- anim_LEFTGEARTALKBACK = CreateAnimation(0);
- // anim_LEFTGEARARMOFF = CreateAnimation(0);
- // anim_LEFTGEARUP = CreateAnimation(0);
- //static UINT LEFTGEARARMOFFGrp[1] = { GRP_leftarmoff };
- //static MGROUP_TRANSLATE LEFTGEARARMOFF(2, LEFTGEARARMOFFGrp, 1, _V(0, 0, .01));
- static UINT LEFTGEARARM0NGrp[1] = { GRP_leftarmon };
- static MGROUP_TRANSLATE LEFTGEARARMON(2, LEFTGEARARM0NGrp, 1, _V(0, 0, -.002));
- ////static UINT LEFTGEARUPGrp[1] = { GRP_leftgearup };
- //static MGROUP_TRANSLATE LEFTGEARUP(2, LEFTGEARUPGrp, 1, _V(0, 0, .01));
- static UINT LEFTGEARDNGrp[1] = { GRP_leftgeardn };
- static MGROUP_TRANSLATE LEFTGEARDN(2, LEFTGEARDNGrp, 1, _V(0, 0, -.002));
- //AddAnimationComponent(anim_LEFTGEARUP, 0, 1, &LEFTGEARUP);
- AddAnimationComponent(anim_LEFTGEARDN, 0, 1, &LEFTGEARDN);
- //AddAnimationComponent(anim_LEFTGEARARMOFF, 0, 1, &LEFTGEARARMOFF);
- AddAnimationComponent(anim_LEFTGEARARMON, 0, 1, &LEFTGEARARMON);
- static UINT LEFTGEARtalkbackGrp[1] = { GRP_leftgeartalkback };
- static MGROUP_TRANSLATE LEFTGEARtalkback(2, LEFTGEARtalkbackGrp, 1, _V(0, 0.01, .005));
- AddAnimationComponent(anim_LEFTGEARTALKBACK, 0, 1, &LEFTGEARtalkback);
- //RIGHT
- anim_RIGHTGEARARMON = CreateAnimation(0);
- anim_RIGHTGEARDN = CreateAnimation(0);
- anim_RIGHTGEARTALKBACK = CreateAnimation(0);
- // anim_RIGHTGEARARMOFF = CreateAnimation(0);
- // anim_RIGHTGEARUP = CreateAnimation(0);
- // static UINT RIGHTGEARARMOFFGrp[1] = { GRP_rightarmoff };
- // static MGROUP_TRANSLATE RIGHTGEARARMOFF(2, RIGHTGEARARMOFFGrp, 1, _V(0, 0, .01));
- static UINT RIGHTGEARARM0NGrp[1] = { GRP_rightarmon };
- static MGROUP_TRANSLATE RIGHTGEARARMON(2, RIGHTGEARARM0NGrp, 1, _V(0, 0, -.003));
- // static UINT RIGHTGEARUPGrp[1] = { GRP_rightgearup };
- // static MGROUP_TRANSLATE RIGHTGEARUP(2, RIGHTGEARUPGrp, 1, _V(0, 0, .01));
- static UINT RIGHTGEARDNGrp[1] = { GRP_rightgeardn };
- static MGROUP_TRANSLATE RIGHTGEARDN(2, RIGHTGEARDNGrp, 1, _V(0, 0, -.003));
- // AddAnimationComponent(anim_RIGHTGEARUP, 0, 1, &RIGHTGEARUP);
- AddAnimationComponent(anim_RIGHTGEARDN, 0, 1, &RIGHTGEARDN);
- // AddAnimationComponent(anim_RIGHTGEARARMOFF, 0, 1, &RIGHTGEARARMOFF);
- AddAnimationComponent(anim_RIGHTGEARARMON, 0, 1, &RIGHTGEARARMON);
- static UINT RIGHTGEARtalkbackGrp[1] = { GRP_rightgeartalkback };
- static MGROUP_TRANSLATE RIGHTGEARtalkback(2, RIGHTGEARtalkbackGrp, 1, _V(0, 0.01, .005));
- AddAnimationComponent(anim_RIGHTGEARTALKBACK, 0, 1, &RIGHTGEARtalkback);
- anim_dragdeploy = CreateAnimation(0);
- static UINT chutedeployGrp[1] = { 4 };
- static MGROUP_TRANSLATE chutedeploy(12, chutedeployGrp, 1, _V(0, 0, .01));
- AddAnimationComponent(anim_dragdeploy, 0, 1, &chutedeploy);
- anim_chutejett = CreateAnimation(0);
- static UINT chutejettGrp[1] = { 3 };
- static MGROUP_TRANSLATE chutejett(12, chutejettGrp, 1, _V(0, 0, .01));
- AddAnimationComponent(anim_chutejett, 0, 1, &chutejett);
- // ***** 3. Ku-band antenna animation *****
- ANIMATIONCOMPONENT_HANDLE KUBANDparent, KUBANDparent1;
- static UINT KuBandDEAGrp[1] = { 2 };
- static MGROUP_ROTATE KuBand1(8, KuBandDEAGrp, 1, _V(2.59, 0.85, 11.773), _V(0, 1, 0), (float)(-113 * RAD));
- static UINT KuBand2Grp[1] = { 3 };
- static MGROUP_ROTATE KuBand2(8, KuBand2Grp, 1, _V(2.341, 1.979, 11.122), _V(0.504249, 0, 0.863558), (float)(-180 * RAD));
- static UINT KuBand3Grp[4] = { 1, 4, 0, 5 };
- static MGROUP_ROTATE KuBand3(8, KuBand3Grp, 4, _V(2.29315, 1.939795, 11.028), _V(0.460305, -0.866073, -0.195029), (float)(-60 * RAD));
- anim_kubd = CreateAnimation(0);
- KUBANDparent = AddAnimationComponent(anim_kubd, 0, .8, &KuBand1);//swing out
- KUBANDparent1 = AddAnimationComponent(anim_kubd, .8, .9, &KuBand2, KUBANDparent);//rotate alpha
- AddAnimationComponent(anim_kubd, .9, 1, &KuBand3, KUBANDparent1);//rotate dish
- // ***** 4. Elevator animation of elevons *****
- static UINT ElevGrp[4] = {GRP_flapR,GRP_flapL,GRP_aileronL,GRP_aileronR};
- static MGROUP_ROTATE Elevator (midx, ElevGrp, 4,
- _V(0,-2.173,-8.84), _V(1,0,0), (float)(30.0*RAD));
- anim_elev = CreateAnimation (0.5);
- AddAnimationComponent (anim_elev, 0, 1, &Elevator);
- // ***** 5. Aileron animation of elevons *****
- static UINT LAileronGrp[2] = {GRP_flapL,GRP_aileronL};
- static MGROUP_ROTATE LAileron (midx, LAileronGrp, 2,
- _V(0,-2.173,-8.84), _V(-1,0,0), (float)(10.0*RAD));
- static UINT RAileronGrp[2] = {GRP_flapR,GRP_aileronR};
- static MGROUP_ROTATE RAileron (midx, RAileronGrp, 2,
- _V(0,-2.173,-8.84), _V(1,0,0), (float)(10.0*RAD));
- anim_laileron = CreateAnimation (0.5);
- AddAnimationComponent (anim_laileron, 0, 1, &LAileron);
- anim_raileron = CreateAnimation (0.5);
- AddAnimationComponent (anim_raileron, 0, 1, &RAileron);
- //INDICATOR
- static UINT leftelevonINDGrp[1] = { GRP_ELEVONSLEFTIND };
- static MGROUP_TRANSLATE leftelevonIND(vidx, leftelevonINDGrp, 1, _V(0, .067, 0));
- anim_leftelevonINDICATOR = CreateAnimation(0.0);
- AddAnimationComponent(anim_leftelevonINDICATOR, 0, 1, &leftelevonIND);
- // ***** 6. Rudder animation *****
- static UINT RudderGrp[2] = {GRP_rudderR,GRP_rudderL};
- static MGROUP_ROTATE Rudder (midx, RudderGrp, 2,
- _V(0,5.77,-12.17), _V(-0.037,0.833,-0.552), (float)(-54.2*RAD));
- anim_rudder = CreateAnimation (0.5);
- AddAnimationComponent (anim_rudder, 0, 1, &Rudder);
- //INDICATOR
- static UINT rdINDGrp[1] = { GRP_RUDDERDEGREEIND };
- static MGROUP_TRANSLATE rudderIND(vidx,rdINDGrp, 1, _V(.067, 0, 0));
- anim_rudderINDICATOR = CreateAnimation(0.5);
- AddAnimationComponent(anim_rudderINDICATOR, 0, 1, &rudderIND);
- // ***** 7. Speedbrake animation *****
- static UINT SB1Grp[1] = {GRP_rudderR};
- static MGROUP_ROTATE SB1 (midx, SB1Grp, 1,
- _V(0.32,5.77,-12.17), _V(-0.037,0.833,-0.552), (float)(-49.3*RAD));
- static UINT SB2Grp[1] = {GRP_rudderL};
- static MGROUP_ROTATE SB2 (midx, SB2Grp, 1,
- _V(-0.32,5.77,-12.17), _V(0.037,0.833,-0.552), (float)(49.3*RAD));
- anim_spdb = CreateAnimation (0);
- AddAnimationComponent (anim_spdb, 0, 1, &SB1);
- AddAnimationComponent (anim_spdb, 0, 1, &SB2);
- //INDICATOR
- static UINT sbINDGrp[2] = { GRP_SPEEDBRAKEIND,GRP_COMMANDSPDBRAKE };
- static MGROUP_TRANSLATE speedbrakeIND(vidx, sbINDGrp, 2, _V(0.066, 0, 0));
- anim_speedbrakeINDICATOR = CreateAnimation(0.0);
- AddAnimationComponent(anim_speedbrakeINDICATOR, 0, 1, &speedbrakeIND);
- // ***** 8. RMS arm animation *****
- // Note that the animation components can't be declared static here, since
- // their rotation parameters are modified by the respective parent transforms
- //default arm
- ANIMATIONCOMPONENT_HANDLE parent, obssparent,parent2;
- static UINT SHOULDERYAWGrp1[1] = { GRP_Shoulder_Yaw };//rotate2 SHOULDERSHOULDERPITCH part
- static UINT ELBOWGrp1[2] = { GRP_ELBOW_BOOM, GRP_ELBOW_CAM_BASE };//rotate part
- static UINT SHOULDERPITCHGrp3[1] = { GRP_SHOULDER_BOOM };//rotate part
- static UINT WPITCHGrp[1] = { GRP_Wristpitch };//rotate part
- static UINT WYAWGrp[1] = { GRP_Wrist_Yaw };//rotate part
- static UINT EEGrp3[1] = { GRP_Endeffector };//rotate part
- anim_MPM = CreateAnimation(0.0);
- anim_arm_sy = CreateAnimation(0.5);
- anim_arm_sp = CreateAnimation(0.0136);
- anim_arm_ep = CreateAnimation(0.0123);
- anim_arm_wp = CreateAnimation(0.5);
- anim_arm_wy = CreateAnimation(0.5);
- anim_arm_wr = CreateAnimation(0.5);
- anim_rms_ee = CreateAnimation(0.0);
- anim_camRMSElbow[PAN] = CreateAnimation(0.5);
- anim_camRMSElbow[TILT] = CreateAnimation(0.5);
- static UINT RMSmpm[3] = { 6, 0,1 };//3/7
- rms_anim[0] = new MGROUP_ROTATE(ridx, RMSmpm, 3, _V(-2.519, 1.149, 9.613), _V(0, 0, 1), (float)(19 * RAD)); // -180 .. +180
- rms_anim[1] = new MGROUP_ROTATE(ridx, SHOULDERYAWGrp1, 1, _V(-2.523, 1.551, 9.589), _V(0, 1, 0), (float)(-360 * RAD)); // -2 .. +145 KNEE BEND
- rms_anim[2] = new MGROUP_ROTATE(ridx, SHOULDERPITCHGrp3, 1, _V(-2.512, 2.059, 9.59), _V(1, 0, 0), (float)(147 * RAD)); // -2 .. +145 WAIST SWIVEL
- rms_anim[3] = new MGROUP_ROTATE(ridx, ELBOWGrp1, 2, _V(-2.512, 1.896298, 3.2241), _V(1, 0, 0), (float)(-162 * RAD)); // -2 .. +145 KNEE BEND
- rms_anim[4] = new MGROUP_ROTATE(ridx, WPITCHGrp, 1, _V(-2.512, 2.061, -3.827), _V(1, 0, 0), (float)(242.6 * RAD)); // -2 .. +145 KNEE BEND
- rms_anim[5] = new MGROUP_ROTATE(ridx, WYAWGrp, 1, _V(-2.512, 2.055, -4.326), _V(0, 1, 0), (float)(242.8 * RAD)); // -2 .. +145 KNEE BEND
- rms_anim[6] = new MGROUP_ROTATE(ridx, EEGrp3, 1, _V(-2.515, 2.059, -5.5327), _V(0, 0, 1), (float)(894 * RAD)); // -2 .. +145 KNEE BEND
- rms_anim[7] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm_tip), 6, _V(-2.515, 2.059, -5.5327), _V(0, 0, 1), (float)(894 * RAD)); // -447 .. +447
- static UINT RMSElbowCamGrp[2] = { GRP_ELBOW_CAM, GRP_PANTILT_ELBOW_CAM };
- MGROUP_ROTATE* pRMSElbowCamPan = new MGROUP_ROTATE(ridx, RMSElbowCamGrp + 1, 1, _V(-2.318106, 2.368114, 2.63319), _V(0.7, 0.7, 0), (float)(340 * RAD));
- MGROUP_ROTATE* pRMSElbowCamTilt = new MGROUP_ROTATE(ridx, RMSElbowCamGrp, 1, _V(-2.116386, 2.48436, 2.63319), _V(0.7, -0.7, 0), (float)(340 * RAD));
- MGROUP_ROTATE* pRMSElbowCamLoc = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(camRMSElbowLoc), 3, _V(-2.57968, 0.296129, -0.0332794), _V(1, 0, 0), 0.0f);
- parent = AddAnimationComponent(anim_MPM, 0, 1, rms_anim[0]);
- parent = AddAnimationComponent(anim_arm_sy, 0, 1, rms_anim[1],parent);
- parent = AddAnimationComponent(anim_arm_sp, 0, 1, rms_anim[2], parent);
- parent = AddAnimationComponent(anim_arm_ep, 0, 1, rms_anim[3], parent);
- parent2 = AddAnimationComponent(anim_camRMSElbow[PAN], 0, 1, pRMSElbowCamPan, parent);
- parent2 = AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamTilt, parent2);
- AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamLoc, parent2);
- parent = AddAnimationComponent(anim_arm_wp, 0, 1, rms_anim[4], parent);
- parent = AddAnimationComponent(anim_arm_wy, 0, 1, rms_anim[5], parent);
- parent = AddAnimationComponent(anim_arm_wr, 0, 1, rms_anim[6], parent);
- hAC_arm1 = AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[7], parent);
- //IK setup
- VECTOR3 shoulder_pos = _V(-9.784, -2.10, 2.05);
- VECTOR3 elbow_pos = _V(-3.3, -2.26, 1.7);
- VECTOR3 wrist_pos = _V(3.55, -2.26, 1.7);
- elbow_pos -= shoulder_pos;
- wrist_pos -= shoulder_pos;
- shoulder_pos -= shoulder_pos;
- lu = length(elbow_pos);
- ll = length(elbow_pos - wrist_pos);
- shoulder_neutral = 0.0136; //In anim coordinate
- shoulder_range = 147; //in deg
- shoulder_min = shoulder_range*-shoulder_neutral; //Min angle, deg
- shoulder_max = shoulder_range*(1 - shoulder_neutral); //Max angle, deg
- elbow_neutral = 0.0123;
- elbow_range = 162;
- elbow_min = elbow_range*-elbow_neutral; //Min angle, deg
- elbow_max = elbow_range*(1 - elbow_neutral); //Max angle, deg
- wrist_neutral = 0.5; //In anim coordinate
- wrist_range = 240; //in deg
- wrist_min = wrist_range*-wrist_neutral; //Min angle, deg
- wrist_max = wrist_range*(1 - wrist_neutral); //Max angle, deg
- arm_wrist_pos = wrist_pos;
- //anim_rms_ee = CreateAnimation(0.0);
- //AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[6] , parent);
- //hAC_arm = AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[6], parent);
- // ***** 9. SSME pitch gimbal animations
- double init_gimbal = -10*RAD;
- float max_gimbal = (float)(-0.2*PI);
- anim_ssmes = CreateAnimation (init_gimbal/max_gimbal);
- static UINT SSMEL_Grp = GRP_SSMEL;
- ssme_anim[0] = new MGROUP_ROTATE (midx, &SSMEL_Grp, 1, _V(-1.55,-0.37,-12.5), _V(-1,0,0), max_gimbal);
- AddAnimationComponent (anim_ssmes, 0, 1, ssme_anim[0]);
- static UINT SSMER_Grp = GRP_SSMER;
- ssme_anim[1] = new MGROUP_ROTATE (midx, &SSMER_Grp, 1, _V( 1.55,-0.37,-12.5), _V(-1,0,0), max_gimbal);
- AddAnimationComponent (anim_ssmes, 0, 1, ssme_anim[1]);
- static UINT SSMET_Grp = GRP_SSMET;
- ssme_anim[2] = new MGROUP_ROTATE (midx, &SSMET_Grp, 1, _V(0.0, 2.7, -12.5), _V(-1,0,0), max_gimbal);
- AddAnimationComponent (anim_ssmes, 0, 1, ssme_anim[2]);
- //SSME STOW
- anim_ssmestow = CreateAnimation(0);
- static UINT SSMEL1_Grp = GRP_SSMEL;
- ssme_animSTOW[0] = new MGROUP_ROTATE(midx, &SSMEL1_Grp, 1, _V(-1.55, -0.37, -12.5), _V(-0.70710678, 0.70710678, 0), -7.1 * RAD);
- AddAnimationComponent(anim_ssmestow, 0, 1, ssme_animSTOW[0]);
- static UINT SSMER1_Grp = GRP_SSMER;
- ssme_animSTOW[1] = new MGROUP_ROTATE(midx, &SSMER1_Grp, 1, _V(1.55, -0.37, -12.5), _V(0.70710678, 0.70710678, 0), 7.1 * RAD);
- AddAnimationComponent(anim_ssmestow, 0, 1, ssme_animSTOW[1]);
- static UINT SSMET1_Grp = GRP_SSMET;
- ssme_animSTOW[2] = new MGROUP_ROTATE(midx, &SSMET1_Grp, 1, _V(0.0, 2.7, -12.5), _V(-1, 0, 0), 11.6 * RAD);
- AddAnimationComponent(anim_ssmestow, 0, 1, ssme_animSTOW[2]);
- // ***** 10. ext airlock *****
- static UINT extDoorGrp[1] = { 0 };
- static MGROUP_ROTATE newextDoor(11, extDoorGrp, 1,
- _V(0, -.9320414, 12.04634), _V(1, 0, 0), (float)(-120 * RAD));
- // static UINT LCargoDoorGrp[4] = { GRP_cargodooroutL, GRP_cargodoorinL, GRP_radiatorFL, GRP_radiatorBL };
- // static MGROUP_ROTATE LCargoDoor(midx, LCargoDoorGrp, 4,
- // _V(-2.88, 1.3, 0), _V(0, 0, 1), (float)(175.5*RAD));
- static UINT extDoor1Grp[1] = { GRP_INNERAIRLOACK };
- static MGROUP_ROTATE newextDoor1(midx, extDoor1Grp, 1,
- _V(0, -1.082, 12.238), _V(1, 0, 0), (float)(90 * RAD));
- anim_extdoor = CreateAnimation(0);
- AddAnimationComponent(anim_extdoor, 0.0, 1, &newextDoor);
- AddAnimationComponent(anim_extdoor, 0.0, 1, &newextDoor1);
- // ***** 11. ext airlock ***** WITH ODS
- static UINT extodsDoorGrp[1] = { 6 };
- static MGROUP_ROTATE newextodsDoor(3, extodsDoorGrp, 1,
- _V(0, -1.11, 9.168), _V(1, 0, 0), (float)(-120 * RAD));
- // static UINT LCargoDoorGrp[4] = { GRP_cargodooroutL, GRP_cargodoorinL, GRP_radiatorFL, GRP_radiatorBL };
- // static MGROUP_ROTATE LCargoDoor(midx, LCargoDoorGrp, 4,
- // _V(-2.88, 1.3, 0), _V(0, 0, 1), (float)(175.5*RAD));
- static UINT extodsDoor1Grp[1] = { 27 };
- static MGROUP_ROTATE newextodsDoor1(3, extodsDoor1Grp, 1,
- _V(0, -1.045832, 9.199), _V(-1, 0, 0), (float)(-90 * RAD));
- anim_extodsdoor = CreateAnimation(0);
- AddAnimationComponent(anim_extodsdoor, 0.0, 1, &newextodsDoor);
- AddAnimationComponent(anim_extodsdoor, 0.0, 1, &newextodsDoor1);
- // ***** 11. ext airlock ***** WITHOUT ODS
- static UINT EXTAIRLOCKDoorGrp[3] = { 5};
- static MGROUP_ROTATE EXTAIRLOCKDoor(6, EXTAIRLOCKDoorGrp, 1,
- _V(0, -1.11, 9.168), _V(1, 0, 0), (float)(-120 * RAD));
- // static UINT LCargoDoorGrp[4] = { GRP_cargodooroutL, GRP_cargodoorinL, GRP_radiatorFL, GRP_radiatorBL };
- // static MGROUP_ROTATE LCargoDoor(midx, LCargoDoorGrp, 4,
- // _V(-2.88, 1.3, 0), _V(0, 0, 1), (float)(175.5*RAD));
- static UINT EXTAIRLOCKDoor1Grp[3] = { 26 };
- static MGROUP_ROTATE EXTAIRLOCK1Door(6, EXTAIRLOCKDoor1Grp, 1,
- _V(0, -1.045832, 9.199), _V(-1, 0, 0), (float)(-120 * RAD));
- anim_EXTAIRLOCK = CreateAnimation(0);
- AddAnimationComponent(anim_EXTAIRLOCK, 0.0, 1, &EXTAIRLOCKDoor);
- AddAnimationComponent(anim_EXTAIRLOCK, 0.0, 1, &EXTAIRLOCK1Door);
- //*******EXternalTankHAtch
- static UINT exhGrp[1] = { GRP_Group9 };
- static MGROUP_ROTATE ExternalTankHatch1(midx, exhGrp, 1,
- _V(1.341984, -2.849617, -7.251037), _V(0, -0.0523, 0.9986), (float)(-180 * RAD));
- static UINT exh1Grp[1] = { GRP_Group10 };
- static MGROUP_ROTATE ExternalTankHatch2(midx, exh1Grp, 1,
- _V(-1.341984, -2.849617, -7.251037), _V(0, -0.0523, 0.9986), (float)(180 * RAD));
- anim_SETD = CreateAnimation(0.0);
- anim_PETD = CreateAnimation(0.0);
- AddAnimationComponent(anim_PETD, 0, 1, &ExternalTankHatch1);
- AddAnimationComponent(anim_SETD, 0, 1, &ExternalTankHatch2);
- //********12 Drag chute****************
- static UINT CHUTE[2] = {0,1 };
- static MGROUP_SCALE DCHUTE(5, CHUTE, 2,
- _V(0, 4.5, -12.158), _V(.01, .01, .01));
- anim_CHUTE = CreateAnimation(0.0);
- AddAnimationComponent(anim_CHUTE, 0, 1, &DCHUTE);
- //*******13 Dock Ring
- anim_DOCKRING = CreateAnimation(0.0);
- static UINT RING[4] = { 6, 10, 7, 5, };
- static MGROUP_TRANSLATE RING1(3, RING, 4,_V(0, .45, 0));
- static UINT ROD1_1[1] = { 12};
- static MGROUP_TRANSLATE ROD1(3, ROD1_1, 1, _V(-.025, .45, 0));
- static UINT ROD1_2[1] = { 11 };
- static MGROUP_TRANSLATE ROD1A(3, ROD1_2, 1, _V(.025, .45, 0));
- static UINT ROD2_1[1] = { 9 };
- static MGROUP_TRANSLATE ROD2(3, ROD2_1, 1, _V(0, .45, .025));
- static UINT ROD2_2[1] = { 10 };
- static MGROUP_TRANSLATE ROD2A(3, ROD2_2, 1, _V(0, .45, -.025));
- static UINT ROD3_1[1] = { 8 };
- static MGROUP_TRANSLATE ROD3(3, ROD3_1, 1, _V(0, .45, -.025));
- static UINT ROD3_2[1] = { 7 };
- static MGROUP_TRANSLATE ROD3A(3, ROD3_2, 1, _V(0, .45, .025));
- AddAnimationComponent(anim_DOCKRING, 0, 1, &ROD1);
- AddAnimationComponent(anim_DOCKRING, 0, 1, &ROD1A);
- AddAnimationComponent(anim_DOCKRING, 0, 1, &ROD2);
- AddAnimationComponent(anim_DOCKRING, 0, 1, &ROD2A);
- AddAnimationComponent(anim_DOCKRING, 0, 1, &ROD3);
- AddAnimationComponent(anim_DOCKRING, 0, 1, &ROD3A);
- AddAnimationComponent(anim_DOCKRING, 0, 1, &RING1);
- //********14 mpmobss
- static UINT OBSSmpm[1] = { 0 };
- static MGROUP_ROTATE OBSS_A(7, OBSSmpm, 1,_V(2.544, 1.187, 9.613), _V(0, 0, 1), (float)(-30 * RAD)); // -180 .. +180
- anim_MPMOBSS = CreateAnimation(0.0);
- // obssparent = AddAnimationComponent(anim_MPMOBSS, 0, 1, &OBSS_A);
- // obss_anim[0] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(armobss_tip), 3, OBSS_POS, _V(0, 0, 1), (float)(0.0));
- // AddAnimationComponent(anim_MPMOBSS, 0, 1, obss_anim[0], obssparent);
- //*******Body flap
- static UINT bfGrp[1] = { GRP_Group2 };
- static MGROUP_ROTATE BodyFlap(midx, bfGrp, 1,
- _V(0, -2.199202, - 12.13037), _V(-1,0,0), (float)(34.2*RAD));
- anim_bf = CreateAnimation(0.34);
- AddAnimationComponent(anim_bf, 0, 1, &BodyFlap);
- //INDICATOR
- static UINT bfINDGrp[1] = { GRP_INDBODYFLAP };
- static MGROUP_TRANSLATE BodyFlapIND(vidx, bfINDGrp, 1, _V(0, -.0485, -.013));
- anim_BODYFLAPINDICATOR = CreateAnimation(0.0);
- AddAnimationComponent(anim_BODYFLAPINDICATOR, 0, 1, &BodyFlapIND);
- static UINT autobfINDGrp[1] = { GRP_LEFTSPDAUTO };
- static MGROUP_TRANSLATE autoBodyFlapIND(vidx, autobfINDGrp, 1, _V(-.002, 0, -.002));
- static UINT autobfINDGrpr[1] = { GRP_RIGHTSPDAUTO };
- static MGROUP_TRANSLATE autoBodyFlapINDr(vidx, autobfINDGrpr, 1, _V(.002, 0, -.002));
- anim_AUTOBDYFLAP = CreateAnimation(0.0);
- AddAnimationComponent(anim_AUTOBDYFLAP, 0, 1, &autoBodyFlapIND);
- AddAnimationComponent(anim_AUTOBDYFLAP, 0, 1, &autoBodyFlapINDr);
- //newius
- anim_ius = CreateAnimation(0.0);
- ius_anim[0] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm_ius), 3, pl1_ofs, _V(1, 0, 0), (float)(-59*RAD));
- AddAnimationComponent(anim_ius, 0, 1, ius_anim[0]);
- static UINT ADTADoorGrp[1] = { GRP_leftairprobe };
- static MGROUP_ROTATE LEFTADTA1(midx, ADTADoorGrp, 1,
- _V(-1.038175, - 1.2254, 19.25658), _V(0, 1, 0), (float)(-180 * RAD));
- static UINT ADTADoor1Grp[1] = { GRP_rightairprobe };
- static MGROUP_ROTATE RIGHTADTA1(midx, ADTADoor1Grp, 1,
- _V(1.038175, -1.2254, 19.25658), _V(0, 1, 0), (float)(180 * RAD));
- // static UINT LCargoDoorGrp[4] = { GRP_cargodooroutL, GRP_cargodoorinL, GRP_radiatorFL, GRP_radiatorBL };
- // static MGROUP_ROTATE LCargoDoor(midx, LCargoDoorGrp, 4,
- // _V(-2.88, 1.3, 0), _V(0, 0, 1), (float)(175.5*RAD));
- anim_ADTA = CreateAnimation(1.0);
- AddAnimationComponent(anim_ADTA, 0.0, 1, &LEFTADTA1);
- AddAnimationComponent(anim_ADTA, 0.0, 1, &RIGHTADTA1);
- //mfdswitches
- static UINT mfd1pwrGrp[1] = { GRP_CRT1_PWR };
- static MGROUP_ROTATE MFDPWR1(vidx, mfd1pwrGrp, 1,
- _V(-0.110675, 1.80093, 14.44304), _V(1, 0, 0), (float)(45 * RAD));
- anim_mfd1 = CreateAnimation(0.5);
- AddAnimationComponent(anim_mfd1, 0.0, 1, &MFDPWR1);
- //MFD0
- static UINT mfd0pwrGrp[1] = { GRP_CRT3_PWR };
- static MGROUP_ROTATE MFDPWR0(vidx, mfd0pwrGrp, 1,
- _V(-0.110675, 1.80093, 14.44304), _V(1, 0, 0), (float)(45 * RAD));
- anim_mfd0 = CreateAnimation(0.5);
- AddAnimationComponent(anim_mfd0, 0.0, 1, &MFDPWR0);
- //MFD2
- static UINT mfd2pwrGrp[1] = { GRP_CRT2_PWR };
- static MGROUP_ROTATE MFDPWR2(vidx, mfd2pwrGrp, 1,
- _V(-0.110675, 1.80093, 14.44304), _V(1, 0, 0), (float)(45 * RAD));
- anim_mfd2 = CreateAnimation(0.5);
- AddAnimationComponent(anim_mfd2, 0.0, 1, &MFDPWR2);
- //aft mfd
- static UINT mfdApwrGrp[1] = { GRP_R11LS1 };
- static MGROUP_ROTATE MFDPWRA(vidx, mfdApwrGrp, 1,
- _V(1.2786, 2.1382, 13.29), _V(0, 0, 1), (float)(45 * RAD));
- anim_mfdAFT = CreateAnimation(0.5);
- AddAnimationComponent(anim_mfdAFT, 0.0, 1, &MFDPWRA);
- //AFTMET TIMER
- anim_AFTMETTIMER = CreateAnimation(0.5);
- static UINT AFTMETSELECTGrp[1] = { GRP_aftmissionmettimer };
- static MGROUP_ROTATE AFTMET(vidx, AFTMETSELECTGrp, 1,
- _V(-0.8209285, 2.869725, 12.25803), _V(1, 0, -.2), (float)(45 * RAD));
- AddAnimationComponent(anim_AFTMETTIMER, 0.0, 1, &AFTMET);
- //afteventtimer
- anim_AFTSETRESET = CreateAnimation(0.5);
- static UINT AFTSETRESETGrp[1] = { GRP_AFTTIMERSETRESET };
- static MGROUP_ROTATE AFTSETRESET(vidx, AFTSETRESETGrp, 1,
- _V(0.352, 2.4346, 12.314), _V(1, 0, 0), (float)(60 * RAD));
- AddAnimationComponent(anim_AFTSETRESET, 0.0, 1, &AFTSETRESET);
- anim_AFTTIMERSTARTSTOP = CreateAnimation(0.5);
- static UINT AFTSTARTSTOPGrp[1] = { GRP_AFTTIMERSTARTSTOP };
- static MGROUP_ROTATE AFTSTARTSTOP(vidx, AFTSTARTSTOPGrp, 1,
- _V(0.381, 2.4346, 12.314), _V(1, 0, 0), (float)(60 * RAD));
- AddAnimationComponent(anim_AFTTIMERSTARTSTOP, 0.0, 1, &AFTSTARTSTOP);
- anim_AFTTIMERUPDOWNTEST = CreateAnimation(0.5);
- static UINT AFTUPDOWNTESTGrp[1] = { GRP_AFTTIMERUPDOWNTEST };
- static MGROUP_ROTATE AFTTIMERUPDOWNTEST(vidx, AFTUPDOWNTESTGrp, 1,
- _V(0.412, 2.4346, 12.314), _V(1, 0, 0), (float)(60 * RAD));
- AddAnimationComponent(anim_AFTTIMERUPDOWNTEST, 0.0, 1, &AFTTIMERUPDOWNTEST);
- //AFT TIMER CONTROLS
- anim_AFTEVENTMINUTE2 = CreateAnimation(0.0);
- static UINT AFTMINUTE2Grp[1] = { GRP_A6Utog1 };
- static MGROUP_ROTATE AFTTIMERMINUTE2(vidx, AFTMINUTE2Grp, 1,
- _V(.415, 2.498, 12.285), _V(1, 0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_AFTEVENTMINUTE2, 0.0, 1, &AFTTIMERMINUTE2);
- anim_AFTEVENTMINUTE1 = CreateAnimation(0.0);
- static UINT AFTMINUTE1Grp[1] = { GRP_A6Utog2 };
- static MGROUP_ROTATE AFTTIMERMINUTE1(vidx, AFTMINUTE1Grp, 1,
- _V(.393, 2.498, 12.285), _V(1, 0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_AFTEVENTMINUTE1, 0.0, 1, &AFTTIMERMINUTE1);
- anim_AFTEVENTSECOND1 = CreateAnimation(0.0);
- static UINT AFTSECOND1Grp[1] = { GRP_A6Utog3 };
- static MGROUP_ROTATE AFTTIMERSECOND1(vidx, AFTSECOND1Grp, 1,
- _V(.369, 2.498, 12.285), _V(1, 0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_AFTEVENTSECOND1, 0.0, 1, &AFTTIMERSECOND1);
- anim_AFTEVENTSECOND2 = CreateAnimation(0.0);
- static UINT AFTSECOND2Grp[1] = { GRP_A6Utog4 };
- static MGROUP_ROTATE AFTTIMERSECOND2(vidx, AFTSECOND2Grp, 1,
- _V(.346, 2.498, 12.285), _V(1, 0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_AFTEVENTSECOND2, 0.0, 1, &AFTTIMERSECOND2);
- //FRONT TIMER CONTROLS
- anim_FRTEVENTMINUTE2 = CreateAnimation(0.0);
- static UINT FRONTMINUTE2Grp[1] = { GRP_frontminutesselect2 };
- static MGROUP_ROTATE FRONTTIMERMINUTE2(vidx, FRONTMINUTE2Grp, 1,
- _V(-0.00718, 1.691, 14.36001), _V(1,0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_FRTEVENTMINUTE2, 0.0, 1, &FRONTTIMERMINUTE2);
- anim_FRTEVENTMINUTE1 = CreateAnimation(0.0);
- static UINT FRONTMINUTE1Grp[1] = { GRP_frontminutes1select };
- static MGROUP_ROTATE FRONTTIMERMINUTE1(vidx, FRONTMINUTE1Grp, 1,
- _V(.014, 1.691, 14.36001), _V(1, 0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_FRTEVENTMINUTE1, 0.0, 1, &FRONTTIMERMINUTE1);
- anim_FRTEVENTSECOND1 = CreateAnimation(0.0);
- static UINT FRONTSECOND1Grp[1] = { GRP_frontseconds1select };
- static MGROUP_ROTATE FRONTTIMERSECOND1(vidx, FRONTSECOND1Grp, 1,
- _V(.06, 1.691, 14.36001), _V(1, 0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_FRTEVENTSECOND1, 0.0, 1, &FRONTTIMERSECOND1);
- anim_FRTEVENTSECOND2 = CreateAnimation(0.0);
- static UINT FRONTSECOND2Grp[1] = { GRP_frontseconds2select };
- static MGROUP_ROTATE FRONTTIMERSECOND2(vidx, FRONTSECOND2Grp, 1,
- _V(.04, 1.691, 14.36001), _V(1, 0, 0), (float)(360 * RAD));
- AddAnimationComponent(anim_FRTEVENTSECOND2, 0.0, 1, &FRONTTIMERSECOND2);
- anim_FRTSETRESET = CreateAnimation(0.5);
- anim_FRTTIMERSTARTSTOP = CreateAnimation(0.5);
- anim_FRTTIMERUPDOWNTEST = CreateAnimation(0.5);
- static UINT FRTSETRESETGrp[1] = { GRP_FRONTTIMERSETRESET };
- static MGROUP_ROTATE FRTSETRESET(vidx, FRTSETRESETGrp, 1,
- _V(0.102, 1.687, 14.33), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_FRTSETRESET, 0.0, 1, &FRTSETRESET);
- static UINT FRTSTARTSTOPGrp[1] = { GRP_FRONTTIMERSTARTSTOP };
- static MGROUP_ROTATE FRTSTARTSTOP(vidx, FRTSTARTSTOPGrp, 1,
- _V(-0.074, 1.687, 14.33), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_FRTTIMERSTARTSTOP, 0.0, 1, &FRTSTARTSTOP);
- static UINT FRTTIMERUPDOWNTESTGrp[1] = { GRP_FRONTEVENTTIMERUPDOWNTEST };
- static MGROUP_ROTATE FTIMERUPDOWNTEST(vidx, FRTTIMERUPDOWNTESTGrp, 1,
- _V(-.105, 1.687, 14.33), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_FRTTIMERUPDOWNTEST, 0.0, 1, &FTIMERUPDOWNTEST);
- //FRONT MET
- anim_FRTMET = CreateAnimation(0.5);
- static UINT FRTMETSELECTGrp[1] = { GRP_FRONTGMTTEST };
- static MGROUP_ROTATE FRTMET(vidx, FRTMETSELECTGrp, 1,
- _V(.512, 2.715, 14.294), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_FRTMET, 0.0, 1, &FRTMET);
- //PANELA2
- anim_PANELA2SCALE = CreateAnimation(0.5);
- static UINT A2SCALESELECTGrp[1] = { GRP_A2U2 };
- static MGROUP_ROTATE A2SCALE(vidx, A2SCALESELECTGrp, 1,
- _V(0, 3.125, 12.231), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_PANELA2SCALE, 0.0, 1, &A2SCALE);
- anim_PANELA2TEST = CreateAnimation(0.5);
- static UINT A2TESTSELECTGrp[1] = { GRP_A2U1 };
- static MGROUP_ROTATE A2TEST(vidx, A2TESTSELECTGrp, 1,
- _V(0, 3.188, 12.231), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_PANELA2TEST, 0.0, 1, &A2TEST);
- anim_PANELA2pwr = CreateAnimation(0.5);
- static UINT A2pwrSELECTGrp[1] = { GRP_A1US12 };
- static MGROUP_ROTATE A2pwr(vidx, A2pwrSELECTGrp, 1,
- _V(1.282, 2.703, 12.147), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_PANELA2pwr, 0.0, 1, &A2pwr);
- //ku controls
- anim_KUAZ = CreateAnimation(0.5);
- static UINT KUAZGrp[1] = { GRP_A1US2 };
- static MGROUP_ROTATE KUAZ(vidx, KUAZGrp, 1,
- _V(1.147, 2.88, 12.147), _V(0, 1, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_KUAZ, 0.0, 1, &KUAZ);
- anim_KUEL = CreateAnimation(0.5);
- static UINT KUELGrp[1] = { GRP_A1US3 };
- static MGROUP_ROTATE KUEL(vidx, KUELGrp, 1,
- _V(1.102, 2.88, 12.147), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_KUEL, 0.0, 1, &KUEL);
- anim_KURATE = CreateAnimation(0.5);
- static UINT KUrateGrp[1] = { GRP_A1US4 };
- static MGROUP_ROTATE KUrate(vidx, KUrateGrp, 1,
- _V(1.069, 2.88, 12.147), _V(1, 0, 0), (float)(45 * RAD));
- AddAnimationComponent(anim_KURATE, 0.0, 1, &KUrate);
- //lighting
- static UINT floodpwrGrp[1] = { GRP_floodlighting };
- static MGROUP_ROTATE FLOODPWR(vidx, floodpwrGrp, 1,
- _V(0.43404, 2.772718 , 12.21255), _V(1, 0, 0), (float)(60 * RAD));
- static UINT AFTPORTpwrGrp[1] = { GRP_AFTPORT };
- static MGROUP_ROTATE AFTPORTPWR(vidx, AFTPORTpwrGrp, 1,
- _V(0.176, 2.694968, 12.235), _V(1, 0, 0), (float)(60 * RAD));
- static UINT AFTSTBDpwrGrp[1] = { GRP_AFTSTBD };
- static MGROUP_ROTATE AFTSTBDPWR(vidx, AFTSTBDpwrGrp, 1,
- _V(0.221, 2.694968, 12.235), _V(1, 0, 0), (float)(60 * RAD));
- static UINT MIDPORTpwrGrp[1] = { GRP_MIDPORT };
- static MGROUP_ROTATE MIDPORTPWR(vidx, MIDPORTpwrGrp, 1,
- _V(0.176, 2.635005, 12.25304), _V(1, 0, 0), (float)(60 * RAD));
- static UINT MIDSTBDpwrGrp[1] = { GRP_MIDSTBD };
- static MGROUP_ROTATE MIDSTBDPWR(vidx, MIDSTBDpwrGrp, 1,
- _V(0.221, 2.635005, 12.25304), _V(1, 0, 0), (float)(60 * RAD));
- static UINT FWDPORTpwrGrp[1] = { GRP_FWDPORT };
- static MGROUP_ROTATE FWDPORTPWR(vidx, FWDPORTpwrGrp, 1,
- _V(0.176, 2.571194 , 12.27293), _V(1, 0, 0), (float)(60 * RAD));
- static UINT FWDSTBDpwrGrp[1] = { GRP_FWDSTBD };
- static MGROUP_ROTATE FWDSTBDPWR(vidx, FWDSTBDpwrGrp, 1,
- _V(0.221, 2.571194, 12.27293), _V(1, 0, 0), (float)(60 * RAD));
- static UINT DOCKpwrGrp[1] = { GRP_DOCKINGLIGHT };
- static MGROUP_ROTATE DOCKPWR(vidx, DOCKpwrGrp, 1,
- _V(0.22196 , 2.517156, 12.28897), _V(1, 0, 0), (float)(60 * RAD));
- anim_docklight = CreateAnimation(0.5);
- AddAnimationComponent(anim_docklight, 0.0, 1, &DOCKPWR);
- static UINT FWDpwrGrp[1] = { GRP_FWDLIGHT };
- static MGROUP_ROTATE FWDPWR(vidx, FWDpwrGrp, 1,
- _V(0.17696, 2.51693, 12.28904), _V(1, 0, 0), (float)(-60 * RAD));
- anim_fwdlight = CreateAnimation(0.5);
- AddAnimationComponent(anim_fwdlight, 0.0, 1, &FWDPWR);
- anim_floodstbdaft = CreateAnimation(0.5);
- AddAnimationComponent(anim_floodstbdaft, 0.0, 1, &AFTSTBDPWR);
- anim_floodportaft = CreateAnimation(0.5);
- AddAnimationComponent(anim_floodportaft, 0.0, 1, &AFTPORTPWR);
- anim_floodstbdmid = CreateAnimation(0.5);
- AddAnimationComponent(anim_floodstbdmid, 0.0, 1, &MIDSTBDPWR);
- anim_floodportmid = CreateAnimation(0.5);
- AddAnimationComponent(anim_floodportmid, 0.0, 1, &MIDPORTPWR);
- anim_floodstbdfwd = CreateAnimation(0.5);
- AddAnimationComponent(anim_floodstbdfwd, 0.0, 1, &FWDSTBDPWR);
- anim_floodportfwd = CreateAnimation(0.5);
- AddAnimationComponent(anim_floodportfwd, 0.0, 1, &FWDPORTPWR);
- anim_floodon = CreateAnimation(0.5);
- AddAnimationComponent(anim_floodon, 0.0, 1, &FLOODPWR);
- static UINT HUDpwrGrp[1] = { GRP_HUDPOWERLEFT };
- static MGROUP_ROTATE HUDPWR(vidx, HUDpwrGrp, 1,_V(-0.538165 , 2.355418, 14.53427), _V(1, 0, 0), (float)(-60 * RAD));
- static UINT HUDpwr1Grp[1] = { GRP_HUDPOWERONRIGHT };
- static MGROUP_ROTATE HUDPWR1(vidx, HUDpwr1Grp, 1, _V(0.530135 , 2.355064 , 14.53435), _V(1, 0, 0), (float)(-60 * RAD));
- anim_HUDpower = CreateAnimation(0.5);
- AddAnimationComponent(anim_HUDpower, 0.0, 1, &HUDPWR);
- AddAnimationComponent(anim_HUDpower, 0.0, 1, &HUDPWR1);
- static UINT ATDApwrGrp[1] = { GRP_leftadtastow };
- static MGROUP_ROTATE ATDAPWR(vidx, ATDApwrGrp, 1, _V(-0.22296, 1.599788, 14.11368), _V(1, 0, 0), (float)(-60 * RAD));
- static UINT ATDApwr1Grp[1] = { GRP_rightadtastow };
- static MGROUP_ROTATE ATDAPWR1(vidx, ATDApwr1Grp, 1, _V(-0.18793, 1.599788, 14.11341), _V(1, 0, 0), (float)(-60 * RAD));
- anim_ATDADeploy = CreateAnimation(0.5);
- AddAnimationComponent(anim_ATDADeploy, 0.0, 1, &ATDAPWR);
- AddAnimationComponent(anim_ATDADeploy, 0.0, 1, &ATDAPWR1);
- // ***** 9 Payload bay cameras animation *****
- // FRONT LEFT A
- static UINT camFLYawGrp[1] = { GRP_Group43 };
- MGROUP_ROTATE* CameraFLYaw = new MGROUP_ROTATE(midx, camFLYawGrp, 1,
- _V(-1.791455, 1.574, 11.82927), _V(0, 1, 0), (float)(340 * RAD));
- anim_camFLyaw = CreateAnimation(0.5);
- parent = AddAnimationComponent(anim_camFLyaw, 0, 1, CameraFLYaw);
- static UINT camFLPitchGrp[1] = { GRP_Group44 };
- MGROUP_ROTATE* CameraFLPitch = new MGROUP_ROTATE(midx, camFLPitchGrp, 1,
- _V(-1.791455, 1.574, 11.82927), _V(1, 0, 0), (float)(340 * RAD));
- anim_camFLpitch = CreateAnimation(0.5);
- //anim_camFLpitch = CreateAnimation (0.7647);
- parent = AddAnimationComponent(anim_camFLpitch, 0, 1, CameraFLPitch, parent);
- MGROUP_TRANSFORM* CameraFLPos = new MGROUP_TRANSFORM(LOCALVERTEXLIST, MAKEGROUPARRAY(&plbCamPos[0]), 1);
- AddAnimationComponent(anim_camFLpitch, 0, 1, CameraFLPos, parent);
- // FRONT RIGHT D
- static UINT camFRYawGrp[1] = { GRP_Group48 };
- MGROUP_ROTATE* CameraFRYaw = new MGROUP_ROTATE(midx, camFRYawGrp, 1,
- _V(1.791455, 1.574, 11.82927), _V(0, 1, 0), (float)(340 * RAD));
- anim_camFRyaw = CreateAnimation(0.5);
- parent = AddAnimationComponent(anim_camFRyaw, 0, 1, CameraFRYaw);
- static UINT camFRPitchGrp[1] = { GRP_Group47 };
- MGROUP_ROTATE* CameraFRPitch = new MGROUP_ROTATE(midx, camFRPitchGrp, 1,
- _V(1.791455, 1.574, 11.82927), _V(1, 0, 0), (float)(340 * RAD));
- anim_camFRpitch = CreateAnimation(0.5);
- parent = AddAnimationComponent(anim_camFRpitch, 0, 1, CameraFRPitch, parent);
- MGROUP_TRANSFORM* CameraFRPos = new MGROUP_TRANSFORM(LOCALVERTEXLIST, MAKEGROUPARRAY(&plbCamPos[3]), 1);
- AddAnimationComponent(anim_camFRpitch, 0, 1, CameraFRPos, parent);
- // BACK RIGHT C
- static UINT camBRYawGrp[1] = { GRP_Group49 };
- MGROUP_ROTATE* CameraBRYaw = new MGROUP_ROTATE(midx, camBRYawGrp, 1,
- _V(2.29455, 1.748, -6.476198), _V(0, 1, 0), (float)(340 * RAD));
- anim_camBRyaw = CreateAnimation(0.5);
- parent = AddAnimationComponent(anim_camBRyaw, 0, 1, CameraBRYaw);
- static UINT camBRPitchGrp[1] = { GRP_Group50 };
- MGROUP_ROTATE* CameraBRPitch = new MGROUP_ROTATE(midx, camBRPitchGrp, 1,
- _V(2.29455, 1.748, -6.476198), _V(-1, 0, 0), (float)(340 * RAD));
- anim_camBRpitch = CreateAnimation(0.5);
- parent = AddAnimationComponent(anim_camBRpitch, 0, 1, CameraBRPitch, parent);
- MGROUP_TRANSFORM* CameraBRPos = new MGROUP_TRANSFORM(LOCALVERTEXLIST, MAKEGROUPARRAY(&plbCamPos[2]), 1);
- AddAnimationComponent(anim_camBRpitch, 0, 1, CameraBRPos, parent);
- // BACK LEFT b
- static UINT camBLYawGrp[1] = { GRP_Group46 };
- MGROUP_ROTATE* CameraBLYaw = new MGROUP_ROTATE(midx, camBLYawGrp, 1,
- _V(-2.29455, 1.748, -6.476198), _V(0, 1, 0), (float)(340 * RAD));
- anim_camBLyaw = CreateAnimation(0.5);
- parent = AddAnimationComponent(anim_camBLyaw, 0, 1, CameraBLYaw);
- static UINT camBLPitchGrp[1] = { GRP_Group45 };
- MGROUP_ROTATE* CameraBLPitch = new MGROUP_ROTATE(midx, camBLPitchGrp, 1,
- _V(-2.29455, 1.748, -6.476198), _V(-1, 0, 0), (float)(340 * RAD));
- anim_camBLpitch = CreateAnimation(0.5);
- parent = AddAnimationComponent(anim_camBLpitch, 0, 1, CameraBLPitch, parent);
- MGROUP_TRANSFORM* CameraBLPos = new MGROUP_TRANSFORM(LOCALVERTEXLIST, MAKEGROUPARRAY(&plbCamPos[1]), 1);
- AddAnimationComponent(anim_camBLpitch, 0, 1, CameraBLPos, parent);
- anim_SLIDEWIRE = CreateAnimation(0);
- // doorparentR = AddAnimationComponent(anim_door, 0, .8, &RCargoDoorHINGE1);//swing out
- //doorparentR = AddAnimationComponent(anim_door, 0.0, 0.4632, &RCargoDoorHINGE);//swing out
- ANIMATIONCOMPONENT_HANDLE SLIDEWIRER, SLIDEWIREL, SLIDEWIRERPARENT, SLIDEWIRELPARENT;
- static UINT SLIDEWIRERGrp[1] = { 4 };
- static MGROUP_ROTATE RSLIDEWIRE(9, SLIDEWIRERGrp, 1,
- _V(2.84, 1.284, 0), _V(0, 0, 1), (float)(-175.5*RAD));
- static UINT SLIDEWIRER1Grp[3] = { 0,8,10};
- static MGROUP_ROTATE RSLIDEWIRE1(9, SLIDEWIRER1Grp, 3,
- _V(2.694777, 1.411242, 3.038241), _V(0, 0, 1), (float)(135*RAD));
- static UINT SLIDEWIRER2Grp[1] = { 3 };
- static MGROUP_ROTATE RSLIDEWIRE2(9, SLIDEWIRER2Grp, 1,
- _V(2.600686, 1.585991, 2.797316), _V(0, 0, 1), (float)(-30 * RAD));
- static UINT SLIDEWIRELGrp[1] = { 5 };
- static MGROUP_ROTATE LSLIDEWIRE(9, SLIDEWIRELGrp, 1,
- _V(-2.84, 1.284, 0), _V(0, 0, 1), (float)(175.5*RAD));
- static UINT SLIDEWIREl1Grp[3] = { 1,9,11 };
- static MGROUP_ROTATE lSLIDEWIRE1(9, SLIDEWIREl1Grp, 3,
- _V(-2.694777, 1.411242, 3.038241), _V(0, 0, 1), (float)(-135 * RAD));
- static UINT SLIDEWIREL2Grp[1] = { 7 };
- static MGROUP_ROTATE LSLIDEWIRE2(9, SLIDEWIREL2Grp, 1,
- _V(-2.599019, 1.578824, 2.775872), _V(0, 0, 1), (float)(30 * RAD));
- SLIDEWIRER = AddAnimationComponent(anim_door, 0.0, 0.4632, &RSLIDEWIRE);//swing out
- SLIDEWIRERPARENT=AddAnimationComponent(anim_door, 0.0, 0.4632, &RSLIDEWIRE1, SLIDEWIRER);
- AddAnimationComponent(anim_door, 0.0, 0.4632, &RSLIDEWIRE2, SLIDEWIRERPARENT);
- SLIDEWIREL = AddAnimationComponent(anim_door, 0.5368, 1.0, &LSLIDEWIRE);//swing out
- SLIDEWIRELPARENT=AddAnimationComponent(anim_door, 0.5368, 1.0, &lSLIDEWIRE1, SLIDEWIREL);
- AddAnimationComponent(anim_door, 0.5368, 1.0, &LSLIDEWIRE2, SLIDEWIRELPARENT);
- //rcsindicators
- anim_pitchup = CreateAnimation(0.0);
- anim_pitchdown = CreateAnimation(0.0);
- anim_rollleft = CreateAnimation(0.0);
- anim_rollright = CreateAnimation(0.0);
- anim_yawleft = CreateAnimation(0.0);
- anim_yawright = CreateAnimation(0.0);
- static UINT PITCHUPGrp[1] = { GRP_PITCHUP };
- static MGROUP_TRANSLATE PITCHUP(vidx, PITCHUPGrp, 1,_V(0, 0, -.001));
- AddAnimationComponent(anim_pitchup, 0.0, 1, &PITCHUP);
- static UINT PITCHDOWNGrp[1] = { GRP_PITCHDOWN };
- static MGROUP_TRANSLATE PITCHDOWN(vidx, PITCHDOWNGrp, 1, _V(0, 0, -.002));
- AddAnimationComponent(anim_pitchdown, 0.0, 1, &PITCHDOWN);
- static UINT ROLLLEFTGrp[1] = { GRP_LEFTROLL };
- static MGROUP_TRANSLATE ROLLLEFT(vidx, ROLLLEFTGrp, 1, _V(0, 0, -.002));
- AddAnimationComponent(anim_rollleft, 0.0, 1, &ROLLLEFT);
- static UINT ROLLRIGHTGrp[1] = { GRP_RIGHTROLL };
- static MGROUP_TRANSLATE ROLLRIGHT(vidx, ROLLRIGHTGrp, 1, _V(0, 0, -.002));
- AddAnimationComponent(anim_rollright, 0.0, 1, &ROLLRIGHT);
- static UINT YAWLEFTGrp[1] = { GRP_LEFTYAW };
- static MGROUP_TRANSLATE YAWLEFT(vidx, YAWLEFTGrp, 1, _V(0, 0, -.002));
- AddAnimationComponent(anim_yawleft, 0.0, 1, &YAWLEFT);
- static UINT YAWRIGHTGrp[1] = { GRP_RIGHTYAW };
- static MGROUP_TRANSLATE YAWRIGHT(vidx, YAWRIGHTGrp, 1, _V(0, 0, -.003));
- AddAnimationComponent(anim_yawright, 0.0, 1, &YAWRIGHT);
- // ======================================================
- // VC animation definitions
- // ======================================================
- plop->DefineAnimations(vidx);
- }
- // --------------------------------------------------------------
- // Register the MFD interface for the ascent autopilot
- // --------------------------------------------------------------
- //int Atlantis::RegisterAscentApMfd ()
- //{
- // static char *name = "AscentAP";
- // MFDMODESPECEX spec;
- // spec.name = name;
- // spec.key = OAPI_KEY_B;
- // spec.context = NULL;
- // spec.msgproc = AscentApMfd::MsgProc;
- // return RegisterMFDMode (spec);
- //}
- // --------------------------------------------------------------
- // Open the dialog interface for the ascent autopilot
- // --------------------------------------------------------------
- //void Atlantis::CreateAscentAPDlg ()
- //{
- // if (!ascentApDlg) {
- // ascentApDlg = new AscentAPDlg(ascap);
- // ascentApDlg->Open (g_Param.hDLL, true);
- // }
- //}
- // --------------------------------------------------------------
- // Close the dialog interface for the ascent autopilot
- // --------------------------------------------------------------
- //void Atlantis::DestroyAscentAPDlg ()
- //{
- // if (ascentApDlg) {
- // delete ascentApDlg;
- // ascentApDlg = 0;
- // }
- //}
- // --------------------------------------------------------------
- // Jettison both SRBs from ET
- // --------------------------------------------------------------
- // --------------------------------------------------------------
- // Jettison ET from orbiter
- // --------------------------------------------------------------
- //rms
- void Atlantis::ToggleGrapple(void)
- {
- HWND hDlg;
- OBJHANDLE hV = GetAttachmentStatus(rms_attach);
- if (hV) { // release satellite
- ATTACHMENTHANDLE hAtt = CanArrest();
- DetachChild(rms_attach, 0);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE), "Grapple");
- EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL* v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAXGRAPPLINGDIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 gpos, grms, pos, dir, rot;
- Local2Global(arm_tip[0], grms); // global position of RMS tip
- // Search the complete vessel list for a grappling candidate.
- // Not very scalable ...
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
- oapiGetGlobalPos(hV, &gpos);
- //sprintf(oapiDebugString(), "dist2 %0.4f ,%0.4f", dist(gpos, grms), oapiGetSize(hV));
- //if (dist(gpos, grms) < oapiGetSize(hV))
- { // in range
- VESSEL* v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- const char* id = v->GetAttachmentId(hAtt);
- if (strncmp(id, "GS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- distattach = (dist(gpos, grms));
- //sprintf(oapiDebugString(), "dist2 %0.4f ,%0.4f", distattach, MAXGRAPPLINGDIST);
- if (dist(gpos, grms) < .2) { // found one!
- // check whether satellite is currently clamped into payload bay
- //if (hV == GetAttachmentStatus(sat_attach))
- // DetachChild(sat_attach);
- AttachChild(hV, rms_attach, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE), "Release");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), FALSE);
- }
- return;
- }
- }
- }
- }
- }
- }
- void Atlantis::ToggleArrest(void)
- {
- { // try to arrest satellite
- ToggleGrapple();
- }
- }
- // check whether the currently grappled object can be stowed in the cargo bay
- ATTACHMENTHANDLE Atlantis::CanArrest(void) const
- {
- OBJHANDLE hV = GetAttachmentStatus(rms_attach);
- if (!hV) return 0;
- VESSEL* v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- VECTOR3 pos, dir, rot, gpos, gbay;
- GetAttachmentParams(rms_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- for (DWORD j = 0; j < nAttach; j++) {
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- if (strncmp(v->GetAttachmentId(hAtt), "GS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < .2) {
- return hAtt;
- }
- }
- return 0;
- }
- /*
- void Atlantis::ToggleGrapple(void)
- {
- HWND hDlg;
- OBJHANDLE hV = GetAttachmentStatus(rms_attach);
- if (hV) { // release satellite
- ATTACHMENTHANDLE hAtt = CanArrest();
- DetachChild(rms_attach);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE), "Grapple");
- EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams (sat_attach, pos, dir, rot);
- Local2Global (pos, gbay);
- VESSEL *v = oapiGetVesselInterface (hV);
- DWORD nAttach = v->AttachmentCount (true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle (true, j);
- v->GetAttachmentParams (hAtt, pos, dir, rot);
- v->Local2Global (pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 gpos, grms, pos, dir, rot;
- Local2Global(arm_tip[0], grms); // global position of RMS tip
- // Search the complete vessel list for a grappling candidate.
- // Not very scalable ...
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
- oapiGetGlobalPos(hV, &gpos);
- if (dist(gpos, grms) < oapiGetSize(hV)) { // in range
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- //const char *id = v->GetAttachmentId(hAtt);
- //if (strncmp(id, "GS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, grms) < MAX_GRAPPLING_DIST) { // found one!
- // check whether satellite is currently clamped into payload bay
- AttachChild(hV, rms_attach, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE), "Release");
- EnableWindow(GetDlgItem(hDlg, IDC_STOW), FALSE);
- }
- return;
- }
- }
- }
- }
- }
- }
- */
- //togglegrappleobss
- void Atlantis::ToggleGrappleOBSS(void)
- {
- HWND hDlg;
- OBJHANDLE hV = GetAttachmentStatus(OBSS_attach);
- if (hV) {
- ATTACHMENTHANDLE hAtt = CanArrestOBSS();
- DetachChild(OBSS_attach);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE2), "Grapple");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 gpos, grms, pos, dir, rot;
- Local2Global(armobss_tip[0], grms); // global position of RMS tip
- EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE2), FALSE);
- // Search the complete vessel list for a grappling candidate.
- // Not very scalable ...
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
- oapiGetGlobalPos(hV, &gpos);
- if (dist(gpos, grms) < oapiGetSize(hV)) { // in range
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- const char *id = v->GetAttachmentId(hAtt);
- if (strncmp(id, "OS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, grms) < MAX_GRAPPLING_DIST) { // found one!
- // check whether satellite is currently clamped into payload bay
- EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE2), TRUE);
- if (hV == GetAttachmentStatus(OBSS_attach))
- DetachChild(OBSS_attach);
- AttachChild(hV, OBSS_attach, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_GRAPPLE2), "Release");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), FALSE);
- }
- return;
- }
- }
- }
- }
- }
- }
- //toggle2
- void Atlantis::ToggleGrapple2(void)
- {
- HWND hDlg;
- OBJHANDLE hV1 = GetAttachmentStatus(sat_attach2);
- if (hV1) { // release satellite
- ATTACHMENTHANDLE hAtt = CanArrest2();
- DetachChild(sat_attach2,.1);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD2), "Arrest");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams (sat_attach, pos, dir, rot);
- Local2Global (pos, gbay);
- VESSEL *v = oapiGetVesselInterface (hV);
- DWORD nAttach = v->AttachmentCount (true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle (true, j);
- v->GetAttachmentParams (hAtt, pos, dir, rot);
- v->Local2Global (pos, gpos);
- if (dist (gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild (hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 aphpos, aphdir, aphrot, gaph;
- VECTOR3 shippos, shipdir, shiprot, gpship;
- // get attachment point positions based on selected point
- {
- GetAttachmentParams(sat_attach2, aphpos, aphdir, aphrot);
- }
- // change the position to a global one rather then a local one. This will allow me to offset it from the local center.
- // the local position is stored in gaph
- Local2Global(aphpos, gaph);
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- // if (strncmp (hV->GetClassName(), "QJFFS", 5)!=0 ){ //restrict to only QuadJ ships to make it easy.
- // Look for any ship with a child attach point. This allows the Mule to grap any object
- if (hV == GetHandle()) continue; // If self then continue onward because we don't want to grapple ourselves ...
- oapiGetGlobalPos(hV, &gpship); // get global postion of ship and put into gpship
- VESSEL *v = oapiGetVesselInterface(hV);
- // Only look for child attach point
- DWORD nAttach = v->AttachmentCount(true); //Get attachment count. I do this so that I can grap any child point.
- if (nAttach > 0){ // Only continue if ship has a child attach point
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate and check how far away from the attach point it is
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- ///* this would allow me to filter out all but QJ ships but I don't want to right now
- const char *id = v->GetAttachmentId(hAtt);
- if (strncmp(id, "XS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, shippos, shipdir, shiprot); //lets get the attach point position
- v->Local2Global(shippos, gpship); // and change it to a global position Recycle of gpship cause I can
- if (dist(gpship, gaph) < .5) { // Is it close enough to grab?
- if (hV == GetAttachmentStatus(sat_attach2))
- {
- DetachChild(sat_attach2, .1);
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD2), "Arrest");
- }
- AttachChild(hV, sat_attach2, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD2), "Release");
- // EnableWindow(GetDlgItem(hDlg, IDC_STOW), FALSE);
- }
- return;
- }
- }
- }
- }
- }
- }
- void Atlantis::ToggleArrest2(void)
- {
- HWND hDlg;
- { // try to arrest satellite
- ToggleGrapple2();
- }
- }
- // check whether the currently grappled object can be stowed in the cargo bay
- ATTACHMENTHANDLE Atlantis::CanArrest2(void) const
- {
- OBJHANDLE hV = GetAttachmentStatus(sat_attach2);
- if (!hV) return 0;
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- VECTOR3 pos, dir, rot, gpos, gbay;
- //GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- for (DWORD j = 0; j < nAttach; j++) {
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- // if (strncmp(v->GetAttachmentId(hAtt), "XS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- return hAtt;
- }
- }
- return 0;
- }
- //toggle1
- void Atlantis::ToggleGrapple1(void)
- {
- HWND hDlg;
- OBJHANDLE hV1 = GetAttachmentStatus(sat_attach);
- if (hV1) { // release satellite
- ATTACHMENTHANDLE hAtt = CanArrest();
- DetachChild(sat_attach, .1);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD), "Arrest");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 aphpos, aphdir, aphrot, gaph;
- VECTOR3 shippos, shipdir, shiprot, gpship;
- // get attachment point positions based on selected point
- {
- GetAttachmentParams(sat_attach, aphpos, aphdir, aphrot);
- }
- // change the position to a global one rather then a local one. This will allow me to offset it from the local center.
- // the local position is stored in gaph
- Local2Global(aphpos, gaph);
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- // if (strncmp (hV->GetClassName(), "QJFFS", 5)!=0 ){ //restrict to only QuadJ ships to make it easy.
- // Look for any ship with a child attach point. This allows the Mule to grap any object
- if (hV == GetHandle()) continue; // If self then continue onward because we don't want to grapple ourselves ...
- oapiGetGlobalPos(hV, &gpship); // get global postion of ship and put into gpship
- VESSEL *v = oapiGetVesselInterface(hV);
- // Only look for child attach point
- DWORD nAttach = v->AttachmentCount(true); //Get attachment count. I do this so that I can grap any child point.
- if (nAttach > 0){ // Only continue if ship has a child attach point
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate and check how far away from the attach point it is
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- ///* this would allow me to filter out all but QJ ships but I don't want to right now
- const char *id = v->GetAttachmentId(hAtt);
- if (strncmp(id, "XS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, shippos, shipdir, shiprot); //lets get the attach point position
- v->Local2Global(shippos, gpship); // and change it to a global position Recycle of gpship cause I can
- if (dist(gpship, gaph) < 2) { // Is it close enough to grab?
- if (hV == GetAttachmentStatus(sat_attach))
- {
- DetachChild(sat_attach, .1);
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD), "Arrest");
- }
- AttachChild(hV, sat_attach, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD), "Release");
- // EnableWindow(GetDlgItem(hDlg, IDC_STOW), FALSE);
- }
- return;
- }
- }
- }
- }
- }
- }
- void Atlantis::ToggleArrest1(void)
- {
- HWND hDlg;
- { // try to arrest satellite
- ToggleGrapple1();
- }
- }
- ATTACHMENTHANDLE Atlantis::CanArrest1(void) const
- {
- OBJHANDLE hV = GetAttachmentStatus(sat_attach);
- if (!hV) return 0;
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- VECTOR3 pos, dir, rot, gpos, gbay;
- //GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- for (DWORD j = 0; j < nAttach; j++) {
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- // if (strncmp(v->GetAttachmentId(hAtt), "XS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- return hAtt;
- }
- }
- return 0;
- }
- //payload3
- void Atlantis::ToggleGrapple3(void)
- {
- HWND hDlg;
- OBJHANDLE hV1 = GetAttachmentStatus(sat_attach3);
- if (hV1) { // release satellite
- ATTACHMENTHANDLE hAtt = CanArrest3();
- DetachChild(sat_attach3, .1);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD3), "Arrest");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 aphpos, aphdir, aphrot, gaph;
- VECTOR3 shippos, shipdir, shiprot, gpship;
- // get attachment point positions based on selected point
- {
- GetAttachmentParams(sat_attach3, aphpos, aphdir, aphrot);
- }
- // change the position to a global one rather then a local one. This will allow me to offset it from the local center.
- // the local position is stored in gaph
- Local2Global(aphpos, gaph);
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- // if (strncmp (hV->GetClassName(), "QJFFS", 5)!=0 ){ //restrict to only QuadJ ships to make it easy.
- // Look for any ship with a child attach point. This allows the Mule to grap any object
- if (hV == GetHandle()) continue; // If self then continue onward because we don't want to grapple ourselves ...
- oapiGetGlobalPos(hV, &gpship); // get global postion of ship and put into gpship
- VESSEL *v = oapiGetVesselInterface(hV);
- // Only look for child attach point
- DWORD nAttach = v->AttachmentCount(true); //Get attachment count. I do this so that I can grap any child point.
- if (nAttach > 0){ // Only continue if ship has a child attach point
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate and check how far away from the attach point it is
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- ///* this would allow me to filter out all but QJ ships but I don't want to right now
- const char *id = v->GetAttachmentId(hAtt);
- if (strncmp(id, "XS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, shippos, shipdir, shiprot); //lets get the attach point position
- v->Local2Global(shippos, gpship); // and change it to a global position Recycle of gpship cause I can
- if (dist(gpship, gaph) < 2) { // Is it close enough to grab?
- if (hV == GetAttachmentStatus(sat_attach3))
- {
- DetachChild(sat_attach3, .1);
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD3), "Arrest");
- }
- AttachChild(hV, sat_attach3, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD3), "Release");
- // EnableWindow(GetDlgItem(hDlg, IDC_STOW), FALSE);
- }
- return;
- }
- }
- }
- }
- }
- }
- void Atlantis::ToggleArrest3(void)
- {
- HWND hDlg;
- { // try to arrest satellite
- ToggleGrapple3();
- }
- }
- ATTACHMENTHANDLE Atlantis::CanArrest3(void) const
- {
- OBJHANDLE hV = GetAttachmentStatus(sat_attach3);
- if (!hV) return 0;
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- VECTOR3 pos, dir, rot, gpos, gbay;
- //GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- for (DWORD j = 0; j < nAttach; j++) {
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- // if (strncmp(v->GetAttachmentId(hAtt), "XS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- return hAtt;
- }
- }
- return 0;
- }
- void Atlantis::GetSSMEGimbalPos (int which, double &pitch, double &yaw)
- {
- VECTOR3 dir;
- if (status < 3) {
- GetThrusterDir (th_main[which], dir);
- } else {
- dir.x = dir.y = 0.0; dir.z = 1.0;
- }
- pitch = asin(dir.y)+10.5*RAD;
- yaw = atan(dir.x/dir.z);
- }
- void Atlantis::GetSRBGimbalPos (int which, double &pitch, double &yaw)
- {
- VECTOR3 dir;
- if (status < 2) {
- // dir = pET->GetSRBThrustDir(which);
- } else {
- dir.x = dir.y = 0.0; dir.z = 1.0;
- }
- pitch = asin(dir.y);
- if (which) pitch = -pitch, yaw = -yaw;
- yaw = atan(dir.x/dir.z);
- }
- //void Atlantis::ToggleArrest(void)
- //{
- // HWND hDlg;
- //if (CanArrest()) { // try to arrest satellite
- // ToggleGrapple();
- // }
- //}
- /*
- // check whether the currently grappled object can be stowed in the cargo bay
- ATTACHMENTHANDLE Atlantis::CanArrest(void) const
- {
- OBJHANDLE hV = GetAttachmentStatus(rms_attach);
- if (!hV) return 0;
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- VECTOR3 pos, dir, rot, gpos, gbay;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- for (DWORD j = 0; j < nAttach; j++) {
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- if (strncmp(v->GetAttachmentId(hAtt), "XS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- return hAtt;
- }
- }
- return 0;
- }
- */
- ATTACHMENTHANDLE Atlantis::CanArrestOBSS(void) const
- {
- OBJHANDLE hV = GetAttachmentStatus(OBSS_attach);
- if (!hV) return 0;
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- VECTOR3 pos, dir, rot, gpos, gbay;
- //GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- for (DWORD j = 0; j < nAttach; j++) {
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- if (strncmp(v->GetAttachmentId(hAtt), "OS", 2)) continue; // attachment point not compatible
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- return hAtt;
- }
- }
- return 0;
- }
- void Atlantis::SpawnEVA(void)
- {
- if ((EVA1 == 0) && (EXT_proc>.8)){
- //if (EXT_status == HATCH_DOWN){
- if (GetAttachmentStatus(ft_pad_att) == NULL)
- {
- if ((ODS == 1) || (EXTAIRLOCK == 1))ft_pad_att_pos = _V(0, 0.3, 8.5);
- SetAttachmentParams(ft_pad_att, ft_pad_att_pos, _V(0, 1, 0), _V(0, 0, -1));
- //OBJHANDLE hVessel;
- VESSELSTATUS vs;
- GetStatus(vs);
- hMMU = oapiCreateVessel(crew1_name, crew1_cfg, vs);
- VESSEL *v = oapiGetVesselInterface(hMMU);
- ATTACHMENTHANDLE hAttWFC = v->GetAttachmentHandle(true, 0);
- AttachChild(hMMU, ft_pad_att, hAttWFC);
- oapiSetFocusObject(hMMU);
- EVA1 = 1;
- //}
- }
- }
- }
- void Atlantis::SpawnEVA1(void)
- {
- //if (EXT_status == HATCH_DOWN){
- if ((EVA2 == 0) && (EXT_proc>.8)){
- if (GetAttachmentStatus(ft_pad_att1) == NULL)
- {
- if ((ODS == 1) || (EXTAIRLOCK == 1))ft_pad_att1_pos = _V(0, 0.3, 8.5);
- SetAttachmentParams(ft_pad_att1, ft_pad_att1_pos, _V(0, 1, 0), _V(0, 0, -1));
- //OBJHANDLE hVessel;
- VESSELSTATUS vs;
- GetStatus(vs);
- hMMU = oapiCreateVessel(crew2_name, crew2_cfg, vs);
- VESSEL *v = oapiGetVesselInterface(hMMU);
- ATTACHMENTHANDLE hAttWFC = v->GetAttachmentHandle(true, 0);
- AttachChild(hMMU, ft_pad_att1, hAttWFC);
- oapiSetFocusObject(hMMU);
- //}
- EVA2 = 1;
- }
- }
- }
- void Atlantis::SpawnEVA2(void)
- {
- //if (EXT_status == HATCH_DOWN){
- if ((EVA3 == 0) &&(EXT_proc>.8)){
- if (GetAttachmentStatus(ft_pad_att2) == NULL)
- {
- if ((ODS == 1) || (EXTAIRLOCK == 1))ft_pad_att2_pos = _V(0, 0.3, 8.5);
- SetAttachmentParams(ft_pad_att2, ft_pad_att2_pos, _V(0, 1, 0), _V(0, 0, -1));
- //OBJHANDLE hVessel;
- VESSELSTATUS vs;
- GetStatus(vs);
- hMMU = oapiCreateVessel(crew3_name, crew3_cfg, vs);
- VESSEL *v = oapiGetVesselInterface(hMMU);
- ATTACHMENTHANDLE hAttWFC = v->GetAttachmentHandle(true, 0);
- AttachChild(hMMU, ft_pad_att2, hAttWFC);
- oapiSetFocusObject(hMMU);
- //}
- EVA3 = 1;
- }
- }
- }
- void Atlantis::SpawnEVA3(void)
- {
- //if (EXT_status == HATCH_DOWN){
- if ((EVA4 == 0) && (EXT_proc>.8)){
- if (GetAttachmentStatus(ft_pad_att3) == NULL)
- {
- if ((ODS == 1) || (EXTAIRLOCK == 1))ft_pad_att3_pos = _V(0, 0.3, 8.5);
- SetAttachmentParams(ft_pad_att3, ft_pad_att3_pos, _V(0, 1, 0), _V(0, 0, -1));
- //OBJHANDLE hVessel;
- VESSELSTATUS vs;
- GetStatus(vs);
- hMMU = oapiCreateVessel(crew4_name, crew4_cfg, vs);
- VESSEL *v = oapiGetVesselInterface(hMMU);
- ATTACHMENTHANDLE hAttWFC = v->GetAttachmentHandle(true, 0);
- AttachChild(hMMU, ft_pad_att3, hAttWFC);
- oapiSetFocusObject(hMMU);
- //}
- EVA4 = 1;
- }
- }
- }
- void Atlantis::ENTER_EVA1(void)
- {
- if (((EVA1 == 1) && ((EXTAIRLOCK == 1) || (ODS == 1)) && (EXT_proc>.8))) {//hatch open and eva performed
- GetAttachmentParams(ft_pad_att, ft_pad_att_pos, ft_pad_att_dir, ft_pad_att_rot);
- if ((ft_pad_att_pos.x > -.35 && ft_pad_att_pos.x<.35) && (ft_pad_att_pos.y>-.6 && ft_pad_att_pos.y<.80) && (ft_pad_att_pos.z>7.80 && ft_pad_att_pos.z < 9.7) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew1_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA1 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- //hatch open and eva performed
- if (((EVA1 == 1) && ((EXTAIRLOCK == 0) && (ODS == 0)) && (EXT_proc>.8))) {
- GetAttachmentParams(ft_pad_att, ft_pad_att_pos, ft_pad_att_dir, ft_pad_att_rot);
- //no ods or airlock
- if ((ft_pad_att_pos.x > -.35 && ft_pad_att_pos.x<.35) && (ft_pad_att_pos.y>-.6 && ft_pad_att_pos.y<.80) && (ft_pad_att_pos.z>11.09 && ft_pad_att_pos.z < 12.39) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew1_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA1 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- }
- void Atlantis::ENTER_EVA2(void)
- {
- if (((EVA2 == 1) && ((EXTAIRLOCK == 1) || (ODS == 1)) && (EXT_proc>.8))) {//hatch open and eva performed
- GetAttachmentParams(ft_pad_att1, ft_pad_att1_pos, ft_pad_att1_dir, ft_pad_att1_rot);
- if ((ft_pad_att1_pos.x > -.35 && ft_pad_att1_pos.x<.35) && (ft_pad_att1_pos.y>-.6 && ft_pad_att1_pos.y<.80) && (ft_pad_att1_pos.z>7.80 && ft_pad_att1_pos.z < 9.7) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew2_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA2 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- if (((EVA2 == 1) && ((EXTAIRLOCK == 0) && (ODS == 0)) && (EXT_proc>.8))) {
- GetAttachmentParams(ft_pad_att1, ft_pad_att1_pos, ft_pad_att1_dir, ft_pad_att1_rot);
- if ((ft_pad_att1_pos.x > -.35 && ft_pad_att1_pos.x<.35) && (ft_pad_att1_pos.y>-.6 && ft_pad_att1_pos.y<.80) && (ft_pad_att1_pos.z>11.09 && ft_pad_att1_pos.z < 12.39) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew2_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA2 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- }
- void Atlantis::ENTER_EVA3(void)
- {
- if (((EVA3 == 1) && ((EXTAIRLOCK == 1) || (ODS == 1)) && (EXT_proc>.8))) {//hatch open and eva performed
- GetAttachmentParams(ft_pad_att2, ft_pad_att2_pos, ft_pad_att2_dir, ft_pad_att2_rot);
- if ((ft_pad_att2_pos.x > -.35 && ft_pad_att2_pos.x<.35) && (ft_pad_att2_pos.y>-.6 && ft_pad_att2_pos.y<.80) && (ft_pad_att2_pos.z>7.80 && ft_pad_att2_pos.z < 9.7) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew3_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA3 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- if (((EVA3 == 1) && ((EXTAIRLOCK == 0) && (ODS == 0)) && (EXT_proc>.8))) {
- GetAttachmentParams(ft_pad_att2, ft_pad_att2_pos, ft_pad_att2_dir, ft_pad_att2_rot);
- if ((ft_pad_att2_pos.x > -.35 && ft_pad_att2_pos.x<.35) && (ft_pad_att2_pos.y>-.6 && ft_pad_att2_pos.y<.80) && (ft_pad_att2_pos.z>11.09 && ft_pad_att2_pos.z < 12.39) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew3_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA3 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- }
- void Atlantis::ENTER_EVA4(void)
- {
- if (((EVA4 == 1) && ((EXTAIRLOCK == 1) || (ODS == 1)) && (EXT_proc>.8))) {//hatch open and eva performed
- GetAttachmentParams(ft_pad_att3, ft_pad_att3_pos, ft_pad_att3_dir, ft_pad_att3_rot);
- if ((ft_pad_att3_pos.x > -.35 && ft_pad_att3_pos.x<.35) && (ft_pad_att3_pos.y>-.6 && ft_pad_att3_pos.y<.80) && (ft_pad_att3_pos.z>7.80 && ft_pad_att3_pos.z < 9.7) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew4_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA4 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- if (((EVA4 == 1) && ((EXTAIRLOCK == 0) && (ODS == 0)) && (EXT_proc>.8))) {
- GetAttachmentParams(ft_pad_att3, ft_pad_att3_pos, ft_pad_att3_dir, ft_pad_att3_rot);
- if ((ft_pad_att3_pos.x > -.35 && ft_pad_att3_pos.x<.35) && (ft_pad_att3_pos.y>-.6 && ft_pad_att3_pos.y<.80) && (ft_pad_att3_pos.z>11.09 && ft_pad_att3_pos.z < 12.39) ){
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i); //get handle for ship
- OBJHANDLE Focusvessel = oapiGetVesselByName(crew4_name);
- //if (strncmp(hV->GetVesselByName(), "MMU", 3) != 0){
- oapiDeleteVessel(Focusvessel);
- EVA4 = 0;
- //SetMeshVisibilityMode(MMUMeshUINT, MESHVIS_EXTERNAL);
- //EVA = 0;
- //oapiSetFocusObject(hMMU);
- }
- }
- }
- }
- //double Atlantis::GetSRBThrustLevel (int which)
- //{
- // return (pET ? pET->GetSRBThrustLevel (which) : 0);
- //}
- void Atlantis::SetSSMEGimbal (const VECTOR3 &angle)
- {
- const double pitch_gimbal_max = -0.2*PI;
- VECTOR3 dir;
- dir.x = -sin(angle.y); // yaw gimbal
- dir.y = sin(angle.x-angle.z); // pitch+roll gimbal
- dir.z = sqrt(1.0-dir.x*dir.x-dir.y*dir.y);
- SetThrusterDir (th_main[0], dir); // left SSME
- dir.y = sin(angle.x+angle.z); // pitch+roll gimbal
- dir.z = sqrt(1.0-dir.x*dir.x-dir.y*dir.y);
- SetThrusterDir (th_main[1], dir); // right SSME
- dir.y = sin(angle.x); // pitch gimbal
- dir.z = sqrt(1.0-dir.x*dir.x-dir.y*dir.y);
- SetThrusterDir (th_main[2], dir); // top SSME
- SetSSMEPosition (gimbal_pos.x/pitch_gimbal_max);
- }
- // --------------------------------------------------------------
- // Autopilot function: set target pitch angle [rad]
- // during launch phase (until ET separation)
- // --------------------------------------------------------------
- double Atlantis::GetAscentPitchRate (double tgt_pitch)
- {
- const double a = 0.07;
- const double b = 0.035;
- VECTOR3 avel;
- GetAngularVel(avel);
- double dpitch = avel.x; // pitch rate
- double pitch = GetPitch(); // current pitch value
- return a*(pitch-tgt_pitch) + b*dpitch;
- }
- // --------------------------------------------------------------
- // Automatic gimbal adjustment for SSME and SRB engines to correct
- // for CG shift, SRB thrust variations, atmospheric effects, etc.
- //
- // NOTE: We use SSME gimbal for adjusting pitch rate, SRB gimbal for
- // adjusting yaw and roll rate
- //
- // The gimbal changes are implemented individually for each axis as
- // damped harmonic oscillators around target rates
- // --------------------------------------------------------------
- void Atlantis::AutoGimbal (const VECTOR3 &tgt_rate)
- {
- // Harmonic oscillator design parameters
- static const double a_pitch = 2e0;
- static const double b_pitch = 1e0;
- static const double a_yaw = 1e-1;
- static const double b_yaw = 3e-2;
- static const double a_roll_srb = 1e-1;
- static const double b_roll_srb = 3e-2;
- static const double a_roll_ssme = 8e-2;
- static const double b_roll_ssme = 5e-2;
- VECTOR3 avel, aacc;
- GetAngularVel(avel);
- GetAngularAcc(aacc);
- double dt = oapiGetSimStep();
- double dgimbal, maxdg;
- const double pitch_gimbal_max = -21.0*RAD;
- const double yaw_gimbal_max = 4*RAD;
- const double roll_gimbal_max_srb = 8.0*RAD;
- const double roll_gimbal_max_ssme = 6*RAD;
- bool srb_gimbal = status < 2 ;
- double roll_gimbal_max = (srb_gimbal ? roll_gimbal_max_srb : roll_gimbal_max_ssme);
- double a_roll = (srb_gimbal ? a_roll_srb : a_roll_ssme);
- double b_roll = (srb_gimbal ? b_roll_srb : b_roll_ssme);
- // Pitch gimbal settings
- maxdg = dt*0.3; // max gimbal speed [rad/s]
- dgimbal = a_pitch*(avel.x-tgt_rate.x) + b_pitch*aacc.x;
- dgimbal = max(-maxdg, min(maxdg, dgimbal));
- gimbal_pos.x = min (0, max (pitch_gimbal_max, gimbal_pos.x+dgimbal));
- // Yaw gimbal settings
- dgimbal = a_yaw*(avel.y-tgt_rate.y) + b_yaw*aacc.y;
- gimbal_pos.y = min (yaw_gimbal_max, max(-yaw_gimbal_max, gimbal_pos.y+dgimbal));
- // Roll gimbal settings
- dgimbal = a_roll*(avel.z-tgt_rate.z) + b_roll*aacc.z;
- gimbal_pos.z = min (roll_gimbal_max, max(-roll_gimbal_max, gimbal_pos.z+dgimbal));
- // Set SRB gimbals
- // if (status < 2 && pET) {
- // pET->SetSRBGimbal (gimbal_pos);
- // SetSSMEGimbal (_V(gimbal_pos.x,0,0)); // If SRBs are available, we gimbal the SSMEs only in pitch
- // } else {
- // SetSSMEGimbal (gimbal_pos);
- // }
- }
- // --------------------------------------------------------------
- // RCS automatic control for commanding a target attitude rate
- // Used by the ascent autopilot when gimbal control is no longer available
- // (SSME cut off)
- // --------------------------------------------------------------
- void Atlantis::AutoRCS (const VECTOR3 &tgt_rate)
- {
- /* // Harmonic oscillator design parameters
- const double a_pitch = 4;
- const double b_pitch = 2;
- const double a_yaw = 2e-1;
- const double b_yaw = 6e-2;
- const double a_roll = 2e-1;
- const double b_roll = 6e-2;
- VECTOR3 avel, aacc;
- GetAngularVel(avel);
- GetAngularAcc(aacc);
- double dt = oapiGetSimStep();
- double drcs;
- // Pitch RCS settings
- drcs = a_pitch*(tgt_rate.x-avel.x) - b_pitch*aacc.x;
- if (drcs > 0.0) {
- SetThrusterGroupLevel(THGROUP_ATT_PITCHUP, min(drcs, 1.0));
- SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN, 0);
- } else {
- SetThrusterGroupLevel(THGROUP_ATT_PITCHUP, 0);
- SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN, min(-drcs, 1.0));
- }
- // Yaw RCS settings
- drcs = a_yaw*(tgt_rate.y-avel.y) - b_yaw*aacc.y;
- if (drcs > 0.0) {
- SetThrusterGroupLevel(THGROUP_ATT_YAWLEFT, min(drcs, 1.0));
- SetThrusterGroupLevel(THGROUP_ATT_YAWRIGHT, 0);
- } else {
- SetThrusterGroupLevel(THGROUP_ATT_YAWLEFT, 0);
- SetThrusterGroupLevel(THGROUP_ATT_YAWRIGHT, min(-drcs, 1.0));
- }
- // Roll RCS settings
- drcs = a_roll*(tgt_rate.z-avel.z) - b_roll*aacc.z;
- if (drcs > 0.0) {
- SetThrusterGroupLevel(THGROUP_ATT_BANKRIGHT, min(drcs, 1.0));
- SetThrusterGroupLevel(THGROUP_ATT_BANKLEFT, 0);
- } else {
- SetThrusterGroupLevel(THGROUP_ATT_BANKRIGHT, 0);
- SetThrusterGroupLevel(THGROUP_ATT_BANKLEFT, min(-drcs, 1.0));
- }
- */
- }
- void Atlantis::LaunchClamps ()
- {
- }
- void Atlantis::SetGearParameters (double state)
- {
- static TOUCHDOWNVTX tdvtx[14] = {
- {_V( 0, -3.3,18.75), 1e8, 1e6, 1.6, 0.1},
- {_V(-3.96, -5.5, -3.2), 1e8, 1e6, 3, 0.2},
- {_V( 3.96, -5.5, -3.2), 1e8, 1e6, 3, 0.2},
- {_V(-11.9, -2.1, -10), 1e8, 1e6, 3},
- {_V( 11.9, -2.1, -10), 1e8, 1e6, 3},
- {_V(-11.3, -2.1, -6), 1e8, 1e6, 3},
- {_V( 11.3, -2.1, -6), 1e8, 1e6, 3},
- {_V(-2.95, -2.0,-14.35),1e8, 1e6, 3},
- {_V( 2.95, -2.0,-14.35),1e8, 1e6, 3},
- {_V(-1.9, -1.0,-14.8), 1e8, 1e6, 3},
- {_V( 1.9, -1.0,-14.8), 1e8, 1e6, 3},
- {_V( 0, 11.2,-16.4), 1e8, 1e6, 3},
- {_V( 0, 11.3,-14.0), 1e8, 1e6, 3},
- {_V( 0, -0.9, 20.6), 1e8, 1e6, 3}
- };
- if (state == 1.0) { // gear fully deployed
- static TOUCHDOWNVTX geardn_vtx[3] = {
- {_V( 0, -3.95,17.5), 1e8, 1e6, 1.6, 0.1},
- {_V(-3.96, -5.5, -3.2), 1e8, 1e6, 3, 0.2},
- {_V( 3.96, -5.5, -3.2), 1e8, 1e6, 3, 0.2},
- };
- memcpy (tdvtx, geardn_vtx, 3*sizeof(TOUCHDOWNVTX));
- SetTouchdownPoints (tdvtx, 14);
- SetSurfaceFrictionCoeff (0.05, 0.4);
- } else {
- static TOUCHDOWNVTX gearup_vtx[3] = {
- {_V( 0, -2.2,16.75), 1e8, 1e6, 3},
- {_V(-3.96, -2.7, -3.2), 1e8, 1e6, 3},
- {_V( 3.96, -2.7, -3.2), 1e8, 1e6, 3},
- };
- memcpy (tdvtx, gearup_vtx, 3*sizeof(TOUCHDOWNVTX));
- SetTouchdownPoints (tdvtx, 14);
- SetSurfaceFrictionCoeff (0.4, 0.4);
- }
- }
- void Atlantis::Jettison ()
- {
- }
- // Update moving parts of the orbiter's visual: payload bay doors and gear
- // This should only be called when the visual exists, e.g. from within
- // clbkVisualCreated or clbkAnimate
- void Atlantis::UpdateMesh ()
- {
- // update animation states
- SetAnimation (anim_gear, gear_proc);
- SetAnimation (anim_spdb, spdb_proc);
- SetAnimation (anim_door, plop->BayDoorStatus.pos);
- SetAnimation(anim_PRADIATOR , plop->RadiatorStatus.pos);
- SetAnimation(anim_SRADIATOR, plop->RadiatorStatus.pos);
- SetAnimation (anim_kubd, plop->KuAntennaStatus.pos);
- SetAnimation(anim_SETD, SETD_proc);
- SetAnimation(anim_PETD, PETD_proc);
- SetAnimationArm (anim_arm_sy, arm_sy);
- SetAnimationArm (anim_arm_sp, arm_sp);
- SetAnimationArm (anim_arm_ep, arm_ep);
- SetAnimationArm (anim_arm_wp, arm_wp);
- SetAnimationArm (anim_arm_wy, arm_wy);
- SetAnimationArm (anim_arm_wr, arm_wr);
- SetAnimation(anim_MPM, Armtilt_proc);
- SetAnimation(anim_MPMOBSS, OBSS_proc);
- SetAnimation(anim_SETD, SETD_proc);
- SetAnimation(anim_PETD, PETD_proc);
- SetAnimation(anim_ssmestow, ssmestow_proc);
- SetAnimation(anim_ADTA, ADTA_proc);
- SetAnimation(anim_ius, ius_proc);
- SetAnimation(anim_CHUTE, CHUTE_proc);
- // update MFD brightness
- if (vis) {
- int i;
- MATERIAL mat;
- memset(&mat, 0, sizeof(MATERIAL));
- DEVMESHHANDLE hMesh = GetDevMesh(vis, mesh_vc);
- for (i = 0; i < 4; i++) {
- mat.emissive.r = mat.emissive.g = mat.emissive.b = (float)mfdbright[i];
- mat.emissive.a = 1.0f;
- oapiSetMaterial(hMesh, 21 + i, &mat);
- }
- }
- }
- void Atlantis::SetBayDoorPosition (double pos)
- {
- SetAnimation (anim_door, pos);
- rdoor_drag = sqrt (min (1.0, pos*3.0));
- ldoor_drag = sqrt (min (1.0, max(0.0, pos-0.3656)*3.0));
- }
- void Atlantis::SetRadiatorPosition (double pos)
- {
- SetAnimation (anim_PRADIATOR, pos);
- SetAnimation(anim_SRADIATOR, pos);
- }
- void Atlantis::SetKuAntennaPosition(double pos)
- {
- SetAnimation(anim_kubd, pos);
- }
- void Atlantis::SetSSMEPosition (double pos)
- {
- SetAnimation (anim_ssmes, pos);
- }
- void Atlantis::OperateLandingGear (AnimState::Action action)
- {
- if (status < 3) return;
- // operate landing gear only once the orbiter is free from the tank
- gear_status = action;
- RecordEvent ("GEAR", action == AnimState::CLOSING ? "UP" : "DOWN");
- }
- void Atlantis::RevertLandingGear ()
- {
- if (status < 3) return;
- // operate landing gear only once the orbiter is free from the tank
- OperateLandingGear (gear_status == AnimState::CLOSED || gear_status == AnimState::CLOSING ?
- AnimState::OPENING : AnimState::CLOSING);
- }
- void Atlantis::OperateSpeedbrake (AnimState::Action action)
- {
- spdb_status = action;
- RecordEvent ("SPEEDBRAKE", action == AnimState::CLOSING ? "CLOSE" : "OPEN");
- }
- void Atlantis::RevertSpeedbrake (void)
- {
- OperateSpeedbrake (spdb_status == AnimState::CLOSED || spdb_status == AnimState::CLOSING ?
- AnimState::OPENING : AnimState::CLOSING);
- }
- void Atlantis::SetAnimationArm (UINT anim, double state)
- {
- if (Armtilt_proc == 1){
- SetAnimation (anim, state);
- arm_scheduled = true;
- HWND hDlg;
- if (!SatStowed2() && (hDlg = oapiFindDialog (g_Param.hDLL, IDD_RMS))) {
- //SetWindowText (GetDlgItem (hDlg, IDC_PAYLOAD2), "Arrest");
- //EnableWindow (GetDlgItem (hDlg, IDC_PAYLOAD2), CanArrest2() ? TRUE : FALSE);
- }
- }
- }
- // ==============================================================
- // Overloaded callback functions
- // ==============================================================
- // --------------------------------------------------------------
- // Set vessel class capabilities from config file
- // --------------------------------------------------------------
- void Atlantis::clbkSetClassCaps (FILEHANDLE cfg)
- {
- // *********************** physical parameters *********************************
- SetSize (19.6);
- SetEmptyMass (ORBITER_EMPTY_MASS+MASS1+MASS2+MASS3+MASS0);
- SetPMI (_V(78.2,82.1,10.7));
- SetGravityGradientDamping (20.0);
- SetCrossSections (ORBITER_CS);
- SetRotDrag (_V(0.43,0.43,0.29)); // angular drag
- SetTrimScale (0.05);
- launchelev = 0.0;
- SetMaxWheelbrakeForce(2e5);
- if (!oapiReadItem_bool (cfg, "RenderCockpit", render_cockpit))
- render_cockpit = false;
- static VECTOR3 beacon_pos[8] = { { -1.7113, -1.2597, 7.486 }, { 1.5527, -1.3734, 7.9518 }, { 1.559, -1.3608, 2.1626 }, { -1.559, -1.3608, 2.1626 }, { 1.58, -1.3231, -2.1778 }, { -1.58, -1.3231, -2.1778 }, { 0, 2.9347, 11.9 }, { 0, 2.9347, 11.9 } };
- for (int i = 0; i < 8; i++) {
- spot_beacon[i].shape = BEACONSHAPE_DIFFUSE;
- spot_beacon[i].pos = &beacon_pos[i];
- spot_beacon[i].col = &beacon_col;
- spot_beacon[i].size = 0.25;
- spot_beacon[i].falloff = 0.4;
- spot_beacon[i].period = 0;
- spot_beacon[i].duration = 0;
- spot_beacon[i].tofs = 0;
- spot_beacon[i].active = false;
- AddBeacon(spot_beacon + i);
- }
- //rms
- for (int i = 8; i < 9; i++) {
- spot_beacon[i].shape = BEACONSHAPE_DIFFUSE;
- spot_beacon[i].pos = &arm_tip[4];
- spot_beacon[i].col = &beacon_col;
- spot_beacon[i].size = 0.25;
- spot_beacon[i].falloff = 0.4;
- spot_beacon[i].period = 0;
- spot_beacon[i].duration = 0;
- spot_beacon[i].tofs = 0;
- spot_beacon[i].active = false;
- AddBeacon(spot_beacon + i);
- }
- COLOUR4 col_d = { 1, 1, 0.9, 0 };
- COLOUR4 col_s = { 1, 1, 0.9, 0 };
- COLOUR4 col_a = { 0, 0, 0, 0 };
- static VECTOR3 color = _V(1.0, 0.839, 0.666);
- const COLOUR4 diff = { 1.0f, 0.839f, 0.666f, 0.0f };
- const COLOUR4 amb = { 0.0, 0.0, 0 };
- const COLOUR4 spec = { 0.0f, 0.0f, 0.0f, 0 };
- spotlight1 = (SpotLight*)AddSpotLight(_V(-1.7113, -1.2597, 7.486), _V(0.5, 0.7071, -0.5), 3, 0.5, 0.0, 0.05, (120 * RAD), (10 * RAD), col_d, col_s, col_a);
- spotlight2 = (SpotLight*)AddSpotLight(_V(1.5527, -1.3734, 7.9518), _V(-0.5, 0.7071, -0.5), 3, 0.5, 0.0, 0.05, (120 * RAD), (10 * RAD), col_d, col_s, col_a);
- spotlight3 = (SpotLight*)AddSpotLight(_V(1.559, -1.3608, 2.1626), _V(0.7071, 0.7071, 0), 3, 0.5, 0.0, 0.05, (120 * RAD), (10 * RAD), col_d, col_s, col_a);
- spotlight4 = (SpotLight*)AddSpotLight(_V(-1.559, -1.3608, 2.1626), _V(0.7071, 0.7071, 0), 3, 0.5, 0.0, 0.05, (120 * RAD), (10 * RAD), col_d, col_s, col_a);
- spotlight5 = (SpotLight*)AddSpotLight(_V(1.6380, -1.3773, -2.0453), _V(0.5, 0.7071, 0.5), 3, 0.5, 0.0, 0.05, (120 * RAD), (10 * RAD), col_d, col_s, col_a);
- spotlight6 = (SpotLight*)AddSpotLight(_V(-1.6380, -1.3773, -2.0453), _V(-0.5, 0.7071, 0.5), 3, 0.5, 0.0, 0.05, (120 * RAD), (10 * RAD), col_d, col_s, col_a);
- spotlightDOCK = (SpotLight*)AddSpotLight(_V(0, 2.9347, 11.9), _V(0, 1, 0), 5, 0.5, 0.0, 0.05, (90 * RAD), (180 * RAD), col_d, col_s, col_a);//dock
- spotlight7 = (SpotLight*)AddSpotLight(_V(0, 2.9347, 11.9), _V(0, 0, -1), 5, 0.5, 0.0, 0.05, (90 * RAD), (180 * RAD), col_d, col_s, col_a);//bulkhead
- spotlightRMS = (SpotLight*)AddSpotLight((arm_tip[4]), (arm_tip[1] - arm_tip[0]), 20, 0.25, 0.8, 0.001, 80.0*RAD, 80.0*1.1*RAD,
- diff, spec, amb);
- spotlight1->Activate(false);
- spotlight2->Activate(false);
- spotlight3->Activate(false);
- spotlight4->Activate(false);
- spotlight5->Activate(false);
- spotlight6->Activate(false);
- spotlight7->Activate(false);
- spotlightDOCK->Activate(false);
- spotlightRMS->Activate(false);
- pl1_ofs = _V(0, 6.220, -7.795);
- pl2_ofs = _V(0, 6.220, -7.795);
- pl3_ofs = _V(-1.850, 8.020, 3.955);
- pl4_ofs = _V(-2.2, 8.020, -14.045);
- pl5_ofs = _V(2.2, 8.020, -14.045);
- pl6_ofs = _V(1.850, 8.020, 3.955);
- pl7_ofs = _V(0, 6.220, -7.795);
- pl8_ofs = _V(0, 6.220, -7.795);
- pl9_ofs = _V(0, 6.220, -7.795);
- pl10_ofs = _V(0, 6.220, -7.795);
- pl1_dir = _V(0, 1,0);
- pl2_dir = _V(0, 1, 0);
- pl3_dir = _V(0, 1, 0);
- pl4_dir = _V(0, 1, 0);
- pl5_dir = _V(0, 1, 0);
- pl6_dir = _V(0, 1, 0);
- pl7_dir = _V(0, 1, 0);
- pl8_dir = _V(0, 1, 0);
- pl9_dir = _V(0, 1, 0);
- pl10_dir = _V(0, 1, 0);
- pl1_rot = _V(0, 0, 1);
- pl2_rot = _V(1, 0, 0);
- pl3_rot = _V(0, 0, 1);
- pl4_rot = _V(0, 0, 1);
- pl5_rot = _V(0, 0, 1);
- pl6_rot = _V(0, 0, 1);
- pl7_rot = _V(0, 0, 1);
- pl8_rot = _V(0, 0, 1);
- pl9_rot = _V(0, 0, 1);
- pl10_rot = _V(0, 0, 1);
- KEELCAM = _V(0.1452, -1.500, -1.356);
- ETCAM = _V(-2, - 2.856126, - 7.334826);//ETCAM = _V(1, -3.500, 11.9);
- DOCKCAM = _V(0, 1.58, 10.16);//ETCAM = _V(1, -3.500, 11.9);
- sat_attach = CreateAttachment(false, pl1_ofs, pl1_dir, pl1_rot, "X");//0
- rms_attach = CreateAttachment(false, _V(-2.515, 2.059, -5.5327), _V(0, -1, 0), _V(0, 0, 1), "G", false);
- //rms_attach = CreateAttachment(false, arm_tip[0], arm_tip[1] - arm_tip[0], arm_tip[2] - arm_tip[0], "G", true);//1
- sat_attach2 = CreateAttachment(false, pl2_ofs, pl2_dir, pl2_rot, "0");//2
- sat_attach3 = CreateAttachment(false, pl3_ofs, pl3_dir, pl3_rot, "X");//3
- sat_attach4 = CreateAttachment(false, pl4_ofs, pl4_dir, pl4_rot, "C");//4
- sat_attach5 = CreateAttachment(false, pl5_ofs, pl5_dir, pl5_rot, "D");//5
- sat_attach6 = CreateAttachment(false, pl6_ofs, pl6_dir, pl6_rot, "E");//6
- sat_attach7 = CreateAttachment(false, pl7_ofs, pl7_dir, pl7_rot, "F");//7
- sat_attach8 = CreateAttachment(false, pl8_ofs, pl8_dir, pl8_rot, "G");//8
- sat_attach9 = CreateAttachment(false, pl9_ofs, pl9_dir, pl9_rot, "H");//9
- sat_attach10 = CreateAttachment(false, pl10_ofs, pl10_dir, pl10_rot, "I");//10
- OBSS_attach = CreateAttachment(false, armobss_tip[0], armobss_tip[1] - armobss_tip[0], armobss_tip[2] - armobss_tip[0], "OBSS", true);//1
- ft_pad_att = CreateAttachment(false, ft_pad_att_pos, ft_pad_att_dir, ft_pad_att_rot, "FPD");
- ft_pad_att1 = CreateAttachment(false, ft_pad_att1_pos, ft_pad_att1_dir, ft_pad_att1_rot, "FPD1");
- ft_pad_att2 = CreateAttachment(false, ft_pad_att2_pos, ft_pad_att2_dir, ft_pad_att2_rot, "FPD2");
- ft_pad_att3 = CreateAttachment(false, ft_pad_att3_pos, ft_pad_att3_dir, ft_pad_att3_rot, "FPD3");
- //Dockring = CreateAttachment(false, ringpos, _V(0, 1, 0), _V(0, 0, 1), "Ring");//7
- pl1_ofs_scn = _V(0,0,0);
- pl1_dir_scn = _V(0, 0, 0);
- pl1_rot_scn = _V(0, 0, 0);
- pl2_ofs_scn = _V(0, 0, 0);
- pl2_dir_scn = _V(0, 0, 0);
- pl2_rot_scn = _V(0, 0, 0);
- pl3_ofs_scn = _V(0, 0, 0);
- pl3_dir_scn = _V(0, 0, 0);
- pl3_rot_scn = _V(0, 0, 0);
- pl4_ofs_scn = _V(0, 0, 0);
- pl4_dir_scn = _V(0, 0, 0);
- pl4_rot_scn = _V(0, 0, 0);
- pl5_ofs_scn = _V(0, 0, 0);
- pl5_dir_scn = _V(0, 0, 0);
- pl5_rot_scn = _V(0, 0, 0);
- pl6_ofs_scn = _V(0, 0, 0);
- pl6_dir_scn = _V(0, 0, 0);
- pl6_rot_scn = _V(0, 0, 0);
- pl7_ofs_scn = _V(0, 0, 0);
- pl7_dir_scn = _V(0, 0, 0);
- pl7_rot_scn = _V(0, 0, 0);
- pl8_ofs_scn = _V(0, 0, 0);
- pl8_dir_scn = _V(0, 0, 0);
- pl8_rot_scn = _V(0, 0, 0);
- pl9_ofs_scn = _V(0, 0, 0);
- pl9_dir_scn = _V(0, 0, 0);
- pl9_rot_scn = _V(0, 0, 0);
- pl10_ofs_scn = _V(0, 0, 0);
- pl10_dir_scn = _V(0, 0, 0);
- pl10_rot_scn = _V(0, 0, 0);
- ft_pad_att_pos_scn = _V(0, 0, 0);
- ft_pad_att_dir_scn = _V(0, 0, 0);
- ft_pad_att_rot_scn = _V(0, 0, 0);
- ft_pad_att1_pos_scn = _V(0, 0, 0);
- ft_pad_att1_dir_scn = _V(0, 0, 0);
- ft_pad_att1_rot_scn = _V(0, 0, 0);
- ft_pad_att2_pos_scn = _V(0, 0, 0);
- ft_pad_att2_dir_scn = _V(0, 0, 0);
- ft_pad_att2_rot_scn = _V(0, 0, 0);
- ft_pad_att3_pos_scn = _V(0, 0, 0);
- ft_pad_att3_dir_scn = _V(0, 0, 0);
- ft_pad_att3_rot_scn = _V(0, 0, 0);
- KEELCAM_scn = _V(0, 0, 0);
- ETCAM_scn = _V(0, 0, 0);
- DOCKCAM_scn = _V(0, 0, 0);
- plbCamPos[0] = _V(-1.782, 1.601, 11.581);//2.2, 1.8, -6.250
- plbCamPos[1] = _V(-2.302, 1.738, -6.231);// 1.850, 1.8, 11.750
- plbCamPos[2] = _V(2.302, 1.738, -6.231);//-1.850, 1.8, 11.750
- plbCamPos[3] = _V(1.782, 1.601, 11.581);;//-2.2, 1.8, -6.250
- /*
- //PLB LIGHTS
- PLBLightPosition[0] = _V(1.6380, -1.3773, 8.5024); //forward stbd
- PLBLightPosition[1] = _V(-1.5549, -1.3773, 8.5024); //forward port
- PLBLightPosition[2] = _V(1.6380, -1.3773, 2.4856);//mid stbd
- PLBLightPosition[3] = _V(-1.6380, -1.3773, 2.4856);//mid port
- PLBLightPosition[4] = _V(1.6380, -1.3773, -4.0384);//aft stbd
- PLBLightPosition[5] = _V(-1.6380, -1.3773, -4.0384);//aft port
- FwdBulkheadLightPos = _V(0.0, 1.7550, 11.966);//fwd bulkhead
- DockingLightPos = _V(0.0, 2.0162, 8.952);//docking light
- //CREATE LIGHTS
- {
- //VECTOR3 dir = _V(-(PLBLightPosition[i].x) * 0.642788, 0.766044, 0.0);// light aim about ~50� up
- PLBLight[0] = AddPayloadBayLight(PLBLightPosition[0], _V(1.6380, .624, .766), 135.0, PLB_bspec[0]);
- PLBLight[1] = AddPayloadBayLight(PLBLightPosition[1], _V(-1.5549, .624, .766), 135.0, PLB_bspec[1]);
- PLBLight[2] = AddPayloadBayLight(PLBLightPosition[2], _V(1.6380, .624, .766), 135.0, PLB_bspec[2]);
- PLBLight[3] = AddPayloadBayLight(PLBLightPosition[3], _V(-1.6380, .624, .766), 135.0, PLB_bspec[3]);
- PLBLight[4] = AddPayloadBayLight(PLBLightPosition[4], _V(1.6380, .624, .766), 135.0, PLB_bspec[4]);
- PLBLight[5] = AddPayloadBayLight(PLBLightPosition[5], _V(-1.6300, .624, .766), 135.0, PLB_bspec[5]);
- }
- FwdBulkheadLight = AddPayloadBayLight(FwdBulkheadLightPos, _V(0, 0, -1), 120.0, FwdBulkhead_bspec);
- for (int i = 0; i < 2; i++) {
- DockingLight[i] = AddPayloadBayLight(DockingLightPos, _V(0, 1, 0), 120.0, Docking_bspec[i]); // create two copies of docking light to simulate DIM and BRIGHT settings
- }
- }
- LightEmitter* Atlantis::AddPayloadBayLight(VECTOR3& pos, VECTOR3& dir, double degWidth, BEACONLIGHTSPEC& bspec)
- {
- static VECTOR3 color = _V(0.75, 0.75, 0.75);
- //const COLOUR4 diff = {0.949f, 0.988f, 1.0f, 0.0f}; //RGB for metal halide but it doesn't quite match up with actual photos
- const COLOUR4 diff = { 0.847f, 0.968f, 1.0f, 0.0f }; //RGB for mercury vapor, this better matches photos
- const COLOUR4 amb = { 0.0, 0.0, 0 };
- const COLOUR4 spec = { 0.0f, 0.0f, 0.0f, 0 };
- bspec.active = false;
- bspec.col = &color;
- bspec.duration = 0;
- bspec.falloff = 0.4;
- bspec.period = 0;
- bspec.pos = &pos;
- bspec.shape = BEACONSHAPE_DIFFUSE;
- bspec.size = 0.25;
- bspec.tofs = 0;
- AddBeacon(&bspec);
- return AddSpotLight(pos, dir, 20, 0.5, 0.0, 0.05, degWidth*RAD, degWidth*1.1*RAD,
- diff, spec, amb);
- */
- }
- // --------------------------------------------------------------
- // Set status from a VESSELSTATUS2 structure
- // --------------------------------------------------------------
- void Atlantis::clbkSetStateEx (const void *status)
- {
- // default parameter initialisation
- VESSEL4::clbkSetStateEx (status);
- }
- // --------------------------------------------------------------
- // Read status from scenario file
- // --------------------------------------------------------------
- void Atlantis::clbkLoadStateEx (FILEHANDLE scn, void *vs)
- {
- int action;
- char *line;
- MIDMODEL = 0;
- ORIGINAL = 0;
- OBSS1 = 0;
- //EVA = 0;
- DRAGCHUTE = 0;
- double met = 0.0; // mission elapsed time
- double srbtime = 0.0;
- double sts_sat_x = 0.0;
- double sts_sat_y = 0.0;
- double sts_sat_z = 0.0;
- spdb_status = AnimState::CLOSED; spdb_proc = 0.0;
- while (oapiReadScenario_nextline (scn, line)) {
- if (!_strnicmp (line, "CONFIGURATION", 13)) {
- sscanf (line+13, "%d", &status);
- //} else if (!_strnicmp (line, "MET", 3)) {
- // sscanf (line+3, "%lf", &met);
- }
- else if (!_strnicmp(line, "GEAR", 4)) {
- sscanf(line + 4, "%d%lf", &action, &gear_proc);
- gear_status = (AnimState::Action)(action + 1);
- }
- else if (!strnicmp(line, "MET", 3)) {
- sscanf(line + 3, "%lf", &MET);
- }
- else if (!strnicmp(line, "VCCAM", 5)) {
- sscanf(line + 5, "%d", &VCCAM);
- }
- else if (!_strnicmp(line, "HATCH", 5)) {
- sscanf(line + 5, "%d%lf", &EXT_status, &EXT_proc);
- }
- else if (!_strnicmp(line, "PETD", 4)) {
- sscanf(line + 4, "%d%lf", &PETD_status, &PETD_proc);
- }
- else if (!_strnicmp(line, "SETD", 4)) {
- sscanf(line + 4, "%d%lf", &SETD_status, &SETD_proc);
- }
- else if (!_strnicmp(line, "ADTA", 4)) {
- sscanf(line + 4, "%d%lf", &ADTA_status, &ADTA_proc);
- }
- else if (!_strnicmp(line, "SSMES", 5)) {
- sscanf(line + 5, "%d%lf", &ssmestow_status, &ssmestow_proc);
- }
- else if (!_strnicmp(line, "Armtilt", 7)) {
- sscanf(line + 7, "%d%lf%d%lf", &Armtilt_status, &Armtilt_proc, &OBSS_status, &OBSS_proc);
- }
- else if (!_strnicmp (line, "SPEEDBRAKE", 10)) {
- sscanf(line + 10, " %0.4f", &spdb_proc);
- }
- else if (!_strnicmp (line, "CARGO_STATIC_MESH", 17)) {
- sscanf (line+17, "%s", cargo_static_mesh_name);
- SetMeshVisibilityMode(mesh_cargo, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
- do_cargostatic = true;
- } else if (!_strnicmp (line, "CARGO_STATIC_OFS", 16)) {
- sscanf (line+16, "%lf%lf%lf", &cargo_static_ofs.x, &cargo_static_ofs.y, &cargo_static_ofs.z);
- } else if (!_strnicmp (line, "ARM_STATUS", 10)) {
- sscanf (line+10, "%lf%lf%lf%lf%lf%lf", &arm_sy, &arm_sp, &arm_ep, &arm_wp, &arm_wy, &arm_wr);
- }
- else if (!_strnicmp(line, "ARM_SEQ1", 8)) {
- sscanf(line + 8, "%lf%lf%lf%lf%lf%lf", &arm1_By, &arm1_Bp,
- &arm1_ep, &arm1_Ap, &arm1_Ay, &arm1_Ar);
- arm1set = true;
- }
- else if (!_strnicmp(line, "ARM_SEQ2", 8)) {
- sscanf(line + 8, "%lf%lf%lf%lf%lf%lf", &arm2_By, &arm2_Bp,
- &arm2_ep, &arm2_Ap, &arm2_Ay, &arm2_Ar);
- arm2set = true;
- }
- else if (!_strnicmp(line, "ARM_SEQ3", 8)) {
- sscanf(line + 8, "%lf%lf%lf%lf%lf%lf", &arm3_By, &arm3_Bp,
- &arm3_ep, &arm3_Ap, &arm3_Ay, &arm3_Ar);
- arm3set = true;
- }
- else if (!_strnicmp(line, "ARM_SEQ4", 8)) {
- sscanf(line + 8, "%lf%lf%lf%lf%lf%lf", &arm4_By, &arm4_Bp,
- &arm4_ep, &arm4_Ap, &arm4_Ay, &arm4_Ar);
- arm4set = true;
- }
- //CAM
- else if (!_strnicmp(line, "PLB_CAM", 7))
- {
- sscanf(line + 7, "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", &camPitch[CAM_A], &camYaw[CAM_A], &camPitch[CAM_B], &camYaw[CAM_B],
- &camPitch[CAM_C], &camYaw[CAM_C], &camPitch[CAM_D], &camYaw[CAM_D], &camRMSElbow[PAN], &camRMSElbow[TILT]);
- cameraMoved = true;
- }
- else if (!strnicmp(line, "PL1_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl1_ofs_scn.x, &pl1_ofs_scn.y, &pl1_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL2_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl2_ofs_scn.x, &pl2_ofs_scn.y, &pl2_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL3_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl3_ofs_scn.x, &pl3_ofs_scn.y, &pl3_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL4_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl4_ofs_scn.x, &pl4_ofs_scn.y, &pl4_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL5_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl5_ofs_scn.x, &pl5_ofs_scn.y, &pl5_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL6_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl6_ofs_scn.x, &pl6_ofs_scn.y, &pl6_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL7_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl7_ofs_scn.x, &pl7_ofs_scn.y, &pl7_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL8_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl8_ofs_scn.x, &pl8_ofs_scn.y, &pl8_ofs_scn.z);
- }
- else if (!strnicmp(line, "PL9_OFS", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl9_ofs_scn.x, &pl9_ofs_scn.y, &pl9_ofs_scn.z);
- }
- else if (!strnicmp(line, "pl10_OFS", 8))
- {
- sscanf(line + 8, "%lf%lf%lf", &pl10_ofs_scn.x, &pl10_ofs_scn.y, &pl10_ofs_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att_POS", 14))
- {
- sscanf(line + 14, "%lf%lf%lf", &ft_pad_att_pos_scn.x, &ft_pad_att_pos_scn.y, &ft_pad_att_pos_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att1_POS", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att1_pos_scn.x, &ft_pad_att1_pos_scn.y, &ft_pad_att1_pos_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att2_POS", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att2_pos_scn.x, &ft_pad_att2_pos_scn.y, &ft_pad_att2_pos_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att3_POS", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att3_pos_scn.x, &ft_pad_att3_pos_scn.y, &ft_pad_att3_pos_scn.z);
- }
- //else if (!strnicmp(line, "PL1_OFS", 7))
- else if (!strnicmp(line, "PL1_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl1_rot_scn.x, &pl1_rot_scn.y, &pl1_rot_scn.z);
- }
- else if (!strnicmp(line, "PL2_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl2_rot_scn.x, &pl2_rot_scn.y, &pl2_rot_scn.z);
- }
- else if (!strnicmp(line, "PL3_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl3_rot_scn.x, &pl3_rot_scn.y, &pl3_rot_scn.z);
- }
- else if (!strnicmp(line, "PL4_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl4_rot_scn.x, &pl4_rot_scn.y, &pl4_rot_scn.z);
- }
- else if (!strnicmp(line, "PL5_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl5_rot_scn.x, &pl5_rot_scn.y, &pl5_rot_scn.z);
- }
- else if (!strnicmp(line, "PL6_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl6_rot_scn.x, &pl6_rot_scn.y, &pl6_rot_scn.z);
- }
- else if (!strnicmp(line, "PL7_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl7_rot_scn.x, &pl7_rot_scn.y, &pl7_rot_scn.z);
- }
- else if (!strnicmp(line, "PL8_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl8_rot_scn.x, &pl8_rot_scn.y, &pl8_rot_scn.z);
- }
- else if (!strnicmp(line, "PL9_ROT", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl9_rot_scn.x, &pl9_rot_scn.y, &pl9_rot_scn.z);
- }
- else if (!strnicmp(line, "pl10_ROT", 8))
- {
- sscanf(line + 8, "%lf%lf%lf", &pl10_rot_scn.x, &pl10_rot_scn.y, &pl10_rot_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att_ROT", 14))
- {
- sscanf(line + 14, "%lf%lf%lf", &ft_pad_att_rot_scn.x, &ft_pad_att_rot_scn.y, &ft_pad_att_rot_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att1_ROT", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att1_rot_scn.x, &ft_pad_att1_rot_scn.y, &ft_pad_att1_rot_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att2_ROT", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att2_rot_scn.x, &ft_pad_att2_rot_scn.y, &ft_pad_att2_rot_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att3_ROT", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att3_rot_scn.x, &ft_pad_att3_rot_scn.y, &ft_pad_att3_rot_scn.z);
- }
- //
- else if (!strnicmp(line, "PL1_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl1_dir_scn.x, &pl1_dir_scn.y, &pl1_dir_scn.z);
- }
- else if (!strnicmp(line, "PL2_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl2_dir_scn.x, &pl2_dir_scn.y, &pl2_dir_scn.z);
- }
- else if (!strnicmp(line, "PL3_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl3_dir_scn.x, &pl3_dir_scn.y, &pl3_dir_scn.z);
- }
- else if (!strnicmp(line, "PL4_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl4_dir_scn.x, &pl4_dir_scn.y, &pl4_dir_scn.z);
- }
- else if (!strnicmp(line, "PL5_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl5_dir_scn.x, &pl5_dir_scn.y, &pl5_dir_scn.z);
- }
- else if (!strnicmp(line, "PL6_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl6_dir_scn.x, &pl6_dir_scn.y, &pl6_dir_scn.z);
- }
- else if (!strnicmp(line, "PL7_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl7_dir_scn.x, &pl7_dir_scn.y, &pl7_dir_scn.z);
- }
- else if (!strnicmp(line, "PL8_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl8_dir_scn.x, &pl8_dir_scn.y, &pl8_dir_scn.z);
- }
- else if (!strnicmp(line, "PL9_DIR", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &pl9_dir_scn.x, &pl9_dir_scn.y, &pl9_dir_scn.z);
- }
- else if (!strnicmp(line, "pl10_DIR", 8))
- {
- sscanf(line + 8, "%lf%lf%lf", &pl10_dir_scn.x, &pl10_dir_scn.y, &pl10_dir_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att_DIR", 14))
- {
- sscanf(line + 14, "%lf%lf%lf", &ft_pad_att_dir_scn.x, &ft_pad_att_dir_scn.y, &ft_pad_att_dir_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att1_DIR", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att1_dir_scn.x, &ft_pad_att1_dir_scn.y, &ft_pad_att1_dir_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att2_DIR", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att2_dir_scn.x, &ft_pad_att2_dir_scn.y, &ft_pad_att2_dir_scn.z);
- }
- else if (!strnicmp(line, "ft_pad_att3_DIR", 15))
- {
- sscanf(line + 15, "%lf%lf%lf", &ft_pad_att3_dir_scn.x, &ft_pad_att3_dir_scn.y, &ft_pad_att3_dir_scn.z);
- }
- else if (!strnicmp(line, "KEELCAM", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &KEELCAM_scn.x, &KEELCAM_scn.y, &KEELCAM_scn.z);
- }
- else if (!strnicmp(line, "ETCAM", 5))
- {
- sscanf(line + 5, "%lf%lf%lf", &ETCAM_scn.x, &ETCAM_scn.y, &ETCAM_scn.z);
- }
- else if (!strnicmp(line, "DOCKCAM", 7))
- {
- sscanf(line + 7, "%lf%lf%lf", &DOCKCAM_scn.x, &DOCKCAM_scn.y, &DOCKCAM_scn.z);
- }
- else {
- if (plop->ParseScenarioLine (line)) continue; // offer the line to bay door operations
- //else if (ascap->ParseScenarioLine (line)) continue; // offer to ascent autopilot
- if (!_strnicmp(line, "FLOOD1", 6)) {
- sscanf(line + 6, "%d", &flood1_status);
- }
- if (!_strnicmp(line, "FLOOD2", 6)) {
- sscanf(line + 6, "%d", &flood2_status);
- }
- if (!_strnicmp(line, "FLOOD3", 6)) {
- sscanf(line + 6, "%d", &flood3_status);
- }
- if (!_strnicmp(line, "FLOOD4", 6)) {
- sscanf(line + 6, "%d", &flood4_status);
- }
- if (!_strnicmp(line, "FLOOD5", 6)) {
- sscanf(line + 6, "%d", &flood5_status);
- }
- if (!_strnicmp(line, "FLOOD6", 6)) {
- sscanf(line + 6, "%d", &flood6_status);
- }
- if (!_strnicmp(line, "AFT_LIGHT", 9)) {
- sscanf(line + 9, "%d", &aft_light_status);
- }
- if (!_strnicmp(line, "DOCK_LIGHT", 10)) {
- sscanf(line + 10, "%d", &docklight_status);
- }
- if (!_strnicmp(line, "OV", 2)) {
- sscanf(line + 2, "%d", &OV);
- }
- if (!_strnicmp(line, "NOSLIDEWIRE", 11)) // if ODS is used or not
- {
- sscanf(line + 11, "%d", &NOSLIDEWIRE);
- NOSLIDEWIRE = 1;
- }
- if (!_strnicmp(line, "EXTAIRLOCK", 10)) // if ODS is used or not
- {
- sscanf(line + 10, "%d", &EXTAIRLOCK);
- EXTAIRLOCK = 1;
- }
- if (!_strnicmp(line, "USEIUS",6)){ // use IUS
- sscanf(line + 6, "%d", &USEIUS);
- USEIUS = 1;
- }
- if (!_strnicmp(line, "ORIGINAL", 8))// tells if Original paint job is used
- {
- sscanf(line + 8, "%d", &ORIGINAL);
- ORIGINAL = 1;
- }
- if (!_strnicmp(line, "NOKU", 4))// tells if Original paint job is used
- {
- sscanf(line + 4, "%d", &NOKU);
- NOKU = 1;
- }
- if (!_strnicmp(line, "NOWIRE", 6))// tells if Original paint job is used
- {
- sscanf(line + 6, "%d", &NOWIRE);
- NOWIRE = 1;
- }
- if (!_strnicmp(line, "EVA1", 4))// if eva has happened
- {
- sscanf(line + 4, "%d", &EVA1);
- EVA1 = 1;
- }
- if (!_strnicmp(line, "EVA2", 4))// if eva has happened
- {
- sscanf(line + 4, "%d", &EVA2);
- EVA2 = 1;
- }
- if (!_strnicmp(line, "EVA3", 4))// if eva has happened
- {
- sscanf(line + 4, "%d", &EVA3);
- EVA3 = 1;
- }
- if (!_strnicmp(line, "EVA4", 4))// if eva has happened
- {
- sscanf(line + 4, "%d", &EVA4);
- EVA4 = 1;
- }
- if (!_strnicmp(line, "MID", 3))// if mid range paint model is used
- {
- sscanf(line + 3, "%d", &MIDMODEL);
- MIDMODEL = 1;
- }
- if (!_strnicmp(line, "OBSS", 4)) {//if OBSS is used
- sscanf(line + 4, "%d", &OBSS1);
- OBSS1 = 1;
- }
- if (!_strnicmp(line, "RMSLIGHT", 8)) {//RMS light on/off
- sscanf(line + 8, "%d", &rmslight_status);
- }
- if (!_strnicmp(line, "ODS", 3)) // if ODS is used or not
- {
- sscanf(line + 3, "%d", &ODS);
- ODS = 1;
- }
- if (!_strnicmp(line, "ARMEDGEAR", 9)) // gear armed
- {
- sscanf(line + 9, "%d", &geararmed);
- geararmed = 1;
- }
- if (!_strnicmp(line, "NOCHUTE", 7)) // if drag chute is used or not
- {
- sscanf(line + 7, "%d", &DRAGCHUTE);
- DRAGCHUTE = 1;
- }
- if (!_strnicmp(line, "RMSARM", 6)) // if RMSARM is used or not
- {
- sscanf(line + 6, "%d", &RMSSELECT);
- RMSSELECT = 1;
- }
- if (!_strnicmp(line, "PAYLOAD_MASS1", 13)) // if PAYLOAD_MASS1 is used or not
- {
- sscanf(line + 13, "%lf", &MASS1);//payload mass 1 is used so get the mass
- PMASS1 = 1;//payload mass 1 is used
- }
- else if (!_strnicmp(line, "PAYLOAD_MASS2", 13)) // if PAYLOAD_MASS2 is used or not
- {
- sscanf(line + 13, "%lf", &MASS2);
- PMASS2 = 1;//payload mass 2 is used
- }
- else if (!_strnicmp(line, "PAYLOAD_MASS3", 13)) // if PAYLOAD_MASS3 is used or not
- {
- sscanf(line + 13, "%lf", &MASS3);
- PMASS3 = 1;//payload mass 3 is used
- }
- else if (!_strnicmp(line, "PAYLOAD_MASS0", 12)) // if PAYLOAD_MASS0 is used or not
- {
- sscanf(line + 12, "%lf", &MASS0);
- PMASS0 = 1;//payload mass 0 is used
- }
- if (!_strnicmp(line, "SPIN0", 5)) // if ODS is used or not
- {
- sscanf(line + 5, "%d", &SPIN0);
- SPIN0 = 1;
- }
- if (!_strnicmp(line, "SPIN1", 5)) // if ODS is used or not
- {
- sscanf(line + 5, "%d", &SPIN1);
- SPIN1 = 1;
- }
- if (!_strnicmp(line, "SPIN2", 5)) // if ODS is used or not
- {
- sscanf(line + 5, "%d", &SPIN2);
- SPIN2 = 1;
- }
- if (!_strnicmp(line, "SPIN3", 5)) // if ODS is used or not
- {
- sscanf(line + 5, "%d", &SPIN3);
- SPIN3 = 1;
- }
- if (!_strnicmp(line, "SPIN4", 5)) // if ODS is used or not
- {
- sscanf(line + 5, "%d", &SPIN4);
- SPIN4 = 1;
- }if (!_strnicmp(line, "SPIN5", 5)) // if ODS is used or not
- {
- sscanf(line + 5, "%d", &SPIN5);
- SPIN5 = 1;
- }
- if (!_strnicmp(line, "RMSDIALOG", 9)) // if rmsdialogue open rmsdialogue =3
- {
- sscanf(line + 9, "%d", &RMSDIALOG);
- RMSDIALOG = 3;
- }
- // else if (!strnicmp(line, "tiltangle", 9))
- // {
- // sscanf(line + 9, "%lf %lf", &phi, &tiltvalue);
- // }
- else if (!strnicmp(line, "IUSproc", 7))
- {
- sscanf(line + 7, "%lf", &ius_proc);
- }
- if (!strnicmp(line, "CREW1", 5))
- {
- sscanf(line + 5, "%s%s", &crew1_name, &crew1_cfg);
- CREW1 = 1;
- }
- else if (!strnicmp(line, "CREW2", 5))
- {
- sscanf(line + 5, "%s%s", &crew2_name, &crew2_cfg);
- CREW2 = 1;
- }
- else if (!strnicmp(line, "CREW3", 5))
- {
- sscanf(line + 5, "%s%s", &crew3_name, &crew3_cfg);
- CREW3 = 1;
- }
- else if (!strnicmp(line, "CREW4", 5))
- {
- sscanf(line + 5, "%s%s", &crew4_name, &crew4_cfg);
- CREW4 = 1;
- }
- else ParseScenarioLineEx (line, vs); // unrecognised option - pass to Orbiter's generic parser
- }
- }
- if (status == 0) {
- VESSELSTATUS2 *vs2 = (VESSELSTATUS2*)vs;
- if (vs2->status & 1) { // idle flag
- launchelev = max (0, vs2->vrot.x - 18.962);
- if (vs2->arot.x > 4.0) { // rotation matrix not defined - need to construct manually
- double slng = sin (vs2->surf_lng), clng = cos (vs2->surf_lng);
- double slat = sin (vs2->surf_lat), clat = cos (vs2->surf_lat);
- double sdir = sin (vs2->surf_hdg), cdir = cos (vs2->surf_hdg);
- vs2->arot.x = atan2(slat, clat*slng);
- vs2->arot.y = -asin(clng*clat);
- vs2->arot.z = atan2(clng*slat*cdir+slng*sdir, clng*slat*sdir-slng*cdir);
- }
- } else {
- double rad = length(vs2->rpos);
- double alt = rad - oapiGetSize(vs2->rbody);
- launchelev = max (0, alt - 18.962);
- }
- }
- // optional meshes
- if (do_plat && !mesh_platform) {
- VECTOR3 plat_ofs = _V(-2.59805, 1.69209, -5.15524);
- mesh_platform = AddMesh("shuttle_eva_plat", &plat_ofs);
- }
- //t0 = ascap->GetMT0();
- if (ODS == 0){
- SetAnimation(anim_extdoor, EXT_proc);
- CreateDock(_V(0.0, -.8, 10.5), _V(0, 1, 0), _V(0, 0, 1));
- }
- //if (RMSDIALOG == 1)oapiOpenDialogEx(g_Param.hDLL, IDD_RMS, RMS_DlgProc, 0, this);
- if (flood1_status == 1)
- {
- spotlight1->Activate(true);
- spot_beacon[0].active = true;
- }
- if (flood2_status == 1)
- {
- spotlight2->Activate(true);
- spot_beacon[1].active = true;
- }
- // flood 1 off
- if (flood1_status == 0)
- {
- spotlight1->Activate(false);
- spot_beacon[0].active = false;
- }
- // flood 2 off
- if (flood2_status == 0)
- {
- spotlight2->Activate(false);
- spot_beacon[1].active = false;
- }
- // flood 3 on
- if (flood3_status == 1)
- {
- spotlight3->Activate(true);
- spot_beacon[2].active = true;
- }
- // flood 4 on
- if (flood4_status == 1)
- {
- spotlight4->Activate(true);
- spot_beacon[3].active = true;
- }
- // flood 3 off
- if (flood3_status == 0)
- {
- spotlight3->Activate(false);
- spot_beacon[2].active = false;
- }
- // flood 4 off
- if (flood4_status == 0)
- {
- spotlight4->Activate(false);
- spot_beacon[3].active = false;
- }
- // flood 5 on
- if (flood5_status == 1)
- {
- spotlight5->Activate(true);
- spot_beacon[4].active = true;
- }
- // flood 6 on
- if (flood6_status == 1)
- {
- spotlight6->Activate(true);
- spot_beacon[5].active = true;
- }
- // flood 5 off
- if (flood5_status == 0)
- {
- spotlight5->Activate(false);
- spot_beacon[4].active = false;
- }
- // flood 6 off
- if (flood6_status == 0)
- {
- spotlight6->Activate(false);
- spot_beacon[5].active = false;
- }
- //aft light on
- if (aft_light_status == 1)
- {
- spotlight7->Activate(true);
- spot_beacon[6].active = true;
- }
- //aft light off
- else if (aft_light_status == 0)
- {
- spotlight7->Activate(false);
- spot_beacon[6].active = false;
- }
- //rms light on
- if (rmslight_status == 1)
- {
- spotlightRMS->Activate(true);
- spot_beacon[8].active = true;
- }
- //rms light off
- else if (rmslight_status == 0)
- {
- spotlightRMS->Activate(false);
- spot_beacon[8].active = false;
- }
- //dock light off
- if (docklight_status == 0)
- {
- spotlightDOCK->Activate(false);
- spot_beacon[7].active = false;
- }
- //dock light on
- if (docklight_status == 1)
- {
- spotlightDOCK->Activate(true);
- spot_beacon[7].active = true;
- }
- ClearMeshes();//clear meshes
- LoadMeshes();//load correct meshes
- if (do_cargostatic && !mesh_cargo) {
- mesh_cargo = AddMesh(cargo_static_mesh_name, &cargo_static_ofs);
- }
- if (do_cargostatic)SetMeshVisibilityMode(mesh_cargo, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);
- if (ODS==1)
- {
- hDockODS = CreateDock(ORBITER_DOCKPOS, _V(0, 1, 0), _V(0, 0, -1));
- SetMeshVisibilityMode(mesh_ODS, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);//ODS PRESENT SHOW MESH
- //CreateDock(_V(0.0, -.8, 8), _V(0, 1, 0), _V(0, 0, 1));
- SetAnimation(anim_extodsdoor, EXT_proc);
- }
- if (NOSLIDEWIRE == 1)
- {
- SetMeshVisibilityMode(mesh_SLIDEWIRE, MESHVIS_NEVER);//DO NOT SHOW THIS MESH
- }
- if (RMSSELECT==1)
- {
- SetMeshVisibilityMode(mesh_RMS1, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);//RMS PRESENT SHOW MESH
- }
- if (OBSS1 == 1)
- {
- SetMeshVisibilityMode(mesh_MPMOBSS, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);//obss PRESENT SHOW MESH
- }
- if (NOKU == 1)
- {
- SetMeshVisibilityMode(mesh_KU, MESHVIS_NEVER);//DO NOT SHOW THIS MESH
- }
- if (NOWIRE == 1)
- {
- SetMeshVisibilityMode(mesh_SHUTTLEWIRE, MESHVIS_NEVER);//DO NOT SHOW THIS MESH
- }
- if (EXTAIRLOCK == 1)
- {
- SetMeshVisibilityMode(mesh_EXTAIRLOCK, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);//obss PRESENT SHOW MESH
- SetMeshVisibilityMode(mesh_THERMALCOVER, MESHVIS_NEVER);//DO NOT SHOW THIS MESH
- SetAnimation(anim_EXTAIRLOCK, EXT_proc);
- }
- //make changes to attachment based off scn
- //ofs_sts_sat.x = pl1_ofs.x;
- //ofs_sts_sat.y = pl1_ofs.y;
- //ofs_sts_sat.z = pl1_ofs.z;
- SetAttachmentParams(sat_attach, pl1_ofs, pl1_dir, pl1_rot);//0
- SetAttachmentParams(sat_attach2, pl2_ofs, pl2_dir, pl2_rot);//1
- SetAttachmentParams(sat_attach3, pl3_ofs, pl3_dir, pl3_rot);//2
- SetAttachmentParams(sat_attach4, pl4_ofs, pl4_dir, pl4_rot);//3
- SetAttachmentParams(sat_attach5, pl5_ofs, pl5_dir, pl5_rot);//4
- SetAttachmentParams(sat_attach6, pl6_ofs, pl6_dir, pl6_rot);//5
- SetAttachmentParams(sat_attach7, pl7_ofs, pl7_dir, pl7_rot);//6
- SetAttachmentParams(sat_attach8, pl8_ofs, pl8_dir, pl8_rot);//7
- SetAttachmentParams(sat_attach9, pl9_ofs, pl9_dir, pl9_rot);//8
- SetAttachmentParams(sat_attach10, pl10_ofs, pl10_dir, pl10_rot);//9
- SetAttachmentParams(ft_pad_att, ft_pad_att_pos, ft_pad_att_dir, ft_pad_att_rot);//13
- SetAttachmentParams(ft_pad_att1, ft_pad_att1_pos, ft_pad_att1_dir, ft_pad_att1_rot);//14
- SetAttachmentParams(ft_pad_att2, ft_pad_att2_pos, ft_pad_att2_dir, ft_pad_att2_rot);//15
- SetAttachmentParams(ft_pad_att3, ft_pad_att3_pos, ft_pad_att3_dir, ft_pad_att3_rot);//16
- SetAttachmentParams(OBSS_attach, armobss_tip[0], armobss_tip[1] - armobss_tip[0], armobss_tip[2] - armobss_tip[0]);
- //6
- //ius_proc = atan(pl1_dir.y);
- //if (OBSS1 == 1)SetAttachmentParams(sat_attach7, _V(2.850, 2.150, 3.850), _V(0, 1, 0), _V(0, 0, 1));//6
- if (gear_proc>=1) {
- SetAnimation(anim_LEFTGEARDN, 1);
- // SetAnimation(anim_LEFTGEARUP, 1);
- SetAnimation(anim_LEFTGEARTALKBACK, 1);
- SetAnimation(anim_RIGHTGEARDN, 1);
- // SetAnimation(anim_RIGHTGEARUP, 1);
- SetAnimation(anim_RIGHTGEARTALKBACK, 1);
- }
- if (geararmed == 1) {
- SetAnimation(anim_LEFTGEARARMON, 1);
- // SetAnimation(anim_LEFTGEARARMOFF, 1);
- SetAnimation(anim_RIGHTGEARARMON, 1);
- // SetAnimation(anim_RIGHTGEARARMOFF, 1);
- }
- if (flood2_status == 0)SetAnimation(anim_floodportaft, 0);
- if (flood2_status == 1)SetAnimation(anim_floodportaft, 1);
- if (flood1_status == 0)SetAnimation(anim_floodstbdaft, 0);
- if (flood1_status == 1)SetAnimation(anim_floodstbdaft, 1);
- if (flood3_status == 0)SetAnimation(anim_floodportmid, 0);
- if (flood3_status == 1)SetAnimation(anim_floodportmid, 1);
- if (flood4_status == 0)SetAnimation(anim_floodstbdmid, 0);
- if (flood4_status == 1)SetAnimation(anim_floodstbdmid, 1);
- if (flood5_status == 0)SetAnimation(anim_floodportfwd, 0);
- if (flood5_status == 1)SetAnimation(anim_floodportfwd, 1);
- if (flood6_status == 0)SetAnimation(anim_floodstbdfwd, 0);
- if (flood6_status == 1)SetAnimation(anim_floodstbdfwd, 1);
- if (aft_light_status == 0)SetAnimation(anim_fwdlight, 0);
- if (aft_light_status == 1)SetAnimation(anim_fwdlight, 1);
- if (docklight_status == 1)SetAnimation(anim_docklight, .5);
- if (docklight_status == 2)SetAnimation(anim_docklight, 1);
- if (docklight_status == 0)SetAnimation(anim_docklight, 0);
- if ((flood1_status == 0)|| (flood2_status == 0)|| (flood3_status == 0)|| (flood4_status == 0)|| (flood5_status == 0)|| (flood6_status == 0))SetAnimation(anim_floodon, 0);
- if ((flood1_status == 1) || (flood2_status == 1) || (flood3_status == 1) || (flood4_status == 1) || (flood5_status == 1) || (flood6_status == 1))SetAnimation(anim_floodon, 1);
- if (ADTA_proc <= 0)SetAnimation(anim_ATDADeploy, 0);
- if (ADTA_proc >= 1)SetAnimation(anim_ATDADeploy, 1);
- }
- // --------------------------------------------------------------
- // Write status to scenario file
- // --------------------------------------------------------------
- void Atlantis::clbkSaveState(FILEHANDLE scn)
- {
- char cbuf[256];
- // default vessel parameters
- VESSEL4::clbkSaveState(scn);
- // custom parameters
- oapiWriteScenario_int(scn, "CONFIGURATION", status);
- //if (status == 1)
- // oapiWriteScenario_float (scn, "MET", oapiGetSimTime()-t0);
- char savebuff[256], savevalbuff[256];
- sprintf(savebuff, "MET");
- sprintf(savevalbuff, "%.3f", MET);
- oapiWriteScenario_string(scn, savebuff, savevalbuff);
- sprintf(cbuf, "%d %0.4f", gear_status - 1, gear_proc);
- oapiWriteScenario_string(scn, "GEAR", cbuf);
- sprintf(cbuf, "%d %0.4f", EXT_status, EXT_proc);
- oapiWriteScenario_string(scn, "HATCH", cbuf);
- sprintf(cbuf, "%d %0.4f", ADTA_status, ADTA_proc);
- oapiWriteScenario_string(scn, "ADTA", cbuf);
- sprintf(cbuf, "%d %0.4f", ssmestow_status, ssmestow_proc);
- oapiWriteScenario_string(scn, "SSMES", cbuf);
- sprintf(cbuf, "%d ", VCCAM);
- oapiWriteScenario_string(scn, "VCCAM", cbuf);
- sprintf(cbuf, "%d %0.4f", PETD_status, PETD_proc);
- oapiWriteScenario_string(scn, "PETD", cbuf);
- sprintf(cbuf, "%d %0.4f", SETD_status, SETD_proc);
- oapiWriteScenario_string(scn, "SETD", cbuf);
- sprintf(cbuf, "%d ", OV);
- oapiWriteScenario_string(scn, "OV", cbuf);
- if (RMSDIALOG == 2)RMSDIALOG = 3;//dialogue is open so set rmsdialogue to 3
- if (USEIUS == 1) oapiWriteScenario_string(scn, "USEIUS", " ");
- if (SPIN0 == 1) oapiWriteScenario_string(scn, "SPIN0", " "); //INTELSAT6 SPIN
- if (SPIN1 == 1) oapiWriteScenario_string(scn, "SPIN1", " "); //if eva has happened or not
- if (SPIN2 == 1) oapiWriteScenario_string(scn, "SPIN2", " "); //if eva has happened or not
- if (SPIN3 == 1) oapiWriteScenario_string(scn, "SPIN3", " "); //if eva has happened or not
- if (SPIN4 == 1) oapiWriteScenario_string(scn, "SPIN4", " "); //if eva has happened or not
- if (SPIN5 == 1) oapiWriteScenario_string(scn, "SPIN5", " "); //if eva has happened or not
- //if (EVA == 1) oapiWriteScenario_string(scn, "EVA", " "); //if eva has happened or not
- if (ODS == 1) oapiWriteScenario_string(scn, "ODS", " "); // if ODS is used or not
- if (geararmed == 1) oapiWriteScenario_string(scn, "ARMEDGEAR", " ");//gear is armed
- if (RMSDIALOG == 3) oapiWriteScenario_string(scn, "RMSDIALOG", " "); // if rms dialogue is open so write rmsdialogue
- if (ORIGINAL == 1) oapiWriteScenario_string(scn, "ORIGINAL", " ");// if Original paint scheme is used
- if (MIDMODEL == 1) oapiWriteScenario_string(scn, "MID", " ");// if mid range paint scheme is used
- if (RMSSELECT == 1) oapiWriteScenario_string(scn, "RMSARM", " ");// if rmsarm is used
- if (OBSS1 == 1) oapiWriteScenario_string(scn, "OBSS", " ");// if Obss is used
- if (EXTAIRLOCK == 1) oapiWriteScenario_string(scn, "EXTAIRLOCK", " ");// if EXTERNAL AIRLOCKf is used
- if (EVA1 == 1) oapiWriteScenario_string(scn, "EVA1", " ");// if EVA1GUY MADE is used
- if (EVA2 == 1) oapiWriteScenario_string(scn, "EVA2", " ");// if EVA2GUY MADE is used
- if (EVA3 == 1) oapiWriteScenario_string(scn, "EVA3", " ");// if EVA3GUY MADE is used
- if (EVA4 == 1) oapiWriteScenario_string(scn, "EVA4", " ");// if EVA4GUY MADE is used
- if (NOKU == 1) oapiWriteScenario_string(scn, "NOKU", " ");// KU band antenna not used
- if (NOWIRE == 1) oapiWriteScenario_string(scn, "NOWIRE", " ");// NO SHUTTLE CARGO BAY WIRE not used
- if (NOSLIDEWIRE == 1) oapiWriteScenario_string(scn, "NOSLIDEWIRE", " ");
- if (DRAGCHUTE == 1) oapiWriteScenario_string(scn, "NOCHUTE", " ");// if DRAGCHUTE is used
- if (RMSSELECT == 1) {
- if (arm1set) oapiWriteScenario_string(scn, "ARM1SET", " "); //if ARM1SET has happened or not
- if (arm2set) oapiWriteScenario_string(scn, "ARM2SET", " "); //if ARM2SET has happened or not
- if (arm3set) oapiWriteScenario_string(scn, "ARM3SET", " "); //if ARM3SET has happened or not
- if (arm4set) oapiWriteScenario_string(scn, "ARM4SET", " "); //if ARM4SET has happened or not
- sprintf(cbuf, "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", arm_sy, arm_sp, arm_ep, arm_wp, arm_wy, arm_wr);
- oapiWriteScenario_string(scn, "ARM_STATUS", cbuf);
- if (arm1set) {
- sprintf(cbuf, " %f %f %f %f %f %f", arm1_By, arm1_Bp,
- arm1_ep, arm1_Ap, arm1_Ay, arm1_Ar);
- oapiWriteScenario_string(scn, "ARM_SEQ1", cbuf);
- }
- if (arm2set) {
- sprintf(cbuf, " %f %f %f %f %f %f", arm2_By, arm2_Bp,
- arm2_ep, arm2_Ap, arm2_Ay, arm2_Ar);
- oapiWriteScenario_string(scn, "ARM_SEQ2", cbuf);
- }
- if (arm3set) {
- sprintf(cbuf, " %f %f %f %f %f %f", arm3_By, arm3_Bp,
- arm3_ep, arm3_Ap, arm3_Ay, arm3_Ar);
- oapiWriteScenario_string(scn, "ARM_SEQ3", cbuf);
- }
- if (arm4set) {
- sprintf(cbuf, " %f %f %f %f %f %f", arm4_By, arm4_Bp,
- arm4_ep, arm4_Ap, arm4_Ay, arm4_Ar);
- oapiWriteScenario_string(scn, "ARM_SEQ4", cbuf);
- }
- sprintf(cbuf, "%d %0.4f %d %0.4f", Armtilt_status, Armtilt_proc, OBSS_status, OBSS_proc);
- oapiWriteScenario_string(scn, "Armtilt", cbuf);
- }
- //PBCAM
- sprintf(cbuf, "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", camPitch[CAM_A], camYaw[CAM_A], camPitch[CAM_B], camYaw[CAM_B],
- camPitch[CAM_C], camYaw[CAM_C], camPitch[CAM_D], camYaw[CAM_D], camRMSElbow[PAN], camRMSElbow[TILT]);
- oapiWriteScenario_string(scn, "PLB_CAM", cbuf);
- //if (USEIUS == 1){
- // sprintf(cbuf, " %0.4f %0.4f", phi, tiltvalue);
- // oapiWriteScenario_string(scn, "tiltangle", cbuf);
- // }
- if (USEIUS == 1) {
- sprintf(cbuf, " %0.4f", ius_proc);
- oapiWriteScenario_string(scn, "IUSproc", cbuf);
- }
- if (spdb_status != AnimState::CLOSED) {
- sprintf(cbuf, " %0.4f", spdb_proc);
- oapiWriteScenario_string(scn, "SPEEDBRAKE", cbuf);
- }
- //if (status == 0 && launchelev)
- // oapiWriteScenario_float (scn, "LAUNCHELEVATION", launchelev);
- if (PMASS0 == 1) {// PAYLOAD_MASS0 is used
- sprintf(cbuf, " %0.3f", MASS0);
- oapiWriteScenario_string(scn, "PAYLOAD_MASS0", cbuf);// write to scn payload mass 0
- }
- if (PMASS1 == 1) {// PAYLOAD_MASS1 is used
- sprintf(cbuf, " %0.3f", MASS1);
- oapiWriteScenario_string(scn, "PAYLOAD_MASS1", cbuf);
- }
- if (PMASS2 == 1) {// PAYLOAD_MASS2 is used
- sprintf(cbuf, " %0.3f", MASS2);
- oapiWriteScenario_string(scn, "PAYLOAD_MASS2", cbuf);
- }
- if (PMASS3 == 1) {// PAYLOAD_MASS3 is used
- sprintf(cbuf, " %0.3f", MASS3);
- oapiWriteScenario_string(scn, "PAYLOAD_MASS3", cbuf);
- }
- /*
- sprintf(cbuf, "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", arm_sy_stored1, arm_sp_stored1, arm_ep_stored1, arm_wp_stored1, arm_wy_stored1, arm_wr_stored1);
- oapiWriteScenario_string(scn, "ARM_SEQ1", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", arm6_By, arm6_Bp, arm6_ep, arm6_Ap, arm6_Ay, arm_wr_stored2);
- oapiWriteScenario_string(scn, "ARM_SEQ2", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", arm6_By, arm6_Bp, arm6_ep, arm6_Ap, arm6_Ay, arm6_Ar);
- oapiWriteScenario_string(scn, "ARM_SEQ3", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", arm6_By, arm6_Bp, arm6_ep, arm6_Ap, arm6_Ay, arm6_Ar);
- oapiWriteScenario_string(scn, "ARM_SEQ4", cbuf);
- */
- // read attachment point loaction,dir, and rot.
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl1_ofs.x, pl1_ofs.y, pl1_ofs.z);
- oapiWriteScenario_string(scn, "PL1_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl1_dir.x, pl1_dir.y, pl1_dir.z);
- oapiWriteScenario_string(scn, "PL1_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl1_rot.x, pl1_rot.y, pl1_rot.z);
- oapiWriteScenario_string(scn, "PL1_ROT", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl2_ofs.x, pl2_ofs.y, pl2_ofs.z);
- oapiWriteScenario_string(scn, "PL2_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl2_dir.x, pl2_dir.y, pl2_dir.z);
- oapiWriteScenario_string(scn, "PL2_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl2_rot.x, pl2_rot.y, pl2_rot.z);
- oapiWriteScenario_string(scn, "PL2_ROT", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl3_ofs.x, pl3_ofs.y, pl3_ofs.z);
- oapiWriteScenario_string(scn, "PL3_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl3_dir.x, pl3_dir.y, pl3_dir.z);
- oapiWriteScenario_string(scn, "PL3_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl3_rot.x, pl3_rot.y, pl3_rot.z);
- oapiWriteScenario_string(scn, "PL3_ROT", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl4_ofs.x, pl4_ofs.y, pl4_ofs.z);
- oapiWriteScenario_string(scn, "PL4_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl4_dir.x, pl4_dir.y, pl4_dir.z);
- oapiWriteScenario_string(scn, "PL4_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl4_rot.x, pl4_rot.y, pl4_rot.z);
- oapiWriteScenario_string(scn, "PL4_ROT", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl5_ofs.x, pl5_ofs.y, pl5_ofs.z);
- oapiWriteScenario_string(scn, "PL5_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl5_dir.x, pl5_dir.y, pl5_dir.z);
- oapiWriteScenario_string(scn, "PL5_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl5_rot.x, pl5_rot.y, pl5_rot.z);
- oapiWriteScenario_string(scn, "PL5_ROT", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl6_ofs.x, pl6_ofs.y, pl6_ofs.z);
- oapiWriteScenario_string(scn, "PL6_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl6_dir.x, pl6_dir.y, pl6_dir.z);
- oapiWriteScenario_string(scn, "PL6_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl6_rot.x, pl6_rot.y, pl6_rot.z);
- oapiWriteScenario_string(scn, "PL6_ROT", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl7_ofs.x, pl7_ofs.y, pl7_ofs.z);
- oapiWriteScenario_string(scn, "PL7_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl7_dir.x, pl7_dir.y, pl7_dir.z);
- oapiWriteScenario_string(scn, "PL7_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl7_rot.x, pl7_rot.y, pl7_rot.z);
- oapiWriteScenario_string(scn, "PL7_ROT", cbuf);
- //8
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl8_ofs.x, pl8_ofs.y, pl8_ofs.z);
- oapiWriteScenario_string(scn, "PL8_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl8_dir.x, pl8_dir.y, pl8_dir.z);
- oapiWriteScenario_string(scn, "PL8_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl8_rot.x, pl8_rot.y, pl8_rot.z);
- oapiWriteScenario_string(scn, "PL8_ROT", cbuf);
- //9
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl9_ofs.x, pl9_ofs.y, pl9_ofs.z);
- oapiWriteScenario_string(scn, "PL9_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl9_dir.x, pl9_dir.y, pl9_dir.z);
- oapiWriteScenario_string(scn, "PL9_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl9_rot.x, pl9_rot.y, pl9_rot.z);
- oapiWriteScenario_string(scn, "PL9_ROT", cbuf);
- //10
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl10_ofs.x, pl10_ofs.y, pl10_ofs.z);
- oapiWriteScenario_string(scn, "pl10_OFS", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl10_dir.x, pl10_dir.y, pl10_dir.z);
- oapiWriteScenario_string(scn, "pl10_DIR", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", pl10_rot.x, pl10_rot.y, pl10_rot.z);
- oapiWriteScenario_string(scn, "pl10_ROT", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att_pos.x, ft_pad_att_pos.y, ft_pad_att_pos.z);
- oapiWriteScenario_string(scn, "ft_pad_att_pos", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att_dir.x, ft_pad_att_dir.y, ft_pad_att_dir.z);
- oapiWriteScenario_string(scn, "ft_pad_att_dir", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att_rot.x, ft_pad_att_rot.y, ft_pad_att_rot.z);
- oapiWriteScenario_string(scn, "ft_pad_att_rot", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att1_pos.x, ft_pad_att1_pos.y, ft_pad_att1_pos.z);
- oapiWriteScenario_string(scn, "ft_pad_att1_pos", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att1_dir.x, ft_pad_att1_dir.y, ft_pad_att1_dir.z);
- oapiWriteScenario_string(scn, "ft_pad_att1_dir", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att1_rot.x, ft_pad_att1_rot.y, ft_pad_att1_rot.z);
- oapiWriteScenario_string(scn, "ft_pad_att1_rot", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att2_pos.x, ft_pad_att2_pos.y, ft_pad_att2_pos.z);
- oapiWriteScenario_string(scn, "ft_pad_att2_pos", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att2_dir.x, ft_pad_att2_dir.y, ft_pad_att2_dir.z);
- oapiWriteScenario_string(scn, "ft_pad_att2_dir", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att2_rot.x, ft_pad_att2_rot.y, ft_pad_att2_rot.z);
- oapiWriteScenario_string(scn, "ft_pad_att2_rot", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att3_pos.x, ft_pad_att3_pos.y, ft_pad_att3_pos.z);
- oapiWriteScenario_string(scn, "ft_pad_att3_pos", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att3_dir.x, ft_pad_att3_dir.y, ft_pad_att3_dir.z);
- oapiWriteScenario_string(scn, "ft_pad_att3_dir", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ft_pad_att3_rot.x, ft_pad_att3_rot.y, ft_pad_att3_rot.z);
- oapiWriteScenario_string(scn, "ft_pad_att3_rot", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", KEELCAM.x, KEELCAM.y, KEELCAM.z);
- oapiWriteScenario_string(scn, "KEEL_CAM", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", ETCAM.x, ETCAM.y, ETCAM.z);
- oapiWriteScenario_string(scn, "ET_CAM", cbuf);
- sprintf(cbuf, "%0.4f %0.4f %0.4f", DOCKCAM.x, DOCKCAM.y, DOCKCAM.z);
- oapiWriteScenario_string(scn, "DOCK_CAM", cbuf);
- sprintf(cbuf, "%d ", flood1_status);
- oapiWriteScenario_string(scn, "FLOOD1", cbuf);
- sprintf(cbuf, "%d ", flood2_status);
- oapiWriteScenario_string(scn, "FLOOD2", cbuf);
- sprintf(cbuf, "%d ", flood3_status);
- oapiWriteScenario_string(scn, "FLOOD3", cbuf);
- sprintf(cbuf, "%d ", flood4_status);
- oapiWriteScenario_string(scn, "FLOOD4", cbuf);
- sprintf(cbuf, "%d ", flood5_status);
- oapiWriteScenario_string(scn, "FLOOD5", cbuf);
- sprintf(cbuf, "%d ", flood6_status);
- oapiWriteScenario_string(scn, "FLOOD6", cbuf);
- sprintf(cbuf, "%d ", docklight_status);
- oapiWriteScenario_string(scn, "DOCK_LIGHT", cbuf);
- sprintf(cbuf, "%d ", aft_light_status);
- oapiWriteScenario_string(scn, "AFT_LIGHT", cbuf);
- sprintf(cbuf, "%d ", rmslight_status);
- oapiWriteScenario_string(scn, "RMSLIGHT", cbuf);
- if (do_cargostatic) {
- oapiWriteScenario_string(scn, "CARGO_STATIC_MESH", cargo_static_mesh_name);
- if (cargo_static_ofs.x || cargo_static_ofs.y || cargo_static_ofs.z)
- oapiWriteScenario_vec(scn, "CARGO_STATIC_OFS", cargo_static_ofs);
- }
- if ((CREW1 == 1)&& (EVA1==0)){
- sprintf(cbuf, "%s %s", crew1_name, crew1_cfg);
- oapiWriteScenario_string(scn, "CREW1", cbuf);
- }
- if ((CREW2 == 1) && (EVA2 == 0)){
- sprintf(cbuf, "%s %s", crew2_name, crew2_cfg);
- oapiWriteScenario_string(scn, "CREW2", cbuf);
- }
- if ((CREW3 == 1) && (EVA3 == 0)){
- sprintf(cbuf, "%s %s", crew3_name, crew3_cfg);
- oapiWriteScenario_string(scn, "CREW3", cbuf);
- }
- if ((CREW4 == 1) && (EVA4 == 0)){
- sprintf(cbuf, "%s %s", crew4_name, crew4_cfg);
- oapiWriteScenario_string(scn, "CREW4", cbuf);
- }
- if (EVA1 == 0) {
- if ((ODS == 0) || (EXTAIRLOCK == 0))ft_pad_att_pos = _V(0, 0.7, 11.321);
- else ft_pad_att_pos = _V(0, 0.3, 8.5);
- ft_pad_att_dir = _V(0, 1, 0);
- ft_pad_att_rot = _V(0, 0, -1);
- }
- if (EVA2 == 0) {
- if ((ODS == 0) || (EXTAIRLOCK == 0))ft_pad_att1_pos = _V(0, 0.7, 11.321);
- else ft_pad_att1_pos = _V(0, 0.3, 8.5);
- ft_pad_att1_dir = _V(0, 1, 0);
- ft_pad_att1_rot = _V(0, 0, -1);
- }
- if (EVA3 == 0) {
- if ((ODS == 0) || (EXTAIRLOCK == 0))ft_pad_att2_pos = _V(0, 0.7, 11.321);
- else ft_pad_att2_pos = _V(0, 0.3, 8.5);
- ft_pad_att2_dir = _V(0, 1, 0);
- ft_pad_att2_rot = _V(0, 0, -1);
- }
- if (EVA4 == 0) {
- if ((ODS == 0) || (EXTAIRLOCK == 0))ft_pad_att3_pos = _V(0, 0.7, 11.321);
- else ft_pad_att3_pos = _V(0, 0.3, 8.5);
- ft_pad_att3_dir = _V(0, 1, 0);
- ft_pad_att3_rot = _V(0, 0, -1);
- }
- // save bay door operations status
- plop->SaveState (scn);
- //ascap->SaveState (scn);
- }
- // --------------------------------------------------------------
- void Atlantis::clbkPostCreation ()
- {
- oapi::Font* font1 = oapiCreateFont(50, true, "*Seven Segment");
- oapi::Font* font2 = oapiCreateFont(40, true, "*Seven Segment");
- oapi::Font* font3 = oapiCreateFont(-11, true, "Arial");
- EnableSSME(status < 3);
- EnableRCS(status == 3);
- EnableOMS(status == 3);
- SetADCtrlMode(status < 3 ? 0 : 7);
- //ShiftMesh(4, _V(-.2, 0, 0));
- //LoadMeshes();
- UpdateMesh();
- //if ((OV == 102) || (OV == 103) || (OV == 99) || (OV == 104) || (OV == 105) || (OV == 106) || (OV == 107) || (OV == 108))
- {
- pl1_ofs = _V(0, 6.220, -7.795);
- pl2_ofs = _V(0, 6.220, -7.795);
- pl3_ofs = _V(-1.850, 8.020, 3.955);
- pl4_ofs = _V(-2.2, 8.020, -14.045);
- pl5_ofs = _V(2.2, 8.020, -14.045);
- pl6_ofs = _V(1.850, 8.020, 3.955);
- pl7_ofs = _V(0, 6.220, -7.795);
- pl8_ofs = _V(0, 6.220, -7.795);
- pl9_ofs = _V(0, 0, 0);
- pl10_ofs = _V(0, 0, 0);
- pl1_dir = _V(0, 1, 0);
- pl2_dir = _V(0, 1, 0);
- pl3_dir = _V(0, 1, 0);
- pl4_dir = _V(0, 1, 0);
- pl5_dir = _V(0, 1, 0);
- pl6_dir = _V(0, 1, 0);
- pl7_dir = _V(0, 1, 0);
- pl8_dir = _V(0, 1, 0);
- pl9_dir = _V(0, 1, 0);
- pl10_dir = _V(0, 1, 0);
- pl1_rot = _V(0, 0, 1);
- pl2_rot = _V(1, 0, 0);
- pl3_rot = _V(0, 0, 1);
- pl4_rot = _V(0, 0, 1);
- pl5_rot = _V(0, 0, 1);
- pl6_rot = _V(0, 0, 1);
- pl7_rot = _V(0, 0, 1);
- pl8_rot = _V(0, 0, 1);
- pl9_rot = _V(0, 0, 1);
- pl10_rot = _V(0, 0, 1);
- // default crew
- //if now eva set to start places.
- //ft_pad_att_dir = _V(0, 1, 0);// _V(0, 1, 0), _V(0, 0, -1),
- //ft_pad_att1_dir = _V(0, 1, 0);
- //ft_pad_att2_dir = _V(0, 1, 0);
- //ft_pad_att3_dir = _V(0, 1, 0);
- //ft_pad_att_rot = _V(0, 0, -1);
- // ft_pad_att1_rot = _V(0, 0, -1);
- // ft_pad_att2_rot = _V(0, 0, -1);
- // ft_pad_att3_rot = _V(0, 0, -1);
- }
- /*
- if (CREW1 == 1){
- crew1_name[40] = crew1_name_scn[40];
- crew1_cfg[40] = crew1_cfg_scn[40];
- }
- if (CREW2 == 1){
- char*crew2_name = crew2_name_scn;
- char*crew2_cfg = crew2_cfg_scn;
- }if (CREW3 == 1){
- char*crew3_name = crew3_name_scn;
- char*crew3_cfg = crew3_cfg_scn;
- }if (CREW4 == 1){
- char*crew4_name = crew4_name_scn;
- char*crew4_cfg = crew4_cfg_scn;
- }
- */
- if (length(pl1_dir_scn) > 0)
- {
- pl1_ofs = pl1_ofs_scn;
- pl1_dir = pl1_dir_scn;
- pl1_rot = pl1_rot_scn;
- }
- if (length(pl2_dir_scn) > 0)
- {
- pl2_ofs = pl2_ofs_scn;
- pl2_dir = pl2_dir_scn;
- pl2_rot = pl2_rot_scn;
- }
- if (length(pl3_dir_scn) > 0)
- {
- pl3_ofs = pl3_ofs_scn;
- pl3_dir = pl3_dir_scn;
- pl3_rot = pl3_rot_scn;
- }
- if (length(pl4_dir_scn) > 0)
- {
- pl4_ofs = pl4_ofs_scn;
- pl4_dir = pl4_dir_scn;
- pl4_rot = pl4_rot_scn;
- }
- if (length(pl5_dir_scn) > 0)
- {
- pl5_ofs = pl5_ofs_scn;
- pl5_dir = pl5_dir_scn;
- pl5_rot = pl5_rot_scn;
- }
- if (length(pl6_dir_scn) > 0)
- {
- pl6_ofs = pl6_ofs_scn;
- pl6_dir = pl6_dir_scn;
- pl6_rot = pl6_rot_scn;
- }
- if (length(pl7_dir_scn) > 0)
- {
- pl7_ofs = pl7_ofs_scn;
- pl7_dir = pl7_dir_scn;
- pl7_rot = pl7_rot_scn;
- }
- if (length(pl8_dir_scn) > 0)
- {
- pl8_ofs = pl8_ofs_scn;
- pl8_dir = pl8_dir_scn;
- pl8_rot = pl8_rot_scn;
- }
- if (length(pl9_dir_scn) > 0)
- {
- pl9_ofs = pl9_ofs_scn;
- pl9_dir = pl9_dir_scn;
- pl9_rot = pl9_rot_scn;
- }
- if (length(pl10_dir_scn) > 0)
- {
- pl10_ofs = pl10_ofs_scn;
- pl10_dir = pl10_dir_scn;
- pl10_rot = pl10_rot_scn;
- }
- if (length(KEELCAM_scn) > 0)
- {
- KEELCAM = KEELCAM_scn;
- }
- if (length(ETCAM_scn) > 0)
- {
- ETCAM = ETCAM_scn;
- }
- if (length(DOCKCAM_scn) > 0)
- {
- DOCKCAM = DOCKCAM_scn;
- }
- if (length(ft_pad_att_dir_scn) > 0)
- {
- ft_pad_att_pos = ft_pad_att_pos_scn;
- ft_pad_att_dir = ft_pad_att_dir_scn;
- ft_pad_att_rot = ft_pad_att_rot_scn;
- }
- if (length(ft_pad_att1_dir_scn) > 0)
- {
- ft_pad_att1_pos = ft_pad_att1_pos_scn;
- ft_pad_att1_dir = ft_pad_att1_dir_scn;
- ft_pad_att1_rot = ft_pad_att1_rot_scn;
- }
- if (length(ft_pad_att_dir_scn) > 0)
- {
- ft_pad_att2_pos = ft_pad_att2_pos_scn;
- ft_pad_att2_dir = ft_pad_att2_dir_scn;
- ft_pad_att2_rot = ft_pad_att2_rot_scn;
- }
- if (length(ft_pad_att_dir_scn) > 0)
- {
- ft_pad_att3_pos = ft_pad_att3_pos_scn;
- ft_pad_att3_dir = ft_pad_att3_dir_scn;
- ft_pad_att3_rot = ft_pad_att3_rot_scn;
- }
- SetAttachmentParams(sat_attach, pl1_ofs, pl1_dir, pl1_rot);//0
- SetAttachmentParams(sat_attach2, pl2_ofs, pl2_dir, pl2_rot);//1
- SetAttachmentParams(sat_attach3, pl3_ofs, pl3_dir, pl3_rot);//2
- SetAttachmentParams(sat_attach4, pl4_ofs, pl4_dir, pl4_rot);//3
- SetAttachmentParams(sat_attach5, pl5_ofs, pl5_dir, pl5_rot);//4
- SetAttachmentParams(sat_attach6, pl6_ofs, pl6_dir, pl6_rot);//5
- SetAttachmentParams(sat_attach7, pl7_ofs, pl7_dir, pl7_rot);//6
- SetAttachmentParams(sat_attach8, pl8_ofs, pl8_dir, pl8_rot);//7
- SetAttachmentParams(sat_attach9, pl9_ofs, pl9_dir, pl9_rot);//8
- SetAttachmentParams(sat_attach10, pl10_ofs, pl10_dir, pl10_rot);//8
- SetAttachmentParams(ft_pad_att, ft_pad_att_pos, ft_pad_att_dir, ft_pad_att_rot);
- SetAttachmentParams(ft_pad_att1, ft_pad_att1_pos, ft_pad_att1_dir, ft_pad_att1_rot);
- SetAttachmentParams(ft_pad_att2, ft_pad_att2_pos, ft_pad_att2_dir, ft_pad_att2_rot);
- SetAttachmentParams(ft_pad_att3, ft_pad_att3_pos, ft_pad_att3_dir, ft_pad_att3_rot);
- //set attachments for OBSS
- // if (OBSS1 == 1)SetAttachmentParams(sat_attach7, _V(2.850, .850, 1.760), _V(-.5, .866, 0), _V(0, 0, 1));//6_V(2.850, .850, 1.760), _V(-.5, .866, 0), _V(0, 0, 1))
- //if (OBSS1 == 1)SetAttachmentParams(sat_attach2, _V(2.85, 1.9, 3.550), _V(0, 1, 0), _V(0, 0, 1));//6
- SetAnimation(anim_spdb, spdb_proc);
- SetAnimationCameras();
- /* char name[256];
- VESSELSTATUS vs;
- VESSEL *pV;
- VESSEL4::clbkPostCreation();
- if (status < 3) {
- OBJHANDLE hET = GetDockStatus (GetDockHandle (1));
- if (!hET) {
- strcpy (name, GetName());
- strcat (name, "_ET");
- hET = oapiGetVesselByName(name);
- if (!hET || strcmp (oapiGetVesselInterface(hET)->GetClassName(), "Atlantis_Tank")) {
- GetStatus (vs);
- hET = oapiCreateVessel (name, "Atlantis_Tank", vs);
- }
- Dock (hET, 1, 0, 1);
- }
- pET = (Atlantis_Tank*)oapiGetVesselInterface(hET);
- if (status < 2) {
- pV = oapiGetVesselInterface (hET);
- for (UINT i = 0; i < 2; i++) {
- OBJHANDLE hSRB = pV->GetDockStatus (pV->GetDockHandle (i+1));
- if (!hSRB) {
- sprintf (name, "%s-SRB%d", GetName(), i+1);
- hSRB = oapiGetVesselByName(name);
- if (!hSRB || strcmp (oapiGetVesselInterface(hSRB)->GetClassName(), "Atlantis_SRB")) {
- GetStatus (vs);
- hSRB = oapiCreateVessel (name, "Atlantis_SRB", vs);
- }
- pV->Dock (hSRB, i+1, 0, 1);
- }
- }
- if (status < 1) {
- if (launchelev) {
- pET->SetSRBLaunchElevation (launchelev);
- }
- }
- }
- } else {
- if (hDockET) {
- DelDock (hDockET); // remove the ET docking port
- hDockET = NULL;
- }
- }
- EnableSSME (status < 3);
- EnableRCS (status == 3);
- EnableOMS (status == 3);
- SetADCtrlMode (status < 3 ? 0 : 7);
- UpdateMesh ();
- */
- }
- // --------------------------------------------------------------
- // Vessel gains or loses input focus
- // --------------------------------------------------------------
- void Atlantis::clbkFocusChanged (bool getfocus, OBJHANDLE newv, OBJHANDLE oldv)
- {
- if (getfocus) {
- oapiDisableMFDMode (MFD_LANDING);
- // no VTOL MFD mode for Atlantis
- }
- }
- // --------------------------------------------------------------
- // Simulation time step
- // --------------------------------------------------------------
- void Atlantis::clbkPreStep(double simt, double simdt, double mjd)
- {
- //load redraw
- oapiVCTriggerRedrawArea(-1, AID_METTIME);
- //oapiVCTriggerRedrawArea(-1, AID_EVENTTIME);
- oapiVCTriggerRedrawArea(-1, AID_RCSQTY);
- if (RMSDIALOG == 3) {//rms dialogue was open so now open window
- oapiOpenDialogEx(g_Param.hDLL, IDD_RMS, RMS_DlgProc, DLG_CAPTIONCLOSE, this);
- //RMSDIALOG = 0;
- }
- // sprintf(oapiDebugString(), "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", arm_sy, arm_sp, arm_ep, arm_wp, arm_wy, arm_wr);
- //dragchute
- spot_beacon[8].pos = &arm_tip[4];
- spotlightRMS->SetPosition(arm_tip[4]);
- spotlightRMS->SetDirection(arm_tip[1] - arm_tip[0]);
- // sprintf(oapiDebugString(), "armtip4x %2.2f armtip4y %2.2f armtip4z %2.2f", arm_tip[4].x, arm_tip[4].y, arm_tip[4].z);
- if (rmslight_status == 0){
- spotlightRMS->Activate(false);
- spot_beacon[8].active = false;
- }
- if (rmslight_status == 1){
- spotlightRMS->Activate(true);
- spot_beacon[8].active = true;
- }
- // ascap->Update (simt);
- // if (ascentApDlg) ascentApDlg->Update (simt);
- //double met = (status == 0 ? 0.0 : simt-t0);
- //double met = ascap->GetMET (simt)
- ATMPRESSURE = GetAtmPressure();
- if (ATMPRESSURE >.1)//in atmosphere so use control surfaces
- {
- //EnableRCS(true);
- SetADCtrlMode(7);//set control surface enable
- (SetAttitudeMode(0));//no rcs
- }
- else {
- //in space
- SetADCtrlMode(0);//disable control surfaces
- //(SetAttitudeMode(1));
- //(SetAttitudeMode(2));
- EnableRCS(status == 3);
- }
- double leftelevon = (GetControlSurfaceLevel(AIRCTRL_AILERON));
- double flapdegree = (GetControlSurfaceLevel(AIRCTRL_ELEVATORTRIM) );
- if (flapdegree < 0)SetAnimation(anim_BODYFLAPINDICATOR, ((flapdegree) / 2) + .35);
- if (flapdegree > 0)SetAnimation(anim_BODYFLAPINDICATOR, ((flapdegree) / 1.5) + .35);// 0 to 1 add .5 so as to start at the middle
- if (flapdegree == 0)SetAnimation(anim_BODYFLAPINDICATOR, .35);
- //if (flapdegree < 0)SetAnimation(anim_BODYFLAPINDICATOR, ((flapdegree) * 0, 354 - 0.177);
- //TRIM * 0, 354 - 0. 177
- //SetAnimation(anim_AUTOBDYFLAP, 1);
- // if (flapdegree<=0)SetAnimation(anim_BODYFLAPINDICATOR, 0);
- // else SetAnimation(anim_BODYFLAPINDICATOR, flapdegree);
- //SetAnimation(anim_BODYFLAPINDICATOR, flapdegree);
- double rudderdegree = (GetControlSurfaceLevel(AIRCTRL_RUDDER));
- if (rudderdegree < 0)SetAnimation(anim_rudderINDICATOR, ((rudderdegree)/2)+.5);
- if (rudderdegree > 0)SetAnimation(anim_rudderINDICATOR, ((rudderdegree) / 2) + .5);// 0 to 1 add .5 so as to start at the middle
- if (rudderdegree == 0)SetAnimation(anim_rudderINDICATOR, .5);
- //SetAnimation(anim_rudderINDICATOR, rudderdegree);
- SetAnimation(anim_speedbrakeINDICATOR, spdb_proc);
- // if (leftelevon < 0)SetAnimation(anim_leftelevonINDICATOR, ((leftelevon) / 2) + .5);
- // if (leftelevon > 0)SetAnimation(anim_leftelevonINDICATOR, ((leftelevon) / 2) + .5);// 0 to 1 add .5 so as to start at the middle
- // if (leftelevon == 0)SetAnimation(anim_leftelevonINDICATOR, .5);
- //spdb_proc
- //sprintf(oapiDebugString(), "flapdegree %lf,rudderdegree %lf,leftelevon %lf;", flapdegree, rudderdegree, leftelevon);
- if (oapiCameraMode() != CAM_COCKPIT){ //not in cockpit so delete note
- oapiDelAnnotation(hNote);
- }
- if (oapiCameraMode() == CAM_COCKPIT){
- if (CAM == 6){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "RMS ELBOW");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 7){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "RMS WRIST");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 1){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Payload Camera (A)");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 2){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Payload Camera (B)");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 3){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Payload Camera (C)");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 4){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Payload Camera (D)");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 5){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Keel");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 9) {
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "ET");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if ((CAM == 0)&&(vccameracase==4)){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Cockpit");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if ((CAM == 0) && (vccameracase == 0)){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Commander");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if ((CAM == 0) && (vccameracase == 1)){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Pilot");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if ((CAM == 0) && (vccameracase == 2)){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "Aft");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- if (CAM == 8){
- oapiDelAnnotation(hNote);
- char imstr[256];
- strcpy(imstr, "DOCK");
- VECTOR3 col = _V(0.8, 0.7, 0.1);
- hNote = oapiCreateAnnotation(true, 1, col);
- oapiAnnotationSetPos(hNote, 0.468, 0.05, 0.66, 0.1);
- oapiAnnotationSetText(hNote, imstr);
- }
- }
- if (oapiGetFocusObject() != GetHandle()) // focus vessel is not my vessel
- {
- oapiDelAnnotation(hNote);
- }
- engine_light_level = GetThrusterGroupLevel(THGROUP_MAIN);
- VECTOR3 tgt_rate = _V(0, 0, 0); // target rotation rates - used for setting engine gimbals
- {
- // ascent autopilot
- // ascap->GetTargetRate (met, tgt_rate);
- // manual override
- double man_pitch = GetManualControlLevel(THGROUP_ATT_PITCHUP, MANCTRL_ROTMODE, MANCTRL_ANYDEVICE);
- if (!man_pitch) man_pitch = -GetManualControlLevel(THGROUP_ATT_PITCHDOWN, MANCTRL_ROTMODE, MANCTRL_ANYDEVICE);
- if (man_pitch) tgt_rate.x = man_pitch*0.07;
- double man_yaw = GetManualControlLevel(THGROUP_ATT_YAWLEFT, MANCTRL_ROTMODE, MANCTRL_ANYDEVICE);
- if (!man_yaw) man_yaw = -GetManualControlLevel(THGROUP_ATT_YAWRIGHT, MANCTRL_ROTMODE, MANCTRL_ANYDEVICE);
- if (man_yaw) tgt_rate.y = man_yaw*0.07;
- double man_roll = -GetManualControlLevel(THGROUP_ATT_BANKLEFT, MANCTRL_ROTMODE, MANCTRL_ANYDEVICE);
- if (!man_roll) man_roll = GetManualControlLevel(THGROUP_ATT_BANKRIGHT, MANCTRL_ROTMODE, MANCTRL_ANYDEVICE);
- if (man_roll) tgt_rate.z = man_roll*0.07;
- }
- switch (status) {
- case 0: // launch configuration
- //if (!ascap->Active() && pET && GetEngineLevel (ENGINE_MAIN) > 0.95) {
- // pET->IgniteSRBs ();
- // t0 = ascap->StartMissionTime (simt);
- //t0 = simt /*+ SRB_STABILISATION_TIME*/; // store designated liftoff time
- // status = 1;
- //} else if (GetEngineLevel (ENGINE_MAIN) > 0) {
- //AutoGimbal (tgt_rate);
- //}
- break;
- case 1: // SRBs ignited
- // if (met > SRB_SEPARATION_TIME && !Playback() || bManualSeparate) {
- // SeparateBoosters (met);
- // bManualSeparate = false;
- //} else {
- // AutoGimbal (tgt_rate);
- //}
- //break;
- case 2: // Orbiter+ET configuration
- // AutoGimbal (tgt_rate);
- // if (pET && (/*pET->GetMainPropellantMass () < 10.0 ||*/ bManualSeparate)) {
- // SeparateTank ();
- // bManualSeparate = false;
- // }
- break;
- case 3: // Orbiter
- //if (ascap->Active())
- AutoRCS(tgt_rate);
- //if (bManualSeparate && GetAttachmentStatus(sat_attach)) {
- // DetachChild(sat_attach, 0.1);
- // bManualSeparate = false;
- //}
- break;
- }
- // Execute payload bay operations
- plop->Step(simt, simdt);
- // ***** Animate landing gear *****
- if (geararmed == 1) {//ONLY OPERATE IF GEAR IS ARMED
- if (gear_status >= AnimState::CLOSING) {
- double da = simdt * GEAR_OPERATING_SPEED;
- // if (gear_status == AnimState::CLOSING) { // retract gear
- // if (gear_proc > 0.0) gear_proc = max(0.0, gear_proc - da);
- // else gear_status = AnimState::CLOSED;
- //}
- // else { // deploy gear
- if (gear_proc < 1.0) gear_proc = min(1.0, gear_proc + da);
- else gear_status = AnimState::OPEN;
- }
- SetAnimation(anim_gear, gear_proc);
- SetGearParameters(gear_proc);
- if (gear_status == AnimState::OPEN) {
- SetAnimation(anim_LEFTGEARDN, 1);
- SetAnimation(anim_LEFTGEARUP, 1);
- SetAnimation(anim_LEFTGEARTALKBACK, 1);
- SetAnimation(anim_RIGHTGEARDN, 1);
- SetAnimation(anim_RIGHTGEARUP, 1);
- SetAnimation(anim_RIGHTGEARTALKBACK, 1);
- }
- }
- //}
- // ***** Animate speedbrake *****
- if (spdb_auto == 1){
- spdb_proc = .65;
- AIRSPEEDKNOT = (GetAirspeed() *0.514444);
- if (AIRSPEEDKNOT > 300)
- spdb_proc = spdb_proc + .05;
- if (AIRSPEEDKNOT < 300)spdb_auto = 0;
- }
- if (spdb_auto == 0){
- //if (spdb_on == 1) spdb_proc = 1;
- //if (spdb_off == 1) spdb_proc = 0;
- if (spdb_plus == 1){
- spdb_proc = spdb_proc + .05;
- spdb_plus = 0;
- }
- if (spdb_minus == 1)
- {
- spdb_proc = spdb_proc - .05;
- spdb_minus = 0;
- }
- if (spdb_proc > 1)spdb_proc = 1;
- if (spdb_proc < 0)spdb_proc = 0;
- }
- if (spdb_status >= AnimState::CLOSING) {
- double da = simdt * SPEEDBRAKE_OPERATING_SPEED;
- if (spdb_status == AnimState::CLOSING) { // retract brake
- if (spdb_proc > 0.0) spdb_proc = max(0.0, spdb_proc - da);
- else spdb_status = AnimState::CLOSED;
- }
- else { // deploy antenna
- if (spdb_proc < 1.0) spdb_proc = min(1.0, spdb_proc + da);
- else spdb_status = AnimState::OPEN;
- }
- }
- SetAnimation(anim_spdb, spdb_proc);
- //}
- //lights
- // turn PLBD lights on/off
- //if (pMission->HasBulkheadFloodlights()) {
- // bool state = FwdBulkheadLightPower;
- // FwdBulkheadLight->Activate(true);
- // FwdBulkhead_bspec.active = true;
- // check docking light (which has DIM and BRIGHT positions)
- // if (DockingLightDim) {
- // DockingLight[0]->Activate(true);
- // Docking_bspec[0].active = true;
- // DockingLight[1]->Activate(false);
- // Docking_bspec[1].active = false;
- // }
- // else if (DockingLightBright)
- {
- // DockingLight[0]->Activate(true);
- // Docking_bspec[0].active = true;
- // DockingLight[1]->Activate(true);
- // Docking_bspec[1].active = true;
- }
- //else { // off
- // for (int i = 0; i < 2; i++) {
- // DockingLight[i]->Activate(false);
- // Docking_bspec[i].active = false;
- // }
- //}
- //}
- //else { // turn off FWD bulkhead & docking lights
- // FwdBulkheadLight->Activate(false);
- // FwdBulkhead_bspec.active = false;
- // for (int i = 0; i < 2; i++) {
- // DockingLight[i]->Activate(false);
- // Docking_bspec[i].active = false;
- // }
- //}
- //for (int i = 0; i < 6; i++) {
- //bool state = PLBLightPower[i].IsSet();
- //PLBLight[i]->Activate(true);
- //PLB_bspec[i].active = true;
- //}
- // ***** Stow RMS arm *****
- //
- if (center_arm) SeqSSRMS();
- CheckFlags();
- //sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr_stored %2.2f", arm6_Bp, arm1_By);
- //SetAnimation(anim_MPM, 1.0);
- //sprintf(oapiDebugString(), "arm_wr_stored %d arm_wr %d ", recallstored, rmsexecute);
- /*
- if ((rmsexecute == 1) && (recallstored == 1) && (Armtilt_proc == 1)){
- //sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f ", arm_wr_stored1, arm_wr);
- double t0 = oapiGetSimTime();
- double dt = t0 - center_arm_t; // time step
- double da = ARM_OPERATING_SPEED*dt; // total rotation angle
- if (da && (arm_wr != arm6_Ar)) { // wrist roll not the stored value
- if (da >= fabs(arm_wr - arm6_Ar)) //
- arm_wr = arm6_Ar, da -= fabs(arm_wr - arm6_Ar);
- else
- arm_wr -= (arm_wr > arm6_Ar ? da : -da), da = 0;
- // sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f arm_speed %2.2f ", arm_wr_stored1, arm_wr,ARM_OPERATING_SPEED);
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- if (da && (arm_wy != arm6_Ay)) { // zero wrist yaw
- if (da >= fabs(arm_wy - arm6_Ay)) // finished
- arm_wy = arm6_Ay, da -= fabs(arm_wy - arm6_Ay);
- else
- arm_wy -= (arm_wy > arm6_Ay ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- if (da && (arm_wp != arm6_Ap)) { // wrist pitch not stored value
- if (da >= fabs(arm_wp - arm6_Ap)) // finished
- arm_wp = arm6_Ap, da -= fabs(arm_wp - arm6_Ap);
- else
- arm_wp -= (arm_wp > arm6_Ap ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_sp != arm6_Bp)) { // zero wrist pitch
- if (da >= fabs(arm_sp - arm6_Bp)) // finished
- arm_sp = arm6_Bp, da -= fabs(arm_sp - arm6_Bp);
- else
- arm_sp -= (arm_sp > arm6_Bp ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- if (da && (arm_sy != arm6_By)) { // zero wrist yitch
- if (da >= fabs(arm_sy - arm6_By)) // finished
- arm_sy = arm6_By, da -= fabs(arm_sy - arm6_By);
- else
- arm_sy -= (arm_sy > arm6_By ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- center_arm_t = t0;
- if (da) {
- rmsexecute = 0;; // finished stowing
- HWND hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS);
- if (hDlg) EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), FALSE);
- }
- }
- //store=2
- if ((rmsexecute == 1) && (recallstored == 2) && (Armtilt_proc == 1)) {
- //sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f ", arm_wr_stored1, arm_wr);
- double t0 = oapiGetSimTime();
- double dt = t0 - center_arm_t; // time step
- double da = ARM_OPERATING_SPEED*dt; // total rotation angle
- if (da && (arm_wr != arm6_Ar)) { // wrist roll not the stored value
- if (da >= fabs(arm_wr - arm6_Ar)) //
- arm_wr = arm6_Ar, da -= fabs(arm_wr - arm6_Ar);
- else
- arm_wr -= (arm_wr > arm6_Ar ? da : -da), da = 0;
- // sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f arm_speed %2.2f ", arm_wr_stored1, arm_wr,ARM_OPERATING_SPEED);
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- if (da && (arm_wy != arm6_Ay)) { // zero wrist yaw
- if (da >= fabs(arm_wy - arm6_Ay)) // finished
- arm_wy = arm6_Ay, da -= fabs(arm_wy - arm6_Ay);
- else
- arm_wy -= (arm_wy > arm6_Ay ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- if (da && (arm_wp != arm6_Ap)) { // wrist pitch not stored value
- if (da >= fabs(arm_wp - arm6_Ap)) // finished
- arm_wp = arm6_Ap, da -= fabs(arm_wp - arm6_Ap);
- else
- arm_wp -= (arm_wp > arm6_Ap ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_sp != arm6_Bp)) { // zero wrist pitch
- if (da >= fabs(arm_sp - arm6_Bp)) // finished
- arm_sp = arm6_Bp, da -= fabs(arm_sp - arm6_Bp);
- else
- arm_sp -= (arm_sp > arm6_Bp ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- if (da && (arm_sy != arm6_By)) { // zero wrist yitch
- if (da >= fabs(arm_sy - arm6_By)) // finished
- arm_sy = arm6_By, da -= fabs(arm_sy - arm6_By);
- else
- arm_sy -= (arm_sy > arm6_By ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- center_arm_t = t0;
- if (da) {
- rmsexecute = 0;; // finished stowing
- HWND hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS);
- if (hDlg) EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), FALSE);
- }
- }
- //store 3
- if ((rmsexecute == 1) && (recallstored == 3) && (Armtilt_proc == 1)) {
- //sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f ", arm_wr_stored1, arm_wr);
- double t0 = oapiGetSimTime();
- double dt = t0 - center_arm_t; // time step
- double da = ARM_OPERATING_SPEED*dt; // total rotation angle
- if (da && (arm_wr != arm6_Ar)) { // wrist roll not the stored value
- if (da >= fabs(arm_wr - arm6_Ar)) //
- arm_wr = arm6_Ar, da -= fabs(arm_wr - arm6_Ar);
- else
- arm_wr -= (arm_wr > arm6_Ar ? da : -da), da = 0;
- // sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f arm_speed %2.2f ", arm_wr_stored1, arm_wr,ARM_OPERATING_SPEED);
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- if (da && (arm_wy != arm6_Ay)) { // zero wrist yaw
- if (da >= fabs(arm_wy - arm6_Ay)) // finished
- arm_wy = arm6_Ay, da -= fabs(arm_wy - arm6_Ay);
- else
- arm_wy -= (arm_wy > arm6_Ay ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- if (da && (arm_wp != arm6_Ap)) { // wrist pitch not stored value
- if (da >= fabs(arm_wp - arm6_Ap)) // finished
- arm_wp = arm6_Ap, da -= fabs(arm_wp - arm6_Ap);
- else
- arm_wp -= (arm_wp > arm6_Ap ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_sp != arm6_Bp)) { // zero wrist pitch
- if (da >= fabs(arm_sp - arm6_Bp)) // finished
- arm_sp = arm6_Bp, da -= fabs(arm_sp - arm6_Bp);
- else
- arm_sp -= (arm_sp > arm6_Bp ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- if (da && (arm_sy != arm6_By)) { // zero wrist yitch
- if (da >= fabs(arm_sy - arm6_By)) // finished
- arm_sy = arm6_By, da -= fabs(arm_sy - arm6_By);
- else
- arm_sy -= (arm_sy > arm6_By ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- center_arm_t = t0;
- if (da) {
- rmsexecute = 0;; // finished stowing
- HWND hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS);
- if (hDlg) EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), FALSE);
- }
- }
- //4
- if ((rmsexecute == 1) && (recallstored == 4) && (Armtilt_proc == 1)) {
- //sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f ", arm_wr_stored1, arm_wr);
- double t0 = oapiGetSimTime();
- double dt = t0 - center_arm_t; // time step
- double da = ARM_OPERATING_SPEED*dt; // total rotation angle
- if (da && (arm_wr != arm6_Ar)) { // wrist roll not the stored value
- if (da >= fabs(arm_wr - arm6_Ar)) //
- arm_wr = arm6_Ar, da -= fabs(arm_wr - arm6_Ar);
- else
- arm_wr -= (arm_wr > arm6_Ar ? da : -da), da = 0;
- // sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f arm_speed %2.2f ", arm_wr_stored1, arm_wr,ARM_OPERATING_SPEED);
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- if (da && (arm_wy != arm6_Ay)) { // zero wrist yaw
- if (da >= fabs(arm_wy - arm6_Ay)) // finished
- arm_wy = arm6_Ay, da -= fabs(arm_wy - arm6_Ay);
- else
- arm_wy -= (arm_wy > arm6_Ay ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- if (da && (arm_wp != arm6_Ap)) { // wrist pitch not stored value
- if (da >= fabs(arm_wp - arm6_Ap)) // finished
- arm_wp = arm6_Ap, da -= fabs(arm_wp - arm6_Ap);
- else
- arm_wp -= (arm_wp > arm6_Ap ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_sp != arm6_Bp)) { // zero wrist pitch
- if (da >= fabs(arm_sp - arm6_Bp)) // finished
- arm_sp = arm6_Bp, da -= fabs(arm_sp - arm6_Bp);
- else
- arm_sp -= (arm_sp > arm6_Bp ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- if (da && (arm_sy != arm6_By)) { // zero wrist yitch
- if (da >= fabs(arm_sy - arm6_By)) // finished
- arm_sy = arm6_By, da -= fabs(arm_sy - arm6_By);
- else
- arm_sy -= (arm_sy > arm6_By ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- center_arm_t = t0;
- if (da) {
- rmsexecute = 0;; // finished stowing
- HWND hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS);
- if (hDlg) EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), FALSE);
- }
- }
- if ((rmsexecute == 1) && (Armtilt_proc == 1) && (recallstored !=8)){
- //sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f ", arm_wr_stored1, arm_wr);
- double t0 = oapiGetSimTime();
- double dt = t0 - center_arm_t; // time step
- double da = ARM_OPERATING_SPEED*dt; // total rotation angle
- if (da && (arm_wr != arm6_Ar)) { // wrist roll not the stored value
- if (da >= fabs(arm_wr - arm6_Ar)) //
- arm_wr = arm6_Ar, da -= fabs(arm_wr - arm6_Ar);
- else
- arm_wr -= (arm_wr > arm6_Ar ? da : -da), da = 0;
- // sprintf(oapiDebugString(), "arm_wr_stored %2.2f arm_wr %2.2f arm_speed %2.2f ", arm_wr_stored1, arm_wr,ARM_OPERATING_SPEED);
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- if (da && (arm_wy != arm6_Ay)) { // zero wrist yaw
- if (da >= fabs(arm_wy - arm6_Ay)) // finished
- arm_wy = arm6_Ay, da -= fabs(arm_wy - arm6_Ay);
- else
- arm_wy -= (arm_wy > arm6_Ay ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- if (da && (arm_wp != arm6_Ap)) { // wrist pitch not stored value
- if (da >= fabs(arm_wp - arm6_Ap)) // finished
- arm_wp = arm6_Ap, da -= fabs(arm_wp - arm6_Ap);
- else
- arm_wp -= (arm_wp > arm6_Ap ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_ep != arm6_ep)) { // zero wrist pitch
- if (da >= fabs(arm_ep - arm6_ep)) // finished
- arm_ep = arm6_ep, da -= fabs(arm_ep - arm6_ep);
- else
- arm_ep -= (arm_ep > arm6_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da && (arm_sp != arm6_Bp)) { // zero wrist pitch
- if (da >= fabs(arm_sp - arm6_Bp)) // finished
- arm_sp = arm6_Bp, da -= fabs(arm_sp - arm6_Bp);
- else
- arm_sp -= (arm_sp > arm6_Bp ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- if (da && (arm_sy != arm6_By)) { // zero wrist yitch
- if (da >= fabs(arm_sy - arm6_By)) // finished
- arm_sy = arm6_By, da -= fabs(arm_sy - arm6_By);
- else
- arm_sy -= (arm_sy > arm6_By ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- center_arm_t = t0;
- if (da) {
- rmsexecute = 0;; // finished stowing
- HWND hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS);
- if (hDlg) EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), FALSE);
- }
- }
- if (rmsexecute == 1) {
- if (center_arm)
- {
- double t1 = oapiGetSimTime();
- double dt1 = t1 - center_arm_time; // time step
- double da1 = ARM_OPERATING_SPEED*dt1; // total rotation angle
- // work from the wrist down to the shoulder
- if (da1 && (arm_wr != 0.5))
- { // zero wrist roll
- if (da1 >= fabs(arm_wr - wrstart)) // finished
- arm_wr = wrstart, da1 -= fabs(arm_wr - wrstart);
- else
- arm_wr -= (arm_wr > wrstart ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- //sprintf(oapiDebugString(), "arm_wr %2.2f da1 %f dt1 %f t1 %f centert1 %f armspeeded %f", arm_wr, da1, dt1, t1, center_arm_time, ARM_OPERATING_SPEED);
- if (da1 && (arm_wy != wystart)) { // zero wrist yaw
- if (da1 >= fabs(arm_wy - wystart)) // finished
- arm_wy = wystart, da1 -= fabs(arm_wy - wystart);
- else
- arm_wy -= (arm_wy > wystart ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- sprintf(oapiDebugString(), "arm_wr %2.2f arm_wy %2.2f da1 %f dt1 %f t1 %f centert1 %f armspeeded %f", arm_wr, arm_wy, da1, dt1, t1, center_arm_time, ARM_OPERATING_SPEED);
- if (da1 && (arm_wp != wpstart)) { // zero wrist pitch
- if (da1 >= fabs(arm_wp - wpstart)) // finished
- arm_wp = wpstart, da1 -= fabs(arm_wp - wpstart);
- else
- arm_wp -= (arm_wp > wpstart ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- if (da1 && arm_ep) { // zero elbow pitch
- if (da1 >= arm_ep) // finished
- arm_ep = 0.0, da1 -= arm_ep;
- else
- arm_ep -= da1, da1 = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da1 && (arm_sy != 0.5)) { // zero shoulder yaw
- if (da1 >= fabs(arm_sy - 0.5)) // finished
- arm_sy = 0.5, da1 -= fabs(arm_sy - 0.5);
- else
- arm_sy -= (arm_sy > 0.5 ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- if (da1 && arm_sp) { // zero shoulder pitch
- if (da1 >= arm_sp) // finished
- arm_sp = 0.0, da1 -= arm_sp;
- else
- arm_sp -= da1, da1 = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- //sprintf(oapiDebugString(), "arm_sy %2.2f armM_sy %2.2f da1 %2.2f dt %2.2f", arm_sy, arm_sp, da1, dt);
- center_arm_time = t1;
- if (da1) {
- center_arm = false; // finished stowing
- rmsexecute = 0;
- HWND hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS);
- if (hDlg) EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), TRUE);
- }
- }
- }
- */
- if (center_arm) SeqSSRMS();
- // ***** Stow RMS arm *****
- if (rmsexecute == 1) {
- double t0 = oapiGetSimTime();
- double dt = t0 - center_arm_t; // time step
- double da1 = ARM_OPERATING_SPEED * dt; // total rotation angle
- // work from the wrist down to the shoulder
- if (da1 && (arm_wr != 0.5)) { // zero wrist roll
- if (da1 >= fabs(arm_wr - 0.5)) // finished
- arm_wr = 0.5, da1 -= fabs(arm_wr - 0.5);
- else
- arm_wr -= (arm_wr > 0.5 ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- //sprintf(oapiDebugString(), "arm_wr %2.2f da11 %f dt1 %f t1 %f centert1 %f armspeeded %f", arm_wr, da1, center_arm_t, ARM_OPERATING_SPEED);
- if (da1 && (arm_wy != 0.5)) { // zero wrist yaw
- if (da1 >= fabs(arm_wy - 0.5)) // finished
- arm_wy = 0.5, da1 -= fabs(arm_wy - 0.5);
- else
- arm_wy -= (arm_wy > 0.5 ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- if (da1 && (arm_wp != 0.5)) { // zero wrist pitch
- if (da1 >= fabs(arm_wp - 0.5)) // finished
- arm_wp = 0.5, da1 -= fabs(arm_wp - 0.5);
- else
- arm_wp -= (arm_wp > 0.5 ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- if (da1 && arm_ep) { // zero elbow pitch
- if (da1 >= arm_ep) // finished
- arm_ep = 0.0, da1 -= arm_ep;
- else
- arm_ep -= da1, da1 = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- if (da1 && (arm_sy != 0.5)) { // zero shoulder yaw
- if (da1 >= fabs(arm_sy - 0.5)) // finished
- arm_sy = 0.5, da1 -= fabs(arm_sy - 0.5);
- else
- arm_sy -= (arm_sy > 0.5 ? da1 : -da1), da1 = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- if (da1 && arm_sp) { // zero shoulder pitch
- if (da1 >= arm_sp) // finished
- arm_sp = 0.0, da1 -= arm_sp;
- else
- arm_sp -= da1, da1 = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- center_arm_t = t0;
- if (da1) {
- center_arm = false; // finished stowing
- rmsexecute = 0;
- HWND hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS);
- if (hDlg) EnableWindow(GetDlgItem(hDlg, IDC_GRAPPLE), TRUE);
- }
- }
- if (arm_moved) {
- SetAttachmentParams(rms_attach, arm_tip[0], arm_tip[1] - arm_tip[0], arm_tip[2] - arm_tip[0]);
- arm_moved = false;
- }
- if (arm_scheduled) {
- arm_scheduled = false;
- arm_moved = true;
- }
- xp0 = arm_tip[1] - arm_tip[0]; normalise(xp0);
- xr0 = arm_tip[2] - arm_tip[0]; normalise(xr0);
- SetAttachmentParams(rms_attach, arm_tip[0], xp0, xr0);
- if (arm_moved) {
- xp0 = arm_tip[1] - arm_tip[0]; normalise(xp0);
- xr0 = arm_tip[2] - arm_tip[0]; normalise(xr0);
- SetAttachmentParams(rms_attach, arm_tip[0], xp0, xr0);
- //if (arm_moved) {
- // SetAttachmentParams(rms_attach, arm_tip[0], arm_tip[1] - arm_tip[0], arm_tip[2] - arm_tip[0]);
- arm_moved = false;
- }
- if (arm_scheduled) {
- arm_scheduled = false;
- arm_moved = true;
- }
- //MOVE OBSS ATTACHMENT
- if (OBSS_proc > 0 && OBSS_proc < 1) {
- SetAttachmentParams(OBSS_attach, armobss_tip[0], armobss_tip[1] - armobss_tip[0], armobss_tip[2] - armobss_tip[0]);
- //
- }
- if (flood1_status == 1)
- {
- spotlight5->Activate(true);
- spot_beacon[4].active = true;
- }
- if (flood2_status == 1)
- {
- spotlight6->Activate(true);
- spot_beacon[5].active = true;
- }
- if (flood1_status == 0)
- {
- spotlight5->Activate(false);
- spot_beacon[4].active = false;
- }
- if (flood2_status == 0)
- {
- spotlight6->Activate(false);
- spot_beacon[5].active = false;
- }
- if (flood3_status == 1)
- {
- spotlight3->Activate(true);
- spot_beacon[2].active = true;
- }
- if (flood4_status == 1)
- {
- spotlight4->Activate(true);
- spot_beacon[3].active = true;
- }
- if (flood3_status == 0)
- {
- spotlight3->Activate(false);
- spot_beacon[2].active = false;
- }
- if (flood4_status == 0)
- {
- spotlight4->Activate(false);
- spot_beacon[3].active = false;
- }
- //
- if (flood5_status == 1)
- {
- spotlight1->Activate(true);
- spot_beacon[0].active = true;
- }
- if (flood6_status == 1)
- {
- spotlight2->Activate(true);
- spot_beacon[1].active = true;
- }
- if (flood5_status == 0)
- {
- spotlight1->Activate(false);
- spot_beacon[0].active = false;
- }
- if (flood6_status == 0)
- {
- spotlight2->Activate(false);
- spot_beacon[1].active = false;
- }
- if (docklight_status == 0)
- {
- spotlightDOCK->Activate(false);
- spot_beacon[7].active = false;
- }
- if (docklight_status == 1)
- {
- spotlightDOCK->Activate(true);
- spot_beacon[7].active = true;
- }
- if (docklightdim_status == 0)
- {
- //double intensity = 0.0(no light) to 1.0(full light)
- spotlightDOCK->SetIntensity(1.0);
- }
- if (docklightdim_status == 1)
- {
- //double intensity = 0.0(no light) to 1.0(full light)
- spotlightDOCK->SetIntensity(.5);
- }
- if (docklightbright_status == 0)
- {
- //double intensity = 0.0(no light) to 1.0(full light)
- spotlightDOCK->SetIntensity(.5);
- }
- if (docklightbright_status == 1)
- {
- //double intensity = 0.0(no light) to 1.0(full light)
- spotlightDOCK->SetIntensity(1.0);
- }
- if (aft_light_status == 1)
- {
- spotlight7->Activate(true);
- spot_beacon[6].active = true;
- }
- else if (aft_light_status == 0)
- {
- spotlight7->Activate(false);
- spot_beacon[6].active = false;
- }
- if (rmslight_status == 1)
- {
- spotlightRMS->Activate(true);
- spot_beacon[8].active = true;
- }
- else if (rmslight_status == 0)
- {
- spotlightRMS->Activate(false);
- spot_beacon[8].active = false;
- }
- if (ODS == 0){ //ODS is not present
- if (EXT_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (EXT_status == HATCH_RAISING) {
- if (EXT_proc > 0.0) EXT_proc = max(0.0, EXT_proc - da);
- else EXT_status = HATCH_UP;
- }
- else {
- if (EXT_proc < 1.0) EXT_proc = min(1.0, EXT_proc + da);
- else EXT_status = HATCH_DOWN;
- }
- SetAnimation(anim_extdoor, EXT_proc);
- }
- }
- if (ODS == 1){//ODS is present
- if (EXT_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (EXT_status == HATCH_RAISING) {
- if (EXT_proc > 0.0) EXT_proc = max(0.0, EXT_proc - da);
- else EXT_status = HATCH_UP;
- }
- else {
- if (EXT_proc < 1.0) EXT_proc = min(1.0, EXT_proc + da);
- else EXT_status = HATCH_DOWN;
- }
- SetAnimation(anim_extodsdoor, EXT_proc);
- }
- }
- if (ODS == 1){//ODS is present
- //SetDockParams(dockpos, _V(0, 1, 0), _V(0, 0, -1));
- if (DOCKRING_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (DOCKRING_status == HATCH_RAISING) {
- if (DOCKRING_proc > 0.0) DOCKRING_proc = max(0.0, DOCKRING_proc - da);
- else DOCKRING_status = HATCH_UP;
- }
- else {
- if (DOCKRING_proc < 1.0) DOCKRING_proc = min(1.0, DOCKRING_proc + da);
- else DOCKRING_status = HATCH_DOWN;
- }
- SetAnimation(anim_DOCKRING, DOCKRING_proc);
- }
- }
- if (EXTAIRLOCK == 1){//ODS is present
- if (EXT_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (EXT_status == HATCH_RAISING) {
- if (EXT_proc > 0.0) EXT_proc = max(0.0, EXT_proc - da);
- else EXT_status = HATCH_UP;
- }
- else {
- if (EXT_proc < 1.0) EXT_proc = min(1.0, EXT_proc + da);
- else EXT_status = HATCH_DOWN;
- }
- SetAnimation(anim_EXTAIRLOCK, EXT_proc);
- }
- }
- mfd1pwr = (oapiGetMFDMode(MFD_RIGHT));
- mfd0pwr = (oapiGetMFDMode(MFD_LEFT));
- mfd2pwr = (oapiGetMFDMode(MFD_USER1));
- mfdApwr = (oapiGetMFDMode(MFD_USER2));
- //sprintf(oapiDebugString(), "%d ", mfd1pwr);
- if (mfd1pwr >0) SetAnimation(anim_mfd2, 1);//right
- if (mfd1pwr == 0) SetAnimation(anim_mfd2, 0);//right
- if (mfd0pwr > 0) SetAnimation(anim_mfd1, 1);
- if (mfd0pwr == 0) SetAnimation(anim_mfd1, 0);
- if (mfd2pwr > 0) SetAnimation(anim_mfd0, 1);
- if (mfd2pwr == 0) SetAnimation(anim_mfd0, 0);
- if (mfdApwr > 0) SetAnimation(anim_mfdAFT, 0);
- if (mfdApwr == 0) SetAnimation(anim_mfdAFT, 1);
- if (DRAGCHUTE == 0){ //drag chute is presented and not deployed initial set at Chute_proc =1.0
- if (CHUTE_status >= HATCH_RAISING) {
- double da = simdt * .8;
- if (CHUTE_status == HATCH_RAISING) {
- if (CHUTE_proc > 0.0) CHUTE_proc = max(0.0, CHUTE_proc - da);
- else CHUTE_status = HATCH_UP;
- }
- if (CHUTE_status == HATCH_UP) DRAGCHUTEDEPLOYED = 1;
- SetAnimation(anim_CHUTE, CHUTE_proc);
- SetAnimation(anim_dragdeploy, 1);
- }
- if ((DRAGCHUTE == 0) && (CHUTE_proc < 0.2)) {//drag chute present and started to open
- CreateVariableDragElement(&CHUTE_proc, 22.5, _V(0, 4.5, -12.03));
- }
- //obss tilt
- if (OBSS_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (OBSS_status == HATCH_RAISING) {
- if (OBSS_proc > 0.0) OBSS_proc = max(0.0, OBSS_proc - da);
- else OBSS_status = HATCH_UP;
- }
- else {
- if (OBSS_proc < 1.0) OBSS_proc = min(1.0, OBSS_proc + da);
- else OBSS_status = HATCH_DOWN;
- }
- SetAnimation(anim_MPMOBSS, OBSS_proc);
- }
- }
- if (ssmestow_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (ssmestow_status == HATCH_RAISING) {
- if (ssmestow_proc > 0.0) ssmestow_proc = max(0.0, ssmestow_proc - da);
- else ssmestow_status = HATCH_UP;
- }
- else {
- if (ssmestow_proc < 1.0) ssmestow_proc = min(1.0, ssmestow_proc + da);
- else ssmestow_status = HATCH_DOWN;
- }
- SetAnimation(anim_ssmestow, ssmestow_proc);
- }
- //ADTA
- if (ADTA_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (ADTA_status == HATCH_RAISING) {
- if (ADTA_proc > 0.0) ADTA_proc = max(0.0, ADTA_proc - da);
- else ADTA_status = HATCH_UP;
- }
- else {
- if (ADTA_proc < 1.0) ADTA_proc = min(1.0, ADTA_proc + da);
- else ADTA_status = HATCH_DOWN;
- }
- SetAnimation(anim_ADTA, ADTA_proc);
- }
- //ExternalTankHatch tilt
- if (PETD_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (PETD_status == HATCH_RAISING) {
- if (PETD_proc > 0.0) PETD_proc = max(0.0, PETD_proc - da);
- else PETD_status = HATCH_UP;
- }
- else {
- if (PETD_proc < 1.0) PETD_proc = min(1.0, PETD_proc + da);
- else PETD_status = HATCH_DOWN;
- }
- SetAnimation(anim_PETD, PETD_proc);
- }
- //ExternalTankHatch tilt
- if (SETD_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (SETD_status == HATCH_RAISING) {
- if (SETD_proc > 0.0) SETD_proc = max(0.0, SETD_proc - da);
- else SETD_status = HATCH_UP;
- }
- else {
- if (SETD_proc < 1.0) SETD_proc = min(1.0, SETD_proc + da);
- else SETD_status = HATCH_DOWN;
- }
- SetAnimation(anim_SETD, SETD_proc);
- }
- if (plop->BayDoorStatus.pos >= 1.0){
- if (Armtilt_status >= HATCH_RAISING) {
- double da = simdt * .1;
- if (Armtilt_status == HATCH_RAISING) {
- if (Armtilt_proc > 0.0) Armtilt_proc = max(0.0, Armtilt_proc - da);
- else Armtilt_status = HATCH_UP;
- }
- else {
- if (Armtilt_proc < 1.0) Armtilt_proc = min(1.0, Armtilt_proc + da);
- else Armtilt_status = HATCH_DOWN;
- }
- SetAnimation(anim_MPM, Armtilt_proc);
- }
- }
- double airspeed = GetAirspeed();
- double groundspeed = GetGroundspeed();
- if (DRAGCHUTE == 0) {
- SetMeshVisibilityMode(mesh_DRAGCHUITEHUD, MESHVIS_VC);
- }
- if ((DRAGCHUTE == 0)&&(airspeed <= CHUTE_DEPLOY_SPEED) && (airspeed > CHUTE_JETTISON_SPEED) && GroundContact() && (DRAGCHUTEDEPLOYED == 0)) {
- SetMeshVisibilityMode(mesh_DRAGCHUTE, MESHVIS_ALWAYS);
- SetAnimation(anim_chutejett, 1);
- RevertDragchute();
- }
- // sprintf_s(oapiDebugString(), 255, "ft_pad_att1: %f %f %f, pl10_ofs.x,pl10_ofs.y,pl10_ofs.z");
- GetAttachmentParams(ft_pad_att, ft_pad_att_pos, (ft_pad_att_dir), ft_pad_att_rot);
- GetAttachmentParams(ft_pad_att1, ft_pad_att1_pos, (ft_pad_att1_dir), ft_pad_att1_rot);
- GetAttachmentParams(ft_pad_att2, ft_pad_att2_pos, (ft_pad_att2_dir), ft_pad_att2_rot);
- GetAttachmentParams(ft_pad_att3, ft_pad_att3_pos, (ft_pad_att3_dir), ft_pad_att3_rot);
- //sprintf(oapiDebugString(), "ft_pad_att_posx %2.2f ft_pad_att_posy %2.2f ft_pad_att_posz %2.2f eva1 %d", ft_pad_att_pos.x, ft_pad_att_pos.y, ft_pad_att_pos.z,EVA1);
- if (geararmed == 1)
- {
- SetAnimation(anim_LEFTGEARARMON, 1);
- SetAnimation(anim_LEFTGEARARMOFF, 1);
- SetAnimation(anim_RIGHTGEARARMON, 1);
- SetAnimation(anim_RIGHTGEARARMOFF, 1);
- }
- if (GetAttachmentStatus(ft_pad_att) == NULL) SetAttachmentParams(ft_pad_att, ft_pad_att_pos, ft_pad_att_dir, ft_pad_att_rot); // not attached so save the parameters
- if (GetAttachmentStatus(ft_pad_att1) == NULL) SetAttachmentParams(ft_pad_att1, ft_pad_att1_pos, ft_pad_att1_dir, ft_pad_att1_rot); // not attached so save the parameters
- if (GetAttachmentStatus(ft_pad_att2) == NULL) SetAttachmentParams(ft_pad_att2, ft_pad_att2_pos, ft_pad_att2_dir, ft_pad_att2_rot); // not attached so save the parameters
- if (GetAttachmentStatus(ft_pad_att3) == NULL) SetAttachmentParams(ft_pad_att3, ft_pad_att3_pos, ft_pad_att3_dir, ft_pad_att3_rot); // not attached so save the parameters
- if ((airspeed < CHUTE_JETTISON_SPEED) && (DRAGCHUTE == 0) && (DRAGCHUTEDEPLOYED == 1)) SetMeshVisibilityMode(mesh_DRAGCHUTE, MESHVIS_NEVER);;
- if (CAM == 3)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 5)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 9)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 2)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 4)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 1)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 6)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 7)SetMeshVisibilityMode(mesh_vc, MESHVIS_NEVER);
- if (CAM == 2)SetMeshVisibilityMode(mesh_cockpit, MESHVIS_VC | MESHVIS_EXTPASS | MESHVIS_EXTERNAL);
- if (CAM == 3)SetMeshVisibilityMode(mesh_cockpit, MESHVIS_VC | MESHVIS_EXTPASS | MESHVIS_EXTERNAL);
- if (CAM == 6)SetMeshVisibilityMode(mesh_cockpit, MESHVIS_VC | MESHVIS_EXTPASS | MESHVIS_EXTERNAL);
- if (CAM == 7)SetMeshVisibilityMode(mesh_cockpit, MESHVIS_VC | MESHVIS_EXTPASS | MESHVIS_EXTERNAL);
- if ((CAM == 1) || (CAM == 4) || (CAM == 5) || (CAM == 8) || (CAM == 0))SetMeshVisibilityMode(mesh_cockpit, MESHVIS_EXTERNAL);
- if (CAM == 0)SetMeshVisibilityMode(mesh_vc, MESHVIS_VC);
- if (CAM == 6){//elbow view
- VECTOR3 dir = camRMSElbowLoc[1] - camRMSElbowLoc[0];
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- VECTOR3 orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- double angle = SignedAngle(orbiter_cam_rot, camRMSElbowLoc[2] - camRMSElbowLoc[0], dir);
- SetCameraDefaultDirection(dir, angle);
- SetCameraOffset(camRMSElbowLoc[0]);
- oapiCameraSetCockpitDir(0.0, 0.0);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f cam dir: %f %f %f dir: %f %f %f Angle: %f %f length: %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, camRMSElbowLoc[1].x - camRMSElbowLoc[0].x, camRMSElbowLoc[2].y - camRMSElbowLoc[0].y, camRMSElbowLoc[2].z - camRMSElbowLoc[0].z, dir.x, dir.y, dir.z, angle, angle*DEG, length(dir));
- }
- if (CAM == 7){ //ee view
- // calculate rotation angle for EE cam
- VECTOR3 dir = arm_tip[1] - arm_tip[0];
- // if camera is pointing straight up or down, make it slightly offset from (0,1,0) vector
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- VECTOR3 orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- double angle = SignedAngle(orbiter_cam_rot, arm_tip[2] - arm_tip[0], dir);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f dir: %f %f %f dot_prod: %f Angle: %f %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, dir.x, dir.y, dir.z, dot_prod, angle, angle*DEG);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f cam dir: %f %f %f dir: %f %f %f Angle: %f %f length: %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, arm_tip[2].x - arm_tip[0].x, arm_tip[2].y - arm_tip[0].y, arm_tip[2].z - arm_tip[0].z, dir.x, dir.y, dir.z, angle, angle*DEG, length(dir));
- //sprintf_s(oapiDebugString(), 255, "dot_prod: %f Angle: %f %f", dot_prod, angle, angle*DEG);
- SetCameraOffset(arm_tip[3]);
- //STS()->SetCameraDefaultDirection (arm_tip[1]-arm_tip[0], 0.0);
- SetCameraDefaultDirection(dir, angle);
- oapiCameraSetCockpitDir(0.0, 0.0);
- }
- if (CAM == 8) {
- SetCameraDefaultDirection(_V(0, 1, 0));
- SetCameraOffset(DOCKCAM);
- // sprintf(oapiDebugString(), "armtip3x %2.2f armtip3y %2.2f armtip3z %2.2f", arm_tip[5].x, arm_tip[5].y, arm_tip[5].z);
- oapiCameraSetCockpitDir(0, 0);
- }
- if (USEIUS == 1){
- double da = simdt * .01;
- if (tilt == 1)tiltvalue = .4915; //first step
- if (tilt == 3)tiltvalue = 1.0; //2nd step
- if (tilt == 1) ius_proc = (ius_proc + da);//move up
- if (tilt == 2) ius_proc = (ius_proc - da);//move down
- if (tilt == 4) ius_proc = (ius_proc + da);//move up
- if ((tilt == 1) && (ius_proc > tiltvalue))tilt = 3; //reaches limit so 1st stop
- if ((tilt == 4) && (ius_proc > tiltvalue))tilt = 5; //reaches limit so 2nd stop
- if ((tilt == 2) && (ius_proc < 0))tilt = 0; //reaches limit so stop
- if (ius_proc < 0)ius_proc = 0;
- if (ius_proc >1.0)ius_proc = 1.0;
- SetAnimation(anim_ius, ius_proc);
- if (ius_proc == 0)tilt = 0;
- xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
- xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
- DIR = _V(0, sin(ius_proc), cos(ius_proc));
- SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
- SetAttachmentParams(sat_attach, pl1_ofs, DIR, pl1_rot);//ius
- //sets new attachment rotation values for saving
- pl1_dir.x = DIR.x;
- pl4_dir.x = DIR.x;
- pl1_dir.y = DIR.y;
- pl4_dir.y = DIR.y;
- pl1_dir.z = DIR.z;
- pl4_dir.z = DIR.z;
- /*
- //tilt of ase/IUS
- //sprintf(oapiDebugString(), " tipx %f tipy %f tipz %f tipz %d tipVALUE %f", arm1_tip[1].x, arm1_tip[1].y, arm1_tip[1].z,tilt,tiltvalue);
- if (tilt == 1)tiltvalue = .5; //first step
- if (tilt == 3)tiltvalue = 1.0; //2nd step
- //phi = phi + .001;//move up second step
- if (tilt == 1) phi = (phi + .00039);//move up
- if (tilt == 2) phi = (phi - .00039);//move down
- if (tilt == 4) phi = (phi + .00039);//move up
- if ((tilt == 1) && (phi > tiltvalue))tilt = 3; //reaches limit so 1st stop
- if ((tilt == 4) && (phi > tiltvalue))tilt = 5; //reaches limit so 2nd stop
- if ((tilt == 2) && (phi < 0))tilt = 0; //reaches limit so stop
- if (phi < 0)phi = 0;
- if (phi >1.0)phi = 1.0;
- xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
- xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
- //if ((tilt == 1) || (tilt == 2) || (tilt == 4))phi = ANGULAR_VEL *simt; //move ase attachment and ius
- DIR = _V(0, sin(phi), cos(phi));
- SetAttachmentParams(sat_attach4, pl4_ofs, DIR, pl4_rot);//ase
- SetAttachmentParams(sat_attach, pl1_ofs, DIR, pl1_rot);//ius
- //sets new attachment rotation values for saving
- pl1_dir.x = DIR.x;
- pl4_dir.x = DIR.x;
- pl1_dir.y = DIR.y;
- pl4_dir.y = DIR.y;
- pl1_dir.z = DIR.z;
- pl4_dir.z = DIR.z;
- */
- }
- if (SPIN1 == 1){//spintable#1
- if ((spintable == 1) || (spintable == 3) || (spintable == 4)){
- SPINACC = 5 * 360 / 60;
- spintable_vel = spintable_vel + SPINACC*simdt;
- spintable_phi = spintable_phi + spintable_vel*simdt;
- int multiplier = ((int)spintable_phi) / 360;
- if (spintable_vel > (50 * 360 / 60))(spintable_vel = (50 * 360 / 60)); //limit spped
- if (spintable_vel == (50 * 360 / 60)) spintable = 3;//speed achieved
- spintable_phi = spintable_phi - (double)multiplier * 360;
- MATRIX3 spintable_rotmat = rotm(_V(0, 1, 0), spintable_phi*RAD);
- SetAttachmentParams(sat_attach, pl1_ofs, _V(spintable_rotmat.m21, spintable_rotmat.m22, spintable_rotmat.m23), _V(spintable_rotmat.m31, spintable_rotmat.m32, spintable_rotmat.m33));
- ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
- OBJHANDLE hChild = GetAttachmentStatus(ah);
- if (oapiIsVessel(hChild)) { // something is attached!
- VESSEL *v = oapiGetVesselInterface(hChild);
- // sprintf(oapiDebugString(), "%s is attached",
- // v->GetName());
- }
- }
- if (spintable == 4){ // satellite release so slow spintable to 0
- spintable_vel = spintable_vel - SPINACC*simdt;
- if (spintable_vel < 0)spintable_vel = 0;
- }
- }
- if (SPIN2 == 1){//spintable#2
- if ((spintable1 == 1) || (spintable1 == 3) || (spintable1 == 4)){
- SPINACC1 = 5 * 360 / 60;
- spintable1_vel = spintable1_vel + SPINACC1*simdt;
- spintable1_phi = spintable1_phi + spintable1_vel*simdt;
- int multiplier1 = ((int)spintable1_phi) / 360;
- if (spintable1_vel > (50 * 360 / 60))(spintable1_vel = (50 * 360 / 60)); //limit spped
- if (spintable1_vel == (50 * 360 / 60)) spintable1 = 3;//speed achieved
- spintable1_phi = spintable1_phi - (double)multiplier1 * 360;
- MATRIX3 spintable1_rotmat = rotm(_V(0, 1, 0), spintable1_phi*RAD);
- SetAttachmentParams(sat_attach2, pl2_ofs, _V(spintable1_rotmat.m21, spintable1_rotmat.m22, spintable1_rotmat.m23), _V(spintable1_rotmat.m31, spintable1_rotmat.m32, spintable1_rotmat.m33));
- ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
- OBJHANDLE hChild = GetAttachmentStatus(ah);
- if (oapiIsVessel(hChild)) { // something is attached!
- VESSEL *v = oapiGetVesselInterface(hChild);
- // sprintf(oapiDebugString(), "%s is attached",
- // v->GetName());
- }
- }
- }
- if (SPIN4 == 1){//spintable#2
- if ((spintable4 == 1) || (spintable4 == 3) || (spintable4 == 4)){
- SPINACC4 = 5 * 360 / 60;
- spintable4_vel = spintable4_vel + SPINACC4*simdt;
- spintable4_phi = spintable4_phi + spintable4_vel*simdt;
- int multiplier4 = ((int)spintable4_phi) / 360;
- if (spintable4_vel > (50 * 360 / 60))(spintable4_vel = (50 * 360 / 60)); //limit spped
- if (spintable4_vel == (50 * 360 / 60)) spintable4 = 3;//speed achieved
- spintable4_phi = spintable4_phi - (double)multiplier4 * 360;
- MATRIX3 spintable4_rotmat = rotm(_V(0, 1, 0), spintable4_phi*RAD);
- SetAttachmentParams(sat_attach3, pl3_ofs, _V(spintable4_rotmat.m21, spintable4_rotmat.m22, spintable4_rotmat.m23), _V(spintable4_rotmat.m31, spintable4_rotmat.m32, spintable4_rotmat.m33));
- ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
- OBJHANDLE hChild = GetAttachmentStatus(ah);
- if (oapiIsVessel(hChild)) { // something is attached!
- VESSEL *v = oapiGetVesselInterface(hChild);
- // sprintf(oapiDebugString(), "%s is attached",
- // v->GetName());
- }
- }
- if (spintable4 == 4){ // satellite release so slow spintable to 0
- spintable4_vel = spintable4_vel - SPINACC4*simdt;
- if (spintable4_vel < 0)spintable4_vel = 0;
- }
- }
- //mfd1pwr = (oapiGetMFDMode(MFD_RIGHT));
- // if (mfd1pwr==1) SetAnimation(anim_mfd1, 1);
- // if (mfd1pwr == 0) SetAnimation(anim_mfd1, 0);
- if (SPIN5 == 1){//spintable#2
- if ((spintable5 == 1) || (spintable5 == 3) || (spintable5 == 4)){
- SPINACC5 = 5 * 360 / 60;
- spintable5_vel = spintable5_vel + SPINACC5*simdt;
- spintable5_phi = spintable5_phi + spintable5_vel*simdt;
- int multiplier5 = ((int)spintable5_phi) / 360;
- if (spintable5_vel > (50 * 360 / 60))(spintable5_vel = (50 * 360 / 60)); //limit spped
- if (spintable5_vel == (50 * 360 / 60)) spintable5 = 3;//speed achieved
- spintable5_phi = spintable5_phi - (double)multiplier5 * 360;
- MATRIX3 spintable5_rotmat = rotm(_V(0, 1, 0), spintable5_phi*RAD);
- SetAttachmentParams(sat_attach4, pl4_ofs, _V(spintable5_rotmat.m21, spintable5_rotmat.m22, spintable5_rotmat.m23), _V(spintable5_rotmat.m31, spintable5_rotmat.m32, spintable5_rotmat.m33));
- ATTACHMENTHANDLE ah = GetAttachmentHandle(false, 0);
- OBJHANDLE hChild = GetAttachmentStatus(ah);
- if (oapiIsVessel(hChild)) { // something is attached!
- VESSEL *v = oapiGetVesselInterface(hChild);
- // sprintf(oapiDebugString(), "%s is attached",
- // v->GetName());
- }
- }
- if (spintable5 == 4){ // satellite release so slow spintable to 0
- spintable5_vel = spintable5_vel - SPINACC5*simdt;
- if (spintable5_vel < 0)spintable5_vel = 0;
- }
- }
- //CAM MOVEMENT
- for (int i = 0; i < 4; i++) {
- if (bPLBCamPanLeft_Man) {
- camYaw[PBCAMERA] = max(-MAX_PLB_CAM_PAN, camYaw[PBCAMERA] - CAMRATE*simdt);
- cameraMoved = true;
- bPLBCamPanLeft_Man = false;
- }
- else if (bPLBCamPanRight_Man) {
- camYaw[PBCAMERA] = min(MAX_PLB_CAM_PAN, camYaw[PBCAMERA] + CAMRATE*simdt);
- cameraMoved = true;
- bPLBCamPanRight_Man = false;
- }
- if (bPLBCamTiltDown_Man) {
- camPitch[PBCAMERA] = max(-MAX_PLB_CAM_TILT, camPitch[PBCAMERA] - CAMRATE*simdt);
- cameraMoved = true;
- bPLBCamTiltDown_Man = false;
- }
- else if (bPLBCamTiltUp_Man) {
- camPitch[PBCAMERA] = min(MAX_PLB_CAM_TILT, camPitch[PBCAMERA] + CAMRATE*simdt);
- cameraMoved = true;
- bPLBCamTiltUp_Man = false;
- }
- //
- if (bPLBCamTiltDown_Man) {
- camPitch[PBCAMERA] = max(-MAX_PLB_CAM_TILT, camPitch[PBCAMERA] - CAMRATE*simdt);
- cameraMoved = true;
- bPLBCamTiltDown_Man = false;
- }
- else if (bPLBCamTiltUp_Man) {
- camPitch[PBCAMERA] = min(MAX_PLB_CAM_TILT, camPitch[PBCAMERA] + CAMRATE*simdt);
- cameraMoved = true;
- bPLBCamTiltUp_Man = false;
- }
- }
- if (ElbowCamPanLeft) {
- camRMSElbow[PAN] = max(camRMSElbow[PAN] - CAMRATE*simdt, -MAX_PLB_CAM_PAN);
- camera_moved = true;
- ElbowCamPanLeft = false;
- }
- else if (ElbowCamPanRight) {
- camRMSElbow[PAN] = min(camRMSElbow[PAN] + CAMRATE*simdt, MAX_PLB_CAM_PAN);
- camera_moved = true;
- ElbowCamPanRight = false;
- }
- if (ElbowCamTiltDown) {
- camRMSElbow[TILT] = max(camRMSElbow[TILT] - CAMRATE*simdt, -MAX_PLB_CAM_TILT);
- camera_moved = true;
- ElbowCamTiltDown = false;
- }
- else if (ElbowCamTiltUp) {
- camRMSElbow[TILT] = min(camRMSElbow[TILT] + CAMRATE*simdt, MAX_PLB_CAM_TILT);
- camera_moved = true;
- ElbowCamTiltUp = false;
- }
- if (cameraMoved) {
- SetAnimationCameras();
- cameraMoved = false;
- }
- if (cameraMFD[0] || cameraMFD[1] || cameraMFD[2])
- {
- VECTOR3 dir = camRMSElbowLoc[1] - camRMSElbowLoc[0];
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- VECTOR3 orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- double angle = -SignedAngle(orbiter_cam_rot, camRMSElbowLoc[2] - camRMSElbowLoc[0], dir);
- cameraData[6].pos = camRMSElbowLoc[0];
- cameraData[6].pitchAngle = -(atan2(sqrt(dir.z * dir.z + dir.x * dir.x), dir.y) - PI05) * DEG;
- cameraData[6].yawAngle = (atan2(dir.z, dir.x) - PI05) * DEG;
- cameraData[6].rotAngle = angle * DEG;
- dir = arm_tip[1] - arm_tip[0];
- // if camera is pointing straight up or down, make it slightly offset from (0,1,0) vector
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- angle = -SignedAngle(orbiter_cam_rot, arm_tip[2] - arm_tip[0], dir);
- cameraData[7].pos = arm_tip[3];
- cameraData[7].pitchAngle = -(atan2(sqrt(dir.z * dir.z + dir.x * dir.x), dir.y) - PI05) * DEG;
- cameraData[7].yawAngle = (atan2(dir.z, dir.x) - PI05) * DEG;
- cameraData[7].rotAngle = angle * DEG;
- if (cameraMFD[0])
- {
- cameraMFD[0]->SetCameraData(6, cameraData[6]);
- cameraMFD[0]->SetCameraData(7, cameraData[7]);
- }
- if (cameraMFD[1])
- {
- cameraMFD[1]->SetCameraData(6, cameraData[6]);
- cameraMFD[1]->SetCameraData(7, cameraData[7]);
- }
- if (cameraMFD[2])
- {
- cameraMFD[2]->SetCameraData(6, cameraData[6]);
- cameraMFD[2]->SetCameraData(7, cameraData[7]);
- }
- }
- //sprintf(oapiDebugString(), "MASS0 %5.3f MASS1 %5.3f MASS2 %5.3f MASS3 %5.3f pmassa %d pmassb %d pmassc %d pmassd %d", MASS0, MASS1, MASS2, MASS3, PMASS0, PMASS1, PMASS2, PMASS3);
- //met
- MET += simdt;
- //getgmt
- double fMJD = oapiGetSimMJD();
- //SiameseCat edit: calculate GMT; leap year calculation accurate from 1970 to 2097 (I think)
- //41317 = 1.1.1972
- double fSimGMT = (fmod(fMJD - 41317, 365)) * 86400.0; //MJD 40952 == Jan. 1, 1970, 00:00:00
- int Days = (int)(fMJD - 41317.0);
- int leap_days = Days / 1460 + 1;
- fSimGMT -= leap_days * 86400.0; //compensate for leap years
- //sprintf(oapiDebugString(), "MET M: %d T: %d G: %d GMT: %0.4f ", METmode, Testmode, GMTmode, fSimGMT);
- //met
- timenew = floor(MET);
- days = timenew / (24 * 3600);
- timenew = timenew % (24 * 3600);
- hours = timenew / 3600;
- timenew %= 3600;
- minutes = timenew / 60;
- timenew %= 60;
- seconds = timenew;
- //gmt
- fSimGMT = fSimGMT + simdt;
- sGMTMillis = (short)fmod(fSimGMT * 1000.0, 1000.0);
- lTime = (long)fSimGMT;
- sGMTSeconds = lTime % 60;
- lTime /= 60;
- sGMTMinutes = lTime % 60;
- lTime /= 60;
- sGMTHours = lTime % 24;
- lTime /= 24;
- sGMTDays = lTime % 400 + 1;
- if (METmode == 1)
- {
- // timenew = floor(MET);
- // days = timenew / (24 * 3600);
- // timenew = timenew % (24 * 3600);
- // hours = timenew / 3600;
- // timenew %= 3600;
- // minutes = timenew / 60;
- // timenew %= 60;
- // seconds = timenew;
- AFTtimer_state[8] = days / 100;//days1
- AFTtimer_state[7] = (days / 10) % 10;//days2
- AFTtimer_state[6] = days % 10;//days3
- AFTtimer_state[5] = hours / 10;
- AFTtimer_state[4] = hours % 10;
- AFTtimer_state[3] = minutes / 10;
- AFTtimer_state[2] = minutes % 10;
- AFTtimer_state[1] = seconds / 10;
- AFTtimer_state[0] = seconds % 10;
- }
- else if (Testmode == 1)
- {
- AFTtimer_state[8] = 8;//days1
- AFTtimer_state[7] = 8;//days2
- AFTtimer_state[6] = 8;//days3
- AFTtimer_state[5] = 8;
- AFTtimer_state[4] = 8;
- AFTtimer_state[3] = 8;
- AFTtimer_state[2] = 8;
- AFTtimer_state[1] = 8;
- AFTtimer_state[0] = 8;
- }
- else if (GMTmode == 1)
- {
- //fSimGMT = fSimGMT + simdt;
- // sGMTMillis = (short)fmod(fSimGMT * 1000.0, 1000.0);
- // lTime = (long)fSimGMT;
- // sGMTSeconds = lTime % 60;
- // lTime /= 60;
- // sGMTMinutes = lTime % 60;
- // lTime /= 60;
- // sGMTHours = lTime % 24;
- // lTime /= 24;
- // sGMTDays = lTime % 400 + 1;
- AFTtimer_state[8] = sGMTDays / 100;
- AFTtimer_state[7] = (sGMTDays / 10) % 10;
- AFTtimer_state[6] = sGMTDays % 10;
- AFTtimer_state[5] = sGMTHours / 10;
- AFTtimer_state[4] = sGMTHours % 10;
- AFTtimer_state[3] = sGMTMinutes / 10;
- AFTtimer_state[2] = sGMTMinutes % 10;
- AFTtimer_state[1] = sGMTSeconds / 10;
- AFTtimer_state[0] = sGMTSeconds % 10;
- }
- if (FMETmode == 1)
- {
- // timenew = floor(MET);
- // days = timenew / (24 * 3600);
- // timenew = timenew % (24 * 3600);
- // hours = timenew / 3600;
- // timenew %= 3600;
- // minutes = timenew / 60;
- // timenew %= 60;
- // seconds = timenew;
- Ftimer_state[8] = days / 100;//days1
- Ftimer_state[7] = (days / 10) % 10;//days2
- Ftimer_state[6] = days % 10;//days3
- Ftimer_state[5] = hours / 10;
- Ftimer_state[4] = hours % 10;
- Ftimer_state[3] = minutes / 10;
- Ftimer_state[2] = minutes % 10;
- Ftimer_state[1] = seconds / 10;
- Ftimer_state[0] = seconds % 10;
- }
- else if (FTestmode == 1)
- {
- Ftimer_state[8] = 8;//days1
- Ftimer_state[7] = 8;//days2
- Ftimer_state[6] = 8;//days3
- Ftimer_state[5] = 8;
- Ftimer_state[4] = 8;
- Ftimer_state[3] = 8;
- Ftimer_state[2] = 8;
- Ftimer_state[1] = 8;
- Ftimer_state[0] = 8;
- }
- else if (FGMTmode == 1)
- {
- // fSimGMT = fSimGMT + simdt;
- // sGMTMillis = (short)fmod(fSimGMT * 1000.0, 1000.0);
- // lTime = (long)fSimGMT;
- // sGMTSeconds = lTime % 60;
- // lTime /= 60;
- // sGMTMinutes = lTime % 60;
- // lTime /= 60;
- // sGMTHours = lTime % 24;
- // lTime /= 24;
- // sGMTDays = lTime % 400 + 1;
- Ftimer_state[8] = sGMTDays / 100;
- Ftimer_state[7] = (sGMTDays / 10) % 10;
- Ftimer_state[6] = sGMTDays % 10;
- Ftimer_state[5] = sGMTHours / 10;
- Ftimer_state[4] = sGMTHours % 10;
- Ftimer_state[3] = sGMTMinutes / 10;
- Ftimer_state[2] = sGMTMinutes % 10;
- Ftimer_state[1] = sGMTSeconds / 10;
- Ftimer_state[0] = sGMTSeconds % 10;
- }
- //front eventimer
- // run timer
- if (TimerReset == 1)
- {
- time = 0;
- clk = 0.0;
- }
- else if (TimerSet == 1)
- {
- time = Minutes1set + (Minutes2set * 10) + (Minutes3set * 60) + (Minutes4set * 600);
- // time = (int)Minutes_1.IsSet() + (2 * (int)Minutes_2.IsSet()) + (4 * (int)Minutes_4.IsSet()) + (8 * (int)Minutes_8.IsSet()) +
- // (10 * (int)Minutes_10.IsSet()) + (20 * (int)Minutes_20.IsSet()) + (40 * (int)Minutes_40.IsSet());
- // time *= 60;
- // time += (int)Seconds_1.IsSet() + (2 * (int)Seconds_2.IsSet()) + (4 * (int)Seconds_4.IsSet()) + (8 * (int)Seconds_8.IsSet()) +
- // (10 * (int)Seconds_10.IsSet()) + (20 * (int)Seconds_20.IsSet()) + (40 * (int)Seconds_40.IsSet());
- TimerSet = 0;
- }
- else if (TimerStart ==1 )
- {
- clk += oapiGetSimStep();
- int dt = static_cast<int>(clk);
- clk -= dt;//CLK-DTtime -= dt
- //sprintf(oapiDebugString(), "running time DTTIME: %d CLOCKTIME: %f ", dt, clk);
- if (up)
- {
- time += dt;
- if (time >= 3600) time -= 3600;// overflow at 60mins
- }
- else
- {
- time -= dt;
- if (time <= 0)// reached 0, now count up
- {
- //time = -time;
- time = 0;
- }
- }
- }
- else clk = 0.0;
- // output
- if (ETest == 1)
- {
- Etimer_state[3] = 8;
- Etimer_state[2] = 8;
- Etimer_state[1] = 8;
- Etimer_state[0] = 8;
- }
- else
- {
- short sTimerMinutes = time / 60;
- short sTimerSeconds = time % 60;
- Etimer_state[3] = sTimerMinutes / 10;
- Etimer_state[2] = sTimerMinutes % 10;
- Etimer_state[1] = sTimerSeconds / 10;
- Etimer_state[0] = sTimerSeconds % 10;
- }
- //aft eventimer
- // run timer
- if (TimerResetAFT == 1)
- {
- timeAFT = 0;
- clkAFT = 0.0;
- }
- else if (TimerSetAFT == 1)
- {
- timeAFT = Minutes1setAFT + (Minutes2setAFT * 10) + (Minutes3setAFT * 60) + (Minutes4setAFT * 600);
- //sprintf(oapiDebugString(), "timersetE: %f ", clkAFT);
- // time = (int)Minutes_1.IsSet() + (2 * (int)Minutes_2.IsSet()) + (4 * (int)Minutes_4.IsSet()) + (8 * (int)Minutes_8.IsSet()) +
- // (10 * (int)Minutes_10.IsSet()) + (20 * (int)Minutes_20.IsSet()) + (40 * (int)Minutes_40.IsSet());
- // time *= 60;
- // time += (int)Seconds_1.IsSet() + (2 * (int)Seconds_2.IsSet()) + (4 * (int)Seconds_4.IsSet()) + (8 * (int)Seconds_8.IsSet()) +
- // (10 * (int)Seconds_10.IsSet()) + (20 * (int)Seconds_20.IsSet()) + (40 * (int)Seconds_40.IsSet());
- TimerSetAFT = 0;
- }
- else if (TimerStartAFT == 1)
- {
- clkAFT += oapiGetSimStep();
- int dtAFT = static_cast<int>(clkAFT);
- clkAFT -= dtAFT;//CLK-DTtime -= dt
- if (upAFT)
- {
- //sprintf(oapiDebugString(), "running timeup DTTIME: %d CLOCKTIME: %f ", dtAFT, clkAFT);
- timeAFT += dtAFT;
- if (timeAFT >= 3600) timeAFT -= 3600;// overflow at 60mins
- }
- else
- {
- //sprintf(oapiDebugString(), "running timedown DTTIME: %d CLOCKTIME: %f ", dtAFT, clkAFT);
- timeAFT -= dtAFT;
- if (timeAFT <= 0)// reached 0, now count up
- {
- //time = -time;
- timeAFT = 0;
- }
- }
- }
- else clkAFT = 0.0;
- // output
- if (ETestAFT == 1)
- {
- EtimerAFT_state[3] = 8;
- EtimerAFT_state[2] = 8;
- EtimerAFT_state[1] = 8;
- EtimerAFT_state[0] = 8;
- }
- else
- {
- short sTimerMinutes = timeAFT / 60;
- short sTimerSeconds = timeAFT % 60;
- EtimerAFT_state[3] = sTimerMinutes / 10;
- EtimerAFT_state[2] = sTimerMinutes % 10;
- EtimerAFT_state[1] = sTimerSeconds / 10;
- EtimerAFT_state[0] = sTimerSeconds % 10;
- }
- //if (firstStep) {
- // firstStep = false;
- //}
- //kuelevation
- char cbuf[8];
- //sprintf_s(cbuf, 8, "%05.1f", fabs(elevation));
- //sprintf(oapiDebugString(), "%05.1f %05.1f", fabs(elevation), KURATE);
- //if (elevation > 90) elevation = 90.0;
- //if (elevation < -90) elevation = -90.0;
- // if ((KUEL == 2)&&(elevation<90)) elevation = elevation + KURATE;
- // if ((KUEL == 1) && (elevation > -90)) elevation = elevation - KURATE;
- /*
- for (int i = 3, j = 0; i >= 0; i--, j++)
- {
- if (cbuf[j] == '.') j++;
- next_state[i] = cbuf[j] - 48 + _7SD_STATE_NUM0_DOTOFF;
- }
- next_state[1] -= _7SD_STATE_NUM0_DOTON;
- if (elevation > 0) next_state[4] = _7SD_STATE_SIGN2PLUS;
- else if (elevation < 0) next_state[4] = _7SD_STATE_SIGN2MINUS;
- else next_state[4] = _7SD_STATE_SIGN2OFF;
- */
- //SetAnimation(anim_HUDpower, 1);
- //sprintf(oapiDebugString(), "%d ", currentHudMode);
- if (ADTA_proc==1)SetAnimation(anim_ATDADeploy, 1);
- if (ADTA_proc == 0)SetAnimation(anim_ATDADeploy, 0);
- if (currentHudMode==0)SetAnimation(anim_HUDpower, 1);//hud is oo
- if (currentHudMode != 0)SetAnimation(anim_HUDpower, 0);//hud is off
- if (flood2_status == 0)SetAnimation(anim_floodportaft, 1);
- if (flood2_status == 1)SetAnimation(anim_floodportaft, 0);
- if (flood1_status == 0)SetAnimation(anim_floodstbdaft, 1);
- if (flood1_status == 1)SetAnimation(anim_floodstbdaft, 0);
- if (flood4_status == 0)SetAnimation(anim_floodportmid, 1);
- if (flood4_status == 1)SetAnimation(anim_floodportmid, 0);
- if (flood3_status == 0)SetAnimation(anim_floodstbdmid, 1);
- if (flood3_status == 1)SetAnimation(anim_floodstbdmid, 0);
- if (flood6_status == 0)SetAnimation(anim_floodportfwd, 1);
- if (flood6_status == 1)SetAnimation(anim_floodportfwd, 0);
- if (flood5_status == 0)SetAnimation(anim_floodstbdfwd, 1);
- if (flood5_status == 1)SetAnimation(anim_floodstbdfwd, 0);
- if (aft_light_status == 0)SetAnimation(anim_fwdlight, 0);
- if (aft_light_status == 1)SetAnimation(anim_fwdlight, 1);
- if (docklight_status == 1)SetAnimation(anim_docklight, .5);
- if (docklight_status == 2)SetAnimation(anim_docklight, 0);
- if (docklight_status == 0)SetAnimation(anim_docklight, 1);
- if ((flood1_status == 0) || (flood2_status == 0) || (flood3_status == 0) || (flood4_status == 0) || (flood5_status == 0) || (flood6_status == 0))SetAnimation(anim_floodon, 1);
- if ((flood1_status == 1) || (flood2_status == 1) || (flood3_status == 1) || (flood4_status == 1) || (flood5_status == 1) || (flood6_status == 1))SetAnimation(anim_floodon, 0);
- if (ADTA_proc <= 0)SetAnimation(anim_ATDADeploy, 0);
- if (ADTA_proc >= 1)SetAnimation(anim_ATDADeploy, 1);
- RCSQTY = ((fuelmass/ ORBITER_MAX_PROPELLANT_MASS)*100);
- fuelmass = GetPropellantMass(ph_oms);
- if (RCSQTY = 100)RCSQTY = 99;
- //RCS
- if ( GetThrusterGroupLevel(THGROUP_ATT_PITCHUP)>0)SetAnimation(anim_pitchup, 1);
- else SetAnimation(anim_pitchup, 0);
- if (GetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN) > 0)SetAnimation(anim_pitchdown, 1);
- else SetAnimation(anim_pitchdown, 0);
- if (GetThrusterGroupLevel(THGROUP_ATT_BANKLEFT) > 0)SetAnimation(anim_rollleft, 1);
- else SetAnimation(anim_rollleft, 0);
- if (GetThrusterGroupLevel(THGROUP_ATT_BANKRIGHT) > 0)SetAnimation(anim_rollright, 1);
- else SetAnimation(anim_rollright, 0);
- if (GetThrusterGroupLevel(THGROUP_ATT_YAWLEFT) > 0)SetAnimation(anim_yawleft, 1);
- else SetAnimation(anim_yawleft, 0);
- if (GetThrusterGroupLevel(THGROUP_ATT_YAWRIGHT) > 0)SetAnimation(anim_yawright, 1);
- else SetAnimation(anim_yawright, 0);
- }
- // --------------------------------------------------------------
- // Respond to playback event
- // --------------------------------------------------------------
- bool Atlantis::clbkPlaybackEvent (double simt, double event_t, const char *event_type, const char *event)
- {
- if (!_stricmp (event_type, "JET")) {
- if (!_stricmp (event, "SRB")) {
- bManualSeparate = true;
- return true;
- }
- else if (!_stricmp (event, "ET")) {
- bManualSeparate = true;
- return true;
- }
- } else if (!_stricmp (event_type, "STATUS")) {
- } else if (!_stricmp (event_type, "CARGODOOR")) {
- if (!_stricmp(event, "OPEN")) plop->SetDoorAction (AnimState::OPENING, true);
- else if (!_stricmp(event, "CLOSE")) plop->SetDoorAction (AnimState::CLOSING, true);
- else if (!_stricmp(event, "ISOPEN")) plop->SetDoorAction (AnimState::OPEN, true);
- else if (!_stricmp(event, "ISCLOSED")) plop->SetDoorAction (AnimState::CLOSED, true);
- return true;
- } else if (!_stricmp (event_type, "GEAR")) {
- OperateLandingGear (!_stricmp (event, "UP") ? AnimState::CLOSING : AnimState::OPENING);
- return true;
- }
- else if (!_stricmp (event_type,"SPEEDBRAKE")) {
- OperateSpeedbrake (!_stricmp (event, "CLOSE") ? AnimState::CLOSING : AnimState::OPENING);
- return true;
- }
- else if (!_stricmp (event_type, "KUBAND")) {
- plop->SetKuAntennaAction (!_stricmp (event, "CLOSE") ? AnimState::CLOSING : AnimState::OPENING);
- return true;
- }
- return false;
- }
- // --------------------------------------------------------------
- // Atlantis mesh loaded
- // --------------------------------------------------------------
- void Atlantis::clbkVisualCreated (VISHANDLE _vis, int refcount)
- {
- if (refcount > 1) return; // we don't support more than one visual per object
- vis = _vis;
- // make sure the RMS AND OBSS attachment point is in sync with the animation state of the visual
- xp0 = arm_tip[1] - arm_tip[0]; normalise(xp0);
- xr0 = arm_tip[2] - arm_tip[0]; normalise(xr0);
- SetAttachmentParams(rms_attach, arm_tip[0], xp0, xr0);
- //SetAttachmentParams (rms_attach, arm_tip[0], arm_tip[1]-arm_tip[0], arm_tip[2]-arm_tip[0]);
- SetAttachmentParams(OBSS_attach, armobss_tip[0], armobss_tip[1] - armobss_tip[0], armobss_tip[2] - armobss_tip[0]);
- }
- // --------------------------------------------------------------
- // Atlantis mesh discarded
- // --------------------------------------------------------------
- void Atlantis::clbkVisualDestroyed (VISHANDLE _vis, int refcount)
- {
- if (vis == _vis) vis = NULL;
- }
- // --------------------------------------------------------------
- // Update mesh animation state
- // --------------------------------------------------------------
- void Atlantis::clbkAnimate (double simt)
- {
- UpdateMesh ();
- }
- void Atlantis::RedrawPanel_MFDButton(SURFHANDLE surf, int mfd)
- {
- // oapi::Font* font3 = oapiCreateFont(-11, true, "Arial");
- //g_Param.font[0] = CreateFont (-11, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
- oapi::Sketchpad* skp = oapiGetSketchpad(surf);
- //skp->SetTextColor(BBGGRR)
- skp->SetFont(Atlantis::font3);
- skp->SetTextColor(0x00FF00);
- skp->SetTextAlign(oapi::Sketchpad::CENTER);
- if (oapiGetMFDMode(mfd) == MFD_NONE) {
- RECT r = { 0, 0, 255, 13 };
- //skp->Rectangle(0, 0, 255, 13);
- //skp->SetBrush(gBlackBrush); // Enable shape filling
- auto Old = skp->SetPen(NULL); // Disable outline
- skp->Rectangle(0, 0, 255, 13);
- skp->SetBrush(NULL); // Disable shape filling
- skp->SetPen(Old);
- }
- else { // MFD powered on
- const char* label;
- int x = 24;
- for (int bt = 0; bt < 5; bt++) {
- if (label = oapiMFDButtonLabel(mfd, bt)) {
- skp->Text(x, 1, label, strlen(label));
- x += 42;
- }
- else break;
- }
- skp->Text(234, 1, "PG", 2);
- }
- oapiReleaseSketchpad(skp);
- }
- //}
- // --------------------------------------------------------------
- // Respond to MFD mode change
- // --------------------------------------------------------------
- void Atlantis::clbkMFDMode (int mfd, int mode)
- {
- oapiVCTriggerRedrawArea (-1, AID_CDR1_BUTTONS+mfd-MFD_LEFT);
- }
- // --------------------------------------------------------------
- // Respond to RCS mode change
- // --------------------------------------------------------------
- void Atlantis::clbkRCSMode (int mode)
- {
- SetADCtrlMode (mode ? 0 : 7);
- // turn off aerodynamic control surfaces if RCS is enabled
- }
- // --------------------------------------------------------------
- // Load generic glass cockpit mode
- // --------------------------------------------------------------
- bool Atlantis::clbkLoadGenericCockpit ()
- {
- //SetCameraOffset (_V(-0.67,2.55,14.0));
- //SetCameraDefaultDirection (_V(0,0,1));
- return true;
- }
- // --------------------------------------------------------------
- // register VC buttons for the 2 commander MFDs
- // (accessible from commander position only)
- // --------------------------------------------------------------
- void Atlantis::RegisterVC_CdrMFD ()
- {
- // activate MFD function buttons
- oapiVCSetAreaClickmode_Quadrilateral(AID_CDR1_BUTTONS, _V(-.338, 2.1229, 14.705), _V(-.157, 2.1229, 14.705), _V(-.338, 2.1097, 14.702), _V(-.157, 2.1097, 14.402));
- //oapiVCSetAreaClickmode_Quadrilateral(AID_CDR2_BUTTONS, _V(-0.6546, 2.0091, 14.65), _V(-0.4736, 2.0091, 14.65), _V(-0.6546, 1.9881, 14.65), _V(-0.4736, 1.9881, 14.65));
- //_V(-.338, 2.1229, 14.705), _V(-.157, 2.1229, 14.705), _V(-.338, 2.1097, 14.702), _V(-.157, 2.1097, 14.402));
- // D. Beachy: register+activate MFD power buttons
- const double powerButtonRadius = 0.01; // radius of power button on each MFD
- oapiVCRegisterArea (AID_CDR1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_ONREPLAY);
- // oapiVCRegisterArea (AID_CDR2_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_CDR1_PWR, _V(-0.110675, 1.801403 , 14.44215), powerButtonRadius);
- // oapiVCSetAreaClickmode_Spherical(AID_CDR2_PWR, _V(-0.680, 2.0107, 14.65), powerButtonRadius);
- // register+activate MFD brightness buttons
- oapiVCRegisterArea (AID_CDR1_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY);
- //oapiVCRegisterArea (AID_CDR2_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Quadrilateral(AID_CDR1_BRT, _V(-0.373, 2.1138, 14.691), _V(-0.340, 2.1138, 14.691), _V(-0.373, 2.0777, 14.683), _V(-0.340, 2.0777, 14.683));
- //oapiVCSetAreaClickmode_Quadrilateral(AID_CDR2_BRT, _V(-0.459, 2.0221, 14.649), _V(-0.444, 2.0221, 14.649), _V(-0.459, 2.0063, 14.645), _V(-0.444, 2.0063, 14.645));
- oapiVCRegisterArea(AID_FRTMINUTE2UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE2UP, _V(-0.008, 1.72, 14.368), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTMINUTE2DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE2DWN, _V(-0.008, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTMINUTE1UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE1UP, _V(0.014, 1.7185, 14.368), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTMINUTE1DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE1DWN, _V(0.014, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND1DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND1DWN, _V(0.059, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND2DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND2DWN, _V(0.037, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND1UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND1UP, _V(0.059, 1.7185, 14.368), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND2UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND2UP, _V(0.037, 1.7185, 14.368), powerButtonRadius);
- //FRONTTIMER
- oapiVCRegisterArea(AID_FRTEVENTSET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTRESET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTSET, _V(.102, 1.692, 14.338), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTRESET, _V(.102, 1.682, 14.327), .01);//-1.0401, 2.8382, 12.443
- oapiVCRegisterArea(AID_FRTEVENTSTART, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTSTOP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTSTART, _V(-.074, 1.694, 14.34), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTSTOP, _V(-.074, 1.682, 14.324), .01);//-1.0401, 2.8382, 12.443
- oapiVCRegisterArea(AID_FRTEVENTUP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTDOWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTTEST, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTUP, _V(-.105, 1.694, 14.34), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTDOWN, _V(-.105, 1.687, 12.433), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTTEST, _V(-.105, 1.679, 14.324), .01);//-1.0401, 2.8382, 12.443
- }
- // --------------------------------------------------------------
- // register VC buttons for the 2 pilot MFDs
- // (accessible from pilot position only)
- // --------------------------------------------------------------
- void Atlantis::RegisterVC_PltMFD ()
- {
- // activate MFD function buttons
- oapiVCSetAreaClickmode_Quadrilateral(AID_PLT1_BUTTONS, _V(.157, 2.1229, 14.705), _V(.338, 2.1229, 14.705), _V(.157, 2.1097, 14.702), _V(.338, 2.1097, 14.402));
- // oapiVCSetAreaClickmode_Quadrilateral (AID_PLT2_BUTTONS, _V(0.7461,2.0091,14.65), _V(0.9271,2.0091,14.65), _V(0.7461,1.9881,14.65), _V(0.9271,1.9881,14.65));
- // D. Beachy: register+activate MFD power buttons
- const double powerButtonRadius = 0.01; // radius of power button on each MFD
- oapiVCRegisterArea (AID_PLT1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_ONREPLAY);
- // oapiVCRegisterArea (AID_PLT2_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_PLT1_PWR, _V(0.069895, 1.801834, 14.44158), powerButtonRadius);
- // oapiVCSetAreaClickmode_Spherical(AID_PLT2_PWR, _V(0.720, 2.0147, 14.65), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTMINUTE2UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE2UP, _V(-0.008, 1.72, 14.368), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTMINUTE2DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE2DWN, _V(-0.008, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTMINUTE1UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE1UP, _V(0.014, 1.7185, 14.368), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTMINUTE1DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE1DWN, _V(0.014, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND1DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND1DWN, _V(0.059, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND2DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND2DWN, _V(0.037, 1.692, 14.344), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND1UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND1UP, _V(0.059, 1.7185, 14.368), powerButtonRadius);
- oapiVCRegisterArea(AID_FRTSECOND2UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTSECOND2UP, _V(0.037, 1.7185, 14.368), powerButtonRadius);
- // register+activate MFD brightness buttons
- oapiVCRegisterArea (AID_PLT1_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY);
- // oapiVCRegisterArea (AID_PLT2_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Quadrilateral(AID_PLT1_BRT, _V(.111, 2.1138, 14.691), _V(0.157, 2.1138, 14.691), _V(.111, 2.0777, 14.683), _V(0.157, 2.0777, 14.683));
- //oapiVCSetAreaClickmode_Quadrilateral(AID_PLT2_BRT, _V(0.941, 2.0221, 14.649), _V(0.956, 2.0221, 14.649), _V(0.941, 1.9881, 14.65), _V(0.956, 1.9881, 14.65));
- //FRONTTIMER
- oapiVCRegisterArea(AID_FRTEVENTSET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTRESET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTSET, _V(.102, 1.692, 14.338), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTRESET, _V(.102, 1.682, 14.327), .01);//-1.0401, 2.8382, 12.443
- oapiVCRegisterArea(AID_FRTEVENTSTART, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTSTOP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTSTART, _V(-.074, 1.694, 14.34), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTSTOP, _V(-.074, 1.682, 14.324), .01);//-1.0401, 2.8382, 12.443
- oapiVCRegisterArea(AID_FRTEVENTUP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTDOWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FRTEVENTTEST, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTUP, _V(-.105, 1.694, 14.34), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTDOWN, _V(-.105, 1.687, 12.433), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_FRTEVENTTEST, _V(-.105, 1.679, 14.324), .01);//-1.0401, 2.8382, 12.443
- //FRONT MET
- oapiVCRegisterArea(AID_METTIMERGMT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_METTIMERMET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_METTIMERTEST, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_METTIMERGMT, _V(.512, 2.722, 14.294), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_METTIMERMET, _V(.512, 2.714, 14.294), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_METTIMERTEST, _V(.512, 2.704, 14.294), .01);//-1.0401, 2.8382, 12.443
- }
- // --------------------------------------------------------------
- // register VC buttons for the 5 MFDs on the central panel
- // (accessible from commander and pilot positions)
- // --------------------------------------------------------------
- void Atlantis::RegisterVC_CntMFD ()
- {
- // activate MFD function buttons
- oapiVCSetAreaClickmode_Quadrilateral(AID_MFD1_BUTTONS, _V(-0.090, 1.8744, 14.634), _V(0.090, 1.8744, 14.634), _V(-0.090, 1.8652, 14.633), _V(0.090, 1.8652, 14.633));
- // D. Beachy: register+activate MFD power buttons
- const double powerButtonRadius = 0.01; // radius of power button on each MFD
- oapiVCRegisterArea (AID_MFD1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_MFD1_PWR, _V(-0.02039 , 1.801834 , 14.44179), powerButtonRadius);
- // register+activate MFD brightness buttons
- oapiVCRegisterArea (AID_MFD1_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Quadrilateral(AID_MFD1_BRT, _V(-0.143, 1.8647, 14.63), _V(-0.090, 1.8647, 14.63), _V(-0.143, 1.8297, 14.62), _V(-0.090, 1.8297, 14.62));
- // oapiVCRegisterArea(AID_FRTMINUTE2UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- // oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE2UP, _V(-0.008, 1.7185, 14.368), powerButtonRadius);
- // oapiVCRegisterArea(AID_FRTMINUTE2DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- // oapiVCSetAreaClickmode_Spherical(AID_FRTMINUTE2DWN, _V(-0.008, 1.69, 14.368), powerButtonRadius);
- }
- // --------------------------------------------------------------
- // register VC buttons for the aft MFD at the starbord panel
- // (accessible from payload control position only)
- // --------------------------------------------------------------
- void Atlantis::RegisterVC_AftMFD()
- {
- //SURFHANDLE tex1 = oapiGetTextureHandle(hOrbiterVCMesh, 20);
- //oapiVCRegisterArea(AID_MFDA_BUTTONS, _R(0, 127, 255, 140), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- // SURFHANDLE tex1 = oapiGetTextureHandle (hOrbiterVCMesh, 20);
- // activate MFD function buttons
- oapiVCSetAreaClickmode_Quadrilateral(AID_MFDSIDE_BUTTONS, _V(1.4005, 2.2204, 13.465), _V(1.4005, 2.2189, 13.282), _V(1.3931, 2.2195, 13.465), _V(1.3931, 2.1426, 13.282));
- //oapiVCSetAreaClickmode_Quadrilateral(AID_CCTV1_BUTTONS, _V(-.876, 2.92, 12.284), _V(-.876, 2.92, 12.395), _V(-.876, 2.910, 12.284), _V(-.876, 2.910, 12.395));
- oapiVCSetAreaClickmode_Quadrilateral(AID_CCTV2_BUTTONS, _V(-0.98, 2.702, 12.419), _V(-0.877, 2.702, 12.316), _V(-0.98, 2.694, 12.42), _V(-0.877, 2.694, 12.318));
- oapiVCSetAreaClickmode_Quadrilateral(AID_CCTV1_BUTTONS, _V(-1.011, 2.909, 12.39062), _V(-0.904, 2.909, 12.285), _V(-1.01, 2.901, 12.392), _V(-0.903, 2.901, 12.288));
- // oapiVCSetAreaClickmode_Quadrilateral(AID_CCTV1_BUTTONS, _V(-.906, 2.905935, 12.39062), _V(-1.009214, 2.906741, 12.285), _V(-0.903, 2.913594, 12.392), _V(-1.007, 2.914401, 12.288));
- //-0.956014 2.914348 12.3912 -0.956014 2.906688 12.39282 -0.956014 2.913542 12.28598 -0.956014 2.905882 12.2876 -1.009228 2.914146 12.2876
- //oapiVCSetAreaClickmode_Quadrilateral(AID_CCTV1_BUTTONS, _V(-1.0, 2.9, 12.392), _V(-.9, 2.5, 12.288), _V(-1.0, 2.9, 12.392), _V(-.9, 2.5, 12.288)); 2.905935 2.913594
- // D. Beachy: register+activate MFD power buttons
- const double powerButtonRadius = 0.01; // radius of power button on each MFD
- oapiVCRegisterArea(AID_MFDSIDE_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_MFDSIDE_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_MFDSIDE_PWR, _V(1.2789, 2.138, 13.33), powerButtonRadius);
- oapiVCSetAreaClickmode_Spherical(AID_CCTV1_PWR, _V(-1.05952, 3.050369, 12.416), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_CCTV2_PWR, _V(-1.034025, 2.838804, 12.433), .01);//-1.0401, 2.8382, 12.443
- //
- //oapiVCRegisterArea(AID_MFDA_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY);
- //oapiVCSetAreaClickmode_Quadrilateral(AID_MFDA_BRT, _V(1.3817, 2.2164, 13.489), _V(1.3809, 2.2164, 13.463), _V(1.3634, 2.2148, 13.489), _V(1.3634, 2.2118, 13.461));
- //atlantis
- //oapiVCRegisterArea (AID_MFDA_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY);
- //oapiVCSetAreaClickmode_Quadrilateral(AID_MFDA_BRT, _V(1.4024, 2.2675, 13.6736), _V(1.4024, 2.2675, 13.6586), _V(1.3893, 2.2590, 13.6736), _V(1.3893, 2.2590, 13.6586));
- oapiVCRegisterArea(AID_MFDSIDE_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Quadrilateral(AID_MFDSIDE_BRT, _V(1.3853, 2.2171, 13.48), _V(1.3853, 2.2171, 13.463), _V(1.3726, 2.2076, 13.48), _V(1.3724, 2.2076, 13.463));
- oapiVCRegisterArea(AID_CCTV1_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_CCTV2_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTMETTIMERGMT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTMETTIMERMET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTMETTIMERTEST, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTPORTFLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTPORTFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTSTBDFLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTSTBDFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_MIDPORTFLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_MIDPORTFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_MIDSTBDFLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_MIDSTBDFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FWDPORTFLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FWDPORTFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FWDSTBDFLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_FWDSTBDFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTFLOODON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_DOCKFLOODOFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_DOCKFLOODDIM, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_DOCKFLOODBRIGHT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- //EVENT_TIMER
- oapiVCRegisterArea(AID_AFTEVENTSET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTEVENTRESET, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTEVENTSTART, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTEVENTSTOP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTEVENTUP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTEVENTDOWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_AFTEVENTTEST, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_PANELA2TEST, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_PANELA2SCALEX1, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCRegisterArea(AID_PANELA2SCALEX10, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTMETTIMERGMT, _V(-.822, 2.8815, 12.262), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTMETTIMERMET, _V(-.822, 2.8699, 12.262), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTMETTIMERTEST, _V(-.822, 2.8577, 12.262), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTEVENTSET, _V(.351, 2.449, 12.313), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTEVENTRESET, _V(.351, 2.429, 12.313), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTEVENTSTART, _V(.376, 2.448, 12.313), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTEVENTSTOP, _V(.376, 2.426, 12.313), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTEVENTUP, _V(.408, 2.449, 12.313), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTEVENTDOWN, _V(.408, 2.437, 12.313), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTEVENTTEST, _V(.408, 2.426, 12.313), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_PANELA2RR, _V(0, 3.197, 12.23), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_PANELA2TEST, _V(0, 3.179, 12.23), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_PANELA2SCALEX10, _V(0, 3.111, 12.23), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_PANELA2SCALEX1, _V(0, 3.142, 12.23), .01);//-1.0401, 2.8382, 12.443
- oapiVCSetAreaClickmode_Spherical(AID_AFTSTBDFLOODON, _V(0.22196, 2.704 , 12.23508), .01);//-1.079, 3.0613, 12.412 0.22196 2.694968 12.23508
- oapiVCSetAreaClickmode_Spherical(AID_AFTSTBDFLOODOFF, _V(0.22196, 2.69, 12.23508), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_AFTPORTFLOODON, _V(0.176, 2.704, 12.23508), .01);//-1.079, 3.0613, 12.412 0.22196 2.694968 12.23508
- oapiVCSetAreaClickmode_Spherical(AID_AFTPORTFLOODOFF, _V(0.176, 2.69, 12.23508), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_MIDSTBDFLOODON, _V(0.22196, 2.643, 12.252), .01);//-1.079, 3.0613, 12.412 0.22196 2.694968 12.23508
- oapiVCSetAreaClickmode_Spherical(AID_MIDSTBDFLOODOFF, _V(0.22196, 2.631, 12.252), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_MIDPORTFLOODON, _V(0.176, 2.643, 12.252), .01);//-1.079, 3.0613, 12.412 0.22196 2.694968 12.23508
- oapiVCSetAreaClickmode_Spherical(AID_MIDPORTFLOODOFF, _V(0.176, 2.631, 12.252), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_FWDSTBDFLOODON, _V(0.22196, 2.579, 12.273), .01);//-1.079, 3.0613, 12.412 0.22196 2.694968 12.23508
- oapiVCSetAreaClickmode_Spherical(AID_FWDSTBDFLOODOFF, _V(0.22196, 2.566, 12.273), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_FWDPORTFLOODON, _V(0.176, 2.579, 12.273), .01);//-1.079, 3.0613, 12.412 0.22196 2.694968 12.23508
- oapiVCSetAreaClickmode_Spherical(AID_FWDPORTFLOODOFF, _V(0.176, 2.566, 12.273), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_FLOODON, _V(0.43404, 2.785, 12.21263), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_FLOODOFF, _V(0.43404, 2.763, 12.21263), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_AFTFLOODON, _V(0.176, 2.524, 12.28897), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_AFTFLOODOFF, _V(0.176, 2.511, 12.28897), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_DOCKFLOODDIM, _V(0.22196, 2.517118, 12.28912), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_DOCKFLOODOFF, _V(0.22196, 2.512, 12.28912), .01);//-1.079, 3.0613, 12.412
- oapiVCSetAreaClickmode_Spherical(AID_DOCKFLOODBRIGHT, _V(0.22196, 2.527, 12.28912), .01);//-1.079, 3.0613, 12.412
- oapiVCRegisterArea(AID_AFTMINUTE2UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTMINUTE2UP, _V(.405, 2.515002, 12.28757), powerButtonRadius);
- oapiVCRegisterArea(AID_AFTMINUTE2DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTMINUTE2DWN, _V(.405, 2.48366, 12.29915), powerButtonRadius);
- oapiVCRegisterArea(AID_AFTMINUTE1UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTMINUTE1UP, _V(0.382, 2.515002, 12.28757), powerButtonRadius);
- oapiVCRegisterArea(AID_AFTMINUTE1DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTMINUTE1DWN, _V(0.382, 2.48366, 12.29915), powerButtonRadius);
- oapiVCRegisterArea(AID_AFTSECOND1DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTSECOND1DWN, _V(0.335, 2.48, 12.28757), powerButtonRadius);
- oapiVCRegisterArea(AID_AFTSECOND1UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTSECOND1UP, _V(0.335, 2.515002, 12.28757), powerButtonRadius);
- oapiVCRegisterArea(AID_AFTSECOND2DWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTSECOND2DWN, _V(0.359, 2.48366, 12.29915), powerButtonRadius);
- oapiVCRegisterArea(AID_AFTSECOND2UP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_AFTSECOND2UP, _V(0.359, 2.515002, 12.28757), powerButtonRadius);
- oapiVCRegisterArea(AID_PANELA2PWRON, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_PANELA2PWRON, _V(1.283, 2.709, 12.147), .01);//-1.079, 3.0613, 12.412
- oapiVCRegisterArea(AID_PANELA2PWROFF, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_PANELA2PWROFF, _V(1.283, 2.698, 12.147), .01);//-1.079, 3.0613, 12.412
- //KU
- oapiVCRegisterArea(AID_KUAZIMUTHLEFT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_KUAZIMUTHLEFT, _V(1.139, 2.88, 12.147), powerButtonRadius);
- oapiVCRegisterArea(AID_KUAZIMUTHRIGHT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_KUAZIMUTHRIGHT, _V(1.155, 2.88, 12.147), powerButtonRadius);
- oapiVCRegisterArea(AID_KUELUP, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_KUELUP, _V(1.102, 2.89, 12.147), powerButtonRadius);
- oapiVCRegisterArea(AID_KUELDOWN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_KUELDOWN, _V(1.102, 2.87, 12.147), powerButtonRadius);
- oapiVCRegisterArea(AID_KURATESLOW, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_KURATESLOW, _V(1.069, 2.87, 12.147), powerButtonRadius);
- oapiVCRegisterArea(AID_KURATEFAST, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_KURATEFAST, _V(1.069, 2.89, 12.147), powerButtonRadius);
- // register+activate aft MFD function buttons
- // SURFHANDLE tex1 = oapiGetTextureHandle (hOrbiterVCMesh, 14);
- // oapiVCRegisterArea (AID_MFDA_BUTTONS, _R(0,127,255,140), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- // oapiVCSetAreaClickmode_Quadrilateral(AID_MFDA_BUTTONS, _V(.773, 3.0252, 12.376), _V(.600, 3.0133, 12.306), _V(.776, 3.0065, 12.376), _V(.600, 2.2452, 12.306));
- // register+activate MFD power button
- // const double powerButtonRadius = 0.0075; // radius of power button on each MFD
- // oapiVCRegisterArea (AID_MFDA_PWR, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_ONREPLAY);
- // oapiVCSetAreaClickmode_Spherical(AID_MFDA_PWR, _V(0.791, 3.0327, 12.392), powerButtonRadius);
- // register+activate MFD brightness buttons
- // oapiVCRegisterArea (AID_MFDA_BRT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY);
- // oapiVCSetAreaClickmode_Quadrilateral(AID_MFDA_BRT, _V(.591, 3.0318, 12.308), _V(.567, 3.0263, 12.297), _V(.593, 3.0146, 12.309), _V(.568, 3.008, 12.295));
- }
- void Atlantis::RegistergearleftVC()
- {
- SURFHANDLE tkbk_texL = oapiGetTextureHandle(hOrbiterVCMesh, 13);
- const double powerButtonRadius = 0.01; // radius of power button on each MFD
- // oapiVCRegisterArea(AID_LANDINGGEARLEFT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
- // oapiVCSetAreaClickmode_Quadrilateral(AID_LANDINGGEARLEFT, _V(-.957, 2.04, 14.7), _V(-.957, 1.84, 14.6), _V(-.752, 2.04, 14.7), _V(-.752, 1.84, 14.6));
- // register the complete panel for mouse events
- // oapiVCRegisterArea(AID_LANDINGGEARLEFT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
- // oapiVCSetAreaClickmode_Quadrilateral(AID_LANDINGGEARLEFT, _V(1.35, 2.197, 12.456), _V(1.35, 2.197, 12.144), _V(1.0868, 2.0174, 12.456), _V(1.0868, 2.0174, 12.144));
- oapiVCRegisterArea(AID_LANDINGGEARARM, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_LANDINGGEARARM, _V(-.9249141, 1.941366, 14.6538), powerButtonRadius);
- oapiVCRegisterArea(AID_LANDINGGEARDN, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_LANDINGGEARDN, _V(-.889, 1.941366, 14.6538), powerButtonRadius);
- oapiVCRegisterArea(AID_LANDINGGEARARMRIGHT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_LANDINGGEARARMRIGHT, _V(.492, 1.937, 14.6538), powerButtonRadius);
- oapiVCRegisterArea(AID_LANDINGGEARDNRIGHT, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_ONREPLAY);
- oapiVCSetAreaClickmode_Spherical(AID_LANDINGGEARDNRIGHT, _V(.535, 1.937, 14.6538), powerButtonRadius);
- }
- // --------------------------------------------------------------
- // Load virtual cockpit mode
- // --------------------------------------------------------------
- bool Atlantis::clbkLoadVC (int id)
- {
- static VCHUDSPEC huds = { // common HUD specs
- mesh_vc, // nmesh
- GRP_VIRTUAL_HUD, // ngroup
- {0,0,0}, // hudcnt (to be filled)
- 0.176558 // size
- };
- //static VCMFDSPEC mfds = {
- // mesh_vc, 0
- //};
- static EXTMFDSPEC mfds = { // common MFD specs
- {0,0,0,0}, // pos
- mesh_vc, // nmesh
- 0, // ngroup (to be filled)
- MFD_SHOWMODELABELS, // flag
- 5, 0, // nbt1, nbt2
- 512/6, 512/7 // bt_yofs, bt_ydist
- };
- static const int mfdgrp[6] = {
- GRP_CDR1A_VC, GRP_PLT1A_VC, GRP_MFD1A_VC,GRP_MFD_SIDE_VC, GRP_MFDCCTV1_VC, GRP_MFDCCTV2_VC
- };
- //SetClipRadius(.1);
- bool ok = false;
- // register MFD function buttons
- // this needs to be done globally, so that the labels are correctly updated from all VC positions
- //SURFHANDLE tex1 = oapiGetTextureHandle (hOrbiterVCMesh, 14);
- SURFHANDLE tex1 = oapiGetTextureHandle(hOrbiterVCMesh, 19);
- // commander MFD function buttons
- //oapiVCRegisterArea(AID_CDR1_BUTTONS, _R(0, 29, 255, 42), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- // pilot MFD function buttons
- //oapiVCRegisterArea(AID_PLT1_BUTTONS, _R(0, 57, 255, 70), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- oapiVCRegisterArea(AID_PLT1_BUTTONS, _R(0, 29, 255, 42), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- oapiVCRegisterArea(AID_CDR1_BUTTONS, _R(0, 1, 255, 14), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- //oapiVCRegisterArea(AID_PLT1_BUTTONS, _R(0, 15, 255, 28), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- oapiVCRegisterArea(AID_MFD1_BUTTONS, _R(0, 85, 255, 98), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- oapiVCRegisterArea(AID_MFDSIDE_BUTTONS, _R(0, 127, 255, 140), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- oapiVCRegisterArea(AID_CCTV1_BUTTONS, _R(0, 99, 255, 112), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- oapiVCRegisterArea(AID_CCTV2_BUTTONS, _R(0, 113, 255, 126), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP | PANEL_MOUSE_LBPRESSED | PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
- SURFHANDLE const tex3 = oapiGetTextureHandle(hOrbiterVCMesh, 44); //aft met
- oapiVCRegisterArea(AID_METTIME, _R(0, 0, 512, 512), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex3);
- SURFHANDLE const tex5 = oapiGetTextureHandle(hOrbiterVCMesh, 45);//afttimer
- oapiVCRegisterArea(AID_EVENTTIME, _R(0, 0, 256, 256), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex5);
- SURFHANDLE const tex4 = oapiGetTextureHandle(hOrbiterVCMesh, 43);//frontmet
- oapiVCRegisterArea(AID_EVENT1TIME, _R(0, 0, 256, 256), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex4);
- SURFHANDLE const tex6 = oapiGetTextureHandle(hOrbiterVCMesh, 46);//fronttimer
- oapiVCRegisterArea(AID_EVENTAFTTIME, _R(0, 0, 256, 256), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex6);
- SURFHANDLE const tex7 = oapiGetTextureHandle(hOrbiterVCMesh, 58);//panela2
- oapiVCRegisterArea(AID_PANELA2, _R(0, 0, 512, 512), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex7);
- SURFHANDLE const tex8 = oapiGetTextureHandle(hOrbiterVCMesh, 84); //rcsqty
- oapiVCRegisterArea(AID_RCSQTY, _R(0, 0, 256, 256), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex8);
- if (firstStep) id= VCCAM;// if firststep then load vc camera position
- //sprintf(oapiDebugString(), "%d %d", id, VCCAM);
- // Get the VC Mode.
- VCCAM = id;
- //sprintf(oapiDebugString(), "%d ", id);
- firstStep = false;
- switch (id) {
- case 0: // commander position
- SetCameraOffset(_V(-0.67, 2.55, 13.8));
- SetCameraDefaultDirection(_V(0, 0, 1));
- SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
- huds.hudcnt = _V(-0.671257, 2.523535, 14.969);
- oapiVCSetNeighbours(-1, 1, -1, 2);
- RegistergearleftVC();
- RegisterVC_CdrMFD(); // activate commander MFD controls
- RegisterVC_CntMFD(); // activate central panel MFD controls
- vccameracase = 0;
- VCCAM = 0;
- ok = true;
- break;
- case 1: // pilot position
- SetCameraOffset(_V(0.67, 2.55, 13.8));
- SetCameraDefaultDirection(_V(0, 0, 1));
- SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 20 * RAD, -27 * RAD, _V(0.3, 0, 0), -75 * RAD, -5 * RAD);
- huds.hudcnt = _V(0.671257, 2.523535, 14.969);
- oapiVCSetNeighbours(0, -1, -1, 2);
- RegistergearleftVC();
- RegisterVC_PltMFD(); // activate pilot MFD controls
- RegisterVC_CntMFD(); // activate central panel MFD controls
- vccameracase = 1;
- VCCAM = 1;
- ok = true;
- break;
- case 2: // payload view position
- SetCameraOffset(_V(0.35, 3.055, 12.73));
- SetCameraDefaultDirection(_V(0, 0, -1));
- SetCameraMovement(_V(0, -0.1, -0.1), 0, 80.0 * RAD, _V(0.3, -0.3, 0.15), 60.0 * RAD, -50.0 * RAD, _V(-0.8, 0, 0), 0, 0);
- oapiVCSetNeighbours(1, 5, -1, 3);
- RegisterVC_AftMFD(); // activate aft MFD controls
- plop->RegisterVC(); // register panel R13L interface
- ok = true;
- vccameracase = 2;
- VCCAM = 2;
- break;
- case 3: // payload view position
- SetCameraOffset(_V(0.75, 2.855, 12.83));
- SetCameraDefaultDirection(_V(0, 0, -1));
- SetCameraMovement(_V(0, -0.1, -0.1), 0, 80.0*RAD, _V(0.3, -0.3, 0.15), 60.0*RAD, -50.0*RAD, _V(-0.8, 0, 0), 0, 0);
- oapiVCSetNeighbours(1, 4, -1, 3);
- RegisterVC_AftMFD(); // activate aft MFD controls
- plop->RegisterVC(); // register panel R13L interface
- ok = true;
- vccameracase = 2;
- VCCAM = 3;
- break;
- case 4: // payload view position
- //SetCameraOffset(_V(0.45, 3.02, 12.50));
- SetCameraOffset(_V(0.45, 3.02, 12.50));
- SetCameraDefaultDirection(_V(0, 0, -1));
- SetCameraMovement(_V(0, -0.1, -0.1), 0, 80.0*RAD, _V(0.3, -0.3, 0.15), 60.0*RAD, -50.0*RAD, _V(-0.8, 0, 0), 0, 0);
- oapiVCSetNeighbours(1, 5, -1, 0);
- RegisterVC_AftMFD(); // activate aft MFD controls
- plop->RegisterVC(); // register panel R13L interface
- ok = true;
- vccameracase = 2;
- VCCAM = 4;
- break;
- case 5: // payload view position
- SetCameraOffset(_V(-0.45, 3.055, 12.43));
- SetCameraDefaultDirection(_V(0, 0, -1));
- SetCameraMovement(_V(0, -0.1, -0.1), 0, 80.0*RAD, _V(0.3, -0.3, 0.15), 60.0*RAD, -50.0*RAD, _V(-0.8, 0, 0), 0, 0);
- oapiVCSetNeighbours(2, 6, -1, 0);
- RegisterVC_AftMFD(); // activate aft MFD controls
- plop->RegisterVC(); // register panel R13L interface
- vccameracase = 2;
- VCCAM = 5;
- ok = true;
- break;
- case 6: // payload view position
- SetCameraOffset(_V(-0.65, 2.90, 12.644));
- SetCameraDefaultDirection(_V(-.7, -.1, -.7));
- SetCameraMovement(_V(0, -0.1, -0.1), 0, 80.0*RAD, _V(0.3, -0.3, 0.15), 60.0*RAD, -50.0*RAD, _V(-0.8, 0, 0), 0, 0);
- oapiVCSetNeighbours(5, 0, 0, 0);
- RegisterVC_AftMFD(); // activate aft MFD controls
- plop->RegisterVC(); // register panel R13L interface
- vccameracase = 2;
- VCCAM = 6;
- ok = true;
- break;
- }
- if (ok) {
- // register the HUDs (synced)
- oapiVCRegisterHUD(&huds);
- // register all MFD displays
- for (int i = 0; i < 6; i++) {
- mfds.ngroup = mfdgrp[i];
- oapiRegisterMFD(MFD_LEFT + i, &mfds);
- }
- // update panel R13L
- plop->UpdateVC();
- }
- return ok;
- }
- void Atlantis::panelswitch()
- {
- switchtimer = (switchtimer + 1);// count up
- sprintf(oapiDebugString(), "timer M: %d ", switchtimer);
- if (switchtimer > 10)switchtimer = 0; // if timer reaches point reset timer
- if (switchtimer == 0)return;//return since timer reached end
- }
- // --------------------------------------------------------------
- // Respond to virtual cockpit mouse event
- // --------------------------------------------------------------
- bool Atlantis::clbkVCMouseEvent(int id, int event, VECTOR3& p)
- {
- static bool counting = false;
- static double t0 = 0.0;
- switch (id) {
- // handle MFD selection buttons
- case AID_CDR1_BUTTONS:
- case AID_PLT1_BUTTONS:
- case AID_MFD1_BUTTONS:
- case AID_MFDSIDE_BUTTONS: {
- int mfd = id - AID_CDR1_BUTTONS + MFD_LEFT;
- int bt = (int)(p.x * 5.99);
- if (bt < 5) oapiProcessMFDButton(mfd, bt, event);
- else {
- if (event & PANEL_MOUSE_LBDOWN) {
- t0 = oapiGetSysTime();
- counting = true;
- }
- else if ((event & PANEL_MOUSE_LBUP) && counting) {
- oapiSendMFDKey(mfd, OAPI_KEY_F2);
- counting = false;
- }
- else if ((event & PANEL_MOUSE_LBPRESSED) && counting && (oapiGetSysTime() - t0 >= 1.0)) {
- oapiSendMFDKey(mfd, OAPI_KEY_F1);
- counting = false;
- }
- }
- } return true;
- // D. Beachy: handle power buttons
- case AID_CDR1_PWR:
- case AID_PLT1_PWR:
- case AID_MFD1_PWR:
- case AID_MFDSIDE_PWR: {
- int mfd = id - AID_CDR1_PWR + MFD_LEFT;
- oapiSendMFDKey(mfd, OAPI_KEY_ESCAPE);
- } return true;
- // handle MFD brightness buttons
- case AID_CDR1_BRT:
- case AID_PLT1_BRT:
- case AID_MFD1_BRT:
- case AID_MFDSIDE_BRT:
- {
- static double t0, brt0;
- static bool up;
- int mfd = id - AID_CDR1_BRT;
- if (event & PANEL_MOUSE_LBDOWN) {
- up = (p.x >= 0.5);
- t0 = oapiGetSysTime();
- brt0 = mfdbright[mfd];
- }
- else if (event & PANEL_MOUSE_LBPRESSED) {
- double dt = oapiGetSysTime() - t0;
- double brt, dbrt = dt * 0.2;
- if (up) brt = min(1.0, brt0 + dbrt);
- else brt = max(0.25, brt0 - dbrt);
- mfdbright[mfd] = brt;
- if (vis) {
- MATERIAL mat;
- memset(&mat, 0, sizeof(MATERIAL));
- mat.emissive.r = mat.emissive.g = mat.emissive.b = (float)brt;
- mat.emissive.a = 1.0f;
- DEVMESHHANDLE hMesh = GetDevMesh(vis, mesh_vc);
- oapiSetMaterial(hMesh, 20 + mfd, &mat);
- }
- }
- } return false;
- // handle panel R13L events (payload bay operations)
- case AID_R13L:
- return plop->VCMouseEvent(id, event, p);
- }
- return false;
- }
- void Atlantis::Revertextdoor(void) {
- EXT_status = ((EXT_status == HATCH_UP || EXT_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::RevertDockingRing(void) {
- DOCKRING_status = ((DOCKRING_status == HATCH_UP || DOCKRING_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::RevertDragchute(void) {
- CHUTE_status = ((CHUTE_status == HATCH_UP || CHUTE_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::OBSStilt(void) {
- OBSS_status = ((OBSS_status == HATCH_UP || OBSS_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::Armtilt(void) {
- Armtilt_status = ((Armtilt_status == HATCH_UP || Armtilt_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::RevertIUS(void) {
- ius_status = ((ius_status == HATCH_UP || ius_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::RevertPETD(void) {
- PETD_status = ((PETD_status == HATCH_UP || PETD_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::RevertSETD(void) {
- SETD_status = ((SETD_status == HATCH_UP || SETD_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::RevertSSMESTOW(void) {
- ssmestow_status = ((ssmestow_status == HATCH_UP || ssmestow_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::RevertADTA(void) {
- ADTA_status = ((ADTA_status == HATCH_UP || ADTA_status == HATCH_RAISING) ?
- HATCH_LOWERING : HATCH_RAISING);
- }
- void Atlantis::SetODSDock(void) {
- //DelDock(hDockODS);
- //sprintf(oapiDebugString(), "%0.4f ", ringpos.y);
- //hDockODS = CreateDock(_V(0,2.80,10.14), _V(0, 1, 0), _V(0, 0, -1));
- //SetDockParams(hDockODS, dockpos, _V(0, 1, 0), _V(0, 0, -1));
- }
- // --------------------------------------------------------------
- // Respond to virtual cockpit area redraw request
- // --------------------------------------------------------------
- bool Atlantis::clbkVCRedrawEvent (int id, int event, SURFHANDLE surf)
- {
- switch (id) {
- case AID_CDR1_BUTTONS:
- case AID_PLT1_BUTTONS:
- case AID_MFD1_BUTTONS:
- case AID_MFDSIDE_BUTTONS:
- case AID_CCTV1_BUTTONS:
- case AID_CCTV2_BUTTONS: {
- int mfd = id - AID_CDR1_BUTTONS + MFD_LEFT;
- RedrawPanel_MFDButton(surf, mfd);
- } return true;
- case AID_LANDINGGEARARM:
- {
- geararmed = 1;//gear is armed
- } return true;
- case AID_LANDINGGEARDN:
- {
- if (geararmed == 1) {//gear is armed
- SetAnimation(anim_LEFTGEARTALKBACK, .5);//move talkback to barber pole
- SetAnimation(anim_RIGHTGEARTALKBACK, .5);//move talkback to barber pole
- if (gear_proc == 0)RevertLandingGear();//move gear
- }
- } return true;
- case AID_LANDINGGEARARMRIGHT:
- {
- geararmed = 1;//gear is armed
- } return true;
- case AID_LANDINGGEARDNRIGHT:
- {
- if (geararmed == 1) {//gear is armed
- SetAnimation(anim_LEFTGEARTALKBACK, .5);//move talkback to barber pole
- SetAnimation(anim_RIGHTGEARTALKBACK, .5);//move talkback to barber pole
- if (gear_proc == 0)RevertLandingGear();//move gear
- }
- } return true;
- //afttimer
- case AID_AFTMETTIMERGMT:
- {
- GMTmode = 1;
- METmode = 0;
- Testmode = 0;
- SetAnimation(anim_AFTMETTIMER, 0);
- //SetAnimation(anim_mfd2, 0);
- } return true;
- case AID_AFTMETTIMERMET:
- {
- METmode = 1;
- Testmode = 0;
- GMTmode = 0;
- SetAnimation(anim_AFTMETTIMER, .5);
- //SetAnimation(anim_mfd2, 0);
- } return true;
- case AID_AFTMETTIMERTEST:
- {
- if (event & PANEL_MOUSE_LBDOWN) {
- Testmode = 1;
- METmode = 0;
- GMTmode = 0;
- SetAnimation(anim_AFTMETTIMER, 1);
- }
- if (event & PANEL_MOUSE_LBUP) {
- SetAnimation(anim_AFTMETTIMER, .5);
- Testmode = 0;
- METmode = 1;
- GMTmode = 0;
- }
- //SetAnimation(anim_mfd2, 0);
- } return true;
- //FRONTMET
- //
- case AID_METTIMERGMT:
- {
- FGMTmode = 1;
- FMETmode = 0;
- FTestmode = 0;
- SetAnimation(anim_FRTMET, 1);
- //SetAnimation(anim_mfd2, 0);
- } return true;
- case AID_METTIMERMET:
- {
- FMETmode = 1;
- FTestmode = 0;
- FGMTmode = 0;
- SetAnimation(anim_FRTMET, .5);
- //SetAnimation(anim_mfd2, 0);
- } return true;
- case AID_METTIMERTEST:
- {
- if (event & PANEL_MOUSE_LBDOWN) {
- FTestmode = 1;
- FMETmode = 0;
- FGMTmode = 0;
- SetAnimation(anim_FRTMET, 0);
- }
- if (event & PANEL_MOUSE_LBUP) {
- SetAnimation(anim_FRTMET, .5);
- FTestmode = 0;
- FMETmode = 1;
- FGMTmode = 0;
- }
- } return true;
- default:
- if (id >= AID_R13L_MIN && id <= AID_R13L_MAX)
- return plop->VCRedrawEvent(id, event, surf);
- break;
- }
- return false;
- }
- // --------------------------------------------------------------
- // Respond to a HUD redraw request
- // --------------------------------------------------------------
- bool Atlantis::clbkDrawHUD(int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp)
- {
- {
- // draw the default HUD
- VESSEL4::clbkDrawHUD(mode, hps, skp);
- int cx = hps->CX, cy = hps->CY;
- // show OMS thrust marker
- if (status >= 3) {
- int omsy = cy + (int)(15.0*hps->Scale);
- int dx = (int)(1.0*hps->Scale);
- skp->Line(cx - 2 * dx, omsy, cx + 2 * dx, omsy);
- skp->Line(cx, omsy - dx, cx, omsy + dx);
- }
- if (wheelbrake == 1){
- char cbuf[255];
- sprintf(cbuf, "WHEEL BRAKE APPLIED");
- skp->Text(hps->W / 3, hps->H / 10, cbuf, strlen(cbuf));
- }
- if (wheelbrake == 0){
- char cbuf[255];
- sprintf(cbuf, "");
- skp->Text(hps->W / 3, hps->H / 10, cbuf, strlen(cbuf));
- }
- if (DRAGCHUTEDEPLOYED == 1){
- char cbuf[255];
- sprintf(cbuf, "CHUTE DEPLOYED");
- skp->Text(hps->W / 3, hps->H / 10, cbuf, strlen(cbuf));
- }
- if (gear_proc >.9){
- char cbuf[255];
- sprintf(cbuf, "GEAR Down");
- skp->Text(hps->W / 3, hps->H / 5, cbuf, strlen(cbuf));
- }
- {
- // char cbuf[255];
- // if (whicheva == 0)sprintf(cbuf, "EVA1 selected");
- // if (whicheva == 1)sprintf(cbuf, "EVA2 selected");
- // if (whicheva == 2)sprintf(cbuf, "EVA3 selected");
- // if (whicheva == 3)sprintf(cbuf, "EVA4 selected");
- // skp->Text(hps->W / 4, hps->H / 6, cbuf, strlen(cbuf));
- }
- /*
- //ius stuff
- if (USEIUS == 1){
- char cbuf[255];
- //tilt of ase/IUS
- //sprintf(oapiDebugString(), " tipx %f tipy %f tipz %f", arm1_tip[1].x, arm1_tip[1].y, arm1_tip[1].z);
- // if (tilt == 1)tiltvalue = .6; //first step
- // if (tilt == 3)tiltvalue = 1.0; //2nd step
- //phi = phi + .001;//move up second step
- // if (tilt == 1) phi = (phi + .001);//move up
- // if (tilt == 2) phi = (phi - .001);//move down
- // if (tilt == 4) phi = (phi + .001);//move down
- sprintf(cbuf, "IUS STATUS "); //degree of ase tilt
- skp->Text(hps->W / 3, hps->H / 5.5, cbuf, strlen(cbuf));
- sprintf(cbuf, "TILT TABLE %0.0f ", phi / .017); //degree of ase tilt
- skp->Text(hps->W / 3, hps->H / 5, cbuf, strlen(cbuf));
- /*
- if ((tilt == 1) && (phi < tiltvalue)){
- sprintf(cbuf, "IUS moving to first stop");
- skp->Text(hps->W / 3, hps->H / 5, cbuf, strlen(cbuf));
- }
- if (tilt == 3) {
- sprintf(cbuf, "IUS at first stop");
- skp->Text(hps->W / 3, hps->H / 5, cbuf, strlen(cbuf));
- }
- if ((tilt == 4) && (phi < tiltvalue)) {
- sprintf(cbuf, "IUS moving to second stop");
- skp->Text(hps->W / 3, hps->H / 5, cbuf, strlen(cbuf));
- }
- if (phi == tiltvalue) {//ius tilt at max
- sprintf(cbuf, "ENJ ENH");
- skp->Text(hps->W / 3, hps->H / 4.5, cbuf, strlen(cbuf));
- }
- //sprintf(oapiDebugString(), " phi %f tiltvalue %f", phi, tiltvalue);
- //if (tilt == 5) {
- // sprintf(cbuf, "IUS ready to deploy");
- // skp->Text(hps->W / 3, hps->H / 5, cbuf, strlen(cbuf));
- //}
- //if (GetAttachmentStatus(sat_attach)==NULL)//ius deployed so clear ius info
- // sprintf(cbuf, " ");
- //skp->Text(hps->W / 3, hps->H / 4.5, cbuf, strlen(cbuf));
- }
- if (SPIN3 == 1){
- char cbuf[255];
- //tilt of ase/IUS
- //sprintf(oapiDebugString(), " tipx %f tipy %f tipz %f", arm1_tip[1].x, arm1_tip[1].y, arm1_tip[1].z);
- // if (tilt == 1)tiltvalue = .6; //first step
- // if (tilt == 3)tiltvalue = 1.0; //2nd step
- //phi = phi + .001;//move up second step
- // if (tilt == 1) phi = (phi + .001);//move up
- // if (tilt == 2) phi = (phi - .001);//move down
- // if (tilt == 4) phi = (phi + .001);//move down
- sprintf(cbuf, "ENJ ENH"); //degree of ase tilt
- skp->Text(hps->W / 3, hps->H / 5.5, cbuf, strlen(cbuf));
- }
- */
- //show speedbrake status
- int d = hps->Markersize / 2;
- spbrkx = ((spdb_proc*-10) + 5);
- //int spbrkx = (spdb_proc +int (10.0*hps->Scale));
- //if (spdb_proc == 0)spbrkx = 5;
- //if (spdb_proc == 1)spbrkx = -5;
- //if (spdb_proc == .5)spbrkx = 0;
- //if (spdb_proc == .25)spbrkx = 2.5;
- //if (spdb_proc == .75)spbrkx = -2.5;
- //sprintf(oapiDebugString(), "spbrkx %f spdb_proc %7.2f ", SpeedFactor, arm_ep);
- skp->Line(cx - d * -5, cy + d * 22, cx - d*-5, cy + d * 23);
- skp->Line(cx - d * -5, cy + d * 23, cx - d * 5, cy + d * 23);//bottom line
- skp->Line(cx - d * -4, cy + d * 22, cx - d*-4, cy + d * 23);
- skp->Line(cx - d * -3, cy + d * 22, cx - d*-3, cy + d * 23);
- skp->Line(cx - d * -2, cy + d * 22, cx - d*-2, cy + d * 23);
- skp->Line(cx - d * -1, cy + d * 22, cx - d*-1, cy + d * 23);
- skp->Line(cx - d * 0, cy + d * 22, cx - d * 0, cy + d * 23);
- skp->Line(cx - d * 1, cy + d * 22, cx - d * 1, cy + d * 23);
- skp->Line(cx - d * 2, cy + d * 22, cx - d * 2, cy + d * 23);
- skp->Line(cx - d * 3, cy + d * 22, cx - d * 3, cy + d * 23);
- skp->Line(cx - d * 4, cy + d * 22, cx - d * 4, cy + d * 23);
- skp->Line(cx - d * 5, cy + d * 22, cx - d * 5, cy + d * 23);
- //skp->Rectangle(cx - d * -5, cy + d * 22, cx - d*-4, cy + d * 23);
- //skp->Rectangle(cx - d * -4, cy + d * 22, cx - d*-3, cy + d * 23);
- //skp->Rectangle(cx - d * -3, cy + d * 22, cx - d*-2, cy + d * 23);
- //skp->Rectangle(cx - d * -2, cy + d * 22, cx - d*-1, cy + d * 23);
- //skp->Rectangle(cx - d * -1, cy + d * 22, cx - 0 , cy + d * 23);
- //skp->Rectangle(cx - d * 0, cy + d * 22, cx - d, cy + d * 23);
- //skp->Rectangle(cx - d * 3, cy + d * 22, cx - d * 2, cy + d * 23);
- //skp->Rectangle(cx - d * 2, cy + d * 22, cx - d*1 , cy + d * 23);
- //skp->Rectangle(cx - d * 4, cy + d * 22, cx - d *3, cy + d * 23);
- //skp->Rectangle(cx - d * 5, cy + d * 22, cx - d * 4, cy + d * 23);
- skp->Line(cx - d*spbrkx - 6, cy + d * 21, cx - d*spbrkx + 6, cy + d * 21);
- skp->Line(cx - d*spbrkx - 6, cy + d * 21, cx - d*spbrkx, cy + d * 23);
- skp->Line(cx - d*spbrkx + 6, cy + d * 21, cx - d*spbrkx, cy + d * 23);
- //skp->Line(cx - d*spbrkx-6, cy + d * 21.5, cx - d*spbrkx, cy + d * 22);
- // show RCS mode
- if (status >= 3 && oapiCockpitMode() == COCKPIT_VIRTUAL) {
- switch (GetAttitudeMode()) {
- case RCS_ROT:
- skp->Text(0, hps->H - 13, "RCS ROT", 7);
- break;
- case RCS_LIN:
- skp->Text(0, hps->H - 13, "RCS_LIN", 7);
- break;
- }
- }
- arm6_ByHUD = ((arm6_By - systart)*-360); //anim state to degrees
- arm6_BpHUD = ((arm6_Bp - spstart) * 147);
- arm6_epHUD = ((arm6_ep - epstart) * -162);
- arm6_ApHUD = ((arm6_Ap - wpstart) * 240);
- arm6_AyHUD = ((arm6_Ay - wystart) * 240);
- arm6_ArHUD = ((arm6_Ar -wrstart) * 894);
- arm_syHUD = ((arm_sy - systart)*-360);
- arm_spHUD = ((arm_sp - spstart) * 147);
- arm_epHUD = ((arm_ep - epstart)*-162);
- arm_wpHUD = ((arm_wp - wpstart) * 240);
- arm_wyHUD = ((arm_wy - wystart) * 240);
- arm_wrHUD = ((arm_wr - wrstart) * 894);
- if (rmshud == 1){//show rms screen
- char cbuf[255];
- sprintf(cbuf, " SY SP EP WP WY WR");
- skp->Text(hps->W / 35, hps->H / 4.7, cbuf, strlen(cbuf));
- sprintf(cbuf, "%7.1f %7.1f %7.1f %7.1f %7.1f %7.1f (current)", arm_syHUD, arm_spHUD,arm_epHUD, arm_wpHUD, arm_wyHUD, arm_wrHUD);
- skp->Text(hps->W / 35, (hps->H / 8.2) + (2.8*hps->Markersize), cbuf, strlen(cbuf));
- sprintf(cbuf, "%7.1f %7.1f %7.1f %7.1f %7.1f %7.1f TGT", arm6_ByHUD, arm6_BpHUD, arm6_epHUD, arm6_ApHUD, arm6_AyHUD, arm6_ArHUD);
- skp->Text(hps->W / 35, (hps->H / 4.8) + (hps->Markersize), cbuf, strlen(cbuf));
- sprintf(cbuf, "%7.1f %7.1f %7.1f %7.1f %7.1f %7.1f ERR", arm_syHUD - arm6_ByHUD, arm_spHUD - arm6_BpHUD,
- arm_epHUD - arm6_epHUD, arm_wpHUD - arm6_ApHUD, arm_wyHUD - arm6_AyHUD, arm_wrHUD - arm6_ArHUD);
- skp->Text(hps->W / 35, (hps->H / 4.8) + (1.5*hps->Markersize), cbuf, strlen(cbuf));
- //
- /*
- char cbuf[255];
- sprintf(cbuf, " SY SP EP WP WY WR");
- skp->Text(hps->W / 35, hps->H / 4.8, cbuf, strlen(cbuf));
- sprintf(cbuf, "(current)%7.1f %7.1f %7.1f %7.1f %7.1f %7.1f", arm_syHUD, arm_spHUD, arm_epHUD, arm_wpHUD, arm_wyHUD, arm_wrHUD);
- skp->Text(hps->W / 35, (hps->H / 8.2) + (2.8*hps->Markersize), cbuf, strlen(cbuf));
- sprintf(cbuf, "TGT %7.1f %7.1f %7.1f %7.1f %7.1f %7.1f ", arm6_ByHUD, arm6_BpHUD, arm6_epHUD, arm6_ApHUD, arm6_AyHUD, arm6_ArHUD);
- skp->Text(hps->W / 35, (hps->H / 4.8) + (hps->Markersize), cbuf, strlen(cbuf));
- sprintf(cbuf, "ERR %7.1f %7.1f %7.1f %7.1f %7.1f %7.1f ", (arm_syHUD - arm6_ByHUD), (arm_spHUD - arm6_BpHUD), (arm_epHUD - arm6_epHUD), (arm_wpHUD - arm6_ApHUD), (arm_wyHUD - arm6_AyHUD), (arm_wrHUD - arm6_ArHUD));
- ;
- skp->Text(hps->W / 35, (hps->H / 4.8) + (1.5*hps->Markersize), cbuf, strlen(cbuf));
- */
- // position/attitude
- sprintf(cbuf, " X Y Z ");
- skp->Text(hps->W / 35, hps->H / 10 + (4.7*hps->Markersize), cbuf, strlen(cbuf));
- sprintf(cbuf, " %+5.0f %+5.0f %+5.0f ", arm_tip[0].x, arm_tip[0].y, arm_tip[0].z);
- skp->Text(hps->W / 35, hps->H / 10 + (5.2*hps->Markersize), cbuf, strlen(cbuf));
- if (Armtilt_proc == 0) sprintf(cbuf, "ARM Latched");
- if ((Armtilt_proc > 0) && (Armtilt_proc <1))sprintf(cbuf, "ARM Transition");
- if (Armtilt_proc == 1) sprintf(cbuf, "ARM Deployed");
- skp->Text(hps->W / 35, (hps->H / 5) + (2.8*hps->Markersize), cbuf, strlen(cbuf));
- if (rmsspeed == 0) sprintf(cbuf, "ARM Speed =1");
- if (rmsspeed == 1) sprintf(cbuf, "ARM Speed =2");
- if (rmsspeed == 2) sprintf(cbuf, "ARM Speed =3");
- if (rmsspeed == 3) sprintf(cbuf, "ARM Speed =4");
- if (rmsspeed == 4) sprintf(cbuf, "ARM Speed =5");
- if (rmsspeed == 5) sprintf(cbuf, "ARM Speed =10");
- skp->Text(hps->W / 35, (hps->H / 3) + (.2*hps->Markersize), cbuf, strlen(cbuf));
- if (arm1set) sprintf(cbuf, "1");
- skp->Text(hps->W / 35, (hps->H / 5) + (4*hps->Markersize), cbuf, strlen(cbuf));
- if (arm2set) sprintf(cbuf, "1 2");
- skp->Text(hps->W / 35, (hps->H / 5) + (4*hps->Markersize), cbuf, strlen(cbuf));
- if (arm3set) sprintf(cbuf, "1 2 3");
- skp->Text(hps->W / 35, (hps->H / 5) + (4*hps->Markersize), cbuf, strlen(cbuf));
- if (arm4set) sprintf(cbuf, "1 2 3 4");
- skp->Text(hps->W / 35, (hps->H / 5) + (4*hps->Markersize), cbuf, strlen(cbuf));
- if (GRAB == 1)
- {
- skp->SetTextColor(0x0066FF66);
- char abuf[256];
- sprintf(abuf, "Distance to attachment %0.4f", distattach);
- skp->Text(hps->W / 35, (hps->H / 5) + (5 * hps->Markersize), abuf, strlen(abuf));
- }
- if (GRAB == 0) {
- skp->SetTextColor(0x0066FF66);
- char abuf[256];
- sprintf(abuf, " ");
- skp->Text(hps->W / 35, (hps->H / 5) + (5 * hps->Markersize), abuf, strlen(abuf));
- }
- }
- return true;
- }
- }
- VECTOR3 Atlantis::CalcAnimationFKArm() {
- //Do forward kinematics to get the current position of the wrist joint
- double current_phi_s = linterp(0, shoulder_min, 1, shoulder_max, arm_sp);
- double current_phi_e = linterp(0, elbow_min, 1, elbow_max, arm_ep);
- double current_beta_s = linterp(0, -180, 1, 180, arm_sy);
- double current_phi_l = current_phi_s - current_phi_e;
- double rho_e = lu*cos(RAD*current_phi_s);
- double z_e = lu*sin(RAD*current_phi_s);
- double rho_w = rho_e + ll*cos(RAD*current_phi_l);
- double z_w = z_e + ll*sin(RAD*current_phi_l);
- double x_w = rho_w*cos(RAD*current_beta_s);
- double y_w = rho_w*sin(RAD*current_beta_s);
- // sprintf(oapiDebugString(),"ll %f lu %f arm_sy %f beta_s %f arm_sp %f phi_s %f arm_ep %f phi_e %f FK %f,%f,%f",ll,lu,arm_sy,current_beta_s,arm_sp,current_phi_s,arm_ep,current_phi_e,x_w,y_w,z_w);
- return _V(x_w, y_w, z_w);
- }
- void Atlantis::SetAnimationIKArm(VECTOR3 arm_wrist_dpos) {
- arm_wrist_pos = CalcAnimationFKArm();
- //Candidate position. Calculate the joints on it...
- VECTOR3 arm_wrist_cpos = arm_wrist_pos + arm_wrist_dpos;
- double r = length(arm_wrist_cpos);
- double beta_s = DEG*atan2(arm_wrist_cpos.y, arm_wrist_cpos.x);
- double rho = sqrt(arm_wrist_cpos.x*arm_wrist_cpos.x + arm_wrist_cpos.y*arm_wrist_cpos.y);
- double cos_phibar_e = (r*r - lu*lu - ll*ll) / (-2 * lu*ll);
- if (fabs(cos_phibar_e)>1) return;//Can't reach new point with the elbow
- double phi_e = 180 - DEG*acos(cos_phibar_e);
- double cos_phi_s2 = (ll*ll - lu*lu - r*r) / (-2 * lu*r);
- if (fabs(cos_phi_s2)>1) return; //Can't reach with shoulder
- double phi_s = DEG*(atan2(arm_wrist_cpos.z, rho) + acos(cos_phi_s2));
- double anim_phi_s = linterp(shoulder_min, 0, shoulder_max, 1, phi_s);
- double anim_phi_e = linterp(elbow_min, 0, elbow_max, 1, phi_e);
- double anim_beta_s = linterp(-180, 0, 180, 1, beta_s);
- if (anim_beta_s<0 || anim_beta_s>1) return;
- if (anim_phi_s<0 || anim_phi_s>1) return;
- if (anim_phi_e<0 || anim_phi_e>1) return;
- //but only keep it and set the joints if no constraints are violated.
- //Limited IK on the wrist
- double new_phi_l = phi_s - phi_e;
- double current_phi_w = linterp(0, wrist_min, 1, wrist_max, arm_wp);
- double current_phi_s = linterp(0, shoulder_min, 1, shoulder_max, arm_sp);
- double current_phi_e = linterp(0, elbow_min, 1, elbow_max, arm_ep);
- double current_beta_s = linterp(0, -180, 1, 180, arm_sy);
- double current_phi_l = current_phi_s - current_phi_e;
- double new_phi_w = current_phi_w - new_phi_l + current_phi_l;
- double anim_phi_w = linterp(wrist_min, 0, wrist_max, 1, new_phi_w);
- arm_sy = anim_beta_s;
- SetAnimationArm(anim_arm_sy, arm_sy);
- arm_sp = anim_phi_s;
- SetAnimationArm(anim_arm_sp, arm_sp);
- arm_ep = anim_phi_e;
- SetAnimationArm(anim_arm_ep, arm_ep);
- arm_wp = anim_phi_w;
- SetAnimationArm(anim_arm_wp, arm_wp);
- arm_wrist_pos = arm_wrist_cpos;
- }
- // --------------------------------------------------------------
- // Keyboard interface handler (buffered key events)
- // --------------------------------------------------------------
- int Atlantis::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate)
- {
- if (!down) return 0; // only process keydown events
- if (KEYMOD_SHIFT(kstate)) {
- switch (key) {
- case OAPI_KEY_B: //turn lights on/off
- {
- // if (light_status == 0) light_status = 1;
- // else if (light_status == 1) light_status = 0;
- // return 1;
- }
- case OAPI_KEY_F: //armseq
- {
- ARMSEQ();
- }
- case OAPI_KEY_F6:{
- DetachChild(sat_attach, 1.0);
- return 1;
- }
- case OAPI_KEY_E:
- {
- Revertextdoor();
- //case OAPI_KEY_B: // deploy/retract speedbrake
- // if (!Playback()) RevertSpeedbrake();
- return 1;
- }
- case OAPI_KEY_0:
- {
- spdb_off = 1;
- spdb_on = 0;
- RevertSpeedbrake();
- return 1;
- }
- case OAPI_KEY_9:
- {
- spdb_off = 0;
- spdb_on = 1;
- RevertSpeedbrake();
- return 1;
- }
- case OAPI_KEY_V:
- {
- CAM = 6;//elbow
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- //rmshud
- case OAPI_KEY_J:
- {
- if (rmshud == 0) rmshud = 1;
- else (rmshud = 0);
- return 1;
- }
- case OAPI_KEY_Z:
- {
- CAM = 8; //SelectCockpitView(CAM);
- SetAnimationCameras(); SelectCockpitView(CAM);
- return 1;
- }
- case OAPI_KEY_X: //Armtilt
- {
- Armtilt();
- return 1;
- }
- case OAPI_KEY_S: //RMS speed
- {
- if (rmsspeed == 0) rmsspeed = 1;
- else if (rmsspeed == 1) rmsspeed = 2;
- else if (rmsspeed == 2) rmsspeed = 3;
- else if (rmsspeed == 3) rmsspeed = 4;
- else if (rmsspeed == 4) rmsspeed = 5;
- else if (rmsspeed == 5) rmsspeed = 0;
- return 1;
- }
- }
- }
- else if (KEYMOD_CONTROL(kstate)) {
- switch (key) {
- case OAPI_KEY_SPACE: // open RMS control dialog
- oapiOpenDialogEx(g_Param.hDLL, IDD_CTRL, Atlantis_DlgProc, 0, this);
- return 1;
- case OAPI_KEY_B: // deploy/retract speedbrake
- if (!Playback()) RevertSpeedbrake();
- return 1;
- case OAPI_KEY_8: // stop rms
- //rmsexecute = 0;
- return 1;
- case OAPI_KEY_COMMA: // speed brake
- spdb_auto = 1;
- return 1;
- case OAPI_KEY_J: // deploy/retract External Tank Hatch
- RevertSETD();
- RevertPETD();
- return 1;
- case OAPI_KEY_7: // deploy/stow SSME
- RevertSSMESTOW();
- return 1;
- case OAPI_KEY_U: // deploy/store Ku-band antenna
- if (!Playback()) plop->RevertKuAntennaAction();
- return 1;
- case OAPI_KEY_G: // deploy/retract speedbrake
- geararmed = 1;
- return 1;
- case OAPI_KEY_L: // deploy/store Ku-band antenna
- { if (!Playback())
- (plop->MechPwr[0] = plop->MP_ON) || (plop->MechPwr[1] = plop->MP_ON);//if power is off turn power on.
- { // check both systems are set correctly
- (plop->MechPwr[0] = plop->MP_ON) || (plop->MechPwr[1] = plop->MP_ON);//if power is off turn power on.
- (plop->RadiatorCtrl[0] = plop->RC_DEPLOY);
- (plop->RadiatorCtrl[1] = plop->RC_DEPLOY);
- //if plop->(action == AnimState::CLOSING && RadiatorCtrl[i] != RC_STOW) return;
- }
- }
- case OAPI_KEY_5: //Armtilt
- {
- RevertADTA();
- return 1;
- }
- case OAPI_KEY_X: //Armtilt
- {
- OBSStilt();
- return 1;
- }
- case OAPI_KEY_6: //arminput
- {
- ARMINPUT();
- return 1;
- }
- case OAPI_KEY_V:
- {
- CAM = 7;//eecamera
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- }
- }
- else if (KEYMOD_ALT(kstate)) {
- switch (key) {
- case OAPI_KEY_B: //turn aft lights on/off
- {
- // if (aft_light_status == 0) aft_light_status = 1;
- // else if (aft_light_status == 1) aft_light_status = 0;
- // return 1;
- }
- case OAPI_KEY_1:
- {
- // ReleaseDragchute();
- center_arm = false;
- return 1;
- }
- case OAPI_KEY_2:
- {
- // ReleaseDragchute();
- center_arm = true;
- return 1;
- }
- case OAPI_KEY_J:
- {
- // ReleaseDragchute();
- // IUS_check = IUS_UP;
- return 1;
- }
- }
- }
- else { // unmodified keys
- switch (key) {
- case OAPI_KEY_G: // "Landing gear"
- if (geararmed == 1) {
- SetAnimation(anim_LEFTGEARTALKBACK, .5);//move talkback to barber pole
- SetAnimation(anim_RIGHTGEARTALKBACK, .5);//move talkback to barber pole
- if (!Playback()) RevertLandingGear();
- }
- return 1;
- case OAPI_KEY_J: // "Jettison"
- //if (!Playback()) bManualSeparate = true;
- return 1;
- case OAPI_KEY_K: // "Cargo bay doors"
- if (!Playback()) plop->RevertDoorAction();
- return 1;
- case OAPI_KEY_8:
- ToggleGrapple();
- return 1;
- case OAPI_KEY_COMMA:
- spdb_plus=1;
- return 1;
- case OAPI_KEY_PERIOD:
- spdb_minus = 1;
- return 1;
- case OAPI_KEY_9:
- //center_arm = true;
- FULLINPUT();
- return 1;
- case OAPI_KEY_B:
- {
- if (wheelbrake == 0){
- SetWheelbrakeLevel(1, 0);
- wheelbrake = 1;
- }
- else {
- wheelbrake = 0;
- SetWheelbrakeLevel(0, 0);
- }
- return 1;
- }
- case OAPI_KEY_1:
- {
- CAM = 1;
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- case OAPI_KEY_2:
- {
- CAM = 2;
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- case OAPI_KEY_3:
- {
- CAM = 3;
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- case OAPI_KEY_4:
- {
- CAM = 4;
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- case OAPI_KEY_5:
- {
- CAM = 5;
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- case OAPI_KEY_V:
- {
- CAM = 0;
- vccameracase = 4;
- //SelectCockpitView(CAM);
- SetAnimationCameras();
- return 1;
- }
- }
- }
- return 0;
- }
- // ==============================================================
- // API callback interface
- // ==============================================================
- // --------------------------------------------------------------
- // Module initialisation
- // --------------------------------------------------------------
- DLLCLBK void InitModule (HINSTANCE hModule)
- {
- g_Param.hDLL = hModule;
- oapiRegisterCustomControls (hModule);
- g_Param.tkbk_label = oapiCreateSurface (LOADBMP (IDB_TKBKLABEL));
- // allocate GDI resources
- g_Param.font[0] = CreateFont (-11, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
- g_Param.font[1] = CreateFont(70, 0, 0, 0, 000, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
- g_Param.font[2] = CreateFont(40, 0, 0, 0, 0, 000, 0, 0, 0, 0, 0, 0, 0, "Seven Segment");
- g_Param.font[3] = CreateFont(70, 0, 0, 0, 000, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
- g_Param.font[4] = CreateFont(50, 0, 0, 0, 0, 000, 0, 0, 0, 0, 0, 0, 0, "Seven Segment");
- g_Param.font[5] = CreateFont(25, 0, 0, 0, 0, 000, 0, 0, 0, 0, 0, 0, 0, "Seven Segment");
- }
- DLLCLBK void ExitModule (HINSTANCE hModule)
- {
- oapiUnregisterCustomControls (hModule);
- oapiDestroySurface (g_Param.tkbk_label);
- // deallocate GDI resources
- DeleteObject (g_Param.font[0]);
- }
- // --------------------------------------------------------------
- // Vessel initialisation
- // --------------------------------------------------------------
- DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
- {
- return new Atlantis (hvessel, flightmodel);
- }
- // --------------------------------------------------------------
- // Vessel cleanup
- // --------------------------------------------------------------
- DLLCLBK void ovcExit (VESSEL *vessel)
- {
- if (vessel) delete (Atlantis*)vessel;
- oapiReleaseFont(Atlantis::font3);
- }
- // ==============================================================
- // Message callback function for Atlantis control dialog box
- // ==============================================================
- BOOL CALLBACK Atlantis_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext (hWnd));
- // pointer to vessel instance was passed as dialog context
- switch (uMsg) {
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- oapiCloseDialog(hWnd);
- return TRUE;
- //case IDC_ASCENTAP:
- // sts->CreateAscentAPDlg();
- // break;
- case IDC_PLBAYOP:
- sts->plop->OpenDialog();
- break;
- case IDC_RMSOP:
- oapiOpenDialogEx(g_Param.hDLL, IDD_RMS, RMS_DlgProc, 0, sts);
- (sts->RMSDIALOG = 2);
- break;
- case IDC_LIGHT3:
- oapiOpenDialogEx(g_Param.hDLL, IDD_PAYLOAD1, EVA_DlgProc, 0, sts);
- break;
- case IDC_LIGHT:
- oapiOpenDialogEx(g_Param.hDLL, IDD_LIGHT, LIGHT_DlgProc, 0, sts);
- break;
- case IDC_LIGHT2:
- oapiOpenDialogEx(g_Param.hDLL, IDD_PAYLOAD, PAYLOADOPERATION_DlgProc, 0, sts);
- break;
- }
- break;
- }
- return oapiDefDialogProc (hWnd, uMsg, wParam, lParam);
- }
- // ==============================================================
- // Message callback function for RMS control dialog box
- // ==============================================================
- BOOL CALLBACK RMS_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext (hWnd));
- // pointer to vessel instance was passed as dialog context
- const double step = 0.05*RAD;
- static double t0;
- double t1;
- HICON hIcon;
- HWND hDlg;
- switch (uMsg) {
- case WM_INITDIALOG:
- hIcon = LoadIcon (g_Param.hDLL, MAKEINTRESOURCE(IDI_UP));
- SendDlgItemMessage (hWnd, IDC_WRIST_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendDlgItemMessage (hWnd, IDC_ELBOW_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendDlgItemMessage (hWnd, IDC_SHOULDER_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon (g_Param.hDLL, MAKEINTRESOURCE(IDI_DOWN));
- SendDlgItemMessage (hWnd, IDC_WRIST_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendDlgItemMessage (hWnd, IDC_ELBOW_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendDlgItemMessage (hWnd, IDC_SHOULDER_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon (g_Param.hDLL, MAKEINTRESOURCE(IDI_LEFT));
- SendDlgItemMessage (hWnd, IDC_WRIST_YAWLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendDlgItemMessage (hWnd, IDC_SHOULDER_YAWLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon (g_Param.hDLL, MAKEINTRESOURCE(IDI_RIGHT));
- SendDlgItemMessage (hWnd, IDC_WRIST_YAWRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendDlgItemMessage (hWnd, IDC_SHOULDER_YAWRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon (g_Param.hDLL, MAKEINTRESOURCE(IDI_RRIGHT));
- SendDlgItemMessage (hWnd, IDC_WRIST_ROLLRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon (g_Param.hDLL, MAKEINTRESOURCE(IDI_RLEFT));
- SendDlgItemMessage (hWnd, IDC_WRIST_ROLLLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendDlgItemMessage (hWnd, IDC_SHOWGRAPPLE, BM_SETCHECK, oapiGetShowGrapplePoints() ? BST_CHECKED:BST_UNCHECKED, 0);
- SetWindowText (GetDlgItem (hWnd, IDC_GRAPPLE), sts->SatGrappled() ? "Release" : "Grapple");
- EnableWindow (GetDlgItem (hWnd, IDC_STOW), sts->SatGrappled() ? FALSE : TRUE);
- SetWindowText (GetDlgItem (hWnd, IDC_PAYLOAD), sts->SatStowed() ? "Release" : "Arrest");
- EnableWindow (GetDlgItem (hWnd, IDC_PAYLOAD), sts->SatStowed() ? TRUE:FALSE);
- SetWindowText(GetDlgItem(hWnd, IDC_PAYLOAD2), sts->SatStowed2() ? "Release" : "Arrest");
- EnableWindow(GetDlgItem(hWnd, IDC_PAYLOAD2), sts->SatStowed2() ? TRUE : FALSE);
- SetWindowText(GetDlgItem(hWnd, IDC_PAYLOAD3), sts->SatStowed3() ? "Release" : "Arrest");
- EnableWindow(GetDlgItem(hWnd, IDC_PAYLOAD3), sts->SatStowed3() ? TRUE : FALSE);
- SetTimer (hWnd, 1, 100, NULL);
- t0 = oapiGetSimTime();
- return FALSE;
- case WM_DESTROY:
- KillTimer (hWnd, 1);
- return 0;
- case WM_TIMER:
- if (wParam == 1) {
- t1 = oapiGetSimTime();
- if (SendDlgItemMessage (hWnd, IDC_SHOULDER_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_sy = min(1.0, sts->arm_sy + (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_sy, sts->arm_sy);
- } else if (SendDlgItemMessage (hWnd, IDC_SHOULDER_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_sy = max(0.0, sts->arm_sy - (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_sy, sts->arm_sy);
- } else if (SendDlgItemMessage (hWnd, IDC_SHOULDER_PITCHUP, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_sp = min(1.0, sts->arm_sp + (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_sp, sts->arm_sp);
- } else if (SendDlgItemMessage (hWnd, IDC_SHOULDER_PITCHDOWN, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_sp = max(0.0, sts->arm_sp - (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_sp, sts->arm_sp);
- } else if (SendDlgItemMessage (hWnd, IDC_ELBOW_PITCHUP, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_ep = max(0.0, sts->arm_ep - (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_ep, sts->arm_ep);
- } else if (SendDlgItemMessage (hWnd, IDC_ELBOW_PITCHDOWN, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_ep = min(1.0, sts->arm_ep + (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_ep, sts->arm_ep);
- } else if (SendDlgItemMessage (hWnd, IDC_WRIST_PITCHUP, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_wp = min(1.0, sts->arm_wp + (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_wp, sts->arm_wp);
- } else if (SendDlgItemMessage (hWnd, IDC_WRIST_PITCHDOWN, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_wp = max(0.0, sts->arm_wp - (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_wp, sts->arm_wp);
- } else if (SendDlgItemMessage (hWnd, IDC_WRIST_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_wy = min(1.0, sts->arm_wy + (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_wy, sts->arm_wy);
- } else if (SendDlgItemMessage (hWnd, IDC_WRIST_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_wy = max(0.0, sts->arm_wy - (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_wy, sts->arm_wy);
- } else if (SendDlgItemMessage (hWnd, IDC_WRIST_ROLLLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_wr = max(0.0, sts->arm_wr - (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm (sts->anim_arm_wr, sts->arm_wr);
- }
- else if (SendDlgItemMessage(hWnd, IDC_WRIST_ROLLRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->arm_wr = min(1.0, sts->arm_wr + (t1 - t0)*sts->ARM_OPERATING_SPEED);
- sts->SetAnimationArm(sts->anim_arm_wr, sts->arm_wr);
- }
- //ik
- else if (SendDlgItemMessage(hWnd, IDC_TRANS_PX, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->SetAnimationIKArm(_V(+1, 0, 0)*(t1 - t0)*sts->ARM_OPERATING_SPEED);
- }
- else if (SendDlgItemMessage(hWnd, IDC_TRANS_PY, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->SetAnimationIKArm(_V(0, +1, 0)*(t1 - t0)*sts->ARM_OPERATING_SPEED);
- }
- else if (SendDlgItemMessage(hWnd, IDC_TRANS_PZ, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->SetAnimationIKArm(_V(0, 0, +1)*(t1 - t0)*sts->ARM_OPERATING_SPEED);
- }
- else if (SendDlgItemMessage(hWnd, IDC_TRANS_MX, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->SetAnimationIKArm(_V(-1, 0, 0)*(t1 - t0)*sts->ARM_OPERATING_SPEED);
- }
- else if (SendDlgItemMessage(hWnd, IDC_TRANS_MY, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->SetAnimationIKArm(_V(0, -1, 0)*(t1 - t0)*sts->ARM_OPERATING_SPEED);
- }
- else if (SendDlgItemMessage(hWnd, IDC_TRANS_MZ, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->SetAnimationIKArm(_V(0, 0, -1)*(t1 - t0)*sts->ARM_OPERATING_SPEED);
- }
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- if (sts->rmslight_status == 1){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED2), "LIGHT ON");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- if (sts->rmslight_status == 0){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED2), "LIGHT OFF");
- //EnableWindow(GetDlgItem(hDlgsts->rmslight_status = 0;
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_SPEED2, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- if (sts->rmslight_status == 0){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED2), "LIGHT ON");
- sts->rmslight_status = 1;
- }
- else if (sts->rmslight_status == 1){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED2), "LIGHT OFF");
- sts->rmslight_status = 0;
- }
- }
- }
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- if (sts->rmsspeed == 0){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 1");
- }
- else if (sts->rmsspeed == 1){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 2");
- }
- else if (sts->rmsspeed == 2){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 3");
- }
- else if (sts->rmsspeed == 3){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 4");
- }
- else if (sts->rmsspeed == 4){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 5");
- }
- else if (sts->rmsspeed == 5){
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 10");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_SPEED, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- if (sts->rmsspeed == 0){
- // SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 2");
- sts->rmsspeed = 1;
- sts->ARM_OPERATING_SPEED = .01;
- }
- else if (sts->rmsspeed == 1){
- // SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 3");
- sts->rmsspeed = 2;
- sts->ARM_OPERATING_SPEED = .02;
- }
- else if (sts->rmsspeed == 2){
- // SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 4");
- sts->rmsspeed = 3;
- sts->ARM_OPERATING_SPEED = .03;
- }
- else if (sts->rmsspeed == 3){
- // SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 5");
- sts->rmsspeed = 4;
- sts->ARM_OPERATING_SPEED = .04;
- }
- else if (sts->rmsspeed == 4){
- // SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 10");
- sts->rmsspeed = 5;
- sts->ARM_OPERATING_SPEED = .1;
- }
- else if (sts->rmsspeed == 5){
- // SetWindowText(GetDlgItem(hDlg, IDC_SPEED), "Speed 1");
- sts->rmsspeed = 0;
- sts->ARM_OPERATING_SPEED = .01;
- }
- }
- }
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- if (sts->Armtilt_proc >=1)
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED3), "Arm Deployed");
- if (sts->Armtilt_proc <=0)
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED3), "Arm Latch");
- if ((sts->Armtilt_proc >0) && (sts->Armtilt_proc <1))
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED3), "////////");
- if (sts->OBSS_proc >= 1)
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED4), "Arm Deployed");
- if (sts->OBSS_proc <= 0)
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED4), "Arm Latch");
- if ((sts->OBSS_proc >0) && (sts->OBSS_proc <1))
- SetWindowText(GetDlgItem(hDlg, IDC_SPEED4), "////////");
- }
- if (SendDlgItemMessage(hWnd, IDC_SPEED3, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->Armtilt();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_SPEED4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->OBSStilt();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_STORE1, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->SAVEA();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_STORE2, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->SAVEB();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_STORE3, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->SAVEC();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_STORE4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->SAVED();
- }
- }
- if (sts->arm1set)EnableWindow(GetDlgItem(hWnd, IDC_RECALL1), TRUE);
- else EnableWindow(GetDlgItem(hWnd, IDC_RECALL1), FALSE);
- if (sts->arm2set)EnableWindow(GetDlgItem(hWnd, IDC_RECALL2), TRUE);
- else EnableWindow(GetDlgItem(hWnd, IDC_RECALL2), FALSE);
- if (sts->arm3set)EnableWindow(GetDlgItem(hWnd, IDC_RECALL3), TRUE);
- else EnableWindow(GetDlgItem(hWnd, IDC_RECALL3), FALSE);
- if (sts->arm4set )EnableWindow(GetDlgItem(hWnd, IDC_RECALL4), TRUE);
- else EnableWindow(GetDlgItem(hWnd, IDC_RECALL4), FALSE);
- //EnableWindow(GetDlgItem(hWnd, IDC_GRAPPLE), FALSE);
- if (SendDlgItemMessage(hWnd, IDC_RECALL1, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->LOADA();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_RECALL2, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->LOADB();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_RECALL3, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->LOADC();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_RECALL4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->LOADD();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_SPEED10, BM_GETSTATE, 0, 0) & BST_PUSHED) {//halt
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->center_arm = false;
- sts->rmsexecute = 0;
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_SEQ, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->center_arm_t = oapiGetSimTime();
- sts->ARMSEQ();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_SEL, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->ARMINPUT();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_ALL, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->FULLINPUT();
- }
- }
- t0 = t1;
- }
- if (!sts->center_arm) EnableWindow (GetDlgItem (hWnd, IDC_GRAPPLE), TRUE);
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- oapiCloseDialog (hWnd);
- sts->RMSDIALOG = 0;
- return TRUE;
- case IDC_STOW:
- // if (sts->center_arm = !sts->center_arm) {
- // sts->center_arm_time = oapiGetSimTime();
- // sts->rmsexecute = 1;
- //sts->stow_time = oapiGetSimTime();
- //sts->center_arm_t = oapiGetSimTime();
- //sts->STOW();
- // EnableWindow (GetDlgItem (hWnd, IDC_GRAPPLE), FALSE);
- // }
- if (sts->center_arm = !sts->center_arm) {
- sts->center_arm_t = oapiGetSimTime();
- sts->rmsexecute = 1;
- EnableWindow(GetDlgItem(hWnd, IDC_GRAPPLE), FALSE);
- }
- return 0;
- case IDC_SPEED9://execute new rms arm position
- //if (sts->rmsexecute == 0) {
- // sts->rmsexecute = 1;
- // sts->center_arm_t = oapiGetSimTime();
- //}
- return 0;
- case IDC_GRAPPLE:
- sts->ToggleGrapple();
- return 0;
- case IDC_PAYLOAD:
- sts->ToggleArrest1();
- return 0;
- case IDC_PAYLOAD2:
- sts->ToggleArrest2();
- return 0;
- case IDC_PAYLOAD3:
- sts->ToggleArrest3();
- return 0;
- case IDC_GRAPPLE2:
- sts->ToggleGrappleOBSS();
- return 0;
- case IDC_SHOWGRAPPLE:
- oapiSetShowGrapplePoints (SendDlgItemMessage (hWnd, IDC_SHOWGRAPPLE, BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false);
- return 0;
- }
- break;
- }
- return oapiDefDialogProc (hWnd, uMsg, wParam, lParam);
- }
- BOOL CALLBACK LIGHT_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext(hWnd));
- // pointer to vessel instance was passed as dialog context
- const double step = 0.05*RAD;
- static double t0;
- double t2;
- HICON hIcon;
- HWND hDlg;
- char cbuf[256];
- int i;
- //sprintf (cbuf, "Atlantis %s: Payload Bay Operation", sts->GetName());
- //oapiSetSwitchState(GetDlgItem(hWnd, IDC_FLOOD1), FLOODLIGHT1 == FLOOD_ON ? 0 : FLOODLIGHT1 == FLOOD_OFF ? 1 : 2, true);
- switch (uMsg) {
- case WM_INITDIALOG:
- hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_UP));
- SendDlgItemMessage(hWnd, IDC_CAM_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_DOWN));
- SendDlgItemMessage(hWnd, IDC_CAM_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_LEFT));
- SendDlgItemMessage(hWnd, IDC_CAM_YAWLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_RIGHT));
- SendDlgItemMessage(hWnd, IDC_CAM_YAWRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- //UpdateDialog1(hWnd);
- SetTimer(hWnd, 1, 100, NULL);
- t0 = oapiGetSimTime();
- return FALSE;
- case WM_DESTROY:
- KillTimer(hWnd, 1);
- return 0;
- case WM_TIMER:
- {
- t2 = oapiGetSimTime();
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood1_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD1), "LIGHT ON");
- }
- if (sts->flood1_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD1), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_FLOOD1, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood1_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD1), "LIGHT ON");
- sts->flood1_status = 1;
- }
- else if (sts->flood1_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD1), "LIGHT OFF");
- sts->flood1_status = 0;
- }
- }
- }
- //LIGHT2
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood2_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD2), "LIGHT ON");
- }
- if (sts->flood2_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD2), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_FLOOD2, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood2_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD2), "LIGHT ON");
- sts->flood2_status = 1;
- }
- else if (sts->flood2_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD2), "LIGHT OFF");
- sts->flood2_status = 0;
- }
- }
- }
- //light3/4
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood3_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD3), "LIGHT ON");
- }
- if (sts->flood3_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD3), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_FLOOD3, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood3_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD3), "LIGHT ON");
- sts->flood3_status = 1;
- }
- else if (sts->flood3_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD3), "LIGHT OFF");
- sts->flood3_status = 0;
- }
- }
- }
- //LIGHT4
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood4_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD4), "LIGHT ON");
- }
- if (sts->flood4_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD4), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_FLOOD4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood4_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD4), "LIGHT ON");
- sts->flood4_status = 1;
- }
- else if (sts->flood4_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD4), "LIGHT OFF");
- sts->flood4_status = 0;
- }
- }
- }
- //light5/6
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood5_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD5), "LIGHT ON");
- }
- if (sts->flood5_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD5), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_FLOOD5, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood5_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD5), "LIGHT ON");
- sts->flood5_status = 1;
- }
- else if (sts->flood5_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD5), "LIGHT OFF");
- sts->flood5_status = 0;
- }
- }
- }
- //LIGHT4
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood6_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD6), "LIGHT ON");
- }
- if (sts->flood6_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD6), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_FLOOD6, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->flood6_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD6), "LIGHT ON");
- sts->flood6_status = 1;
- }
- else if (sts->flood6_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_FLOOD6), "LIGHT OFF");
- sts->flood6_status = 0;
- }
- }
- }//dock
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->docklight_status == 1){
- SetWindowText(GetDlgItem(hDlg, IDC_DOCKDIM), "DIM");
- }
- if (sts->docklight_status == 2) {
- SetWindowText(GetDlgItem(hDlg, IDC_DOCKDIM), "BRIGHT");
- }
- if (sts->docklight_status == 0){
- SetWindowText(GetDlgItem(hDlg, IDC_DOCKDIM), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_DOCKDIM, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->docklight_status == 1) {
- SetWindowText(GetDlgItem(hDlg, IDC_DOCKDIM), "DIM");
- }
- if (sts->docklight_status == 2) {
- SetWindowText(GetDlgItem(hDlg, IDC_DOCKDIM), "BRIGHT");
- }
- if (sts->docklight_status == 0) {
- SetWindowText(GetDlgItem(hDlg, IDC_DOCKDIM), "LIGHT OFF");
- }
- }
- }
- //forebulkhead
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->aft_light_status == 1){
- SetWindowText(GetDlgItem(hDlg, IDC_FOREL1), "LIGHT ON");
- //EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);
- }
- if (sts->aft_light_status == 0){
- SetWindowText(GetDlgItem(hDlg, IDC_FOREL1), "LIGHT OFF");
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_FOREL1, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- if (sts->aft_light_status == 0){
- SetWindowText(GetDlgItem(hDlg, IDC_FOREL1), "LIGHT ON");
- sts->aft_light_status = 1;
- }
- else if (sts->aft_light_status == 1){
- SetWindowText(GetDlgItem(hDlg, IDC_FOREL1), "LIGHT OFF");
- sts->aft_light_status = 0;
- }
- }
- }
- //CAMERA
- if (SendDlgItemMessage(hWnd, IDC_HIGHRATE, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAMRATE = 12;
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_LOWRATE, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAMRATE = .12;
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_CAM_A, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 1;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_CAM_B, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 2;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC__CAM_C, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 3;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC__CAM_D, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 4;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC__CAM_K, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 5;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC__CAM_ET, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 9;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC__CAM_ELB, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 6;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_CAM_END, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 7;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_CAM_COCKPIT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 0;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_CAM_DOCK, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
- {
- sts->CAM = 8;
- sts->SetAnimationCameras();
- }
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_CAM_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- //if (sts->CAM == 1){
- // sts->camYaw[sts->CAM_A] = min(sts->MAX_PLB_CAM_PAN, sts->camYaw[sts->CAM_A] - sts->CAMRATE);
- //}
- sts->bPLBCamPanLeft_Man = true;
- sts->ElbowCamPanLeft = true;
- sts->cameraMoved = true;
- sts->SetAnimationCameras();
- }
- else if (SendDlgItemMessage(hWnd, IDC_CAM_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->bPLBCamPanRight_Man = true;
- sts->ElbowCamPanRight = true;
- sts->cameraMoved = true;
- sts->SetAnimationCameras();
- }
- if (SendDlgItemMessage(hWnd, IDC_CAM_PITCHUP, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- //if (sts->CAM == 1){
- // sts->camYaw[sts->CAM_A] = min(sts->MAX_PLB_CAM_PAN, sts->camYaw[sts->CAM_A] - sts->CAMRATE);
- //}
- sts->bPLBCamTiltUp_Man = true;
- sts->ElbowCamTiltUp = true;
- sts->cameraMoved = true;
- sts->SetAnimationCameras();
- }
- else if (SendDlgItemMessage(hWnd, IDC_CAM_PITCHDOWN, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->bPLBCamTiltDown_Man = true;
- sts->ElbowCamTiltDown = true;
- sts->cameraMoved = true;
- sts->SetAnimationCameras();
- }
- t0 = t2;
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- oapiCloseDialog(hWnd);
- return TRUE;
- break;
- }
- }
- return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);
- }
- //payloadbayoperation
- BOOL CALLBACK PAYLOADOPERATION_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext(hWnd));
- // pointer to vessel instance was passed as dialog context
- const double step = 0.05*RAD;
- static double t0;
- double t3;
- HICON hIcon;
- HWND hDlg;
- char cbuf[256];
- int i;
- //sprintf (cbuf, "Atlantis %s: Payload Bay Operation", sts->GetName());
- //oapiSetSwitchState(GetDlgItem(hWnd, IDC_FLOOD1), FLOODLIGHT1 == FLOOD_ON ? 0 : FLOODLIGHT1 == FLOOD_OFF ? 1 : 2, true);
- switch (uMsg) {
- case WM_INITDIALOG:
- //UpdateDialog1(hWnd);
- SetTimer(hWnd, 1, 100, NULL);
- t0 = oapiGetSimTime();
- return FALSE;
- case WM_DESTROY:
- KillTimer(hWnd, 1);
- return 0;
- case WM_TIMER:
- {
- t3 = oapiGetSimTime();
- char cbuf1[256];
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD)) {
- sprintf(cbuf1, "%0.0f", (sts->ius_proc / .016949));
- SetWindowText(GetDlgItem(hDlg, IDC_IUSANGLE), cbuf1);
- char cbuf2[256];
- char cbuf3[256];
- sprintf(cbuf2, "%0.0f", sts->spintable_vel*60/360);
- SetWindowText(GetDlgItem(hDlg, IDC_IUSANGLE2), cbuf2);
- sprintf(cbuf3, "%0.0f", sts->spintable1_vel * 60 / 360);
- SetWindowText(GetDlgItem(hDlg, IDC_IUSANGLE3), cbuf3);
- sprintf(cbuf2, "%0.0f", sts->spintable4_vel * 60 / 360);
- SetWindowText(GetDlgItem(hDlg, IDC_IUSANGLE4), cbuf2);
- sprintf(cbuf3, "%0.0f", sts->spintable5_vel * 60 / 360);
- SetWindowText(GetDlgItem(hDlg, IDC_IUSANGLE5), cbuf3);
- if (sts->SPIN1 == 1){
- if (sts->spintable != 3)
- SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE2), "////////");
- else
- SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE2), "SPIN RELEASE");
- }
- if (sts->SPIN2 == 1){
- if (sts->spintable1 != 3)SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE3), "////////");
- else SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE3), "SPIN RELEASE");
- }
- if (sts->SPIN4 == 1){
- if (sts->spintable4 != 3) SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE5), "////////");
- else
- SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE5), "SPIN RELEASE");
- }
- if (sts->SPIN5 == 1){
- if (sts->spintable5 != 3) SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE6), "////////");
- else SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE6), "SPIN RELEASE");
- }
- if (sts->USEIUS == 1){
- if (sts->ius_proc < 1.0)
- SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE), "////////");
- if (sts->ius_proc == 1.0)
- SetWindowText(GetDlgItem(hDlg, IDC_IUSRELEASE), "IUS RELEASE");
- }
- }
- if (sts->USEIUS == 1){
- if (SendDlgItemMessage(hWnd, IDC_IUSUP2, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->tilt == 0) sts->tilt = 1;
- else if (sts->tilt ==3) sts->tilt = 4;
- else if ((sts->tilt == 2) && (sts->ius_proc<.4915))sts->tilt = 1;
- else if ((sts->tilt == 2) && (sts->ius_proc >= .4915))sts->tilt = 4;
- // SetWindowText(GetDlgItem(hDlg, IDC_IUSANGLE), "Speed 1");
- // oapiSetShowGrapplePoints(SendDlgItemMessage(hWnd, IDC_SHOWGRAPPLE, BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false);
- //sts->flood6_status = 1;
- }
- if (SendDlgItemMessage(hWnd, IDC_IUSDOWN, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- sts->tilt = 2;
- }
- if (SendDlgItemMessage(hWnd, IDC_IUSRELEASE, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->ius_proc == 1.0)
- sts->DetachChild(sts->sat_attach, .35);//ius is at max value so release
- // sts->DetachChild(sts->sat_attach, 1.0);//ius is at max value so release
- }
- }
- if (sts->SPIN1 == 1){
- if (SendDlgItemMessage(hWnd, IDC_IUSUP, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable == 0) sts->spintable = 1;
- }
- if (SendDlgItemMessage(hWnd, IDC_IUSRELEASE2, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable == 3) {
- sts->spintable = 4;
- OBJHANDLE hChild = sts->GetAttachmentStatus(sts->sat_attach);
- sts->DetachChild(sts->sat_attach, 1.0);
- if (oapiIsVessel(hChild)) {
- VESSEL *vChild = oapiGetVesselInterface(hChild);
- VECTOR3 avel;
- avel.data[0] = 0;
- avel.data[1] = 0;
- avel.data[2] = 300 * RAD;
- vChild->SetAngularVel(avel);
- }
- }
- }
- }
- if (sts->SPIN2 == 1){
- if (SendDlgItemMessage(hWnd, IDC_IUSUP3, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable1 == 0) sts->spintable1 = 1;
- }
- if (SendDlgItemMessage(hWnd, IDC_IUSRELEASE3, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable1 == 3) {
- sts->spintable1 = 4;
- OBJHANDLE hChild1 = sts->GetAttachmentStatus(sts->sat_attach2);
- sts->DetachChild(sts->sat_attach2, 1.0);
- if (oapiIsVessel(hChild1)) {
- VESSEL *vChild1 = oapiGetVesselInterface(hChild1);
- VECTOR3 avel;
- avel.data[0] = 0;
- avel.data[1] = 0;
- avel.data[2] = 300 * RAD;
- vChild1->SetAngularVel(avel);
- }
- }
- }
- }
- //
- if (sts->SPIN4 == 1){
- if (SendDlgItemMessage(hWnd, IDC_IUSUP4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable4 == 0) sts->spintable4 = 1;
- }
- if (SendDlgItemMessage(hWnd, IDC_IUSRELEASE5, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable4 == 3) {
- sts->spintable4 = 4;
- OBJHANDLE hChild4 = sts->GetAttachmentStatus(sts->sat_attach3);
- sts->DetachChild(sts->sat_attach3, 1.0);
- if (oapiIsVessel(hChild4)) {
- VESSEL *vChild4 = oapiGetVesselInterface(hChild4);
- VECTOR3 avel;
- avel.data[0] = 0;
- avel.data[1] = 0;
- avel.data[2] = 300 * RAD;
- vChild4->SetAngularVel(avel);
- }
- }
- }
- }
- if (sts->SPIN5 == 1){
- if (SendDlgItemMessage(hWnd, IDC_IUSUP5, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable5 == 0) sts->spintable5 = 1;
- }
- if (SendDlgItemMessage(hWnd, IDC_IUSRELEASE6, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (sts->spintable5 == 3) {
- sts->spintable5 = 4;
- OBJHANDLE hChild5 = sts->GetAttachmentStatus(sts->sat_attach4);
- sts->DetachChild(sts->sat_attach4, 1.0);
- if (oapiIsVessel(hChild5)) {
- VESSEL *vChild5 = oapiGetVesselInterface(hChild5);
- VECTOR3 avel;
- avel.data[0] = 0;
- avel.data[1] = 0;
- avel.data[2] = 300 * RAD;
- vChild5->SetAngularVel(avel);
- }
- }
- }
- }
- if (sts->SPIN3 == 1){
- if (SendDlgItemMessage(hWnd, IDC_IUSRELEASE4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- OBJHANDLE hChild3 = sts->GetAttachmentStatus(sts->sat_attach3);
- sts->DetachChild(sts->sat_attach3, 1.0);
- if (oapiIsVessel(hChild3)) {
- VESSEL *vChild3 = oapiGetVesselInterface(hChild3);
- VECTOR3 avel;
- avel.data[1] = 0;
- avel.data[0] = 0;
- avel.data[2] = -100 * RAD;
- vChild3->SetAngularVel(avel);
- }
- }
- }
- if (sts->SPIN0 == 1){
- if (SendDlgItemMessage(hWnd, IDC_IUSRELEASE4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- OBJHANDLE hChild3 = sts->GetAttachmentStatus(sts->sat_attach3);
- sts->DetachChild(sts->sat_attach3, .2);
- if (oapiIsVessel(hChild3)) {
- VESSEL *vChild3 = oapiGetVesselInterface(hChild3);
- VECTOR3 avel;
- avel.data[1] = 0;
- avel.data[0] = 0;
- avel.data[2] = 12 * RAD;
- vChild3->SetAngularVel(avel);
- }
- }
- }
- //}
- t0 = t3;
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- oapiCloseDialog(hWnd);
- return TRUE;
- break;
- }
- }
- return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);
- }
- BOOL CALLBACK EVA_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext(hWnd));
- // pointer to vessel instance was passed as dialog context
- const double step = 0.05*RAD;
- static double t5;
- double t1;
- HICON hIcon;
- HWND hDlg;
- switch (uMsg) {
- case WM_INITDIALOG:
- SetWindowText(GetDlgItem(hWnd, IDC_TETHER1), sts->EVA1TETHER() ? "Release" : "Tether");
- SetWindowText(GetDlgItem(hWnd, IDC_TETHER2), sts->EVA2TETHER() ? "Release" : "Tether");
- SetWindowText(GetDlgItem(hWnd, IDC_TETHER3), sts->EVA3TETHER() ? "Release" : "Tether");
- SetWindowText(GetDlgItem(hWnd, IDC_TETHER4), sts->EVA4TETHER() ? "Release" : "Tether");
- SetTimer(hWnd, 1, 100, NULL);
- t5 = oapiGetSimTime();
- return FALSE;
- case WM_DESTROY:
- KillTimer(hWnd, 1);
- return 0;
- case WM_TIMER:
- {
- //AttachChild(hMMU, ft_pad_att3, hAttWFC);
- if (SendDlgItemMessage(hWnd, IDC_EVA1, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- sts->SpawnEVA();
- //sts->ToggleArrest1();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_EVA2, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- sts->SpawnEVA1();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_EVA3, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- sts->SpawnEVA2();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_EVA4, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- sts->SpawnEVA3();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_EVA5, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- if (sts->EXT_proc == 1)sts->ENTER_EVA1();
- //sts->ToggleArrest1();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_EVA6, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- if (sts->EXT_proc == 1)sts->ENTER_EVA2();
- //sts->ToggleArrest1();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_EVA7, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- if (sts->EXT_proc == 1)sts->ENTER_EVA3();
- //sts->ToggleArrest1();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_EVA8, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- if (sts->EXT_proc == 1)sts->ENTER_EVA4();
- //sts->ToggleArrest1();
- }
- }
- if (SendDlgItemMessage(hWnd, IDC_AIRLOCK, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- sts->Revertextdoor();
- }
- }
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- if (sts->EXT_proc >= 1)
- SetWindowText(GetDlgItem(hDlg, IDC_AIRLOCK), "Hatch Open");
- if (sts->EXT_proc <= 0)
- SetWindowText(GetDlgItem(hDlg, IDC_AIRLOCK), "Hatch Closed");
- if ((sts->EXT_proc >0) && (sts->EXT_proc <1))
- SetWindowText(GetDlgItem(hDlg, IDC_AIRLOCK), "////////");
- }
- if (SendDlgItemMessage(hWnd, IDC_AIRLOCK, BM_GETSTATE, 0, 0) & BST_PUSHED) {
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS)) {
- sts->Revertextdoor();
- }
- }
- t1 = t5;
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- oapiCloseDialog(hWnd);
- return TRUE;
- case IDC_TETHER1:
- sts->TETHER1();
- return 0;
- case IDC_TETHER2:
- sts->TETHER2();
- return 0;
- break;
- case IDC_TETHER3:
- sts->TETHER3();
- return 0;
- break;
- case IDC_TETHER4:
- sts->TETHER4();
- return 0;
- break;
- }
- }
- return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);
- }
- void Atlantis::LOADA()
- {
- arm6_By = arm1_By;
- arm6_Bp = arm1_Bp;
- arm6_ep = arm1_ep;
- arm6_Ap = arm1_Ap;
- arm6_Ay = arm1_Ay;
- arm6_Ar = arm1_Ar;
- recallstored = 1;
- }
- void Atlantis::LOADB()
- {
- arm6_By = arm2_By;
- arm6_Bp = arm2_Bp;
- arm6_ep = arm2_ep;
- arm6_Ap = arm2_Ap;
- arm6_Ay = arm2_Ay;
- arm6_Ar = arm2_Ar;
- recallstored = 2;
- }
- void Atlantis::LOADC()
- {
- arm6_By = arm3_By;
- arm6_Bp = arm3_Bp;
- arm6_ep = arm3_ep;
- arm6_Ap = arm3_Ap;
- arm6_Ay = arm3_Ay;
- arm6_Ar = arm3_Ar;
- recallstored = 3;
- }
- void Atlantis::LOADD()
- {
- arm6_By = arm4_By;
- arm6_Bp = arm4_Bp;
- arm6_ep = arm4_ep;
- arm6_Ap = arm4_Ap;
- arm6_Ay = arm4_Ay;
- arm6_Ar = arm4_Ar;
- recallstored = 4;
- }
- void Atlantis::SAVEA()
- {
- arm1_By = arm_sy;
- arm1_Bp = arm_sp;
- arm1_ep = arm_ep;
- arm1_Ap = arm_wp;
- arm1_Ay = arm_wy;
- arm1_Ar = arm_wr;
- arm1set = true;
- }
- void Atlantis::SAVEB()
- {
- arm2_By = arm_sy;
- arm2_Bp = arm_sp;
- arm2_ep = arm_ep;
- arm2_Ap = arm_wp;
- arm2_Ay = arm_wy;
- arm2_Ar = arm_wr;
- arm2set = true;
- }
- void Atlantis::SAVEC()
- {
- arm3_By = arm_sy;
- arm3_Bp = arm_sp;
- arm3_ep = arm_ep;
- arm3_Ap = arm_wp;
- arm3_Ay = arm_wy;
- arm3_Ar = arm_wr;
- arm3set = true;
- }
- void Atlantis::SAVED()
- {
- arm4_By = arm_sy;
- arm4_Bp = arm_sp;
- arm4_ep = arm_ep;
- arm4_Ap = arm_wp;
- arm4_Ay = arm_wy;
- arm4_Ar = arm_wr;
- arm4set = true;
- }
- void Atlantis::CheckFlags()
- {
- if (arm1set && arm1_By == 0.0 && arm1_Bp == 0.0
- && arm1_ep == 0.0 && arm1_Ar == 0.0 && arm1_Ay == 0.0
- && arm1_Ap == 0.0) arm1set = false;
- if (arm2set && arm2_By == 0.0 && arm2_Bp == 0.0
- && arm2_ep == 0.0 && arm2_Ar == 0.0 && arm2_Ay == 0.0
- && arm2_Ap == 0.0) arm2set = false;
- if (arm3set && arm3_By == 0.0 && arm3_Bp == 0.0
- && arm3_ep == 0.0 && arm3_Ar == 0.0 && arm3_Ay == 0.0
- && arm3_Ap == 0.0) arm3set = false;
- if (arm4set && arm4_By == 0.0 && arm4_Bp == 0.0
- && arm4_ep == 0.0 && arm4_Ar == 0.0 && arm4_Ay == 0.0
- && arm4_Ap == 0.0) arm4set = false;
- if (arm5set && arm5_By == 0.0 && arm5_Bp == 0.0
- && arm5_ep == 0.0 && arm5_Ar == 0.0 && arm5_Ay == 0.0
- && arm5_Ap == 0.0) arm5set = false;
- }
- // ==============================================================
- bool Atlantis::ItemChange(char *rstr)
- {
- int ItemValue;
- sscanf(rstr, "%d", &ItemValue);
- DetermineArmSeq(ItemValue);
- center_arm = true;
- Seqindex = 0;
- Seqfinished = false;
- return true;
- }
- // ==============================================================
- void Atlantis::DetermineArmSeq(int ItemValue)
- {
- armseq[0] = int(ItemValue / 1e6);
- ItemValue = ItemValue - (armseq[0] * 1e6);
- armseq[1] = int(ItemValue / 1e5);
- ItemValue = ItemValue - (armseq[1] * 1e5);
- armseq[2] = int(ItemValue / 1e4);
- ItemValue = ItemValue - (armseq[2] * 1e4);
- armseq[3] = int(ItemValue / 1e3);
- ItemValue = ItemValue - (armseq[3] * 1e3);
- armseq[4] = int(ItemValue / 1e2);
- ItemValue = ItemValue - (armseq[4] * 1e2);
- armseq[5] = int(ItemValue / 1e1);
- ItemValue = ItemValue - (armseq[5] * 1e1);
- armseq[6] = int(ItemValue);
- }
- // ==============================================================
- void Atlantis::SeqSSRMS()
- {
- if (Seqfinished == true){
- Seqfinished = false;
- armseq[Seqindex] = 0;
- Seqindex += 1;
- }
- if (Seqindex > 6) center_arm = false;
- if (center_arm){
- // sprintf(oapiDebugString(), "armtip3x %2.2f armtip3y %2.2f Seqindex %2.2f", arm_tip[5].x, arm_tip[5].y, Seqindex);
- PosSSRMS(Seqindex);
- }
- }
- // ==============================================================
- void Atlantis::PosSSRMS(int i)
- {
- //double t0 = oapiGetSimTime();
- double dt = oapiGetSimStep(); // time step//double dt = t0 - center_arm_t; // time step
- double da = ARM_OPERATING_SPEED*dt ;; // total rotation angle
- //double dt = oapiGetSimStep(); // time step
- //double da = JOINT_ROTATION_SPEED * dt * SpeedFactor; // total rotation angle
- //sprintf(oapiDebugString(), "arm_sy %2.2f armM_sy %2.2f da %2.2f", arm_sy, armM_By, da);
- switch (armseq[i])
- {
- case 1:
- if ((arm_sy != armM_By)) {
- if (da >= fabs(arm_sy - armM_By)) // finished
- arm_sy = armM_By, da -= fabs(arm_sy - armM_By),Seqfinished = true;
- else
- arm_sy -= (arm_sy > armM_By ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- }
- else {
- Seqfinished = true;
- }
- break;
- case 2:
- // sprintf(oapiDebugString(), "arm_sy %2.2f armM_sy %2.2f da %2.2f", arm_sy, armM_By, da);
- if ((arm_sp != armM_Bp)) { // zero wrist yitch
- if (da >= fabs(arm_sp - armM_Bp)) // finished
- arm_sp = armM_Bp, da -= fabs(arm_sp - armM_Bp), Seqfinished = true;
- else
- arm_sp -= (arm_sp > armM_Bp ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- }
- else {
- Seqfinished = true;
- }
- break;
- case 3:
- // sprintf(oapiDebugString(), "arm_sy %2.2f armM_sy %2.2f da %2.2f", arm_sy, armM_By, da);
- if ((arm_ep != armM_ep)) { // zero wrist yitch
- if (da >= fabs(arm_ep - armM_ep)) // finished
- arm_ep = armM_ep, da -= fabs(arm_ep - armM_ep), Seqfinished = true;
- else
- arm_ep -= (arm_ep > armM_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_ep, arm_ep);
- }
- else {
- Seqfinished = true;
- }
- break;
- case 4:
- // sprintf(oapiDebugString(), "arm_sy %2.2f armM_sy %2.2f da %2.2f", arm_sy, armM_By, da);
- if ((arm_wp != armM_Ap)) { // zero wrist yitch
- if (da >= fabs(arm_wp - armM_Ap)) // finished
- arm_wp = armM_Ap, da -= fabs(arm_wp - armM_Ap), Seqfinished = true;
- else
- arm_wp -= (arm_wp > armM_Ap ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- }
- else {
- Seqfinished = true;
- }
- break;
- case 5:
- // sprintf(oapiDebugString(), "arm_sy %2.2f armM_sy %2.2f da %2.2f", arm_sy, armM_By, da);
- if ((arm_wy != armM_Ay)) { // zero wrist yitch
- if (da >= fabs(arm_wy - armM_Ay)) // finished
- arm_wy = armM_Ay, da -= fabs(arm_wy - armM_Ay), Seqfinished = true;
- else
- arm_wy -= (arm_wy > armM_Ay ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- }
- else {
- Seqfinished = true;
- }
- break;
- case 6:
- // sprintf(oapiDebugString(), "arm_sy %2.2f armM_sy %2.2f da %2.2f", arm_sy, armM_By, da);
- if ((arm_wr != armM_Ar)) { // zero wrist yitch
- if (da >= fabs(arm_wr - armM_Ar)) // finished
- arm_wr = armM_Ar, da -= fabs(arm_wr - armM_Ar), Seqfinished = true;
- else
- arm_wr -= (arm_wr > armM_Ar ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- else {
- Seqfinished = true;
- }
- break;
- case 7:
- if (((arm_sy != armM_By))|| ((arm_sp != armM_Bp))|| ((arm_ep != armM_ep))|| ((arm_wp != armM_Ap))|| ((arm_wy != armM_Ay))|| ((arm_wr != armM_Ar))){
- if (da >= fabs(arm_sy - armM_By)) // finished
- arm_sy = armM_By, da -= fabs(arm_sy - armM_By);
- else
- arm_sy -= (arm_sy > armM_By ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sy, arm_sy);
- if (da >= fabs(arm_sp - armM_Bp)) // finished
- arm_sp = armM_Bp, da -= fabs(arm_sp - armM_Bp);
- else
- arm_sp -= (arm_sp > armM_Bp ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- if (da >= fabs(arm_ep - armM_ep)) // finished
- arm_ep = armM_ep, da -= fabs(arm_ep - armM_ep);
- else
- arm_ep -= (arm_ep > armM_ep ? da : -da), da = 0;
- SetAnimationArm(anim_arm_sp, arm_sp);
- if (da >= fabs(arm_wp - armM_Ap)) // finished
- arm_wp = armM_Ap, da -= fabs(arm_wp - armM_Ap);
- else
- arm_wp -= (arm_wp > armM_Ap ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wp, arm_wp);
- if (da >= fabs(arm_wy - armM_Ay)) // finished
- arm_wy = armM_Ay, da -= fabs(arm_wy - armM_Ay);
- else
- arm_wy -= (arm_wy > armM_Ay ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wy, arm_wy);
- if (da >= fabs(arm_wr - armM_Ar)) // finished
- arm_wr = armM_Ar, da -= fabs(arm_wr - armM_Ar);
- else
- arm_wr -= (arm_wr > armM_Ar ? da : -da), da = 0;
- SetAnimationArm(anim_arm_wr, arm_wr);
- }
- else {
- Seqfinished = true;
- }
- break;
- case 0:
- Seqfinished = true;
- break;
- }
- }
- bool IteminputJoint(void *id, char *str, void *data)
- {
- return ((Atlantis*)data)->ItemChangeJoint(str);
- }
- // ==============================================================
- bool Atlantis::ItemChangeJoint(char *rstr)
- {
- int JointValue;
- double JointAmt;
- sscanf(rstr, "%d%lf", &JointValue, &JointAmt);
- if (JointAmt > 270.0) JointAmt = 270.0;
- if (JointAmt < -270.0) JointAmt = -270.0;
- switch (JointValue){
- //sprintf(oapiDebugString(), "JointValue %d JointAmt %2.2f ", JointValue, JointAmt);
- case 1:
- arm6_By = (((JointAmt - 0)/-360)+.5);
- break;
- case 2:
- arm6_Bp = (((JointAmt - 0) / 147) + 0.0136);
- break;
- case 3:
- //- epstart) * -162);
- arm6_ep = (((JointAmt - 0) / -162) + epstart);
- break;
- case 4:
- arm6_Ap = (((JointAmt - 0) / 240) + wpstart);
- break;
- case 5:
- arm6_Ay = (((JointAmt - 0) / 240) + wystart);
- break;
- case 6:
- arm6_Ar = (((JointAmt - 0) / 894) + wrstart);
- break;
- }
- return true;
- }
- void Atlantis::ARMINPUT()
- {
- oapiOpenInputBox("Joint (1-6) and Value (degrees)", IteminputJoint, 0, 20, (void*)this);
- }
- bool FullinputJoint(void *id, char *str, void *data)
- {
- return ((Atlantis*)data)->FullChangeJoint(str);
- }
- // ==============================================================
- bool Atlantis::FullChangeJoint(char *rstr)
- {
- sscanf(rstr, "%lf%lf%lf%lf%lf%lf", &arm6_By, &arm6_Bp, &arm6_ep, &arm6_Ap, &arm6_Ay, &arm6_Ar);
- arm6_By = (((arm6_By - 0) / -360) + .5);
- arm6_Bp = (((arm6_Bp - 0) / 147) + 0.0136);
- arm6_ep = (((arm6_ep - 0) / -162) + epstart);
- arm6_Ap = (((arm6_Ap - 0) / 240) + wpstart);
- arm6_Ay = (((arm6_Ay - 0) / 240) + wystart);
- arm6_Ar = (((arm6_Ar - 0) / 894) + wrstart);
- return true;
- }
- void Atlantis::FULLINPUT()
- {
- oapiOpenInputBox("SY SP EP WP WY WR", FullinputJoint, 0, 60, (void*)this);
- }
- bool Iteminput(void *id, char *str, void *data)
- {
- return ((Atlantis*)data)->ItemChange(str);
- }
- void Atlantis::ARMSEQ()
- {
- armM_Bp = arm6_Bp;
- armM_By = arm6_By;
- armM_ep = arm6_ep;
- armM_Ap = arm6_Ap;
- armM_Ay = arm6_Ay;
- armM_Ar = arm6_Ar;
- oapiOpenInputBox("ARM SEQ", Iteminput, 0, 20, (void*)this);
- }
- void Atlantis::STOW()
- {}
- void Atlantis::TETHER2(void)
- {
- if (EVA2 == 1){
- HWND hDlg;
- OBJHANDLE hV = GetAttachmentStatus(ft_pad_att1);
- if (hV) { // release satellite
- // ATTACHMENTHANDLE hAtt = CanArrest();
- // DetachChild(ft_pad_att1);
- // if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- // SetWindowText(GetDlgItem(hDlg, IDC_TETHER2), "TETHER");
- // }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- // if (hAtt) {
- // AttachChild(hV, sat_attach, hAtt);
- // if (hDlg) {
- // SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD), "Purge");
- // EnableWindow(GetDlgItem(hDlg, IDC_PAYLOAD), TRUE);
- // }
- //}
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 gpos, grms, pos, dir, rot;
- Local2Global(arm_tip[0], grms); // global position of RMS tip
- // sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // Search the complete vessel list for a grappling candidate.
- // Not very scalable ...
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
- // oapiGetGlobalPos(hV, &gpos);
- //sprintf(oapiDebugString(), "dist %2.2f size %2.2f ", dist(gpos, grms), oapiGetSize(hV));
- // if (dist(gpos, grms) < oapiGetSize(hV)) { // in range
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- const char *id = v->GetAttachmentId(hAtt);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- if (strncmp(id, "FTEVA2", 6)) continue; // attachment point compatible go to next step
- //v->GetAttachmentParams(hAtt, pos, dir, rot);
- //v->Local2Global(pos, gpos);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // check whether satellite is currently clamped into payload bay
- //if (hV == GetAttachmentStatus(sat_attach))
- // DetachChild(sat_attach);
- AttachChild(hV, ft_pad_att1, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- // SetWindowText(GetDlgItem(hDlg, IDC_TETHER2), "Release");
- return;
- //}
- }
- }
- }
- }
- }
- }
- void Atlantis::TETHER1(void)
- {
- if (EVA1 == 1){
- HWND hDlg;
- OBJHANDLE hV = GetAttachmentStatus(ft_pad_att);
- if (hV) { // release satellite
- //ATTACHMENTHANDLE hAtt = CanArrest();
- //DetachChild(ft_pad_att);
- //if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- // SetWindowText(GetDlgItem(hDlg, IDC_TETHER1), "TETHER");
- //}
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- // if (hAtt) {
- // AttachChild(hV, sat_attach, hAtt);
- // if (hDlg) {
- // SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD), "Purge");
- // EnableWindow(GetDlgItem(hDlg, IDC_PAYLOAD), TRUE);
- // }
- //}
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 gpos, grms, pos, dir, rot;
- Local2Global(arm_tip[0], grms); // global position of RMS tip
- // sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // Search the complete vessel list for a grappling candidate.
- // Not very scalable ...
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
- // oapiGetGlobalPos(hV, &gpos);
- //sprintf(oapiDebugString(), "dist %2.2f size %2.2f ", dist(gpos, grms), oapiGetSize(hV));
- // if (dist(gpos, grms) < oapiGetSize(hV)) { // in range
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- const char *id = v->GetAttachmentId(hAtt);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- if (strncmp(id, "FTEVA1", 6)) continue; // attachment point compatible go to next step
- //v->GetAttachmentParams(hAtt, pos, dir, rot);
- //v->Local2Global(pos, gpos);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // check whether satellite is currently clamped into payload bay
- //if (hV == GetAttachmentStatus(sat_attach))
- // DetachChild(sat_attach);
- AttachChild(hV, ft_pad_att, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- // SetWindowText(GetDlgItem(hDlg, IDC_TETHER1), "Release");
- return;
- //}
- }
- }
- }
- }
- }
- }
- void Atlantis::TETHER3(void)
- {
- if (EVA3 == 1){
- HWND hDlg;
- OBJHANDLE hV = GetAttachmentStatus(ft_pad_att2);
- if (hV) { // release satellite
- //ATTACHMENTHANDLE hAtt = CanArrest();
- //DetachChild(ft_pad_att2);
- // if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- // SetWindowText(GetDlgItem(hDlg, IDC_TETHER3), "TETHER");
- // }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- // if (hAtt) {
- // AttachChild(hV, sat_attach, hAtt);
- // if (hDlg) {
- // SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD), "Purge");
- // EnableWindow(GetDlgItem(hDlg, IDC_PAYLOAD), TRUE);
- // }
- //}
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 gpos, grms, pos, dir, rot;
- Local2Global(arm_tip[0], grms); // global position of RMS tip
- // sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // Search the complete vessel list for a grappling candidate.
- // Not very scalable ...
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
- // oapiGetGlobalPos(hV, &gpos);
- //sprintf(oapiDebugString(), "dist %2.2f size %2.2f ", dist(gpos, grms), oapiGetSize(hV));
- // if (dist(gpos, grms) < oapiGetSize(hV)) { // in range
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- const char *id = v->GetAttachmentId(hAtt);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- if (strncmp(id, "FTEVA3", 6)) continue; // attachment point compatible go to next step
- //v->GetAttachmentParams(hAtt, pos, dir, rot);
- //v->Local2Global(pos, gpos);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // check whether satellite is currently clamped into payload bay
- //if (hV == GetAttachmentStatus(sat_attach))
- // DetachChild(sat_attach);
- AttachChild(hV, ft_pad_att2, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- // SetWindowText(GetDlgItem(hDlg, IDC_TETHER3), "Release");
- return;
- //}
- }
- }
- }
- }
- }
- }
- void Atlantis::TETHER4(void)
- {
- if (EVA4 == 1){
- HWND hDlg;
- OBJHANDLE hV = GetAttachmentStatus(ft_pad_att1);
- if (hV) { // release satellite
- // ATTACHMENTHANDLE hAtt = CanArrest();
- // DetachChild(ft_pad_att3);
- // if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- // SetWindowText(GetDlgItem(hDlg, IDC_TETHER4), "TETHER");
- // }
- // check whether the object being ungrappled is ready to be clamped into the payload bay
- // if (hAtt) {
- // AttachChild(hV, sat_attach, hAtt);
- // if (hDlg) {
- // SetWindowText(GetDlgItem(hDlg, IDC_PAYLOAD), "Purge");
- // EnableWindow(GetDlgItem(hDlg, IDC_PAYLOAD), TRUE);
- // }
- //}
- #ifdef UNDEF
- VECTOR3 pos, dir, rot, gbay, gpos;
- GetAttachmentParams(sat_attach, pos, dir, rot);
- Local2Global(pos, gbay);
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- v->GetAttachmentParams(hAtt, pos, dir, rot);
- v->Local2Global(pos, gpos);
- if (dist(gpos, gbay) < MAX_GRAPPLING_DIST) {
- AttachChild(hV, sat_attach, hAtt);
- return;
- }
- }
- #endif
- }
- else { // grapple satellite
- VECTOR3 gpos, grms, pos, dir, rot;
- Local2Global(arm_tip[0], grms); // global position of RMS tip
- // sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // Search the complete vessel list for a grappling candidate.
- // Not very scalable ...
- for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
- OBJHANDLE hV = oapiGetVesselByIndex(i);
- if (hV == GetHandle()) continue; // we don't want to grapple ourselves ...
- // oapiGetGlobalPos(hV, &gpos);
- //sprintf(oapiDebugString(), "dist %2.2f size %2.2f ", dist(gpos, grms), oapiGetSize(hV));
- // if (dist(gpos, grms) < oapiGetSize(hV)) { // in range
- VESSEL *v = oapiGetVesselInterface(hV);
- DWORD nAttach = v->AttachmentCount(true);
- for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
- ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle(true, j);
- const char *id = v->GetAttachmentId(hAtt);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- if (strncmp(id, "FTEVA4", 6)) continue; // attachment point compatible go to next step
- //v->GetAttachmentParams(hAtt, pos, dir, rot);
- //v->Local2Global(pos, gpos);
- //sprintf(oapiDebugString(), "dist %2.2f ", dist(gpos, grms));
- // check whether satellite is currently clamped into payload bay
- //if (hV == GetAttachmentStatus(sat_attach))
- // DetachChild(sat_attach);
- AttachChild(hV, ft_pad_att3, hAtt);
- if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_PAYLOAD1)) {
- //SetWindowText(GetDlgItem(hDlg, IDC_TETHER4), "Release");
- return;
- //}
- }
- }
- }
- }
- }
- }
- void Atlantis::SetAnimationCameras() {
- // FRONT LEFT
- double anim_yaw = linterp(-170, 0, 170, 1, camYaw[CAM_A]);
- SetAnimation(anim_camFLyaw, anim_yaw);
- double anim_pitch = linterp(-170, 0, 170, 1, camPitch[CAM_A]);
- SetAnimation(anim_camFLpitch, anim_pitch);
- // FRONT RIGHT
- anim_yaw = linterp(-170, 0, 170, 1, camYaw[CAM_D]);
- SetAnimation(anim_camFRyaw, anim_yaw);
- anim_pitch = linterp(-170, 0, 170, 1, camPitch[CAM_D]);
- SetAnimation(anim_camFRpitch, anim_pitch);
- // BACK LEFT
- anim_yaw = linterp(-170, 0, 170, 1, camYaw[CAM_B]);
- SetAnimation(anim_camBLyaw, anim_yaw);
- anim_pitch = linterp(-170, 0, 170, 1, camPitch[CAM_B]);
- SetAnimation(anim_camBLpitch, anim_pitch);
- // BACK RIGHT
- anim_yaw = linterp(-170, 0, 170, 1, camYaw[CAM_C]);
- SetAnimation(anim_camBRyaw, anim_yaw);
- anim_pitch = linterp(-170, 0, 170, 1, camPitch[CAM_C]);
- SetAnimation(anim_camBRpitch, anim_pitch);
- //rms elbow
- double anim = linterp(-MAX_PLB_CAM_PAN, 0, MAX_PLB_CAM_PAN, 1, camRMSElbow[PAN]);
- SetAnimation(anim_camRMSElbow[PAN], anim);
- anim = linterp(-MAX_PLB_CAM_TILT, 0, MAX_PLB_CAM_TILT, 1, camRMSElbow[TILT]);
- SetAnimation(anim_camRMSElbow[TILT], anim);
- //sprintf(oapiDebugString(), "YAW %f ", anim);
- //if (oapiCameraInternal() && VCMode >= VC_PLBCAMFL && VCMode <= VC_PLBCAMFR) {
- double a = 0.0;
- double b = 0.0;
- double c = 0.0;
- if (CAM == 3){
- PBCAMERA = 2;
- a = ((-camYaw[CAM_C] - 90)*RAD);
- b = ((camPitch[CAM_C] - 90)*RAD);
- //SetCameraOffset(_V(-1.850, 1.8, 11.750));
- //sprintf(oapiDebugString(), "phi %d YAW %f ", PBCAMERA, a);
- SetCameraOffset(plbCamPos[2]);
- SetCameraDefaultDirection(_V(cos(a)*sin(b), cos(b), sin(a)*sin(b)), c);
- oapiCameraSetCockpitDir(0.0, 0.0);
- //sprintf(oapiDebugString(), "YAW %f PITCH %f", a, b);
- }
- if (CAM == 4){
- PBCAMERA = 3;
- a = ((-camYaw[CAM_D] + 90)*RAD);
- b = ((camPitch[CAM_D] - 90)*RAD);
- //SetCameraOffset(_V(-2.2, 1.8, -6.250));
- SetCameraOffset(plbCamPos[3]);
- SetCameraDefaultDirection(_V(cos(a)*sin(b), cos(b), sin(a)*sin(b)), c);
- oapiCameraSetCockpitDir(0.0, 0.0);
- //sprintf(oapiDebugString(), "YAW %f PITCH %f", a, b);
- }
- if (CAM == 1){
- PBCAMERA = 0;
- a = ((-camYaw[CAM_A] + 90)*RAD);
- b = ((camPitch[CAM_A] - 90)*RAD);
- //SetCameraOffset(_V(2.2, 1.8, -6.250));
- SetCameraOffset(plbCamPos[0]);
- SetCameraDefaultDirection(_V(cos(a)*sin(b), cos(b), sin(a)*sin(b)), c);
- oapiCameraSetCockpitDir(0.0, 0.0);
- //sprintf(oapiDebugString(), "YAW %f PITCH %f c %f", a,b,c);
- }
- if (CAM == 2){
- PBCAMERA = 1;
- a = ((-camYaw[CAM_B] - 90)*RAD);
- b = ((camPitch[CAM_B] - 90)*RAD);
- //SetCameraOffset(_V(1.850, 1.8, 11.750));
- SetCameraOffset(plbCamPos[1]);
- SetCameraDefaultDirection(_V(cos(a)*sin(b), cos(b), sin(a)*sin(b)), c);
- oapiCameraSetCockpitDir(0.0, 0.0);
- //sprintf(oapiDebugString(), "YAW %f PITCH %f", a, b);
- }
- if (b > 0.0) c = 180.0 * RAD;
- if (CAM == 0) {
- SetCameraDefaultDirection(_V(0, 0, 1));
- SetCameraOffset(_V(-0.67, 2.55, 14.4));
- oapiCameraSetCockpitDir(0, 0);
- }
- if (CAM == 5){
- SetCameraDefaultDirection(_V(0, 1, 0));
- SetCameraOffset(KEELCAM);
- oapiCameraSetCockpitDir(0, 0);
- };
- if (CAM == 9) {
- SetCameraDefaultDirection(_V(0, -1, 0));
- SetCameraOffset(ETCAM);
- oapiCameraSetCockpitDir(0, 0);
- };
- if (CAM == 8) {
- SetCameraDefaultDirection(_V(0, 1, 0));
- SetCameraOffset(DOCKCAM);
- // sprintf(oapiDebugString(), "armtip3x %2.2f armtip3y %2.2f armtip3z %2.2f", arm_tip[5].x, arm_tip[5].y, arm_tip[5].z);
- oapiCameraSetCockpitDir(0, 0);
- }
- if (CAM == 6){//elbow view
- PBCAMERA = 5;
- VECTOR3 dir = camRMSElbowLoc[1] - camRMSElbowLoc[0];
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- VECTOR3 orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- double angle = SignedAngle(orbiter_cam_rot, camRMSElbowLoc[2] - camRMSElbowLoc[0], dir);
- SetCameraDefaultDirection(dir, angle);
- SetCameraOffset(camRMSElbowLoc[0]);
- oapiCameraSetCockpitDir(0.0, 0.0);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f cam dir: %f %f %f dir: %f %f %f Angle: %f %f length: %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, camRMSElbowLoc[1].x - camRMSElbowLoc[0].x, camRMSElbowLoc[2].y - camRMSElbowLoc[0].y, camRMSElbowLoc[2].z - camRMSElbowLoc[0].z, dir.x, dir.y, dir.z, angle, angle*DEG, length(dir));
- }
- if (CAM == 7){ //ee view
- // calculate rotation angle for EE cam
- VECTOR3 dir = arm_tip[1] - arm_tip[0];
- // if camera is pointing straight up or down, make it slightly offset from (0,1,0) vector
- if (Eq(dotp(dir, _V(0, -1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, -0.999999984769, 0.0);
- else if (Eq(dotp(dir, _V(0, 1, 0)), 1.0, 1e-4)) dir = _V(1.74532924314e-4, 0.999999984769, 0.0);
- VECTOR3 orbiter_cam_rot = crossp(crossp(dir, _V(0, 1, 0)), dir);
- orbiter_cam_rot /= length(orbiter_cam_rot);
- if (orbiter_cam_rot.y < 0) orbiter_cam_rot = -orbiter_cam_rot;
- double angle = SignedAngle(orbiter_cam_rot, arm_tip[2] - arm_tip[0], dir);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f dir: %f %f %f dot_prod: %f Angle: %f %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, dir.x, dir.y, dir.z, dot_prod, angle, angle*DEG);
- //sprintf_s(oapiDebugString(), 255, "Rot Vec: %f %f %f cam dir: %f %f %f dir: %f %f %f Angle: %f %f length: %f", orbiter_cam_rot.x, orbiter_cam_rot.y, orbiter_cam_rot.z, arm_tip[2].x - arm_tip[0].x, arm_tip[2].y - arm_tip[0].y, arm_tip[2].z - arm_tip[0].z, dir.x, dir.y, dir.z, angle, angle*DEG, length(dir));
- //sprintf_s(oapiDebugString(), 255, "dot_prod: %f Angle: %f %f", dot_prod, angle, angle*DEG);
- SetCameraOffset(arm_tip[3]);
- //STS()->SetCameraDefaultDirection (arm_tip[1]-arm_tip[0], 0.0);
- SetCameraDefaultDirection(dir, angle);
- oapiCameraSetCockpitDir(0.0, 0.0);
- }
- //SetCameraOffset(orbiter_ofs + plbCamPos[VCMode - VC_PLBCAMFL]);
- //SetCameraDefaultDirection(_V(cos(a)*sin(b), cos(b), sin(a)*sin(b)), c);
- // oapiCameraSetCockpitDir(0.0, 0.0);
- }
- int Atlantis::clbkGeneric(int msgid, int prm, void* context)
- {
- if (msgid == CAMERA_MFD)
- {
- int index = prm - 3;
- if (index < 0 || index > 2) return 0;
- if (context)
- {
- cameraData[0] = { "Keel Camera", KEELCAM, 90, 0, 0, 40, { true, true, false, true, false } };// keel camera
- cameraData[1] = { "ET Camera", ETCAM, 0, 0, 0, 40, { true, true, false, true, false } };// ET camera
- cameraData[2] = { "Payload Bay Camera A", plbCamPos[0], 0, 180, 0, 40, { true, true, false, true, false } };// payload bay camera 1
- cameraData[3] = { "Payload Bay Camera B", plbCamPos[1], 0, 0, 0, 40, { true, true, false, true, false } };// payload bay camera 2
- cameraData[4] = { "Payload Bay Camera C", plbCamPos[2], 0, 0, 0, 40, { true, true, false, true, false } };// payload bay camera 3
- cameraData[5] = { "Payload Bay Camera D", plbCamPos[3], 0, 180, 0, 40, { true, true, false, true, false } };// payload bay camera 4
- cameraData[6] = { "RMS Elbow Camera", camRMSElbowLoc[0], 0, 180, 0, 40, { true, true, false, true, false } }; // RMS elbow camera
- cameraData[7] = { "RMS EE Camera", arm_tip[3], 0, -90, 0, 40, { true, true, false, false, false } }; // RMS tip camera
- cameraData[8] = { "Dock Camera", DOCKCAM, 90, 90, 90, 40, { true, true, false, false, false } }; // dockcam camera
- cameraMFD[index] = static_cast<CameraMFD*>(context);
- cameraMFD[index]->SetCameraData(0, cameraData[0]);
- if (cameraMFD[index]->CameraDataExist())
- {
- for (int cam = 1; cam <= 8; cam++)
- cameraMFD[index]->SetCameraData(cam, cameraData[cam]);
- }
- else
- {
- for (int cam = 1; cam <= 8; cam++)
- cameraMFD[index]->AddCamera(cam, cameraData[cam]);
- }
- return CAMERA_MFD;
- }
- else cameraMFD[index] = nullptr;
- }
- return 0;
- }
- h:
- // ==============================================================
- // ORBITER MODULE: Atlantis
- // Part of the ORBITER SDK
- // Copyright (C) 2001-2012 Martin Schweiger
- // All rights reserved
- //
- // Atlantis.h
- // Class interface of Atlantis (Space Shuttle) vessel class
- // module and associated subclasses (SRB, tank)
- // ==============================================================
- #ifndef __ATLANTIS_H
- #define __ATLANTIS_H
- #include "orbitersdk.h"
- #include <math.h>
- #include <CameraMFD_API.h>
- //#ifdef ATLANTIS_TANK_MODULE
- //#define TANKFUNC DLLEXPORT
- //#else
- //#define TANKFUNC DLLIMPORT
- //#endif
- //#ifdef ATLANTIS_SRB_MODULE
- //#define SRBFUNC DLLEXPORT
- //#else
- //#define SRBFUNC DLLIMPORT
- //#endif
- // ==========================================================
- // Some Orbiter-related parameters
- // ==========================================================
- const double ORBITER_EMPTY_MASS = 104326.0;
- // Orbiter empty mass [kg]
- //const double MPS2KTS = 1.94384;
- // Orbiter empty mass [kg]
- const double ORBITER_MAX_PROPELLANT_MASS = 21600.0;
- // Amount of fuel the orbiter can hold in internal OMS tanks
- const double ORBITER_MAIN_THRUST = 1668652.0 * 1.25;
- // Vacuum thrust rating per main engine [N] (x3 for total)
- // assuming vacuum thrust is 5/4 liftoff thrust
- const double ORBITER_OMS_THRUST = 26700.0;
- // Vacuum thrust per unit for Orbital Maneuvering System [N] (x2 for total)
- const double ORBITER_RCS_THRUST = 7740.0;
- // Vacuum thrust rating for attitude thrusters (Reaction Control System) [N]
- const double ORBITER_MAIN_ISP0 = 4444.0; // 453s*9.81
- const double ORBITER_MAIN_ISP1 = 3561.0; // 363s*9.81
- // Vacuum and sea-level fuel-specific impulse for orbiter main engines [m/s]
- // using H2/O2 (hydrogen/oxygen)
- const double ORBITER_OMS_ISP0 = 3100;
- const double ORBITER_OMS_ISP1 = 2500;
- // Vacuum and sea-level fuel-specific impulse for Orbital Maneuvering System [m/s]
- // using MMH/N2O4 (monomethyl hydrazine/nitrogen tetroxide)
- const double ORBITER_RCS_ISP0 = 5000.0;
- const double ORBITER_RCS_ISP1 = 4000.0;
- // Vacuum and sea-level fuel-specific impulse for Reaction Control System [m/s]
- const double GEAR_OPERATING_SPEED = 0.3;
- // Opening/closing speed of landing gear (1/sec)
- // => gear cycle ~ 3 sec
- const double DOOR_OPERATING_SPEED = 0.007353;
- // Opening/closing speed of payload bay doors (1/sec)
- // This contains the door opening sequence (63 sec for each door) and an
- // interval of 10 sec between the two door operations
- const double RAD_OPERATING_SPEED = 0.025;
- // Deployment/stowing speed of radiators (1/sec)
- // => radiator cycle = 40 sec
- const double RADLATCH_OPERATING_SPEED = 0.2;
- // Release/engaging speed of radiator latches (1/sec)
- // => radiator latch cycle = 5 sec
- const double KU_OPERATING_SPEED = 0.0435;
- // Deployment speed of the Ku Band antenna (1/sec)
- // cycle is 23 sec
- const double SPEEDBRAKE_OPERATING_SPEED = 0.20284;
- // Deployment speed of the speedbrake (1/sec)
- // cycle is 4.93 sec
- //const double ARM_OPERATING_SPEED = 0.005;
- // RMS arm joint rotation speed (rad/sec)
- const VECTOR3 ORBITER_CS = {234.8,389.1,68.2};
- // Orbiter cross sections (projections into principal axes) [m^2]
- const VECTOR3 ORBITER_CS_GEAR = {10.0,0.0,3.0};
- // Contribution of fully extended landing gear to cross sections
- const double MAX_GRAPPLING_DIST = 4;//.5
- // max distance between RMS tip and grappling point for successful grappling
- const double MAX_GRAPPLING_ANGLE_COS_ERR = 0.02; // max angle between EE and grapple for successful grappling (cosine of angle)
- //ik
- const double ARM_TRANSLATE_SPEED = 0.1;
- // RMS IK translation speed (m/s)
- // ==========================================================
- // Some Tank-related parameters
- // ==========================================================
- //const double TANK_MAX_PROPELLANT_MASS = 719115.0;
- // Main tank propellant mass [kg]
- //const double TANK_EMPTY_MASS = 35425.0;
- // Main tank empty mass
- // ==========================================================
- // Some SRB-related parameters
- // ==========================================================
- //const double SRB_MAX_PROPELLANT_MASS = 502126.0;
- // SRB propellant mass [kg]
- //const double SRB_EMPTY_MASS = 87543.0;
- // SRB empty mass [kg]
- //const double SRB_ISP0 = 3574.68;
- //const double SRB_ISP1 = 2859.74;
- // SRB vacuum and sea-level fuel-specific impulse [m/s]
- //const double SRB_THRUST = 1202020.0*9.81 * 1.25;
- // Mean vacuum SRB thrust per unit [N]
- //const double SRB_THRUST_MAX = 1.7070e+07;
- // Peak vacuum SRB thrust per unit [N]
- //const double MAX_ATT_LAUNCH = 1e5;
- //const double MAX_ROLL_SRB = 2.5e5;
- // Max attitude thrust during launch phase (temporary)
- //const double SRB_STABILISATION_TIME = 4.0;
- // MET: -SRB ignition
- //const double SRB_SEPARATION_TIME = 126.0;
- // MET: SRB separation
- //const double SRB_CUTOUT_TIME = 135.0;
- // MET: engine shutdown
- //const double SRB_GIMBAL_SPEED = 0.5;
- // ==========================================================
- // Thruster reference positions and thrust directions
- // ==========================================================
- const VECTOR3 THRUSTREF_SSME0 = {-1.55,-0.37,-12.5};
- const VECTOR3 THRUSTREF_SSME1 = { 1.55,-0.37,-12.5};
- const VECTOR3 THRUSTREF_SSME2 = { 0.0, 2.7, -12.5};
- const VECTOR3 THRUSTREF_OMSL = { -2.8, 3.5, -13.5 };//-2.6, 3.3, -12.8
- const VECTOR3 THRUSTREF_OMSR = { 2.8, 3.5, -13.5 };//2.6, 3.3, -12.8
- const VECTOR3 THRUSTREF_SRB = { 0.0, 0.0, -20.4};
- const double THRUSTPITCH_LAUNCH = -2.3*RAD;
- const VECTOR3 THRUSTGIMBAL_LAUNCH = {0, sin(THRUSTPITCH_LAUNCH), cos(THRUSTPITCH_LAUNCH)};
- const VECTOR3 THRUSTDIR_OMSL = { 0.10, -0.23, 0.97 };//0.19299542, -0.24495572, 0.95013129
- const VECTOR3 THRUSTDIR_OMSR = { -0.10, -0.23, 0.97 }; //-0.19299542, -0.24495572, 0.95013129
- const VECTOR3 RMS_EE_POS = _V(-2.515, 2.059, -5.5327);
- const VECTOR3 RMS_ELBOW_CAM_POS = _V(-2.65, 2.533, 2.432944);
- const VECTOR3 OBSS_POS = _V(2.45, 2.2, 4.4);
- const VECTOR3 RMS_EE_CAM_POS = _V(-2.429, 2.453, -4.987415);
- //const VECTOR3 RMS_EE_CAM_POS = _V(-1.7, 2.455, -4.5);
- const VECTOR3 RMS_EE_LIGHT_POS = _V(-2.4, 2.5407, -5.0);
- const VECTOR3 RMS_Z_AXIS = _V(0.0, 1.0, 0.0); // axis along which RMS EE camera & light are mounted
- const VECTOR3 RMS_ELBOW_CAM_AXIS = _V(0.422618, 0.906308, 0.0);// 25� tilt inboard
- const double JOINT_ROTATION_SPEED = 1.0;
- const double CHUTE_DEPLOY_SPEED = 165.0 / 1.94384;
- // Speed at which chute is deployed (m/s)
- const double CHUTE_JETTISON_SPEED = 60.0 / 1.94384;
- // Speed at which chute is jettisoned (m/s)
- // ==========================================================
- // Docking port position
- // ==========================================================
- const VECTOR3 ORBITER_DOCKPOS = { -.088, 2.35, 10.166 };// 0.0, 2.40, 10.15
- // ==========================================================
- // panel area identifiers
- // ==========================================================
- // define MFD function buttons
- #define AID_CDR1_BUTTONS 1
- #define AID_PLT1_BUTTONS 2
- #define AID_MFD1_BUTTONS 3
- #define AID_MFDSIDE_BUTTONS 4
- #define AID_CCTV1_BUTTONS 5
- #define AID_CCTV2_BUTTONS 6
- // D. Beachy: define power buttons
- #define AID_CDR1_PWR 7
- #define AID_PLT1_PWR 8
- #define AID_MFD1_PWR 9
- #define AID_MFDSIDE_PWR 10
- #define AID_CCTV1_PWR 11
- #define AID_CCTV2_PWR 12
- // MFD brightness buttons
- #define AID_CDR1_BRT 13
- #define AID_PLT1_BRT 14
- #define AID_MFD1_BRT 15
- #define AID_MFDSIDE_BRT 16
- // Panel R13L (payload bay operations)
- #define AID_R13L_MIN 100
- #define AID_R13L 100
- #define AID_R13L_TKBK1 101
- #define AID_R13L_TKBK2 102
- #define AID_R13L_TKBK3 103
- #define AID_R13L_TKBK4 104
- #define AID_R13L_TKBK5 105
- #define AID_R13L_TKBK6 106
- #define AID_R13L_MAX 120
- typedef struct {
- HINSTANCE hDLL;
- SURFHANDLE tkbk_label;
- HFONT font[1];
- } GDIParams;
- //met
- #define AID_EVENTAFTTIME 114
- #define AID_METTIME 115
- #define AID_EVENTTIME 116
- #define AID_EVENT1TIME 117
- #define AID_AFTMETTIMERGMT 118
- #define AID_AFTMETTIMERMET 119
- #define AID_AFTMETTIMERTEST 121
- #define AID_AFTEVENTTEST 122
- #define AID_AFTEVENTSET 123
- #define AID_AFTEVENTRESET 124
- #define AID_AFTEVENTSTART 125
- #define AID_AFTEVENTSTOP 126
- #define AID_AFTEVENTUP 127
- #define AID_AFTEVENTDOWN 128
- #define AID_FRTMINUTE2UP 129
- #define AID_FRTMINUTE2DWN 130
- #define AID_FRTMETTIMERTEST 131
- #define AID_FRTEVENTTEST 132
- #define AID_FRTEVENTSET 133
- #define AID_FRTEVENTRESET 134
- #define AID_FRTEVENTSTART 135
- #define AID_FRTEVENTSTOP 136
- #define AID_FRTEVENTUP 137
- #define AID_FRTEVENTDOWN 138
- #define AID_FRTMINUTE1UP 139
- #define AID_FRTMINUTE1DWN 140
- #define AID_FRTSECOND1UP 141
- #define AID_FRTSECOND1DWN 142
- #define AID_FRTSECOND2UP 143
- #define AID_FRTSECOND2DWN 144
- #define AID_AFTMINUTE1UP 145
- #define AID_AFTMINUTE1DWN 146
- #define AID_AFTSECOND1UP 147
- #define AID_AFTSECOND1DWN 148
- #define AID_AFTSECOND2UP 149
- #define AID_AFTSECOND2DWN 150
- #define AID_AFTMINUTE2UP 151
- #define AID_AFTMINUTE2DWN 152
- #define AID_METTIMERGMT 153
- #define AID_METTIMERMET 154
- #define AID_METTIMERTEST 155
- #define AID_PANELA2 156
- #define AID_PANELA2SCALEX1 157
- #define AID_PANELA2TEST 158
- #define AID_PANELA2SCALEX10 159
- #define AID_PANELA2RR 160
- #define AID_PANELA2PWRON 161
- #define AID_PANELA2PWROFF 162
- //ku antenna
- #define AID_KUAZIMUTHLEFT 163
- #define AID_KUAZIMUTHRIGHT 164
- #define AID_KUELUP 165
- #define AID_KUELDOWN 166
- #define AID_KURATESLOW 167
- #define AID_KURATEFAST 168
- #define AID_LANDINGGEARLEFT 169
- #define AID_LANDINGGEARRIGHT 170
- #define AID_LANDINGGEARARMRIGHT 171
- #define AID_LANDINGGEARDNRIGHT 172
- #define AID_LANDINGGEARLEFT_TKBK3 173
- #define AID_LANDINGGEARARM 174
- #define AID_LANDINGGEARDN 175
- #define AID_FLOODON 176
- #define AID_FLOODOFF 177
- #define AID_AFTPORTFLOODON 178
- #define AID_AFTPORTFLOODOFF 179
- #define AID_AFTSTBDFLOODON 180
- #define AID_AFTSTBDFLOODOFF 181
- #define AID_MIDPORTFLOODON 182
- #define AID_MIDPORTFLOODOFF 183
- #define AID_MIDSTBDFLOODON 184
- #define AID_MIDSTBDFLOODOFF 185
- #define AID_FWDPORTFLOODON 186
- #define AID_FWDPORTFLOODOFF 187
- #define AID_FWDSTBDFLOODON 188
- #define AID_FWDSTBDFLOODOFF 189
- #define AID_AFTFLOODON 190
- #define AID_AFTFLOODOFF 191
- #define AID_DOCKFLOODDIM 192
- #define AID_DOCKFLOODOFF 193
- #define AID_DOCKFLOODBRIGHT 194
- #define AID_RCSQTY 195
- //class Atlantis_Tank;
- class AscentAPDlg;
- // ==========================================================
- // Interface for derived vessel class: Atlantis
- // ==========================================================
- class Atlantis: public VESSEL4 {
- friend class AscentAP;
- friend class PayloadBayOp;
- friend BOOL CALLBACK RMS_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- friend BOOL CALLBACK LIGHT_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- friend BOOL CALLBACK PAYLOADOPERATION_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- public:
- AnimState::Action gear_status, spdb_status;
- Atlantis (OBJHANDLE hObj, int fmodel);
- ~Atlantis();
- //AscentAP *AscentAutopilot() { return ascap; }
- //int RegisterAscentApMfd();
- //void CreateAscentAPDlg();
- //void DestroyAscentAPDlg();
- //void SeparateBoosters (double srb_time);
- // Jettison both SRBs from ET
- // void SeparateTank ();
- // Jettison ET from orbiter
- void clbkHUDMode(int mode) { currentHudMode = mode; }
- void GetSSMEGimbalPos (int which, double &pitch, double &yaw);
- void GetSRBGimbalPos (int which, double &pitch, double &yaw);
- void RevertDockingRing(void);
- void ToggleGrapple (void);
- void ToggleGrapple2(void);
- void ToggleGrapple1(void);
- void ToggleGrapple3(void);
- void ToggleGrappleOBSS(void);
- void ToggleArrest (void);
- void ToggleArrest2(void);
- void ToggleArrest1(void);
- void ToggleArrest3(void);
- void TETHER2(void);
- void TETHER1(void);
- void TETHER3(void);
- void TETHER4(void);
- void SetGearParameters (double state);
- void STOW();
- void Jettison ();
- void UpdateMesh ();
- void SetODSDock();
- void SetBayDoorPosition (double pos);
- void SetRadiatorPosition (double pos);
- void SetRadLatchPosition (double pos) {}
- void SetKuAntennaPosition (double pos);
- void SetSSMEPosition (double pos);
- void OperateLandingGear (AnimState::Action action);
- void RevertLandingGear ();
- void OperateSpeedbrake (AnimState::Action action);
- void RevertSpeedbrake ();
- void SetAnimationArm (UINT anim, double state);
- void RevertPETD();
- void RevertSETD();
- void RevertIUS();
- void RevertADTA();
- void RevertSSMESTOW();
- //new
- void SpawnEVA(void);
- void SpawnEVA1(void);
- void SpawnEVA2(void);
- void SpawnEVA3(void);
- ATTACHMENTHANDLE ft_pad_att, ft_pad_att1, ft_pad_att2, ft_pad_att3;
- VECTOR3 attp_pos[12];
- int EVA1,EVA2,EVA3,EVA4;
- //
- double GetSRBThrustLevel (int which);
- // returns the thrust level from left (which=0) or right (which=1)
- // SRB, or 0 if SRB is detached
- void RegisterVC_CdrMFD ();
- void RegisterVC_PltMFD ();
- void RegisterVC_CntMFD ();
- void RegisterVC_AftMFD ();
- void RegistergearleftVC();
- void RedrawPanel_MFDButton (SURFHANDLE surf, int mfd);
- //met
- void RedrawPanel_metmeterstatus(SURFHANDLE surf, int part);
- void RedrawPanel_EVENTstatus(SURFHANDLE surf, int part);
- void RedrawPanel_EVENT1status(SURFHANDLE surf, int part);
- void RedrawPanel_EVENTAFTstatus(SURFHANDLE surf, int part);
- void RedrawPanel_PANELA2status(SURFHANDLE surf, int part);
- void RedrawPanel_PANELRCSstatus(SURFHANDLE surf, int part);
- void panelswitch();
- //mfdcame
- int clbkGeneric(int msgid, int prm, void* context);
- int status; // 0=launch configuration
- // 1=SRB's engaged
- // 2=SRB's separated
- // 3=Tank separated (orbiter only)
- double t0; // reference time: designated liftoff time
- WORD srb_id1, srb_id2;
- double gear_proc; // landing gear deployment state (0=retracted, 1=deployed)
- //double kubd_proc; // Ku-band antenna deployment state (0=retracted, 1=deployed)
- double spdb_proc; // Speedbrake deployment state (0=retracted, 1=deployed)
- double ldoor_drag, rdoor_drag; // drag components from open cargo doors
- bool center_arm;
- bool arm_moved, arm_scheduled, armOBSS_moved;
- double center_arm_t, center_arm_time, stow_time;
- bool do_plat;
- bool do_cargostatic;
- VECTOR3 glatchpos, glatchdir, glatchrot;
- VECTOR3 ofs_sts_sat, ofs_sts_sat1, ofs_sts_sat2, ofs_sts_sat3, ofs_sts_sat4, ofs_sts_sat5, ofs_sts_sat6;
- VECTOR3 cargo_static_ofs;
- VISHANDLE vis; // handle for visual - note: we assume that only one visual per object is created!
- MESHHANDLE hOrbiterDRAGCHUTEHUD,hOrbiterMesh, hOrbiterCockpitMesh, hOrbiterVCMesh, hOrbiterRMS1Mesh, hOrbiterODSMesh, hOrbiterdragchuteMesh, hOrbiterdragchutereleasedMesh, hOrbiterMPMobss, hOrbiterEXTAIRLOCK, hOrbiterKU, hOrbiterSLIDEWIRE, hOrbiterSHUTTLEWIRE, hOrbiterTHERMALCOVER; // mesh handles
- char cargo_static_mesh_name[256];
- ATTACHMENTHANDLE sat_attach, rms_attach, sat_attach2, sat_attach3, sat_attach4, sat_attach5, sat_attach6, sat_attach7, sat_attach8, sat_attach9, sat_attach10, OBSS_attach;
- VECTOR3 arm_tip[6], armobss_tip[3], arm_ius[6];
- VECTOR3 obssdir, dockpos, ringpos,dockpos1;
- double EXT_proc;
- VECTOR3 xp0, xr0;
- // Overloaded callback functions
- void clbkSetClassCaps (FILEHANDLE cfg);
- void clbkSetStateEx (const void *status);
- void clbkLoadStateEx (FILEHANDLE scn, void *vs);
- void clbkSaveState (FILEHANDLE scn);
- void clbkPostCreation ();
- void clbkFocusChanged (bool getfocus, OBJHANDLE hNewVessel, OBJHANDLE hOldVessel);
- void clbkPreStep (double simt, double simdt, double mjd);
- bool clbkPlaybackEvent (double simt, double event_t, const char *event_type, const char *event);
- int clbkConsumeBufferedKey (DWORD key, bool down, char *kstate);
- void clbkVisualCreated (VISHANDLE vis, int refcount);
- void clbkVisualDestroyed (VISHANDLE vis, int refcount);
- void clbkAnimate (double simt);
- void clbkMFDMode (int mfd, int mode);
- void clbkRCSMode (int mode);
- bool clbkLoadGenericCockpit ();
- bool clbkLoadVC (int id);
- bool clbkVCMouseEvent (int id, int event, VECTOR3 &p);
- bool clbkVCRedrawEvent (int id, int event, SURFHANDLE surf);
- bool clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp);
- bool firstStep; //call functions in first timestep
- //ik
- void SetAnimationIKArm(VECTOR3 arm_wrist_dpos);
- VECTOR3 CalcAnimationFKArm();
- PayloadBayOp *plop; // control and status of payload bay operations
- int RMSSELECT, OBSS1, RMSDIALOG;
- int OV,MIDMODEL,DRAGCHUTE,NOSLIDEWIRE;
- void ENTER_EVA1(void);
- void ENTER_EVA2(void);
- void ENTER_EVA3(void);
- void ENTER_EVA4(void);
- void Revertextdoor(void);
- void RMSspeed(void);
- void Armtilt(void);
- void OBSStilt(void);
- void RevertDragchute(void);
- bool ItemChange(char *rstr);
- bool ItemChangeJoint(char *rstr);
- bool FullChangeJoint(char *rstr);
- double systart, spstart, epstart, wpstart, wrstart, wystart;
- double arm6_AyHUD, arm6_ApHUD, arm6_ArHUD, arm6_epHUD, arm6_BpHUD, arm6_ByHUD, arm_syHUD, arm_spHUD, arm_epHUD, arm_wpHUD, arm_wyHUD, arm_wrHUD;
- bool EVA1TETHER() const { return GetAttachmentStatus(ft_pad_att) != 0; }
- bool EVA2TETHER() const { return GetAttachmentStatus(ft_pad_att1) != 0; }
- bool EVA3TETHER() const { return GetAttachmentStatus(ft_pad_att2) != 0; }
- bool EVA4TETHER() const { return GetAttachmentStatus(ft_pad_att3) != 0; }
- //payload masses
- int PMASS0, PMASS1, PMASS2, PMASS3;//read from scn
- double MASS1, MASS2, MASS3, MASS0; //payload masses
- protected:
- void LoadMeshes();
- // Load the meshes for cockpit and exterior
- void CreateSSME();
- // Initialise the thrusters for the shuttle main engines
- void CreateOMS();
- // Initialise the thrusters for the orbital maneuvering system
- void CreateRCS();
- // Initialise the thrusters for the reaction control system
- void CreateAirfoils();
- // Initialise airfoils, aerodynamic control surfaces and drag elements
- static void VLiftCoeff (double aoa, double M, double Re, double *cl, double *cm, double *cd);
- static void HLiftCoeff (double beta, double M, double Re, double *cl, double *cm, double *cd);
- // airfoil coefficient functions
- void DefineAnimations (void);
- // Initialises all animation objects
- //
- enum hatch_status { HATCH_UP, HATCH_DOWN, HATCH_RAISING, HATCH_LOWERING } EXT_status, Armtilt_status, ODS_status, OBSS_status, CHUTE_status, DOCKRING_status, PETD_status, SETD_status, ius_status, ssmestow_status, ADTA_status;;
- enum SPANELcheck { IUS_UP, IUS_STOP, IUS_DOWN } IUS_check;
- typedef enum { SHOULDER_YAW = 0, SHOULDER_PITCH = 1, ELBOW_PITCH = 2, WRIST_PITCH = 3, WRIST_YAW = 4, WRIST_ROLL = 5 } RMS_JOINT;
- typedef enum { PAN = 0, TILT = 1 } CAMERA_MOTION;
- //
- //
- int mfd1pwr, mfd0pwr, mfd2pwr, mfdApwr,HUDpwr,floodon;
- //
- private:
- oapi::Font *font, *font1, *font2, *font3;
- int currentHudMode; // Stores the current HUD mode | don't forget to initialize at c'tor!
- int getHUDMode() const { return currentHudMode; }
- void SetSSMEGimbal (const VECTOR3 &angle);
- // Set the gimbal positions for the shuttle main engines
- double GetAscentPitchRate (double tgt_pitch);
- // Autopilot function: returns the pitch rate for the specified
- // target pitch during launch phase (until ET separation)
- void AutoGimbal (const VECTOR3 &tgt_rate);
- // Automatic gimbal adjustment for SSME and SRB engines to correct
- // for CG shift, SRB thrust variations, atmospheric effects, etc.
- void AutoRCS (const VECTOR3 &tgt_rate);
- // Automatic RCS control for ascent autopilot
- void Atlantis::SelectCockpitView(int CAM);
- unsigned short SpeedFactor;
- void LaunchClamps();
- bool EnableSSME (bool enable);
- void EnableOMS (bool enable);
- void EnableRCS (bool enable);
- void PosSSRMS(int i);
- void SeqSSRMS();
- void CheckFlags();
- void DetermineArmSeq(int ItemValue);
- void LOADA();
- void LOADB();
- void LOADC();
- void LOADD();
- void SAVEA();
- void SAVEB();
- void SAVEC();
- void SAVED();
- void ARMSEQ();
- void ARMINPUT();
- void FULLINPUT();
- bool SatGrappled() const { return GetAttachmentStatus (rms_attach) != 0; }
- bool SatStowed() const { return GetAttachmentStatus (sat_attach) != 0; }
- bool SatStowed2() const { return GetAttachmentStatus(sat_attach2) != 0; }
- bool SatStowed3() const { return GetAttachmentStatus(sat_attach3) != 0; }
- ANIMATIONCOMPONENT_HANDLE hAC_arm1;
- ATTACHMENTHANDLE CanArrest() const;
- ATTACHMENTHANDLE CanArrest2() const;
- ATTACHMENTHANDLE CanArrest1() const;
- ATTACHMENTHANDLE CanArrest3() const;
- ATTACHMENTHANDLE CanArrestOBSS() const;
- VECTOR3 pl1_ofs, pl2_ofs, pl3_ofs, pl4_ofs, pl5_ofs, pl6_ofs, pl7_ofs, pl8_ofs, pl9_ofs, pl10_ofs, ft_pad_att_pos, ft_pad_att1_pos, ft_pad_att2_pos, ft_pad_att3_pos;
- VECTOR3 pl1_dir, pl2_dir, pl3_dir, pl4_dir, pl5_dir, pl6_dir, pl7_dir, pl8_dir, pl9_dir, pl10_dir, ft_pad_att_dir, ft_pad_att1_dir, ft_pad_att2_dir, ft_pad_att3_dir;
- VECTOR3 pl1_rot, pl2_rot, pl3_rot, pl4_rot, pl5_rot, pl6_rot, pl7_rot, pl8_rot, pl9_rot, pl10_rot, ft_pad_att_rot, ft_pad_att1_rot, ft_pad_att2_rot, ft_pad_att3_rot;
- VECTOR3 pl1_ofs_scn, pl2_ofs_scn, pl3_ofs_scn, pl4_ofs_scn, pl5_ofs_scn, pl6_ofs_scn, pl7_ofs_scn, pl8_ofs_scn, pl9_ofs_scn, pl10_ofs_scn, ft_pad_att_pos_scn, ft_pad_att1_pos_scn, ft_pad_att2_pos_scn, ft_pad_att3_pos_scn;
- VECTOR3 pl1_dir_scn, pl2_dir_scn, pl3_dir_scn, pl4_dir_scn, pl5_dir_scn, pl6_dir_scn, pl7_dir_scn, pl8_dir_scn, pl9_dir_scn, pl10_dir_scn, ft_pad_att_dir_scn, ft_pad_att1_dir_scn, ft_pad_att2_dir_scn, ft_pad_att3_dir_scn;
- VECTOR3 pl1_rot_scn, pl2_rot_scn, pl3_rot_scn, pl4_rot_scn, pl5_rot_scn, pl6_rot_scn, pl7_rot_scn, pl8_rot_scn, pl9_rot_scn, pl10_rot_scn, ft_pad_att_rot_scn, ft_pad_att1_rot_scn, ft_pad_att2_rot_scn, ft_pad_att3_rot_scn;
- VECTOR3 KEELCAM, KEELCAM_scn, ETCAM, ETCAM_scn, DOCKCAM, DOCKCAM_scn;
- AscentAP *ascap; // ascent autopilot
- int ascapMfdId; // ID for ascent autopilot MFD mode
- //Atlantis_Tank *pET; // pointer to ET object (if attached)
- DOCKHANDLE hDockET, hDockODS; // docking connector to ET
- VECTOR3 gimbal_pos; // gimbal settings for pitch,yaw,roll
- UINT anim_door;
- UINT anim_ssmestow;
- UINT anim_ADTA; // handle for cargo door animation
- UINT anim_extodsdoor;
- UINT anim_EXTAIRLOCK;
- UINT anim_extdoor;
- UINT anim_armtwist;
- //RMS Camera rot/direction
- double camRMSElbow[2];
- VECTOR3 camRMSElbowLoc[3];
- UINT anim_camRMSElbow[2];
- UINT anim_joint[6];
- //
- //payloadcam
- // PAYLOAD CAMERAS ANIMATIONS
- UINT anim_camFLyaw; // handle for front-left payload camera yaw animation
- UINT anim_camFLpitch; // handle for front-left payload camera pitch animation
- UINT anim_camFRyaw; // handle for front-right payload camera yaw animation
- UINT anim_camFRpitch; // handle for front-right payload camera pitch animation
- UINT anim_camBLyaw; // handle for back-left payload camera yaw animation
- UINT anim_camBLpitch; // handle for back-left payload camera pitch animation
- UINT anim_camBRyaw; // handle for back-right payload camera yaw animation
- UINT anim_camBRpitch; // handle for back-right payload camera pitch animation
- typedef enum { CAM_A = 0, CAM_B = 1, CAM_C = 2, CAM_D = 3 } PLB_CAM;
- double camYaw[4], camPitch[4];
- VECTOR3 plbCamPos[4];
- // Camera MFD
- CameraMFD* cameraMFD[3];
- CameraMFD::CameraData cameraData[9];
- // Selected camera must be moved at low rate (if false at high rate)
- bool cameraLowRate;
- // If a camera have been moved (used for reposition camera animations)
- bool cameraMoved;
- // Selected camera for control
- int cameraControl; // 0:FL 1:FR 2:BL 3:BR 4:RMS Elbow
- // Sets the camera positions and animations.
- void SetAnimationCameras();
- double MAX_PLB_CAM_PAN, MAX_PLB_CAM_TILT, CAMRATE, anim_yaw, anim_pitch, a, b, c, MIN_PLB_CAM_PAN;
- UINT PLBCamPanLeft[4], PLBCamPanRight[4], PLBCamTiltUp[4], PLBCamTiltDown[4];
- bool bPLBCamPanLeft_Man, bPLBCamPanRight_Man, bPLBCamTiltUp_Man, bPLBCamTiltDown_Man, ElbowCamTiltUp, ElbowCamTiltDown, ElbowCamPanLeft, ElbowCamPanRight;
- //double CalculateCameraRotationAngle(VECTOR3& dir, const VECTOR3& rot);
- //double Cameraangle;
- VECTOR3 Cameraangle;
- NOTEHANDLE nhCameraLabel; // annotation to display current camera view
- double annotationDisplayTime; // counter used to show/hide camera label
- //
- double arm1_Ay, arm1_Ap, arm1_Ar, arm1_ep, arm1_Bp, arm1_By, arm1_Br;
- double arm2_Ay, arm2_Ap, arm2_Ar, arm2_ep, arm2_Bp, arm2_By, arm2_Br;
- double arm3_Ay, arm3_Ap, arm3_Ar, arm3_ep, arm3_Bp, arm3_By, arm3_Br;
- double arm4_Ay, arm4_Ap, arm4_Ar, arm4_ep, arm4_Bp, arm4_By, arm4_Br;
- double arm5_Ay, arm5_Ap, arm5_Ar, arm5_ep, arm5_Bp, arm5_By, arm5_Br;
- double arm6_Ay, arm6_Ap, arm6_Ar, arm6_ep, arm6_Bp, arm6_By, arm6_Br;
- double armM_Ay, armM_Ap, armM_Ar, armM_ep, armM_Bp, armM_By, armM_Br;
- bool arm1set, arm2set, arm3set, arm4set, arm5set;
- int armseq[8];
- int Seqindex;
- bool Seqfinished;
- bool SpeedChange;
- //
- double ARM_OPERATING_SPEED, OBSS_proc, DOCKRING_proc, AIRSPEEDKNOT, spbrkx, SETD_proc, PETD_proc,ssmes_proc,ADTA_proc;
- int ORIGINAL, spdb_on, spdb_off, spdb_plus, spdb_minus, spdb_auto, rmshud ,NOKU,NOWIRE,GRAB;
- bool camera_moved, update_vectors;
- double distattach;
- UINT anim_MPM; // handle for mpm
- UINT anim_MPMOBSS; // handle for mpmOBSS
- //UINT anim_rad;
- // handle for radiator animation
- UINT anim_PRADIATOR;
- UINT anim_SRADIATOR;
- UINT anim_gear; // handle for landing gear animation
- UINT anim_kubd; // handle for Ku-band antenna animation
- UINT anim_elev; // handle for elevator animation
- UINT anim_laileron; // handle for left aileron animation
- UINT anim_raileron; // handle for right aileron animation
- UINT anim_rudder; // handle for rudder animation
- UINT anim_spdb; // handle for speed brake animation
- UINT anim_ssmes;
- UINT anim_CHUTE; // handle for speed brake animation
- // handle for SSME pitch gimbal animation
- UINT mesh_orbiter; // index for orbiter mesh
- UINT mesh_cockpit; // index for cockpit mesh for external view
- UINT mesh_vc; // index for virtual cockpit mesh
- UINT mesh_ODS;
- UINT mesh_RMS1; // index for DEFAULT RMS
- UINT mesh_cargo; // index for cargo
- UINT mesh_platform; // index for payload platform meshFcent
- UINT mesh_DRAGCHUTE; // dragchute mesh
- UINT mesh_DRAGCHUTERELEASED; // dragchute mesh
- UINT mesh_MPMOBSS;
- UINT mesh_EXTAIRLOCK;
- UINT anim_DOCKRING; // dragchute mesh
- UINT anim_bf;//body flap
- UINT anim_SETD;
- UINT anim_PETD;
- UINT anim_mfd1,anim_mfd2,anim_mfd0,anim_mfdAFT;
- UINT mesh_KU, mesh_SLIDEWIRE, mesh_SHUTTLEWIRE, mesh_THERMALCOVER, mesh_DRAGCHUITEHUD;
- UINT anim_AFTMETTIMER, anim_AFTSETRESET, anim_AFTTIMERSTARTSTOP, anim_AFTTIMERUPDOWNTEST, anim_FRTMET, anim_PANELA2TEST, anim_PANELA2SCALE, anim_PANELA2pwr,anim_KUAZ, anim_KUEL, anim_KURATE;
- UINT anim_FRTEVENTMINUTE2, anim_FRTEVENTMINUTE1, anim_FRTEVENTSECOND2, anim_FRTEVENTSECOND1;
- UINT anim_AFTEVENTMINUTE2, anim_AFTEVENTMINUTE1, anim_AFTEVENTSECOND2, anim_AFTEVENTSECOND1;
- UINT anim_FRTSETRESET, anim_FRTTIMERSTARTSTOP, anim_FRTTIMERUPDOWNTEST;
- PROPELLANT_HANDLE ph_oms; // handles for propellant resources
- THRUSTER_HANDLE th_main[3]; // handles for orbiter main engines
- THRUSTER_HANDLE th_oms[2]; // handles for orbiter oms engines
- THGROUP_HANDLE thg_main, thg_oms; // handles for thruster groups
- int CAM, rmsspeed, ODS, DRAGCHUTEDEPLOYED, EXTAIRLOCK;
- // RMS arm animation status
- ANIMATIONCOMPONENT_HANDLE hAC_arm, hAC_sat, hAC_satref;
- MGROUP_TRANSFORM *rms_anim[9], *obss_anim[1],*ius_anim[1];
- MGROUP_TRANSFORM *ssme_anim[3], *ssme_animSTOW[3];
- UINT anim_arm_sy, anim_arm_sp, anim_arm_ep, anim_arm_wp, anim_arm_wy, anim_arm_wr;
- double arm_sy, arm_sp, arm_ep, arm_wp, arm_wy, arm_wr;
- int Shuttlechutereleased, wheelbrake, PBCAMERA ,geararmed;
- double launchelev; // elevation of launch stack on the ground [m]
- UINT anim_rms_ee;
- UINT anim_ius, anim_SLIDEWIRE;
- MGROUP_TRANSFORM *sat_anim, *sat_ref;
- bool bManualSeparate; // flag for user-induced booster or tank separation
- bool reset_sat;
- OBJHANDLE hMMU, hSAT,hMM1;
- bool render_cockpit;
- double mfdbright[4];
- double cockpitbright;
- //
- double Armtilt_proc, CHUTE_proc, olddockpos, rotchange, rotchange1, phi1, rotchange4, rotchange5, ius_proc, SPINACC, SPINACC1, SPINACC4, SPINACC5, ExternalTankHatch_proc, ssmestow_proc;
- //
- double phi, tiltvalue, ANGULAR_VEL, ANGULAR_VEL1, ANGULAR_VEL4, ANGULAR_VEL5, phi2, phi4, phi5;
- double spintable_vel, spintable1_vel, spintable4_vel, spintable5_vel;
- double spintable_phi, spintable1_phi, spintable4_phi, spintable5_phi;
- int USEIUS, tilt, SPIN1, spintable, SPIN2, spintable1, SPIN3, SPIN4, SPIN5, spintable4, spintable5, SPIN0, vccameracase ;
- VECTOR3 arm1_tip[3], arm2_tip[3], arm3_tip[3], arm4_tip[3];
- VECTOR3 xp1, xr1, DIR, ROT, ROT1, xp2, xr2, xp4, xr4, xp5, xr5, ROT4, ROT5;
- NOTEHANDLE hNote;
- // double arm_sy_stored1, arm_sp_stored1, arm_ep_stored1, arm_wp_stored1, arm_wy_stored1, arm_wr_stored1;
- // double arm_sy_stored2, arm_sp_stored2, arm_ep_stored2, arm_wp_stored2, arm_wy_stored2, arm_wr_stored2;
- // double arm_sy_stored3, arm_sp_stored3, arm_ep_stored3, arm_wp_stored3, arm_wy_stored3, arm_wr_stored3;
- // double arm_sy_stored4, arm_sp_stored4, arm_ep_stored4, arm_wp_stored4, arm_wy_stored4, arm_wr_stored4;
- int storerms, recallstored, rmsexecute;
- //IK parameters
- VECTOR3 arm_wrist_pos;
- double lu, ll;
- double shoulder_neutral;
- double shoulder_range, shoulder_min, shoulder_max;
- double elbow_neutral;
- double elbow_range, elbow_min, elbow_max;
- double wrist_neutral;
- double wrist_range, wrist_min, wrist_max;
- SURFHANDLE contrail_tex; // contrail particle texture
- LightEmitter *engine_light;
- double engine_light_level;
- double ATMPRESSURE; //get DYNAMIC pressure for rcs or control surfaces
- //AscentAPDlg *ascentApDlg;
- int aft_light_status, rmslight_status, flood1_status, flood2_status, flood3_status, flood4_status, flood5_status, flood6_status, docklight_status, docklightdim_status, docklightbright_status;
- SpotLight *spotlight1, *spotlight2, *spotlight3, *spotlight4, *spotlight5, *spotlight6, *spotlight7, *spotlightDOCK, *spotlightRMS;
- BEACONLIGHTSPEC spot_beacon[9];
- VECTOR3 beacon_col = _V(0.75, 0.75, 0.75);
- //eva
- char crew1_name[40];
- char crew2_name[40];
- char crew3_name[40];
- char crew4_name[40];
- char crew1_cfg[40];
- char crew2_cfg[40];
- char crew3_cfg[40];
- char crew4_cfg[40];
- char crew1_name_scn[40];
- char crew2_name_scn[40];
- char crew3_name_scn[40];
- char crew4_name_scn[40];
- char crew1_cfg_scn[40];
- char crew2_cfg_scn[40];
- char crew3_cfg_scn[40];
- char crew4_cfg_scn[40];
- int CREW1, CREW2, CREW3, CREW4;
- int VCCAM;
- //met
- //etimer
- short time;
- double clk;
- short timeAFT;
- double clkAFT;
- //bool start;
- bool up;
- bool upAFT;
- int ETest, TimerReset, TimerStart, TimerSet,A2Test;
- int ETestAFT, TimerResetAFT, TimerStartAFT, TimerSetAFT;
- int switchtimer;
- int Etimer_state[10], Minutes1set, Minutes2set, Minutes3set, Minutes4set;
- int EtimerAFT_state[10], Minutes1setAFT, Minutes2setAFT, Minutes3setAFT, Minutes4setAFT;
- UINT MeshMain, METNUMBER;
- //
- double MET, loadedMET, fGMT;
- int AFTtimer_state[10], GMTmode, Testmode, lTime, METmode, sGMTMillis, Ftimer_state[10], FGMTmode, FTestmode, FMETmode;
- int hours1, minutes, minutes1, timenew, seconds, days, hours;
- int sGMTDays, sGMTHours, sGMTSeconds, sGMTMinutes;
- double FRONTMINUTE2_proc, FRONTMINUTE1_proc, FRONTSECOND2_proc, FRONTSECOND1_proc;
- double AFTMINUTE2_proc, AFTMINUTE1_proc, AFTSECOND2_proc, AFTSECOND1_proc;
- //PANELA1/A2
- int PANELa2pwr;
- int KUAZ, KUEL;
- double elevation, KURATE ;
- //UINT anim_kubdAlpha, anim_kubdBeta;
- UINT anim_LEFTGEARARMON, anim_LEFTGEARDN, anim_LEFTGEARTALKBACK, anim_LEFTGEARARMOFF, anim_LEFTGEARUP ;
- UINT anim_RIGHTGEARARMON, anim_RIGHTGEARDN, anim_RIGHTGEARTALKBACK, anim_RIGHTGEARARMOFF, anim_RIGHTGEARUP;
- UINT anim_floodon, anim_floodportaft, anim_floodportmid, anim_floodportfwd, anim_floodstbdaft, anim_floodstbdmid, anim_floodstbdfwd, anim_fwdlight, anim_docklight,anim_HUDpower, anim_ATDADeploy,anim_dragdeploy,anim_chutejett;
- //RCSQUANTITY
- double RCSQTY;
- double fuelmass;
- //rcsindicators
- UINT anim_pitchup, anim_pitchdown, anim_yawleft, anim_yawright, anim_rollleft, anim_rollright;
- //SPI
- UINT anim_BODYFLAPINDICATOR, anim_rudderINDICATOR, anim_speedbrakeINDICATOR, anim_leftelevonINDICATOR, anim_rightelevonINDICATOR;
- UINT anim_AUTOSPDBRAKE, anim_AUTOBDYFLAP;
- };
- #endif // !__ATLANTIS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement