# HG changeset patch # User unc0rr # Date 1137367978 0 # Node ID b6e3ae05857fc0a55993106c725fbad35b1cfc17 # Parent 9ab4067dabecc50d74a9248572f60fe0d98acb75 - Get rid of hwserv and runhelper - Rename hw -> hwengine - Updated copyright info - Fixed graves not reacting on explosion - Fixed fpc warning - Fill Land by another ( hope better) way - One more land template diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/hw.dpr --- a/hedgewars/hw.dpr Sun Jan 15 23:31:34 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +0,0 @@ -(* - * Hedgewars, a worms-like game - * Copyright (c) 2004, 2005 Andrey Korotaev - * - * Distributed under the terms of the BSD-modified licence: - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * with the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *) - -program hedgewars; -{$APPTYPE CONSOLE} -uses - SDLh, - uConsts in 'uConsts.pas', - uGame in 'uGame.pas', - uMisc in 'uMisc.pas', - uStore in 'uStore.pas', - uWorld in 'uWorld.pas', - uIO in 'uIO.pas', - uGears in 'uGears.pas', - uConsole in 'uConsole.pas', - uKeys in 'uKeys.pas', - uTeams in 'uTeams.pas', - uSound in 'uSound.pas', - uRandom in 'uRandom.pas', - uAI in 'uAI.pas', - uAIActions in 'uAIActions.pas', - uAIMisc in 'uAIMisc.pas', - uAIAmmoTests in 'uAIAmmoTests.pas', - uCollisions in 'uCollisions.pas', - uLand in 'uLand.pas', - uLandTemplates in 'uLandTemplates.pas', - uLandObjects in 'uLandObjects.pas'; - -{$INCLUDE options.inc} - -// also: GSHandlers.inc -// CCHandlers.inc -// HHHandlers.inc - - -procedure OnDestroy; forward; - -//////////////////////////////// -procedure DoTimer(Lag: integer); // - обработка таймера -const cCons: boolean = false; -var s: string; -begin -case GameState of - gsLandGen: begin - GenMap; - GameState:= gsStart; - end; - gsStart: begin - AssignHHCoords; - AddMiscGears; - AdjustColor(cColorNearBlack); - AdjustColor(cWhiteColor); - StoreLoad; - AdjustColor(cConsoleSplitterColor); - ResetKbd; - SoundLoad; - PlayMusic; - GameState:= gsGame - end; - gsGame : begin - ProcessKbd; - DoGameTick(Lag); - DrawWorld(Lag, SDLPrimSurface); - end; - gsConsole: begin - DoGameTick(Lag); - DrawWorld(Lag, SDLPrimSurface); - DrawConsole(SDLPrimSurface); - end; - gsExit : begin - OnDestroy; - end; - end; -SDL_Flip(SDLPrimSurface); -if flagMakeCapture then - begin - flagMakeCapture:= false; - s:= 'hw_' + ParamStr(5) + '_' + inttostr(GameTicks) + '.bmp'; - WriteLnToConsole('Saving ' + s); - SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(PChar(s), 'wb'), 1) - end; -end; - -//////////////////// -procedure OnDestroy; // - очищаем память -begin -{$IFDEF DEBUGFILE}AddFileLog('Freeing resources...');{$ENDIF} -if isSoundEnabled then ReleaseSound; -StoreRelease; -CloseIPC; -TTF_Quit; -SDL_Quit; -halt -end; - -/////////////////// -procedure MainLoop; -var PrevTime, - CurrTime: Cardinal; - event: TSDL_Event; -begin -PrevTime:= SDL_GetTicks; -repeat -while SDL_PollEvent(@event) <> 0 do - case event.type_ of - SDL_KEYDOWN: case GameState of - gsGame: if event.key.keysym.sym = 96 then - begin - cConsoleYAdd:= cConsoleHeight; - GameState:= gsConsole - end; - gsConsole: KeyPressConsole(event.key.keysym.sym); - end; - SDL_QUITEV: isTerminated:= true - end; -CurrTime:= SDL_GetTicks; -if PrevTime + cTimerInterval <= CurrTime then - begin - DoTimer(CurrTime - PrevTime); - PrevTime:= CurrTime - end else {sleep(1)}; -IPCCheckSock -until isTerminated -end; - -//////////////////// -procedure GetParams; -var c: integer; -{$IFDEF DEBUGFILE} - i: integer; -begin -for i:= 0 to ParamCount do - AddFileLog(inttostr(i) + ': ' + ParamStr(i)); -{$ELSE} -begin -{$ENDIF} -if ParamCount=6 then - begin - //TODO: сделать передачу через IPC - val(ParamStr(1), cScreenWidth, c); - val(ParamStr(2), cScreenHeight, c); - Pathz[ptThemeCurrent]:= Pathz[ptThemes] + ParamStr(3)+'/'; - val(ParamStr(4), ipcPort, c); - SetRandomParams(ParamStr(5), rndfillstr); - cFullScreen:= ParamStr(6)[1] = '1' - end else OutError(errmsgShouldntRun, true); -end; - -procedure ShowMainWindow; -var flags: Longword; -begin -flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL; -if cFullScreen then flags:= flags or SDL_FULLSCREEN - else SDL_WM_SetCaption('Hedgewars', nil); -SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); -TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); -PixelFormat:= SDLPrimSurface.format; -SDL_ShowCursor(0); -end; -//////////////////////////////////////////////////////////////////////////////// -/////////////////////////////// m a i n //////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -{$INCLUDE revision.inc} - -begin -WriteLnToConsole('HedgeWars 0.1, svn '+cRevision); -WriteLnToConsole(' -= by unC0Rr =- '); -GetParams; -Randomize; - -WriteToConsole('Init SDL... '); -SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true); -WriteLnToConsole(msgOK); - -WriteToConsole('Init SDL_ttf... '); -SDLTry(TTF_Init >= 0, true); -WriteLnToConsole(msgOK); - -ShowMainWindow; - -InitKbdKeyTable; -InitIPC; -WriteLnToConsole(msgGettingConfig); -SendIPCAndWaitReply('C'); // запрос конфига игры -InitTeams; - -if isSoundEnabled then InitSound; -InitWorld; - -StoreInit; - -isDeveloperMode:= false; - -MainLoop - -end. diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/hwengine.dpr --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/hwengine.dpr Sun Jan 15 23:32:58 2006 +0000 @@ -0,0 +1,226 @@ +(* + * Hedgewars, a worms-like game + * Copyright (c) 2004, 2005, 2006 Andrey Korotaev + * + * Distributed under the terms of the BSD-modified licence: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * with the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *) + +program hwengine; +{$APPTYPE CONSOLE} +uses + SDLh, + uConsts in 'uConsts.pas', + uGame in 'uGame.pas', + uMisc in 'uMisc.pas', + uStore in 'uStore.pas', + uWorld in 'uWorld.pas', + uIO in 'uIO.pas', + uGears in 'uGears.pas', + uConsole in 'uConsole.pas', + uKeys in 'uKeys.pas', + uTeams in 'uTeams.pas', + uSound in 'uSound.pas', + uRandom in 'uRandom.pas', + uAI in 'uAI.pas', + uAIActions in 'uAIActions.pas', + uAIMisc in 'uAIMisc.pas', + uAIAmmoTests in 'uAIAmmoTests.pas', + uCollisions in 'uCollisions.pas', + uLand in 'uLand.pas', + uLandTemplates in 'uLandTemplates.pas', + uLandObjects in 'uLandObjects.pas'; + +{$INCLUDE options.inc} + +// also: GSHandlers.inc +// CCHandlers.inc +// HHHandlers.inc + + +procedure OnDestroy; forward; + +//////////////////////////////// +procedure DoTimer(Lag: integer); // - обработка таймера +const cCons: boolean = false; +var s: string; +begin +case GameState of + gsLandGen: begin + GenMap; + GameState:= gsStart; + end; + gsStart: begin + AssignHHCoords; + AddMiscGears; + AdjustColor(cColorNearBlack); + AdjustColor(cWhiteColor); + StoreLoad; + AdjustColor(cConsoleSplitterColor); + ResetKbd; + SoundLoad; + PlayMusic; + GameState:= gsGame + end; + gsGame : begin + ProcessKbd; + DoGameTick(Lag); + DrawWorld(Lag, SDLPrimSurface); + end; + gsConsole: begin + DoGameTick(Lag); + DrawWorld(Lag, SDLPrimSurface); + DrawConsole(SDLPrimSurface); + end; + gsExit : begin + OnDestroy; + end; + end; +SDL_Flip(SDLPrimSurface); +if flagMakeCapture then + begin + flagMakeCapture:= false; + s:= 'hw_' + ParamStr(5) + '_' + inttostr(GameTicks) + '.bmp'; + WriteLnToConsole('Saving ' + s); + SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(PChar(s), 'wb'), 1) + end; +end; + +//////////////////// +procedure OnDestroy; // - очищаем память +begin +{$IFDEF DEBUGFILE}AddFileLog('Freeing resources...');{$ENDIF} +if isSoundEnabled then ReleaseSound; +StoreRelease; +CloseIPC; +TTF_Quit; +SDL_Quit; +halt +end; + +/////////////////// +procedure MainLoop; +var PrevTime, + CurrTime: Cardinal; + event: TSDL_Event; +begin +PrevTime:= SDL_GetTicks; +repeat +while SDL_PollEvent(@event) <> 0 do + case event.type_ of + SDL_KEYDOWN: case GameState of + gsGame: if event.key.keysym.sym = 96 then + begin + cConsoleYAdd:= cConsoleHeight; + GameState:= gsConsole + end; + gsConsole: KeyPressConsole(event.key.keysym.sym); + end; + SDL_QUITEV: isTerminated:= true + end; +CurrTime:= SDL_GetTicks; +if PrevTime + cTimerInterval <= CurrTime then + begin + DoTimer(CurrTime - PrevTime); + PrevTime:= CurrTime + end else {sleep(1)}; +IPCCheckSock +until isTerminated +end; + +//////////////////// +procedure GetParams; +var c: integer; +{$IFDEF DEBUGFILE} + i: integer; +begin +for i:= 0 to ParamCount do + AddFileLog(inttostr(i) + ': ' + ParamStr(i)); +{$ELSE} +begin +{$ENDIF} +if ParamCount=6 then + begin + //TODO: сделать передачу через IPC + val(ParamStr(1), cScreenWidth, c); + val(ParamStr(2), cScreenHeight, c); + Pathz[ptThemeCurrent]:= Pathz[ptThemes] + ParamStr(3)+'/'; + val(ParamStr(4), ipcPort, c); + SetRandomParams(ParamStr(5), rndfillstr); + cFullScreen:= ParamStr(6)[1] = '1' + end else OutError(errmsgShouldntRun, true); +end; + +procedure ShowMainWindow; +var flags: Longword; +begin +flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL; +if cFullScreen then flags:= flags or SDL_FULLSCREEN + else SDL_WM_SetCaption('Hedgewars', nil); +SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); +TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); +PixelFormat:= SDLPrimSurface.format; +SDL_ShowCursor(0); +end; +//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////// m a i n //////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +{$INCLUDE revision.inc} + +begin +WriteLnToConsole('HedgeWars 0.1, svn '+cRevision); +WriteLnToConsole(' -= by unC0Rr =- '); +GetParams; +Randomize; + +WriteToConsole('Init SDL... '); +SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true); +WriteLnToConsole(msgOK); + +WriteToConsole('Init SDL_ttf... '); +SDLTry(TTF_Init >= 0, true); +WriteLnToConsole(msgOK); + +ShowMainWindow; + +InitKbdKeyTable; +InitIPC; +WriteLnToConsole(msgGettingConfig); +SendIPCAndWaitReply('C'); // запрос конфига игры +InitTeams; + +if isSoundEnabled then InitSound; +InitWorld; + +StoreInit; + +isDeveloperMode:= false; + +MainLoop + +end. diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/hwserv.dpr --- a/hedgewars/hwserv.dpr Sun Jan 15 23:31:34 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -(* - * Hedgewars, a worms-like game - * Copyright (c) 2004, 2005 Andrey Korotaev - * - * Distributed under the terms of the BSD-modified licence: - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * with the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *) - -program hwserv; -{$APPTYPE CONSOLE} -uses - Windows, - WinSock, - Messages, - uServerMisc in 'uServerMisc.pas', - uNet, - uPlayers in 'uPlayers.pas'; - -function MainWndProc(hwnd: HWND; Message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; -begin -case Message of - WM_CLOSE : begin - PostQuitMessage(0); - end; - WM_ASYNC_NETEVENT: NetSockEvent(wParam, lParam); - end; -Result:= DefWindowProc(hwnd, Message, wParam,lParam) -end; - -procedure DoCreateWindow; -var wc: WNDCLASS; -begin -FillChar(wc, sizeof(wc), 0); -wc.style := CS_VREDRAW or CS_HREDRAW; -wc.lpfnWndProc := @MainWndProc; -wc.hInstance := hInstance; -wc.lpszClassName := cAppName; -TryDo(RegisterClass(wc) <> 0, 'Cannot register window class'); -hwndMain := CreateWindowEx( 0, cAppName, cAppTitle, WS_POPUP, - 0, 0, - GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), - 0, 0, hInstance, nil); -TryDo(hwndMain <> 0, 'Cannot create window') -end; - -procedure ProcessMessages; -var Message: Windows.MSG; -begin -if PeekMessage(Message,0,0,0,PM_REMOVE) then - if Message.message <> WM_QUIT then - begin - TranslateMessage(Message); - DispatchMessage(Message) - end else isTerminated:= true -end; - -begin -WriteLn('-= Hedgewars server =-'); -WriteLn('protocol version ', cProtVer); -DoCreateWindow; -InitServer; -repeat -ProcessMessages; -until isTerminated -end. diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/runhelper.dpr --- a/hedgewars/runhelper.dpr Sun Jan 15 23:31:34 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -(* - * Hedgewars, a worms-like game - * Copyright (c) 2004, 2005 Andrey Korotaev - * - * Distributed under the terms of the BSD-modified licence: - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * with the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *) - -program runhelper; -{$APPTYPE CONSOLE} -{$J+} -uses SDLh; -var servsock, clsock: PTCPSocket; - ip: TIPAddress; - event: TSDL_Event; - -procedure Send(s: shortstring); -begin -SDLNet_TCP_Send(clsock, @s, succ(byte(s[0]))) -end; - -procedure SendConfig; -begin -Send('TL'); -Send('e$gmflags 1'); -Send('eaddteam'); -Send('ename team "C0CuCKAzZz"'); -Send('ename hh0 "Йожык"'); -Send('ename hh1 "Ёжик"'); -Send('ename hh2 "Ёжык"'); -Send('ename hh3 "Йожик"'); -Send('ename hh4 "Ёжик без ножек"'); -Send('ename hh5 "Just hedgehog"'); -Send('ename hh6 "Ёжик без головы"'); -Send('ename hh7 "Валасатый йож"'); -Send('ebind left "+left"'); -Send('ebind right "+right"'); -Send('ebind up "+up"'); -Send('ebind down "+down"'); -Send('ebind F1 "slot 1"'); -Send('ebind F2 "slot 2"'); -Send('ebind F3 "slot 3"'); -Send('ebind F4 "slot 4"'); -Send('ebind F5 "slot 5"'); -Send('ebind F6 "slot 6"'); -Send('ebind F7 "slot 7"'); -Send('ebind F8 "slot 8"'); -Send('ebind F10 "quit"'); -Send('ebind F11 "capture"'); -Send('ebind space "+attack"'); -Send('ebind return "ljump"'); -Send('ebind backspace "hjump"'); -Send('ebind tab "switch"'); -Send('ebind 1 "timer 1"'); -Send('ebind 2 "timer 2"'); -Send('ebind 3 "timer 3"'); -Send('ebind 4 "timer 4"'); -Send('ebind 5 "timer 5"'); -Send('ebind mousel "put"'); -Send('egrave "coffin"'); -Send('efort "Barrelhouse"'); -Send('ecolor 65535'); -Send('eadd hh0 0'); -Send('eadd hh1 0'); -Send('eadd hh2 0'); -Send('eadd hh3 0'); -Send('eaddteam'); -Send('ename team "-= ЕЖЫ =-"'); -Send('ename hh0 "Маленький"'); -Send('ename hh1 "Удаленький"'); -Send('ename hh2 "Игольчатый"'); -Send('ename hh3 "Стреляный"'); -Send('ename hh4 "Ежиха"'); -Send('ename hh5 "Ежонок"'); -Send('ename hh6 "Инфернальный"'); -Send('ename hh7 "X"'); -Send('egrave Bone'); -Send('ecolor 16776960'); -Send('eadd hh0 1'); -Send('eadd hh1 1'); -Send('eadd hh2 1'); -Send('eadd hh3 1'); -Send('efort Barrelhouse'); -end; - -procedure ParseCmd(s: shortstring); -begin -case s[1] of - '?': Send('!'); - 'C': SendConfig; - end; -end; - -procedure DoIt; -const ss: string = ''; -var s: shortstring; - i: integer; -begin -i:= SDLNet_TCP_Recv(clsock, @s[1], 255); -if i <= 0 then - begin - if i = -1 then exit; - SDLNet_TCP_Close(clsock); - clsock:= nil; - ss:= ''; - exit - end; -byte(s[0]):= i; -ss:= ss + s; -while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) do - begin - s:= copy(ss, 2, byte(ss[1])); - Delete(ss, 1, Succ(byte(ss[1]))); - ParseCmd(s) - end; -end; - -begin -WriteLn('run hw 640 480 avematan 46631 (CVSKGIHSVHX) 1'); -SDL_Init(0); -SDLNet_Init; -ip.host:= 0; -ip.port:= $27B6; -servsock:= SDLNet_TCP_Open(ip); -repeat - if clsock = nil then - clsock:= SDLNet_TCP_Accept(servsock); - if clsock <> nil then - DoIt; - SDL_PollEvent(@event); - SDL_Delay(1) -until event.type_ = SDL_QUITEV; -SDLNet_Quit; -SDL_Quit -end. diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/uAI.pas --- a/hedgewars/uAI.pas Sun Jan 15 23:31:34 2006 +0000 +++ b/hedgewars/uAI.pas Sun Jan 15 23:32:58 2006 +0000 @@ -1,6 +1,6 @@ (* * Hedgewars, a worms-like game - * Copyright (c) 2005 Andrey Korotaev + * Copyright (c) 2005, 2006 Andrey Korotaev * * Distributed under the terms of the BSD-modified licence: * diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Sun Jan 15 23:31:34 2006 +0000 +++ b/hedgewars/uAIAmmoTests.pas Sun Jan 15 23:32:58 2006 +0000 @@ -1,6 +1,6 @@ (* * Hedgewars, a worms-like game - * Copyright (c) 2005 Andrey Korotaev + * Copyright (c) 2005, 2006 Andrey Korotaev * * Distributed under the terms of the BSD-modified licence: * diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Sun Jan 15 23:31:34 2006 +0000 +++ b/hedgewars/uConsole.pas Sun Jan 15 23:32:58 2006 +0000 @@ -1,6 +1,6 @@ (* * Hedgewars, a worms-like game - * Copyright (c) 2004, 2005 Andrey Korotaev + * Copyright (c) 2004, 2005, 2006 Andrey Korotaev * * Distributed under the terms of the BSD-modified licence: * diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun Jan 15 23:31:34 2006 +0000 +++ b/hedgewars/uGears.pas Sun Jan 15 23:32:58 2006 +0000 @@ -569,7 +569,10 @@ FollowGear:= Gear end; end; - gtGrave: Gear.dY:= - dmg / 250; + gtGrave: begin + Gear.dY:= - dmg / 250; + Gear.Active:= true; + end; end; end; Gear:= Gear.NextGear @@ -640,7 +643,6 @@ if sqr(mX - t.X) / rX + sqr(mY - t.Y) / rY <= 1 then begin Result:= t; -// {$IFDEF DEBUGFILE}AddFileLog('CheckGearsNear: near ('+inttostr(mx)+','+inttostr(my)+') is gear '+inttostr(integer(t)));{$ENDIF} exit end; t:= t.NextGear @@ -668,7 +670,6 @@ k:= 7; repeat x:= getrandom(2000) + 24; -// {$IFDEF DEBUGFILE}AddFileLog('SpawnBoxOfSmth: check x = '+inttostr(x));{$ENDIF} b:= false; y:= -1; while (y < 1023) and not b do @@ -680,7 +681,6 @@ if Land[y, i] <> 0 then begin b:= true; -// {$IFDEF DEBUGFILE}AddFileLog('SpawnBoxOfSmth: Land['+inttostr(y)+','+inttostr(i)+'] <> 0');{$ENDIF} end; inc(i) end; diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/uLand.pas --- a/hedgewars/uLand.pas Sun Jan 15 23:31:34 2006 +0000 +++ b/hedgewars/uLand.pas Sun Jan 15 23:32:58 2006 +0000 @@ -56,7 +56,7 @@ var HHPoints: record First, Last: word; ar: array[1..Pred(cMaxSpawnPoints)] of TPoint - end = (First: 1); + end; procedure LogLandDigest; var ctx: TSHA1Context; @@ -127,7 +127,7 @@ Y:= round(r1 + r2 + r3 + r4); t:= t + 0.001; if ((x and $FFFFF800) = 0) and ((y and $FFFFFC00) = 0) then - Land[y, x]:= $FFFFFF; + Land[y, x]:= 0; end; end; end; @@ -244,15 +244,15 @@ while Stack.Count > 0 do begin Pop(xl, xr, y, dir); - while (xl > 0) and (Land[y, xl] = 0) do dec(xl); - while (xr < 2047) and (Land[y, xr] = 0) do inc(xr); + while (xl > 0) and (Land[y, xl] <> 0) do dec(xl); + while (xr < 2047) and (Land[y, xr] <> 0) do inc(xr); while (xl < xr) do begin - while (xl <= xr) and (Land[y, xl] <> 0) do inc(xl); + while (xl <= xr) and (Land[y, xl] = 0) do inc(xl); x:= xl; - while (xl <= xr) and (Land[y, xl] = 0) do + while (xl <= xr) and (Land[y, xl] <> 0) do begin - Land[y, xl]:= $FFFFFF; + Land[y, xl]:= 0; inc(xl) end; if x < xl then @@ -462,8 +462,11 @@ procedure GenLandSurface; var tmpsurf: PSDL_Surface; + i: Longword; begin -GenBlank(EdgeTemplates[getrandom(Succ(High(EdgeTemplates)))]); +for i:= 0 to sizeof(Land) div 4 do + PLongword(Longword(@Land) + i * 4)^:= $FFFFFF; +GenBlank(EdgeTemplates[8{getrandom(Succ(High(EdgeTemplates)))}]); AddProgress; with PixelFormat^ do @@ -564,4 +567,8 @@ end end; +initialization + +HHPoints.First:= 1 + end. diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Sun Jan 15 23:31:34 2006 +0000 +++ b/hedgewars/uLandObjects.pas Sun Jan 15 23:32:58 2006 +0000 @@ -1,3 +1,36 @@ +(* + * Hedgewars, a worms-like game + * Copyright (c) 2005, 2006 Andrey Korotaev + * + * Distributed under the terms of the BSD-modified licence: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * with the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *) + unit uLandObjects; interface uses SDLh; diff -r 9ab4067dabec -r b6e3ae05857f hedgewars/uLandTemplates.pas --- a/hedgewars/uLandTemplates.pas Sun Jan 15 23:31:34 2006 +0000 +++ b/hedgewars/uLandTemplates.pas Sun Jan 15 23:32:58 2006 +0000 @@ -1,3 +1,36 @@ +(* + * Hedgewars, a worms-like game + * Copyright (c) 2005, 2006 Andrey Korotaev + * + * Distributed under the terms of the BSD-modified licence: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * with the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *) + unit uLandTemplates; interface uses SDLh; @@ -27,7 +60,7 @@ ); Template0FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 1023) + (x: 1023; y: 0) ); const Template1Points: array[0..12] of TPoint = @@ -48,7 +81,7 @@ ); Template1FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 1023) + (x: 1023; y: 0) ); const Template2Points: array[0..28] of TPoint = @@ -83,10 +116,9 @@ (x: 1700; y: 1010), (x: 1700; y: 1500) ); - Template2FPoints: array[0..1] of TPoint = + Template2FPoints: array[0..0] of TPoint = ( - (x: 600; y: 1023), - (x: 1500; y: 1023) + (x: 1023; y: 0) ); const Template3Points: array[0..23] of TPoint = @@ -116,10 +148,9 @@ (x: 1900; y: 1010), (x: 1800; y: 1200) ); - Template3FPoints: array[0..1] of TPoint = + Template3FPoints: array[0..0] of TPoint = ( - (x: 500; y: 1023), - (x: 1500; y: 1023) + (x: 1023; y: 0) ); const Template4Points: array[0..38] of TPoint = @@ -164,10 +195,9 @@ (x: 1800; y: 1000), (x: 1800; y: 1500) ); - Template4FPoints: array[0..1] of TPoint = + Template4FPoints: array[0..0] of TPoint = ( - (x: 500; y: 1023), - (x: 1500; y: 1023) + (x: 1023; y: 0) ); const Template5Points: array[0..10] of TPoint = @@ -186,7 +216,7 @@ ); Template5FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 1023) + (x: 1023; y: 0) ); const Template6Points: array[0..20] of TPoint = @@ -215,7 +245,7 @@ ); Template6FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 1023) + (x: 1023; y: 0) ); const Template7Points: array[0..43] of TPoint = @@ -264,14 +294,44 @@ (x: 1665; y: 831), (x: 1818; y: 951), (x: 1893; y: 1476) - ); - Template7FPoints: array[0..1] of TPoint = + ); + Template7FPoints: array[0..0] of TPoint = ( - (x: 630; y: 1023), - (x:1655; y: 1023) + (x: 1023; y: 0) ); -const EdgeTemplates: array[0..7] of TEdgeTemplate = +const Template8Points: array[0..23] of TPoint = + ( + (x: 222; y: 1482), + (x: 354; y: 1023), + (x: 249; y: 783), + (x: 240; y: 421), + (x: 411; y: 401), + (x: 432; y: 777), + (x: 573; y: 777), + (x: 567; y: 300), + (x: 696; y: 250), + (x: 744; y: 683), + (x: 897; y: 698), + (x: 885; y: 450), + (x: 1032; y: 479), + (x: 1065; y: 698), + (x: 1200; y: 690), + (x: 1200; y: 218), + (x: 1326; y: 252), + (x: 1359; y: 786), + (x: 1470; y: 810), + (x: 1485; y: 379), + (x: 1608; y: 342), + (x: 1641; y: 819), + (x: 1719; y: 864), + (x: 1746; y: 1440) ); + Template8FPoints: array[0..0] of TPoint = + ( + (x: 1023; y: 0) + ); + +const EdgeTemplates: array[0..8] of TEdgeTemplate = ( (BasePoints: @Template0Points; BasePointsCount: Succ(High(Template0Points)); @@ -352,8 +412,17 @@ FillPoints: @Template7FPoints; FillPointsCount: Succ(High(Template7FPoints)); canMirror: true; canFlip: false; + ), + (BasePoints: @Template8Points; + BasePointsCount: Succ(High(Template8Points)); + BezPassCnt: 4; + PassMin: 9; PassDelta: 3; + WaveAmplMin: 18; WaveAmplDelta: 18; + WaveFreqMin: 0.010; WaveFreqDelta: 0.002; + FillPoints: @Template8FPoints; + FillPointsCount: Succ(High(Template8FPoints)); + canMirror: true; canFlip: false; ) - );