hedgewars/hwengine.pas
changeset 2786 85f6425a4d74
parent 2747 7889a3a9724f
child 2790 83630d5f94db
equal deleted inserted replaced
2785:de6406cd6b25 2786:85f6425a4d74
    52 	uSHA in 'uSHA.pas',
    52 	uSHA in 'uSHA.pas',
    53 	uFloat in 'uFloat.pas',
    53 	uFloat in 'uFloat.pas',
    54 	uStats in 'uStats.pas',
    54 	uStats in 'uStats.pas',
    55 	uChat in 'uChat.pas',
    55 	uChat in 'uChat.pas',
    56 	uTriggers in 'uTriggers.pas',
    56 	uTriggers in 'uTriggers.pas',
    57 	uLandTexture in 'uLandTexture.pas'
    57 	uLandTexture in 'uLandTexture.pas',
       
    58 	uScript in 'uScript.pas',
    58 	{$IFDEF IPHONEOS}
    59 	{$IFDEF IPHONEOS}
    59 	, PascalExports in 'PascalExports.pas'
    60 	PascalExports in 'PascalExports.pas',
    60 	{$ELSE}
    61 	{$ELSE}
    61 	, sysutils
    62 	sysutils
    62 	{$ENDIF}
    63 	{$ENDIF}
    63 	;
    64 	;
    64 
    65 
    65 // also: GSHandlers.inc
    66 // also: GSHandlers.inc
    66 //       CCHandlers.inc
    67 //       CCHandlers.inc
   113 					isSoundEnabled:= false
   114 					isSoundEnabled:= false
   114 					end;
   115 					end;
   115 				FinishProgress;
   116 				FinishProgress;
   116 				PlayMusic;
   117 				PlayMusic;
   117 				SetScale(zoom);
   118 				SetScale(zoom);
       
   119 				ScriptCall('onGameStart');
   118 				GameState:= gsGame;
   120 				GameState:= gsGame;
   119 				end;
   121 				end;
   120 		gsConfirm,
   122 		gsConfirm,
   121 		gsGame: begin
   123 		gsGame: begin
   122 				DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
   124 				DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
   284         if (Length(cLocaleFName) > 6) and (Copy(cLocaleFName,1,2)+'.txt' <> 'en.txt') then 
   286         if (Length(cLocaleFName) > 6) and (Copy(cLocaleFName,1,2)+'.txt' <> 'en.txt') then 
   285             LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocaleFName,1,2)+'.txt');
   287             LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocaleFName,1,2)+'.txt');
   286 	    LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName);
   288 	    LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName);
   287         end;
   289         end;
   288 
   290 
       
   291 	ScriptCall('onTeamSetup');
       
   292 		
   289 	if recordFileName = '' then
   293 	if recordFileName = '' then
   290 		SendIPCAndWaitReply('C')        // ask for game config
   294 		SendIPCAndWaitReply('C')        // ask for game config
   291 	else
   295 	else
   292 		LoadRecordFromFile(recordFileName);
   296 		LoadRecordFromFile(recordFileName);
       
   297 
       
   298 	ScriptOnGameInit;
   293 
   299 
   294 	s:= 'eproto ' + inttostr(cNetProtoVersion);
   300 	s:= 'eproto ' + inttostr(cNetProtoVersion);
   295 	SendIPCRaw(@s[0], Length(s) + 1); // send proto version
   301 	SendIPCRaw(@s[0], Length(s) + 1); // send proto version
   296 
   302 
   297 	InitTeams();
   303 	InitTeams();
   340 	init_uStore();
   346 	init_uStore();
   341 	init_uTeams();
   347 	init_uTeams();
   342 	init_uTriggers();
   348 	init_uTriggers();
   343 	init_uVisualGears();
   349 	init_uVisualGears();
   344 	init_uWorld();
   350 	init_uWorld();
       
   351 	init_uScript();
   345 end;
   352 end;
   346 
   353 
   347 procedure freeEverything;
   354 procedure freeEverything;
   348 begin
   355 begin
   349 	free_uWorld();
   356 	free_uWorld();
   375 	free_uAI();		//stub
   382 	free_uAI();		//stub
   376 
   383 
   377 	free_uConsole();
   384 	free_uConsole();
   378 	free_uMisc();
   385 	free_uMisc();
   379 	free_uConsts();		//stub
   386 	free_uConsts();		//stub
   380 
   387 	free_uScript();
   381 end;
   388 end;
   382 {$IFNDEF IPHONEOS}
   389 {$IFNDEF IPHONEOS}
   383 /////////////////////////
   390 /////////////////////////
   384 procedure GenLandPreview;
   391 procedure GenLandPreview;
   385 var Preview: TPreview;
   392 var Preview: TPreview;