315 var p: TPathType; |
315 var p: TPathType; |
316 s: shortstring; |
316 s: shortstring; |
317 i: LongInt; |
317 i: LongInt; |
318 begin |
318 begin |
319 {$IFDEF HWLIBRARY} |
319 {$IFDEF HWLIBRARY} |
320 cBits:= 32; |
320 initEverything(true); |
321 cTimerInterval:= 8; |
|
322 cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF}; |
321 cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF}; |
323 ipcPort:= StrToInt(gameArgs[0]); |
322 ipcPort:= StrToInt(gameArgs[0]); |
324 cScreenWidth:= StrToInt(gameArgs[1]); |
323 cScreenWidth:= StrToInt(gameArgs[1]); |
325 cScreenHeight:= StrToInt(gameArgs[2]); |
324 cScreenHeight:= StrToInt(gameArgs[2]); |
326 cReducedQuality:= StrToInt(gameArgs[3]); |
325 cReducedQuality:= StrToInt(gameArgs[3]); |
345 cMinScreenWidth:= min(cScreenWidth, cMinScreenWidth); |
344 cMinScreenWidth:= min(cScreenWidth, cMinScreenWidth); |
346 cMinScreenHeight:= min(cScreenHeight, cMinScreenHeight); |
345 cMinScreenHeight:= min(cScreenHeight, cMinScreenHeight); |
347 cOrigScreenWidth:= cScreenWidth; |
346 cOrigScreenWidth:= cScreenWidth; |
348 cOrigScreenHeight:= cScreenHeight; |
347 cOrigScreenHeight:= cScreenHeight; |
349 |
348 |
350 initEverything(true); |
|
351 WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); |
349 WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); |
352 AddFileLog('Prefix: "' + PathPrefix +'"'); |
350 AddFileLog('Prefix: "' + PathPrefix +'"'); |
353 AddFileLog('UserPrefix: "' + UserPathPrefix +'"'); |
351 AddFileLog('UserPrefix: "' + UserPathPrefix +'"'); |
354 |
352 |
355 for i:= 0 to ParamCount do |
353 for i:= 0 to ParamCount do |
538 |
536 |
539 ///////////////////////// |
537 ///////////////////////// |
540 procedure GenLandPreview{$IFDEF HWLIBRARY}(port: LongInt); cdecl; export{$ENDIF}; |
538 procedure GenLandPreview{$IFDEF HWLIBRARY}(port: LongInt); cdecl; export{$ENDIF}; |
541 var Preview: TPreview; |
539 var Preview: TPreview; |
542 begin |
540 begin |
|
541 {$IFDEF HWLIBRARY} |
543 initEverything(false); |
542 initEverything(false); |
544 {$IFDEF HWLIBRARY} |
|
545 WriteLnToConsole('Preview connecting on port ' + inttostr(port)); |
543 WriteLnToConsole('Preview connecting on port ' + inttostr(port)); |
546 ipcPort:= port; |
544 ipcPort:= port; |
547 InitStepsFlags:= cifRandomize; |
545 InitStepsFlags:= cifRandomize; |
548 {$ENDIF} |
546 {$ENDIF} |
549 InitIPC; |
547 InitIPC; |
591 procedure GetParams; |
589 procedure GetParams; |
592 begin |
590 begin |
593 if (ParamCount < 3) then |
591 if (ParamCount < 3) then |
594 GameType:= gmtSyntax |
592 GameType:= gmtSyntax |
595 else |
593 else |
596 if (ParamCount = 3) and ((ParamStr(3) = '--stats-only') or (ParamStr(3) = 'landpreview')) then |
594 if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then |
597 internalSetGameTypeLandPreviewFromParameters() |
595 begin |
598 else if ParamCount = cDefaultParamNum then |
596 initEverything(false); |
599 internalStartGameWithParameters() |
597 ipcPort:= StrToInt(ParamStr(2)); |
|
598 GameType:= gmtLandPreview; |
|
599 exit; |
|
600 end |
|
601 else |
|
602 begin |
|
603 initEverything(true); |
|
604 if (ParamCount = 3) and (ParamStr(3) = '--stats-only') then |
|
605 playReplayFileWithParameters() |
|
606 else |
|
607 if ParamCount = cDefaultParamNum then |
|
608 internalStartGameWithParameters() |
600 {$IFDEF USE_VIDEO_RECORDING} |
609 {$IFDEF USE_VIDEO_RECORDING} |
601 else if ParamCount = cVideorecParamNum then |
610 else if ParamCount = cVideorecParamNum then |
602 internalStartVideoRecordingWithParameters() |
611 internalStartVideoRecordingWithParameters() |
603 {$ENDIF} |
612 {$ENDIF} |
604 else |
613 else |
605 playReplayFileWithParameters(); |
614 playReplayFileWithParameters(); |
|
615 end |
606 end; |
616 end; |
607 |
617 |
608 //////////////////////////////////////////////////////////////////////////////// |
618 //////////////////////////////////////////////////////////////////////////////// |
609 /////////////////////////////// m a i n //////////////////////////////////////// |
619 /////////////////////////////// m a i n //////////////////////////////////////// |
610 //////////////////////////////////////////////////////////////////////////////// |
620 //////////////////////////////////////////////////////////////////////////////// |