# HG changeset patch # User unc0rr # Date 1213216029 0 # Node ID cdff3f6f9b389ac8848add57d5157d2605a8f290 # Parent 0fcd3fadda410f5eb45949b3f7195a4bda83cd45 Get rid of old console diff -r 0fcd3fadda41 -r cdff3f6f9b38 hedgewars/hwengine.dpr --- a/hedgewars/hwengine.dpr Wed Jun 11 15:42:53 2008 +0000 +++ b/hedgewars/hwengine.dpr Wed Jun 11 20:27:09 2008 +0000 @@ -89,7 +89,6 @@ AssignHHCoords; AddMiscGears; StoreLoad; - AdjustColor(cConsoleSplitterColor); ResetKbd; SoundLoad; if GameType = gmtSave then @@ -106,12 +105,6 @@ ProcessVisualGears(Lag); DrawWorld(Lag); end; - gsConsole: begin - DoGameTick(Lag); - ProcessVisualGears(Lag); - DrawWorld(Lag); - DrawConsole(SDLPrimSurface); - end; gsChat: begin DoGameTick(Lag); ProcessVisualGears(Lag); diff -r 0fcd3fadda41 -r cdff3f6f9b38 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Wed Jun 11 15:42:53 2008 +0000 +++ b/hedgewars/uChat.pas Wed Jun 11 20:27:09 2008 +0000 @@ -25,11 +25,12 @@ procedure KeyPressChat(Key: Longword); var UserNick: shortstring = ''; + ChatVisibleCount: Longword = 7; implementation uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys; -const MaxStrIndex = 7; +const MaxStrIndex = 30; type TChatLine = record s: shortstring; @@ -91,11 +92,11 @@ cnt:= 0; t:= 0; i:= lastStr; -while (t <= MaxStrIndex) +while (t < ChatVisibleCount) and (Strs[i].Tex <> nil) and (Strs[i].Time > RealTicks) do begin - DrawTexture(8, (visibleCount - t) * 16 - 6 + cConsoleYAdd, Strs[i].Tex); + DrawTexture(8, (visibleCount - t) * 16 - 6, Strs[i].Tex); if i = 0 then i:= MaxStrIndex else dec(i); inc(cnt); inc(t) @@ -105,7 +106,7 @@ if (GameState = gsChat) and (InputStr.Tex <> nil) then - DrawTexture(11, visibleCount * 16 + 10 + cConsoleYAdd, InputStr.Tex); + DrawTexture(11, visibleCount * 16 + 10, InputStr.Tex); end; procedure KeyPressChat(Key: Longword); diff -r 0fcd3fadda41 -r cdff3f6f9b38 hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Wed Jun 11 15:42:53 2008 +0000 +++ b/hedgewars/uConsole.pas Wed Jun 11 20:27:09 2008 +0000 @@ -18,13 +18,12 @@ unit uConsole; interface -uses SDLh, uFloat; +uses uFloat; {$INCLUDE options.inc} const isDeveloperMode: boolean = true; type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean); TCommandHandler = procedure (var params: shortstring); -procedure DrawConsole(Surface: PSDL_Surface); procedure WriteToConsole(s: shortstring); procedure WriteLnToConsole(s: shortstring); procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); @@ -36,7 +35,7 @@ implementation {$J+} uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uLand, - uRandom, uAmmos, uTriggers, GL, uStats, uGame, uChat; + uRandom, uAmmos, uTriggers, uStats, uGame, uChat, SDLh; const cLineWidth: LongInt = 0; cLinesCount = 256; @@ -51,8 +50,6 @@ end; TTextLine = record s: shortstring; - tex: PTexture; - updatetex: boolean; end; var ConsoleLines: array[byte] of TTextLine; @@ -62,11 +59,7 @@ procedure SetLine(var tl: TTextLine; str: shortstring); begin with tl do - begin s:= str; - if tex <> nil then FreeTexture(tex); - updatetex:= true - end end; function RegisterVariable(Name: string; VType: TVariableType; p: pointer; Trusted: boolean): PVariable; @@ -116,45 +109,6 @@ end else b:= ''; end; -procedure DrawConsole(Surface: PSDL_Surface); -var x, y: LongInt; - - procedure DrawLine(var tl: TTextLine; X, Y: LongInt); - var tmpSurface: PSDL_Surface; - begin - with tl do - begin - if updatetex then - begin - if s[0] <> #0 then - begin - tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), $FFFFFF); - tex:= Surface2Tex(tmpSurface); - SDL_FreeSurface(tmpSurface) - end else tex:= nil; - updatetex:= false - end; - - if tex <> nil then - DrawTexture(X, Y, tex); - end - end; - -begin -glEnable(GL_TEXTURE_2D); -glEnable(GL_BLEND); - -for y:= 0 to cConsoleHeight div 256 + 1 do - for x:= 0 to cScreenWidth div 256 + 1 do - DrawSprite(sprConsoleBG, x * 256, cConsoleHeight - 256 - y * 256, 0); - -for y:= 0 to cConsoleHeight div Fontz[fnt16].Height do - DrawLine(ConsoleLines[(CurrLine - 1 - y + cLinesCount) mod cLinesCount], 4, cConsoleHeight - (y + 1) * (Fontz[fnt16].Height + 2)); - -glDisable(GL_BLEND); -glDisable(GL_TEXTURE_2D); -end; - procedure WriteToConsole(s: shortstring); var Len: LongInt; begin @@ -277,7 +231,6 @@ RegisterVariable('delay' , vtLongInt, @cInactDelay , false); RegisterVariable('casefreq', vtLongInt, @cCaseFactor , false); RegisterVariable('landadds', vtLongInt, @cLandAdditions , false); -RegisterVariable('c_height', vtLongInt, @cConsoleHeight , false); RegisterVariable('gmflags' , vtLongInt, @GameFlags , false); RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false); RegisterVariable('fort' , vtCommand, @chFort , false); diff -r 0fcd3fadda41 -r cdff3f6f9b38 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Wed Jun 11 15:42:53 2008 +0000 +++ b/hedgewars/uConsts.pas Wed Jun 11 20:27:09 2008 +0000 @@ -23,7 +23,7 @@ {$INCLUDE proto.inc} type - TGameState = (gsLandGen, gsStart, gsGame, gsConsole, gsChat, gsExit); + TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsExit); TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview); @@ -39,7 +39,7 @@ sprSky, sprAMBorders, sprAMSlot, sprAMSlotName, sprAMAmmos, sprAMSlotKeys, sprAMSelection, sprFinger, sprAirBomb, sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask, - sprSwitch, sprParachute, sprTarget, sprRopeNode, sprConsoleBG, + sprSwitch, sprParachute, sprTarget, sprRopeNode, sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR, sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun, sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer, @@ -346,8 +346,6 @@ Width: 32; Height: 32; saveSurf: false),// sprTarget (FileName: 'RopeNode'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; Width: 6; Height: 6; saveSurf: false),// sprRopeNode - (FileName: 'Console'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 256; Height:256; saveSurf: false),// sprConsoleBG (FileName: 'thinking'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; Width: 32; Height: 32; saveSurf: false),// sprQuestion (FileName: 'PowerBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; diff -r 0fcd3fadda41 -r cdff3f6f9b38 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Wed Jun 11 15:42:53 2008 +0000 +++ b/hedgewars/uMisc.pas Wed Jun 11 20:27:09 2008 +0000 @@ -37,8 +37,6 @@ cMaxAIThinkTime : Longword = 9000; cCloudsNumber : LongInt = 9; - cConsoleHeight : LongInt = 320; - cConsoleYAdd : LongInt = 0; cScreenWidth : LongInt = 1024; cScreenHeight : LongInt = 768; cBits : LongInt = 16; @@ -56,7 +54,6 @@ cSkyColor : Longword = 0; cWhiteColor : Longword = $FFFFFFFF; - cConsoleSplitterColor : Longword = $FFFF0000; cColorNearBlack : Longword = $FF000010; cExplosionBorderColor : LongWord = $808080; diff -r 0fcd3fadda41 -r cdff3f6f9b38 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Wed Jun 11 15:42:53 2008 +0000 +++ b/hedgewars/uWorld.pas Wed Jun 11 20:27:09 2008 +0000 @@ -276,7 +276,7 @@ with Captions[grp] do if Tex <> nil then begin - DrawCentered(cScreenWidth div 2, i + cConsoleYAdd, Tex); + DrawCentered(cScreenWidth div 2, i, Tex); inc(i, Tex^.h + 2); if EndTime <= RealTicks then begin @@ -310,7 +310,7 @@ end; // Lag alert -if isInLag then DrawSprite(sprLag, 32, 32 + cConsoleYAdd, (RealTicks shr 7) mod 12); +if isInLag then DrawSprite(sprLag, 32, 32, (RealTicks shr 7) mod 12); // Wind bar DrawSprite(sprWindBar, cScreenWidth - 180, cScreenHeight - 30, 0); diff -r 0fcd3fadda41 -r cdff3f6f9b38 share/hedgewars/Data/Graphics/Console.png Binary file share/hedgewars/Data/Graphics/Console.png has changed