author | koda |
Sat, 05 Feb 2011 22:22:16 +0100 | |
changeset 4924 | 616b618814b5 |
parent 4004 | b1c2c2f6fc5e |
child 4976 | 088d40d8aba2 |
permissions | -rw-r--r-- |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
1 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
2 |
procedure internalSetGameTypeLandPreviewFromParameters(); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
3 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
4 |
val(ParamStr(2), ipcPort); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
5 |
GameType:= gmtLandPreview; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
6 |
if ParamStr(3) <> 'landpreview' then |
3858 | 7 |
GameType:= gmtSyntax |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
8 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
9 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
10 |
procedure internalStartGameWithParameters(); |
4004
b1c2c2f6fc5e
update branch with latest head, most likely breaking water color in stereo mode
koda
parents:
3858
diff
changeset
|
11 |
var tmp: LongInt; |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
12 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
13 |
val(ParamStr(2), cScreenWidth); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
14 |
val(ParamStr(3), cScreenHeight); |
3709 | 15 |
val(ParamStr(4), cBits); |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
16 |
val(ParamStr(5), ipcPort); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
17 |
cFullScreen:= ParamStr(6) = '1'; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
18 |
isSoundEnabled:= ParamStr(7) = '1'; |
3709 | 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); |
|
4004
b1c2c2f6fc5e
update branch with latest head, most likely breaking water color in stereo mode
koda
parents:
3858
diff
changeset
|
27 |
val(ParamStr(16), tmp); |
b1c2c2f6fc5e
update branch with latest head, most likely breaking water color in stereo mode
koda
parents:
3858
diff
changeset
|
28 |
cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp))); |
b1c2c2f6fc5e
update branch with latest head, most likely breaking water color in stereo mode
koda
parents:
3858
diff
changeset
|
29 |
cLocaleFName:= ParamStr(17); |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
30 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
31 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
32 |
procedure setVideo(screenWidth: LongInt; screenHeight: LongInt; bitsStr: LongInt); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
33 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
34 |
cScreenWidth:= screenWidth; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
35 |
cScreenHeight:= screenHeight; |
3858 | 36 |
cBits:= bitsStr |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
37 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
38 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
39 |
procedure setVideoWithParameters(screenWidthParam: string; screenHeightParam: string; bitsParam: string); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
40 |
var screenWidthAsInt, screenHeightAsInt, bitsStrAsInt: LongInt; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
41 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
42 |
val(screenWidthParam, screenWidthAsInt); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
43 |
val(screenHeightParam, screenHeightAsInt); |
3709 | 44 |
val(bitsParam, bitsStrAsInt); |
3858 | 45 |
setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt) |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
46 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
47 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
48 |
procedure setOtherOptions(languageFile: string; fullScreen: boolean); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
49 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
50 |
cLocaleFName:= languageFile; |
3858 | 51 |
cFullScreen:= fullScreen |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
52 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
53 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
54 |
procedure setShowFPS(showFPS: boolean); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
55 |
begin |
3858 | 56 |
cShowFPS:= showFPS |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
57 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
58 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
59 |
procedure setOtherOptionsWithParameters(languageFileParam: string; fullScreenParam: string; showFPSParam: string); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
60 |
var fullScreen, showFPS: boolean; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
61 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
62 |
fullScreen:= fullScreenParam = '1'; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
63 |
showFPS:= showFPSParam = '1'; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
64 |
setOtherOptions(languageFileParam,fullScreen); |
3858 | 65 |
setShowFPS(showFPS) |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
66 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
67 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
68 |
procedure setAudio(initialVolume: LongInt; musicEnabled: boolean; soundEnabled: boolean); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
69 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
70 |
cInitVolume:= initialVolume; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
71 |
isMusicEnabled:= musicEnabled; |
3858 | 72 |
isSoundEnabled:= soundEnabled |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
73 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
74 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
75 |
procedure setAudioWithParameters(initialVolumeParam: string; musicEnabledParam: string; soundEnabledParam: string); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
76 |
var initialVolumeAsInt: LongInt; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
77 |
musicEnabled, soundEnabled: boolean; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
78 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
79 |
val(initialVolumeParam, initialVolumeAsInt); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
80 |
musicEnabled:= musicEnabledParam = '1'; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
81 |
soundEnabled:= soundEnabledParam = '1'; |
3858 | 82 |
setAudio(initialVolumeAsInt,musicEnabled, soundEnabled) |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
83 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
84 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
85 |
procedure setMultimediaOptionsWithParameters(screenWidthParam, screenHeightParam, bitsParam: string; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
86 |
initialVolumeParam, musicEnabledParam, soundEnabledParam: string; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
87 |
languageFileParam, fullScreenParam: string); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
88 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
89 |
setVideoWithParameters(screenWidthParam,screenHeightParam, bitsParam); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
90 |
setAudioWithParameters(initialVolumeParam,musicEnabledParam,soundEnabledParam); |
3858 | 91 |
setOtherOptions(languageFileParam,fullScreenParam = '1') |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
92 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
93 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
94 |
procedure setAltDamageTimerValueAndQuality(altDamage: boolean; timeIterval: LongInt; reducedQuality: boolean); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
95 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
96 |
cAltDamage:= altDamage; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
97 |
cTimerInterval:= timeIterval; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
98 |
if (reducedQuality) then //HACK |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
99 |
cReducedQuality:= $FFFFFFFF xor rqLowRes |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
100 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
101 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
102 |
procedure setAllOptionsWithParameters(screenWidthParam:string; screenHeightParam:string; bitsParam:string; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
103 |
initialVolumeParam:string; musicEnabledParam:string; soundEnabledParam:string; |
3858 | 104 |
languageFileParam:string; fullScreenParam:string; showFPSParam:string; |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
105 |
altDamageParam:string; timeItervalParam:string; reducedQualityParam: string); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
106 |
var showFPS, altDamage, reducedQuality: boolean; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
107 |
timeIterval: LongInt; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
108 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
109 |
setMultimediaOptionsWithParameters(screenWidthParam,screenHeightParam, bitsParam, |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
110 |
initialVolumeParam,musicEnabledParam,soundEnabledParam, |
3858 | 111 |
languageFileParam,fullScreenParam); |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
112 |
showFPS := showFPSParam = '1'; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
113 |
setShowFPS(showFPS); |
3858 | 114 |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
115 |
altDamage:= altDamageParam = '1'; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
116 |
val(timeItervalParam, timeIterval); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
117 |
reducedQuality:= reducedQualityParam = '1'; |
3858 | 118 |
setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality); |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
119 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
120 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
121 |
procedure playReplayFileWithParameters(); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
122 |
var paramIndex: LongInt; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
123 |
wrongParameter: boolean; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
124 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
125 |
PathPrefix:= ParamStr(1); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
126 |
recordFileName:= ParamStr(2); |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
127 |
paramIndex:= 3; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
128 |
wrongParameter:= false; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
129 |
while (paramIndex <= ParamCount) and not wrongParameter do |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
130 |
begin |
3858 | 131 |
if ParamStr(paramIndex) = '--set-video' then |
132 |
//--set-video [screen width] [screen height] [color dept] |
|
133 |
begin |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
134 |
if(ParamCount-paramIndex < 3) then |
3858 | 135 |
begin |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
136 |
wrongParameter:= true; |
3858 | 137 |
GameType:= gmtSyntax |
138 |
end; |
|
139 |
setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3)); |
|
140 |
paramIndex:= paramIndex + 4 |
|
141 |
end |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
142 |
else |
3858 | 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 |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
201 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
202 |