|
1 |
|
2 procedure internalSetGameTypeLandPreviewFromParameters(); |
|
3 begin |
|
4 val(ParamStr(2), ipcPort); |
|
5 GameType:= gmtLandPreview; |
|
6 if ParamStr(3) <> 'landpreview' then |
|
7 GameType:= gmtSyntax |
|
8 end; |
|
9 |
|
10 procedure internalStartGameWithParameters(); |
|
11 var tmp: LongInt; |
|
12 begin |
|
13 val(ParamStr(2), cScreenWidth); |
|
14 val(ParamStr(3), cScreenHeight); |
|
15 val(ParamStr(4), cBits); |
|
16 val(ParamStr(5), ipcPort); |
|
17 cFullScreen:= ParamStr(6) = '1'; |
|
18 isSoundEnabled:= ParamStr(7) = '1'; |
|
19 isMusicEnabled:= ParamStr(8) = '1'; |
|
20 val(ParamStr(9), cInitVolume); |
|
21 val(ParamStr(10), cTimerInterval); |
|
22 PathPrefix:= ParamStr(11); |
|
23 cShowFPS:= ParamStr(12) = '1'; |
|
24 cAltDamage:= ParamStr(13) = '1'; |
|
25 UserNick:= DecodeBase64(ParamStr(14)); |
|
26 val(ParamStr(15), cReducedQuality); |
|
27 val(ParamStr(16), tmp); |
|
28 cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp))); |
|
29 cLocaleFName:= ParamStr(17); |
|
30 end; |
|
31 |
|
32 procedure setVideo(screenWidth: LongInt; screenHeight: LongInt; bitsStr: LongInt); |
|
33 begin |
|
34 cScreenWidth:= screenWidth; |
|
35 cScreenHeight:= screenHeight; |
|
36 cBits:= bitsStr |
|
37 end; |
|
38 |
|
39 procedure setVideoWithParameters(screenWidthParam: string; screenHeightParam: string; bitsParam: string); |
|
40 var screenWidthAsInt, screenHeightAsInt, bitsStrAsInt: LongInt; |
|
41 begin |
|
42 val(screenWidthParam, screenWidthAsInt); |
|
43 val(screenHeightParam, screenHeightAsInt); |
|
44 val(bitsParam, bitsStrAsInt); |
|
45 setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt) |
|
46 end; |
|
47 |
|
48 procedure setOtherOptions(languageFile: string; fullScreen: boolean); |
|
49 begin |
|
50 cLocaleFName:= languageFile; |
|
51 cFullScreen:= fullScreen |
|
52 end; |
|
53 |
|
54 procedure setShowFPS(showFPS: boolean); |
|
55 begin |
|
56 cShowFPS:= showFPS |
|
57 end; |
|
58 |
|
59 procedure setOtherOptionsWithParameters(languageFileParam: string; fullScreenParam: string; showFPSParam: string); |
|
60 var fullScreen, showFPS: boolean; |
|
61 begin |
|
62 fullScreen:= fullScreenParam = '1'; |
|
63 showFPS:= showFPSParam = '1'; |
|
64 setOtherOptions(languageFileParam,fullScreen); |
|
65 setShowFPS(showFPS) |
|
66 end; |
|
67 |
|
68 procedure setAudio(initialVolume: LongInt; musicEnabled: boolean; soundEnabled: boolean); |
|
69 begin |
|
70 cInitVolume:= initialVolume; |
|
71 isMusicEnabled:= musicEnabled; |
|
72 isSoundEnabled:= soundEnabled |
|
73 end; |
|
74 |
|
75 procedure setAudioWithParameters(initialVolumeParam: string; musicEnabledParam: string; soundEnabledParam: string); |
|
76 var initialVolumeAsInt: LongInt; |
|
77 musicEnabled, soundEnabled: boolean; |
|
78 begin |
|
79 val(initialVolumeParam, initialVolumeAsInt); |
|
80 musicEnabled:= musicEnabledParam = '1'; |
|
81 soundEnabled:= soundEnabledParam = '1'; |
|
82 setAudio(initialVolumeAsInt,musicEnabled, soundEnabled) |
|
83 end; |
|
84 |
|
85 procedure setMultimediaOptionsWithParameters(screenWidthParam, screenHeightParam, bitsParam: string; |
|
86 initialVolumeParam, musicEnabledParam, soundEnabledParam: string; |
|
87 languageFileParam, fullScreenParam: string); |
|
88 begin |
|
89 setVideoWithParameters(screenWidthParam,screenHeightParam, bitsParam); |
|
90 setAudioWithParameters(initialVolumeParam,musicEnabledParam,soundEnabledParam); |
|
91 setOtherOptions(languageFileParam,fullScreenParam = '1') |
|
92 end; |
|
93 |
|
94 procedure setAltDamageTimerValueAndQuality(altDamage: boolean; timeIterval: LongInt; reducedQuality: boolean); |
|
95 begin |
|
96 cAltDamage:= altDamage; |
|
97 cTimerInterval:= timeIterval; |
|
98 if (reducedQuality) then //HACK |
|
99 cReducedQuality:= $FFFFFFFF xor rqLowRes |
|
100 end; |
|
101 |
|
102 procedure setAllOptionsWithParameters(screenWidthParam:string; screenHeightParam:string; bitsParam:string; |
|
103 initialVolumeParam:string; musicEnabledParam:string; soundEnabledParam:string; |
|
104 languageFileParam:string; fullScreenParam:string; showFPSParam:string; |
|
105 altDamageParam:string; timeItervalParam:string; reducedQualityParam: string); |
|
106 var showFPS, altDamage, reducedQuality: boolean; |
|
107 timeIterval: LongInt; |
|
108 begin |
|
109 setMultimediaOptionsWithParameters(screenWidthParam,screenHeightParam, bitsParam, |
|
110 initialVolumeParam,musicEnabledParam,soundEnabledParam, |
|
111 languageFileParam,fullScreenParam); |
|
112 showFPS := showFPSParam = '1'; |
|
113 setShowFPS(showFPS); |
|
114 |
|
115 altDamage:= altDamageParam = '1'; |
|
116 val(timeItervalParam, timeIterval); |
|
117 reducedQuality:= reducedQualityParam = '1'; |
|
118 setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality); |
|
119 end; |
|
120 |
|
121 procedure playReplayFileWithParameters(); |
|
122 var paramIndex: LongInt; |
|
123 wrongParameter: boolean; |
|
124 begin |
|
125 PathPrefix:= ParamStr(1); |
|
126 recordFileName:= ParamStr(2); |
|
127 paramIndex:= 3; |
|
128 wrongParameter:= false; |
|
129 while (paramIndex <= ParamCount) and not wrongParameter do |
|
130 begin |
|
131 if ParamStr(paramIndex) = '--set-video' then |
|
132 //--set-video [screen width] [screen height] [color dept] |
|
133 begin |
|
134 if(ParamCount-paramIndex < 3) then |
|
135 begin |
|
136 wrongParameter:= true; |
|
137 GameType:= gmtSyntax |
|
138 end; |
|
139 setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3)); |
|
140 paramIndex:= paramIndex + 4 |
|
141 end |
|
142 else |
|
143 //--set-audio [volume] [enable music] [enable sounds] |
|
144 if ParamStr(paramIndex) = '--set-audio' then |
|
145 begin |
|
146 if(ParamCount-paramIndex < 3) then |
|
147 begin |
|
148 wrongParameter := true; |
|
149 GameType:= gmtSyntax |
|
150 end; |
|
151 setAudioWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3)); |
|
152 paramIndex:= paramIndex + 4 |
|
153 end |
|
154 else |
|
155 // --set-other [language file] [full screen] [show FPS] |
|
156 if ParamStr(paramIndex) = '--set-other' then |
|
157 begin |
|
158 if(ParamCount-paramIndex < 3) then |
|
159 begin |
|
160 wrongParameter:= true; |
|
161 GameType:= gmtSyntax |
|
162 end; |
|
163 setOtherOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3)); |
|
164 paramIndex:= paramIndex + 4 |
|
165 end |
|
166 else |
|
167 //--set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] |
|
168 if ParamStr(paramIndex) = '--set-multimedia' then |
|
169 begin |
|
170 if ParamCount-paramIndex < 8 then |
|
171 begin |
|
172 wrongParameter:= true; |
|
173 GameType:= gmtSyntax |
|
174 end; |
|
175 setMultimediaOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3), |
|
176 ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6), |
|
177 ParamStr(paramIndex+7),ParamStr(paramIndex+8)); |
|
178 paramIndex:= paramIndex + 9 |
|
179 end |
|
180 else |
|
181 //--set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality] |
|
182 if ParamStr(paramIndex) = '--set-everything' then |
|
183 begin |
|
184 if ParamCount-paramIndex < 12 then |
|
185 begin |
|
186 wrongParameter:= true; |
|
187 GameType:= gmtSyntax |
|
188 end; |
|
189 setAllOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3), |
|
190 ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6), |
|
191 ParamStr(paramIndex+7),ParamStr(paramIndex+8),ParamStr(paramIndex+9), |
|
192 ParamStr(paramIndex+10),ParamStr(paramIndex+11),ParamStr(paramIndex+12)); |
|
193 paramIndex:= paramIndex + 13 |
|
194 end |
|
195 else |
|
196 begin |
|
197 wrongParameter:= true; |
|
198 GameType:= gmtSyntax |
|
199 end |
|
200 end |
|
201 end; |
|
202 |