hedgewars/CCHandlers.inc
changeset 2671 7e0f88013fe8
parent 2645 89aa2aa89066
child 2695 ed789a7ef68d
equal deleted inserted replaced
2670:1b327b7515ed 2671:7e0f88013fe8
    79    begin
    79    begin
    80    SplitBySpace(s, ts);
    80    SplitBySpace(s, ts);
    81    val(s, Color);
    81    val(s, Color);
    82    TryDo(Color <> 0, 'Error: black team color', true);
    82    TryDo(Color <> 0, 'Error: black team color', true);
    83 
    83 
    84    // color is always in ARGB so the mask must be constant
    84    // color is always little endian so the mask must be constant also in big endian archs
    85    Color:= Color or $FF000000;
    85    Color:= Color or $FF000000;
    86  	
    86  	
    87    AddTeam(Color);
    87    AddTeam(Color);
    88    CurrentTeam^.TeamName:= ts;
    88    CurrentTeam^.TeamName:= ts;
    89    if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
    89    if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
   592                or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true
   592                or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true
   593           end
   593           end
   594 end;
   594 end;
   595 
   595 
   596 procedure chFullScr(var s: shortstring);
   596 procedure chFullScr(var s: shortstring);
   597 var flags: Longword;
   597 var flags: Longword = 0;
   598 {$IFDEF DEBUGFILE}
   598 {$IFDEF DEBUGFILE}
   599     buf: array[byte] of char;
   599     buf: array[byte] of char;
   600 {$ENDIF}
   600 {$ENDIF}
   601 begin
   601 begin
   602 if Length(s) = 0 then cFullScreen:= not cFullScreen
   602 if Length(s) = 0 then cFullScreen:= not cFullScreen
   603                  else cFullScreen:= s = '1';
   603 	else cFullScreen:= s = '1';
   604 
   604 
   605 {$IFDEF DEBUGFILE}
   605 {$IFDEF DEBUGFILE}
   606 AddFileLog('Prepare to change video parameters...');
   606 AddFileLog('Prepare to change video parameters...');
   607 {$ENDIF}
   607 {$ENDIF}
   608 
   608 
   618 {$ELSE}
   618 {$ELSE}
   619 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
   619 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
   620 {$ENDIF}
   620 {$ENDIF}
   621 
   621 
   622 {$IFNDEF SDL13}
   622 {$IFNDEF SDL13}
   623 // this attribute is default in 1.3
   623 // this attribute is default in 1.3 and must be enabled in MacOSX
   624 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
   624 {$IFNDEF DARWIN}
       
   625 if cVSyncInUse then
       
   626 {$ENDIF}
       
   627 	SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
   625 {$ENDIF}
   628 {$ENDIF}
   626 
   629 
   627 flags:= SDL_OPENGL;// or SDL_RESIZABLE;
   630 flags:= SDL_OPENGL;// or SDL_RESIZABLE;
       
   631 {$IFDEF IPHONEOS}
       
   632 // remove the topbar from the iPhone
       
   633 flags:= flags or SDL_NOFRAME;
       
   634 {$ENDIF}
       
   635 
   628 if cFullScreen then
   636 if cFullScreen then
   629 	begin
   637 	begin
   630 	flags:= flags or SDL_FULLSCREEN;
   638 	flags:= flags or SDL_FULLSCREEN;
   631 	cScreenWidth:= cInitWidth;
   639 	cScreenWidth:= cInitWidth;
   632 	cScreenHeight:= cInitHeight
   640 	cScreenHeight:= cInitHeight
   639 	AddFileLog('Freeing old primary surface...');
   647 	AddFileLog('Freeing old primary surface...');
   640 	{$ENDIF}
   648 	{$ENDIF}
   641 	SDL_FreeSurface(SDLPrimSurface);
   649 	SDL_FreeSurface(SDLPrimSurface);
   642 	end;
   650 	end;
   643 
   651 
   644 {$IFDEF IPHONEOS}
       
   645 //remove the topbar from the iPhone
       
   646 flags:= flags or SDL_NOFRAME;
       
   647 {$ENDIF}
       
   648 
       
   649 SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
   652 SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
   650 SDLTry(SDLPrimSurface <> nil, true);
   653 SDLTry(SDLPrimSurface <> nil, true);
       
   654 PixelFormat:= SDLPrimSurface^.format;
   651 
   655 
   652 {$IFDEF DEBUGFILE}
   656 {$IFDEF DEBUGFILE}
   653 AddFileLog('Setting up OpenGL...');
   657 AddFileLog('Setting up OpenGL...');
       
   658 AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf))));
   654 {$ENDIF}
   659 {$ENDIF}
   655 SetupOpenGL();
   660 SetupOpenGL();
   656 
   661 
   657 {$IFDEF DEBUGFILE}
       
   658 AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf))));
       
   659 {$ENDIF}
       
   660 PixelFormat:= SDLPrimSurface^.format
       
   661 end;
   662 end;
   662 
   663 
   663 procedure chVol_p(var s: shortstring);
   664 procedure chVol_p(var s: shortstring);
   664 begin
   665 begin
   665 inc(cVolumeDelta, 3)
   666 inc(cVolumeDelta, 3)