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