Revision | 1735f6a35598343464462e4dd12a273a0ae580cc (tree) |
---|---|
Time | 2013-03-08 00:56:24 |
Author | Face |
Commiter | Face |
Merged in fixes for issue #1
@@ -6,29 +6,11 @@ | ||
6 | 6 | #pragma once |
7 | 7 | #define ORBITER_MODULE |
8 | 8 | #define _CRT_SECURE_NO_WARNINGS |
9 | -#define _CRT_NONSTDC_NO_DEPRECATE | |
10 | -#define SPACECRAFTCLASS "spacecraft\\spacecraft" | |
11 | -#define SPACECRAFTINIPATH ".\\Config\\Spacecraft\\%s.ini" | |
12 | -#define CONFIGDIRTAG "ConfigDir" | |
13 | -#define MESHDIRTAG "MeshDir" | |
14 | -#define TEXTUREDIRTAG "TextureDir" | |
15 | -#define HIGHTEXDIRTAG "HightexDir" | |
16 | -#define SCENARIODIRTAG "ScenarioDir" | |
17 | -#define CONFIGDIRDEFAULT ".\\Config\\" | |
18 | -#define MESHDIRDEFAULT ".\\Meshes\\" | |
19 | -#define TEXTUREDIRDEFAULT ".\\Textures\\" | |
20 | -#define HIGHTEXDIRDEFAULT ".\\Textures2\\" | |
21 | -#define SCENARIODIRDEFAULT ".\\Scenarios\\" | |
22 | -#define CONFIGPATH "%s%s.cfg" | |
23 | -#define CONFIG2PATH "%sVessels\\%s.cfg" | |
24 | -#define ORBITERCONFIG "Orbiter.cfg" | |
25 | -#define CONFIGEXCEPTION "abort: neither vessel configuration \"%s%s.cfg\" nor \"%sVessels\\%s.cfg\" was found!" | |
9 | +#define _CRT_NONSTDC_NO_DEPRECATE | |
10 | +//############################################################################// | |
26 | 11 | #include <math.h> |
27 | 12 | #include <stdio.h> |
28 | 13 | #include "orbitersdk.h" |
29 | -#ifndef NOPM | |
30 | -#include <PayloadManager.h> | |
31 | -#endif | |
32 | 14 | //############################################################################// |
33 | 15 | #include "genericvessel.h" |
34 | 16 |
@@ -130,6 +112,10 @@ | ||
130 | 112 | //INI file at legacy location - fixed prefix here, because it is not clear if SC3 respected custom config paths |
131 | 113 | iniFile=new char[strlen(name)+strlen(SPACECRAFTINIPATH)]; |
132 | 114 | sprintf(iniFile, SPACECRAFTINIPATH, name); |
115 | + }else if (strncmp(cn, SPACECRAFTCLASS2, strlen(SPACECRAFTCLASS2))==0){ | |
116 | + //INI file at legacy location - fixed prefix here, because it is not clear if SC3 respected custom config paths | |
117 | + iniFile=new char[strlen(name)+strlen(SPACECRAFTINIPATH)]; | |
118 | + sprintf(iniFile, SPACECRAFTINIPATH, name); | |
133 | 119 | }else{ |
134 | 120 | //configuration file is also INI file, read orbiter.cfg first to get custom config paths |
135 | 121 | FILEHANDLE f=oapiOpenFile(ORBITERCONFIG, FILE_IN); |
@@ -315,6 +301,12 @@ | ||
315 | 301 | } |
316 | 302 | } |
317 | 303 | |
304 | + //Initialize animations | |
305 | + for(i=0;i<sc3.Config.anicnt;i++){ | |
306 | + ani[i].status=ANI_BACK_PAUSE; | |
307 | + if(ani[i].repeat)ani[i].status=ANI_RUN; | |
308 | + } | |
309 | + | |
318 | 310 | //Beacons |
319 | 311 | for(i=0;i<sc3.Config.beaccnt;i++)AddBeacon(&sc3.Data.beac[i].bl); |
320 | 312 |
@@ -369,7 +361,7 @@ | ||
369 | 361 | if(PM_LoadState(line))continue; |
370 | 362 | #endif |
371 | 363 | |
372 | - //Animation states (not SC3 compatible) | |
364 | + //Animation states | |
373 | 365 | if(!strnicmp(line,"SEQ",3)){ |
374 | 366 | sscanf(line+4,"%d",&i); |
375 | 367 | if((i>=0)&&(i<sc3.Config.anicnt)){ |
@@ -377,10 +369,9 @@ | ||
377 | 369 | if(i>=10)n=1; |
378 | 370 | if(i>=100)n=2; |
379 | 371 | if(i>=1000)n=3; |
380 | - sscanf(line+6+n,"%d",&ani[i].status); | |
381 | - sscanf(line+6+n+3,"%lf",&ani[i].proc); | |
372 | + sscanf(line+6+n,"%d %lf",&ani[i].status,&ani[i].proc); | |
382 | 373 | SetAnimation(ani[i].id,ani[i].proc); |
383 | - if(sc3.Config.tdp_anim==i)if(abs(ani[i].status)==2){ | |
374 | + if(sc3.Config.tdp_anim==i)if(abs(ani[i].status)==ANI_PAUSE){ | |
384 | 375 | if(sc3.Config.tdcnt>=1)if(ani[i].proc==0.0)SetTouchdownPoints(sc3.Data.td[0].pta,sc3.Data.td[0].ptb,sc3.Data.td[0].ptc); |
385 | 376 | if(sc3.Config.tdcnt>=2)if(ani[i].proc==1.0)SetTouchdownPoints(sc3.Data.td[1].pta,sc3.Data.td[1].ptb,sc3.Data.td[1].ptc); |
386 | 377 | } |
@@ -510,26 +501,46 @@ | ||
510 | 501 | case OAPI_KEY_A:att_on=!att_on;att_blank=1;break; |
511 | 502 | } |
512 | 503 | } |
504 | + //Payload jettisoning | |
513 | 505 | if(key==OAPI_KEY_J)sc3.Jettison(); |
506 | + | |
507 | + | |
514 | 508 | //Animation handling |
515 | 509 | for(i=0;i<sc3.Config.anicnt;i++)if(ani[i].tp==0){ |
516 | 510 | DWORD mod=ani[i].trigkey >> 8; |
517 | 511 | if(!mod | KEYDOWN(kstate, mod))if(key==(ani[i].trigkey & 0xFF)){ |
518 | - if(!ani[i].repeat){ | |
519 | - switch(ani[i].status){ | |
520 | - //Fix it short | |
521 | - case -2:ani[i].status=1;break; | |
522 | - case -1:ani[i].status=1;break; | |
523 | - case 1:ani[i].status=-1;break; | |
524 | - case 2:ani[i].status=-1;break; | |
525 | - default:ani[i].status=2; | |
526 | - } | |
527 | - }else{ | |
528 | - switch(ani[i].status){ | |
529 | - case 1:ani[i].status=0;break; | |
530 | - case 0:ani[i].status=1;break; | |
531 | - default:ani[i].status=0; | |
532 | - } | |
512 | + if(ani[i].repeat!=0){ | |
513 | + switch(ani[i].status){ | |
514 | + case ANI_RUN:ani[i].status=ANI_PAUSE;break; | |
515 | + case ANI_PAUSE:ani[i].status=ANI_RUN;break; | |
516 | + default:ani[i].status=ANI_RUN; | |
517 | + } | |
518 | + }else if(ani[i].pause){ | |
519 | + if(KEYMOD_LCONTROL(kstate)){ | |
520 | + switch(ani[i].status){ | |
521 | + case ANI_RUN :ani[i].status=ANI_PAUSE;break; | |
522 | + case ANI_BACK_RUN :ani[i].status=ANI_PAUSE;break; | |
523 | + case ANI_BACK_PAUSE:ani[i].status=ANI_BACK_RUN;break; | |
524 | + case ANI_PAUSE :ani[i].status=ANI_BACK_RUN;break; | |
525 | + default:ani[i].status=ANI_PAUSE; | |
526 | + } | |
527 | + }else{ | |
528 | + switch(ani[i].status){ | |
529 | + case ANI_RUN :ani[i].status=ANI_PAUSE;break; | |
530 | + case ANI_BACK_RUN :ani[i].status=ANI_PAUSE;break; | |
531 | + case ANI_BACK_PAUSE:ani[i].status=ANI_RUN;break; | |
532 | + case ANI_PAUSE :ani[i].status=ANI_RUN;break; | |
533 | + default:ani[i].status=ANI_PAUSE; | |
534 | + } | |
535 | + } | |
536 | + }else{ | |
537 | + switch(ani[i].status){ | |
538 | + case ANI_RUN :ani[i].status=ANI_BACK_RUN;break; | |
539 | + case ANI_BACK_RUN :ani[i].status=ANI_RUN;break; | |
540 | + case ANI_BACK_PAUSE:ani[i].status=ANI_RUN;break; | |
541 | + case ANI_PAUSE :ani[i].status=ANI_BACK_RUN;break; | |
542 | + default:ani[i].status=ANI_PAUSE; | |
543 | + } | |
533 | 544 | } |
534 | 545 | } |
535 | 546 | } |
@@ -569,28 +580,28 @@ | ||
569 | 580 | double pos; |
570 | 581 | |
571 | 582 | //Animations |
572 | - for(i=0;i<sc3.Config.anicnt;i++)if(abs(ani[i].status)==1){ | |
583 | + for(i=0;i<sc3.Config.anicnt;i++)if((ani[i].status==ANI_RUN)||(ani[i].status==ANI_BACK_RUN)){ | |
573 | 584 | double da=simdt*ani[i].spd; |
585 | + | |
574 | 586 | if(ani[i].repeat==1){ |
575 | 587 | ani[i].proc=fmod(ani[i].proc+da,1); |
576 | 588 | }else if(ani[i].repeat==2){ |
577 | - if(ani[i].status==1){ | |
578 | - if(ani[i].proc+da>1.0){ani[i].status=-1;ani[i].proc=(ani[i].proc+da)-1.0;}else ani[i].proc+=da; | |
579 | - } | |
580 | - if(ani[i].status==-1){ | |
581 | - if(ani[i].proc-da<0.0){ani[i].status=1;ani[i].proc=-(ani[i].proc-da);}else ani[i].proc-=da; | |
589 | + if(ani[i].status==ANI_RUN){ | |
590 | + if(ani[i].proc+da>1.0){ani[i].status=ANI_BACK_RUN;ani[i].proc=1.0;}else ani[i].proc+=da; | |
591 | + }else if(ani[i].status==ANI_BACK_RUN){ | |
592 | + if(ani[i].proc-da<0.0){ani[i].status=ANI_RUN;ani[i].proc=0;}else ani[i].proc-=da; | |
582 | 593 | } |
583 | 594 | }else{ |
584 | - if(ani[i].status==-1){ | |
595 | + if(ani[i].status==ANI_BACK_RUN){ | |
585 | 596 | if(ani[i].proc>0.0)ani[i].proc=max(0.0,ani[i].proc-da); |
586 | - else ani[i].status=-2; | |
597 | + else ani[i].status=ANI_BACK_PAUSE; | |
587 | 598 | }else{ |
588 | 599 | if(ani[i].proc<1.0)ani[i].proc=min(1.0,ani[i].proc+da); |
589 | - else ani[i].status=2; | |
600 | + else ani[i].status=ANI_PAUSE; | |
590 | 601 | } |
591 | 602 | } |
592 | 603 | SetAnimation(ani[i].id,ani[i].proc); |
593 | - if(sc3.Config.tdp_anim==i)if(abs(ani[i].status)==2){ | |
604 | + if(sc3.Config.tdp_anim==i)if(abs(ani[i].status)==ANI_PAUSE){ | |
594 | 605 | if(sc3.Config.tdcnt>=1)if(ani[i].proc==0.0)SetTouchdownPoints(sc3.Data.td[0].pta,sc3.Data.td[0].ptb,sc3.Data.td[0].ptc); |
595 | 606 | if(sc3.Config.tdcnt>=2)if(ani[i].proc==1.0)SetTouchdownPoints(sc3.Data.td[1].pta,sc3.Data.td[1].ptb,sc3.Data.td[1].ptc); |
596 | 607 | } |
@@ -6,7 +6,30 @@ | ||
6 | 6 | #pragma once |
7 | 7 | #include "Orbitersdk.h" |
8 | 8 | #include "SC3Data.h" |
9 | -#define CUSTOMDIRSLENGTH 1024 | |
9 | +#define CUSTOMDIRSLENGTH 1024 | |
10 | +//############################################################################// | |
11 | +#define SPACECRAFTCLASS "spacecraft\\spacecraft" | |
12 | +#define SPACECRAFTCLASS2 "spacecraft/spacecraft" | |
13 | +#define SPACECRAFTINIPATH ".\\Config\\Spacecraft\\%s.ini" | |
14 | +#define CONFIGDIRTAG "ConfigDir" | |
15 | +#define MESHDIRTAG "MeshDir" | |
16 | +#define TEXTUREDIRTAG "TextureDir" | |
17 | +#define HIGHTEXDIRTAG "HightexDir" | |
18 | +#define SCENARIODIRTAG "ScenarioDir" | |
19 | +#define CONFIGDIRDEFAULT ".\\Config\\" | |
20 | +#define MESHDIRDEFAULT ".\\Meshes\\" | |
21 | +#define TEXTUREDIRDEFAULT ".\\Textures\\" | |
22 | +#define HIGHTEXDIRDEFAULT ".\\Textures2\\" | |
23 | +#define SCENARIODIRDEFAULT ".\\Scenarios\\" | |
24 | +#define CONFIGPATH "%s%s.cfg" | |
25 | +#define CONFIG2PATH "%sVessels\\%s.cfg" | |
26 | +#define ORBITERCONFIG "Orbiter.cfg" | |
27 | +#define CONFIGEXCEPTION "abort: neither vessel configuration \"%s%s.cfg\" nor \"%sVessels\\%s.cfg\" was found!" | |
28 | +//############################################################################// | |
29 | +#define ANI_RUN 1 | |
30 | +#define ANI_BACK_RUN -1 | |
31 | +#define ANI_PAUSE 2 | |
32 | +#define ANI_BACK_PAUSE -2 | |
10 | 33 | //############################################################################// |
11 | 34 | //Vessel class |
12 | 35 | class GenericVessel:public VESSEL3{ |
@@ -86,7 +86,7 @@ | ||
86 | 86 | }; |
87 | 87 | struct genericvessel_animinfo{ |
88 | 88 | UINT id; |
89 | - DWORD tp,repeat; | |
89 | + DWORD tp,repeat,pause; | |
90 | 90 | DWORD trigkey; |
91 | 91 | int status; |
92 | 92 | double spd,proc,init; |
@@ -156,7 +156,7 @@ | ||
156 | 156 | //############################################################################// |
157 | 157 | //Crew info |
158 | 158 | struct genericvessel_crewinfo{ |
159 | - VECTOR3 air_pos,eva_rot,air_siz; //Airlock position, rotation, ... | |
159 | + VECTOR3 air_pos,air_siz,eva_pos,eva_rot; //Airlock position, rotation, ... | |
160 | 160 | int maxcrew; |
161 | 161 | }; |
162 | 162 | //############################################################################// |
@@ -179,13 +179,8 @@ | ||
179 | 179 | begin |
180 | 180 | result:=0; |
181 | 181 | s:=lowercase(trim(s)); |
182 | - if s='s' then result:=OAPI_KEY_S; | |
183 | - if s='l' then result:=OAPI_KEY_L; | |
184 | 182 | if s='k' then result:=OAPI_KEY_K; |
185 | 183 | if s='g' then result:=OAPI_KEY_G; |
186 | - if s='j' then result:=OAPI_KEY_J; | |
187 | - if s='b' then result:=OAPI_KEY_b; | |
188 | - if s='a' then result:=OAPI_KEY_a; | |
189 | 184 | if s='0' then result:=(OAPI_KEY_LSHIFT shl 8) or OAPI_KEY_NUMPAD0; |
190 | 185 | if s='1' then result:=(OAPI_KEY_LSHIFT shl 8) or OAPI_KEY_NUMPAD1; |
191 | 186 | if s='2' then result:=(OAPI_KEY_LSHIFT shl 8) or OAPI_KEY_NUMPAD2; |
@@ -108,6 +108,7 @@ | ||
108 | 108 | main_dat.crew[0].air_pos:=zvec; |
109 | 109 | main_dat.crew[0].air_siz:=evec; |
110 | 110 | main_dat.crew[0].eva_rot:=tvec(1,0,0); |
111 | + main_dat.crew[0].eva_pos:=zvec; | |
111 | 112 | end; |
112 | 113 | //############################################################################// |
113 | 114 | procedure os_makecleanvess; |
@@ -125,7 +126,9 @@ | ||
125 | 126 | main_cfg.sorted_anims:=0; |
126 | 127 | main_cfg.tdp_anim:=-1; |
127 | 128 | |
128 | - main_cfg.pmi:=tvec(1,1,1);;main_cfg.cross:=zvec;main_cfg.rdrag:=zvec; | |
129 | + main_cfg.pmi:=tvec(1,1,1); | |
130 | + main_cfg.cross:=evec; | |
131 | + main_cfg.rdrag:=evec; | |
129 | 132 | main_cfg.defcamera:=zvec; |
130 | 133 | |
131 | 134 | main_cfg.frc1:=0.07;main_cfg.frc2:=0.3;main_cfg.cw1:=0.09;main_cfg.cw2:=0.09; |
@@ -12,10 +12,12 @@ | ||
12 | 12 | //############################################################################// |
13 | 13 | const SEC_COUNT=1000; //Max number of [] sections in an ini |
14 | 14 | //############################################################################// |
15 | +type astr=array of string; | |
15 | 16 | type parse_info_rec=record |
16 | 17 | one_str:array[0..255]of char; |
17 | 18 | spc:array[0..SEC_COUNT-1]of array[0..255]of char; |
18 | 19 | spcs:array[0..SEC_COUNT-1]of integer; |
20 | + remains:string; | |
19 | 21 | |
20 | 22 | w0,w1:boolean; |
21 | 23 |
@@ -28,7 +30,8 @@ | ||
28 | 30 | hud_siz:double; |
29 | 31 | hud_center:vec; |
30 | 32 | |
31 | - off,dir:vec; | |
33 | + off:array[0..4]of vec; | |
34 | + dir:vec; | |
32 | 35 | ex_length,ex_width:double; |
33 | 36 | |
34 | 37 | anim_seq_key:string; |
@@ -49,12 +52,75 @@ | ||
49 | 52 | pparse_info_rec=^parse_info_rec; |
50 | 53 | //############################################################################// |
51 | 54 | function vali(par:string):integer;var n:integer;begin val(trim(par),result,n);end; |
52 | -function vale(par:string):double; var n:integer;begin val(trim(par),result,n);end; | |
55 | +function vale(par:string):double; var n:integer;begin val(trim(par),result,n);end; | |
56 | +function strsinsym(s:string;c:char):string; | |
57 | +var i:integer; | |
58 | +b:boolean; | |
59 | +begin | |
60 | + b:=false; | |
61 | + result:=''; | |
62 | + for i:=1 to length(s) do if s[i]=c then begin | |
63 | + if not b then begin | |
64 | + result:=result+c; | |
65 | + b:=true; | |
66 | + end; | |
67 | + end else begin | |
68 | + b:=false; | |
69 | + result:=result+s[i]; | |
70 | + end; | |
71 | +end; | |
72 | +function getfsymp(st:string;sb:char):integer; | |
73 | +var i:integer; | |
74 | +begin | |
75 | + result:=0; | |
76 | + if st<>'' then for i:=1 to length(st) do if (st[i]=sb)or((sb=' ')and(st[i]=#9)) then begin result:=i; exit; end; | |
77 | +end; | |
78 | +function getnsymp(st:string;sb:char;n:integer):integer; | |
79 | +var i:integer; | |
80 | +begin | |
81 | + result:=0; | |
82 | + if st<>'' then for i:=1 to length(st) do if (st[i]=sb)or((sb=' ')and(st[i]=#9)) then begin n:=n-1; if n=0 then begin result:=i; exit; end else continue; end; | |
83 | +end; | |
84 | +function valvec(st:string):vec; | |
85 | +var i,j:integer; | |
86 | +str1,str2,str3:string; | |
87 | +begin | |
88 | + st:=strsinsym(st,' '); | |
89 | + i:=getfsymp(st,','); | |
90 | + j:=getnsymp(st,',',2); | |
91 | + if i=0 then i:=getfsymp(st,' '); | |
92 | + if j=0 then j:=getnsymp(st,' ',2); | |
93 | + str1:=copy(st,1,i-1); | |
94 | + str2:=copy(st,i+1,j-i-1); | |
95 | + str3:=copy(st,j+1,length(st)-j); | |
96 | + result.x:=vale(trim(str1)); | |
97 | + result.y:=vale(trim(str2)); | |
98 | + result.z:=vale(trim(str3)); | |
99 | +end; | |
100 | +//############################################################################// | |
101 | +function break_str(s:string):astr; | |
102 | +var ss:string; | |
103 | +n,pr,c:integer; | |
104 | +begin | |
105 | + c:=0; | |
106 | + while c<10 do begin | |
107 | + pr:=getnsymp(s,';',c); | |
108 | + n:=getnsymp(s,';',c+1); | |
109 | + if n<pr then n:=length(s)+1; | |
110 | + ss:=copy(s,pr+1,n-pr-1); | |
111 | + setlength(result,c+1); | |
112 | + result[c]:=ss; | |
113 | + c:=c+1; | |
114 | + if n=length(s)+1 then break; | |
115 | + end; | |
116 | +end; | |
53 | 117 | //############################################################################// |
54 | 118 | //############################################################################// |
55 | 119 | procedure applysec(sec:string;p:pparse_info_rec); |
56 | 120 | var n:integer; |
57 | -begin | |
121 | +a:astr; | |
122 | +begin | |
123 | + a:=nil; | |
58 | 124 | if sec='config' then begin |
59 | 125 | p.meshname:=trim(AnsiReplaceStr(AnsiReplaceStr(p.meshname,'''',' '),'"',' ')); |
60 | 126 | p.mn:=os_addmsh(p.meshname,(1-p.visible)*MESHVIS_EXTERNAL+p.visible*MESHVIS_ALWAYS,zvec); |
@@ -75,9 +141,9 @@ | ||
75 | 141 | if p.mfd_l<>-1 then os_addvcmfd(n,MFD_LEFT,p.vcmn,p.mfd_l); |
76 | 142 | if p.mfd_r<>-1 then os_addvcmfd(n,MFD_RIGHT,p.vcmn,p.mfd_r); |
77 | 143 | end; |
78 | - if copy(sec,1,8)='ex_main_' then if p.men<>-1 then os_addexhaust(p.men,p.ex_length,p.ex_width,p.off,p.dir); | |
79 | - if copy(sec,1,9)='ex_retro_' then if p.ren<>-1 then os_addexhaust(p.ren,p.ex_length,p.ex_width,p.off,p.dir); | |
80 | - if copy(sec,1,9)='ex_hover_' then if p.hen<>-1 then os_addexhaust(p.hen,p.ex_length,p.ex_width,p.off,p.dir); | |
144 | + if copy(sec,1,8)='ex_main_' then if p.men<>-1 then os_addexhaust(p.men,p.ex_length,p.ex_width,p.off[0],p.dir); | |
145 | + if copy(sec,1,9)='ex_retro_' then if p.ren<>-1 then os_addexhaust(p.ren,p.ex_length,p.ex_width,p.off[0],p.dir); | |
146 | + if copy(sec,1,9)='ex_hover_' then if p.hen<>-1 then os_addexhaust(p.hen,p.ex_length,p.ex_width,p.off[0],p.dir); | |
81 | 147 | if copy(sec,1,7)='ex_att_' then if p.aen<>-1 then begin |
82 | 148 | n:=-1; |
83 | 149 | if p.rot_axis<>-1 then case p.rot_axis of |
@@ -131,20 +197,16 @@ | ||
131 | 197 | 1:n:=12; |
132 | 198 | end; |
133 | 199 | end; |
134 | - if n<>-1 then os_addexhaust(p.aen+n,p.ex_length,p.ex_width,p.off,p.dir); | |
200 | + if n<>-1 then os_addexhaust(p.aen+n,p.ex_length,p.ex_width,p.off[0],p.dir); | |
135 | 201 | end; |
136 | 202 | |
137 | 203 | if copy(sec,1,9)='anim_seq_' then begin |
138 | 204 | n:=vali(copy(sec,10,length(sec)-1)); |
139 | 205 | if n<>main_cfg.anicnt then exit; |
140 | 206 | os_addanim(str2okey(p.anim_seq_key),0,1/max2(1,p.anim_seq_duration),p.anim_seq_init_pos); |
141 | - //As stated in the SC3-PDF, the default status should be 2 for designed state | |
142 | - main_dat.anim[n].status:=2; | |
143 | - //Use the rept variable to also store the pause setting. According to SC3-PDF, | |
144 | - //pause is only valid for the normal repeat mode, so it can be interpreted as | |
145 | - //the 4th repeat mode | |
146 | - if (p.anim_seq_pause=1) and (p.anim_seq_repeat=0) then main_dat.anim[n].rept:=3 | |
147 | - else main_dat.anim[n].rept:=p.anim_seq_repeat; | |
207 | + main_dat.anim[n].pause:=p.anim_seq_pause; | |
208 | + main_dat.anim[n].status:=1; | |
209 | + main_dat.anim[n].rept:=p.anim_seq_repeat; | |
148 | 210 | end; |
149 | 211 | |
150 | 212 | if copy(sec,1,10)='anim_comp_' then begin |
@@ -163,7 +225,10 @@ | ||
163 | 225 | if copy(sec,1,8)='payload_' then begin |
164 | 226 | if p.etc_meshname<>'' then begin |
165 | 227 | p.etc_meshname:=trim(AnsiReplaceStr(AnsiReplaceStr(p.etc_meshname,'''',' '),'"',' ')); |
166 | - os_addmsh(p.etc_meshname,MESHVIS_ALWAYS,p.off); | |
228 | + a:=break_str(p.etc_meshname); | |
229 | + main_dat.pay[p.cur_pay].mesh:=os_addmsh(a[0],MESHVIS_ALWAYS,p.off[0]); | |
230 | + for n:=1 to length(a)-1 do os_addmsh(a[n],MESHVIS_ALWAYS,p.off[n]); | |
231 | + main_dat.pay[p.cur_pay].mesh_cnt:=length(a); | |
167 | 232 | end; |
168 | 233 | end; |
169 | 234 | end; |
@@ -231,17 +296,27 @@ | ||
231 | 296 | procedure parse_ummu(p:pparse_info_rec;par:string); |
232 | 297 | begin |
233 | 298 | if par='maxseats' then main_dat.crew[0].maxcrew:=vali(p.spc[1]); |
234 | - if par='airlock_position' then main_dat.crew[0].air_pos:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); | |
299 | + if par='airlock_position' then begin | |
300 | + main_dat.crew[0].air_pos:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); | |
301 | + main_dat.crew[0].eva_pos:=main_dat.crew[0].air_pos; | |
302 | + end; | |
235 | 303 | if par='airlock_size' then main_dat.crew[0].air_siz:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); |
304 | + if par='eva_pos' then main_dat.crew[0].eva_pos:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); | |
236 | 305 | if par='eva_rot' then main_dat.crew[0].eva_rot:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); |
237 | 306 | end; |
238 | 307 | //############################################################################// |
239 | 308 | procedure parse_payload(p:pparse_info_rec;par:string); |
240 | 309 | var ss:string; |
241 | -j:integer; | |
310 | +a:astr; | |
311 | +j,i:integer; | |
242 | 312 | begin |
243 | - if par='meshname' then p.etc_meshname:=p.spc[1]; | |
244 | - if par='off' then p.off:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); | |
313 | + a:=nil; | |
314 | + if par='meshname' then p.etc_meshname:=p.remains; | |
315 | + if par='off' then begin | |
316 | + a:=break_str(p.remains); | |
317 | + for i:=0 to length(a)-1 do | |
318 | + p.off[i]:=valvec(copy(a[i],2,length(a[i])-2)); | |
319 | + end; | |
245 | 320 | if par='name' then begin |
246 | 321 | ss:=trim(AnsiReplaceStr(AnsiReplaceStr(p.spc[1],'''',' '),'"',' ')); |
247 | 322 | for j:=0 to length(ss)-1 do main_dat.pay[p.cur_pay].name[j]:=ss[j+1]; |
@@ -307,7 +382,7 @@ | ||
307 | 382 | //############################################################################// |
308 | 383 | procedure parse_exhaust(p:pparse_info_rec;par:string); |
309 | 384 | begin |
310 | - if par='off' then p.off:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); | |
385 | + if par='off' then p.off[0]:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); | |
311 | 386 | if par='dir' then p.dir:=tvec(vale(p.spc[1]),vale(p.spc[2]),vale(p.spc[3])); |
312 | 387 | if par='length' then p.ex_length:=vale(p.spc[1]); |
313 | 388 | if par='width' then p.ex_width:=vale(p.spc[1]); |
@@ -426,6 +501,7 @@ | ||
426 | 501 | //############################################################################// |
427 | 502 | procedure start_section(p:pparse_info_rec;var sec:string); |
428 | 503 | var s:string; |
504 | +i:integer; | |
429 | 505 | begin |
430 | 506 | s:=trim(p.one_str); |
431 | 507 | s:=copy(s,2,length(s)-2); |
@@ -446,7 +522,9 @@ | ||
446 | 522 | |
447 | 523 | p.visible:=0;p.mfd_l:=-1;p.mfd_r:=-1;p.hud:=-1; |
448 | 524 | p.hud_siz:=0; |
449 | - p.hud_center:=tvec(0,0,0);p.off:=tvec(0,0,0);p.dir:=tvec(0,0,0); | |
525 | + p.hud_center:=tvec(0,0,0); | |
526 | + for i:=0 to length(p.off)-1 do p.off[i]:=zvec; | |
527 | + p.dir:=tvec(0,0,0); | |
450 | 528 | p.fuel_mass:=0;p.isp:=0;p.main_thrust:=0;p.retro_thrust:=0;p.hover_thrust:=0;p.att_thrust:=0;p.ex_width:=0;p.ex_length:=0; |
451 | 529 | p.anim_seq_key:=''; |
452 | 530 | p.anim_seq_duration:=0;p.anim_seq_init_pos:=0; |
@@ -491,6 +569,7 @@ | ||
491 | 569 | for j:=0 to cs-1 do begin |
492 | 570 | c:=p.one_str[j]; |
493 | 571 | if(c='=')or(c=',')or(c=')')then begin |
572 | + if c='=' then p.remains:=copy(trim(p.one_str),j+2,1000); | |
494 | 573 | if not l then begin p.spc[k][p.spcs[k]]:=#0;k:=k+1;end; |
495 | 574 | l:=true; |
496 | 575 | continue; |
@@ -127,7 +127,7 @@ | ||
127 | 127 | aoshdll_animcompinfo=array[0..maxint div 100]of oshdll_animcompinfo; |
128 | 128 | paoshdll_animcompinfo=^aoshdll_animcompinfo; |
129 | 129 | oshdll_animinfo=packed record |
130 | - id,tp,rept,trigkey:dword; | |
130 | + id,tp,rept,pause,trigkey:dword; | |
131 | 131 | status:integer; |
132 | 132 | spd,proc,init:double; |
133 | 133 | grpcnt,compcnt:integer; |
@@ -206,7 +206,7 @@ | ||
206 | 206 | paoshdll_payinfo=^aoshdll_payinfo; |
207 | 207 | |
208 | 208 | oshdll_crewinfo=packed record |
209 | - air_pos,eva_rot,air_siz:vec; | |
209 | + air_pos,air_siz,eva_pos,eva_rot:vec; | |
210 | 210 | maxcrew:integer; |
211 | 211 | end; |
212 | 212 | aoshdll_crewinfo=array[0..10000]of oshdll_crewinfo; |