I am sprucing up some code in Kev33's Mirage 2000 model and am trying to save and read animation states to the scenario file.
I am writing the animation status and state using clbkSaveState:
This seems to be working properly as I get the following in the scenario file:
But clbkLoadStateEx doesn't seem to be able to read those lines from the scenario with this code:
I'm not quite sure what is going on. The scenario loads, but the canopy animation status and state are in the position of their initialized state (UINT canopy_anim_status = 0 and double canopy_anim_state = 0.0).
I am writing the animation status and state using clbkSaveState:
C++:
void Mirage2000::clbkSaveState(FILEHANDLE scn)
{
VESSEL2::clbkSaveState(scn);
//Write canopy animation status and state
oapiWriteScenario_int(scn, "canopy_anim_status", canopy_anim_status);
oapiWriteScenario_float(scn, "canopy_anim_state", canopy_anim_state);
}
This seems to be working properly as I get the following in the scenario file:
Code:
K-Mirage2000:K33\K-Mirage2000
STATUS Landed Earth
POS -80.6832361 28.5978592
HEADING 330.33
ALT 2.401
AROT 66.737 33.746 9.912
AFCMODE 7
PRPLEVEL 0:1.000000
NAVFREQ 94 481
canopy_anim_status 1 //canopy opening
canopy_anim_state 0.537892 //canopy 53.8% open
END
But clbkLoadStateEx doesn't seem to be able to read those lines from the scenario with this code:
C++:
void Mirage2000::clbkLoadStateEx(FILEHANDLE scn, void *status)
{
char *line;
while (oapiReadScenario_nextline(scn, line))
{
//Load canopy animation status and state
if (!_strnicmp(line, "canopy_anim_status", 19))
{
sscanf(line + 19, "%li", &canopy_anim_status);
}
else if (!_strnicmp(line, "canopy_anim_state", 18))
{
sscanf(line + 18, "%lf", &canopy_anim_state);
}
else
{
ParseScenarioLineEx(line, status);
}
}
}
I'm not quite sure what is going on. The scenario loads, but the canopy animation status and state are in the position of their initialized state (UINT canopy_anim_status = 0 and double canopy_anim_state = 0.0).
Last edited: