146 end; |
146 end; |
147 |
147 |
148 //////////////////// |
148 //////////////////// |
149 procedure GetParams; |
149 procedure GetParams; |
150 var c: integer; |
150 var c: integer; |
151 i: integer; |
151 {$IFDEF DEBUGFILE} |
|
152 i: integer; |
|
153 {$ENDIF} |
152 p: TPathType; |
154 p: TPathType; |
153 begin |
155 begin |
154 PathPrefix:= ParamStr(0); |
|
155 for i:= 1 to Length(PathPrefix) do |
|
156 if PathPrefix[i] = '\' then PathPrefix[i]:= '/'; |
|
157 i:= Length(PathPrefix); |
|
158 while (i > 0) and not (PathPrefix[i] = '/') do dec(i); |
|
159 Delete(PathPrefix, i, Length(PathPrefix) - i + 1); |
|
160 dec(i); |
|
161 while (i > 0) and not (PathPrefix[i] = '/') do dec(i); |
|
162 Delete(PathPrefix, i, Length(PathPrefix) - i + 1); |
|
163 PathPrefix:= PathPrefix + '/share/hedgewars/'; |
|
164 for p:= Low(TPathType) to High(TPathType) do |
|
165 if p <> ptMapCurrent then Pathz[p]:= PathPrefix + Pathz[p]; |
|
166 |
|
167 {$IFDEF DEBUGFILE} |
156 {$IFDEF DEBUGFILE} |
168 AddFileLog('Prefix: "' + PathPrefix +'"'); |
157 AddFileLog('Prefix: "' + PathPrefix +'"'); |
169 for i:= 0 to ParamCount do |
158 for i:= 0 to ParamCount do |
170 AddFileLog(inttostr(i) + ': ' + ParamStr(i)); |
159 AddFileLog(inttostr(i) + ': ' + ParamStr(i)); |
171 {$ENDIF} |
160 {$ENDIF} |
|
161 |
172 case ParamCount of |
162 case ParamCount of |
173 8: begin |
163 9: begin |
174 val(ParamStr(1), cScreenWidth, c); |
164 val(ParamStr(1), cScreenWidth, c); |
175 val(ParamStr(2), cScreenHeight, c); |
165 val(ParamStr(2), cScreenHeight, c); |
176 cBitsStr:= ParamStr(3); |
166 cBitsStr:= ParamStr(3); |
177 val(cBitsStr, cBits, c); |
167 val(cBitsStr, cBits, c); |
178 val(ParamStr(4), ipcPort, c); |
168 val(ParamStr(4), ipcPort, c); |
179 cFullScreen:= ParamStr(5) = '1'; |
169 cFullScreen:= ParamStr(5) = '1'; |
180 isSoundEnabled:= ParamStr(6) = '1'; |
170 isSoundEnabled:= ParamStr(6) = '1'; |
181 cLocaleFName:= ParamStr(7); |
171 cLocaleFName:= ParamStr(7); |
182 val(ParamStr(8), cInitVolume, c); |
172 val(ParamStr(8), cInitVolume, c); |
|
173 PathPrefix:= ParamStr(9); |
|
174 for p:= Succ(Low(TPathType)) to High(TPathType) do |
|
175 if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]; |
183 end; |
176 end; |
184 2: begin |
177 2: begin |
185 val(ParamStr(1), ipcPort, c); |
178 val(ParamStr(1), ipcPort, c); |
186 GameType:= gmtLandPreview; |
179 GameType:= gmtLandPreview; |
187 if ParamStr(2) <> 'landpreview' then OutError(errmsgShouldntRun, true); |
180 if ParamStr(2) <> 'landpreview' then OutError(errmsgShouldntRun, true); |