--- a/hedgewars/CMakeLists.txt Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/CMakeLists.txt Thu Nov 18 09:12:27 2010 +0300
@@ -45,6 +45,7 @@
uAmmos.pas
uChat.pas
uCollisions.pas
+ uCommands.pas
uConsole.pas
uConsts.pas
uFloat.pas
--- a/hedgewars/hwengine.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/hwengine.pas Thu Nov 18 09:12:27 2010 +0300
@@ -31,7 +31,7 @@
uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound,
uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, uMobile,
- sysutils, uTypes, uVariables;
+ sysutils, uTypes, uVariables, uCommands;
var isTerminated: boolean = false;
alsoShutdownFrontend: boolean = false;
@@ -322,6 +322,7 @@
uMisc.initModule;
uVariables.initModule;
uConsole.initModule; // MUST happen after uMisc
+ uCommands.initModule;
uLand.initModule;
uIO.initModule;
@@ -388,6 +389,7 @@
uIO.freeModule; //stub
uLand.freeModule;
+ uCommands.freeModule;
uConsole.freeModule;
uVariables.freeModule;
uMisc.freeModule; // uMisc closes the debug log.
--- a/hedgewars/uAI.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uAI.pas Thu Nov 18 09:12:27 2010 +0300
@@ -30,8 +30,8 @@
implementation
uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions, uMisc,
- uAmmos, uConsole, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes,
- uVariables;
+ uAmmos, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes,
+ uVariables, uCommands;
var BestActions: TActions;
CanUseAmmo: array [TAmmoType] of boolean;
--- a/hedgewars/uAIActions.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uAIActions.pas Thu Nov 18 09:12:27 2010 +0300
@@ -62,7 +62,7 @@
procedure ProcessAction(var Actions: TActions; Me: PGear);
implementation
-uses uMisc, uConsole, uAIMisc, uAI, uAmmos, uVariables;
+uses uMisc, uAIMisc, uAI, uAmmos, uVariables, uCommands;
const ActionIdToStr: array[0..6] of string[16] = (
{aia_none} '',
--- a/hedgewars/uAmmos.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uAmmos.pas Thu Nov 18 09:12:27 2010 +0300
@@ -47,7 +47,7 @@
var StoreCnt: Longword;
implementation
-uses uMisc, uWorld, uLocale, uConsole, uMobile, uVariables;
+uses uMisc, uWorld, uLocale, uMobile, uVariables, uCommands;
type TAmmoCounts = array[TAmmoType] of Longword;
var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
--- a/hedgewars/uChat.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uChat.pas Thu Nov 18 09:12:27 2010 +0300
@@ -34,7 +34,7 @@
showAll: boolean;
implementation
-uses uMisc, uStore, SDLh, uConsole, uKeys, uTypes, uVariables;
+uses uMisc, uStore, SDLh, uKeys, uTypes, uVariables, uCommands;
const MaxStrIndex = 27;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uCommands.pas Thu Nov 18 09:12:27 2010 +0300
@@ -0,0 +1,235 @@
+{$INCLUDE "options.inc"}
+
+unit uCommands;
+
+interface
+
+var isDeveloperMode: boolean;
+type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
+ TCommandHandler = procedure (var params: shortstring);
+
+procedure initModule;
+procedure freeModule;
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
+procedure StopMessages(Message: Longword);
+procedure doPut(putX, putY: LongInt; fromAI: boolean);
+
+implementation
+uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uMobile,
+ uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes,
+ uVariables, uConsole, uFloat;
+
+type PVariable = ^TVariable;
+ TVariable = record
+ Next: PVariable;
+ Name: string[15];
+ VType: TVariableType;
+ Handler: pointer;
+ Trusted: boolean;
+ end;
+
+var
+ Variables: PVariable;
+
+function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
+var value: PVariable;
+begin
+New(value);
+TryDo(value <> nil, 'RegisterVariable: value = nil', true);
+FillChar(value^, sizeof(TVariable), 0);
+value^.Name:= Name;
+value^.VType:= VType;
+value^.Handler:= p;
+value^.Trusted:= Trusted;
+
+if Variables = nil then Variables:= value
+ else begin
+ value^.Next:= Variables;
+ Variables:= value
+ end;
+
+RegisterVariable:= value;
+end;
+
+
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
+var ii: LongInt;
+ s: shortstring;
+ t: PVariable;
+ c: char;
+begin
+//WriteLnToConsole(CmdStr);
+if CmdStr[0]=#0 then exit;
+{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF}
+c:= CmdStr[1];
+if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
+s:= '';
+SplitBySpace(CmdStr, s);
+t:= Variables;
+while t <> nil do
+ begin
+ if t^.Name = CmdStr then
+ begin
+ if TrustedSource or t^.Trusted then
+ case t^.VType of
+ vtCommand: if c='/' then
+ begin
+ TCommandHandler(t^.Handler)(s);
+ end;
+ vtLongInt: if c='$' then
+ if s[0]=#0 then
+ begin
+ str(PLongInt(t^.Handler)^, s);
+ WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+ end else val(s, PLongInt(t^.Handler)^);
+ vthwFloat: if c='$' then
+ if s[0]=#0 then
+ begin
+ //str(PhwFloat(t^.Handler)^:4:6, s);
+ WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+ end else; //val(s, PhwFloat(t^.Handler)^, i);
+ vtBoolean: if c='$' then
+ if s[0]=#0 then
+ begin
+ str(ord(boolean(t^.Handler^)), s);
+ WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+ end else
+ begin
+ val(s, ii);
+ boolean(t^.Handler^):= not (ii = 0)
+ end;
+ end;
+ exit
+ end else t:= t^.Next
+ end;
+case c of
+ '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
+ else WriteLnToConsole(errmsgUnknownCommand + ': "/' + CmdStr + '"') end
+end;
+
+
+procedure StopMessages(Message: Longword);
+begin
+if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else
+if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else
+if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else
+if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else
+if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true)
+end;
+
+{$INCLUDE "CCHandlers.inc"}
+
+procedure initModule;
+begin
+ Variables:= nil;
+ isDeveloperMode:= true;
+
+ // NOTE: please, keep most frequently used commands on bottom
+ RegisterVariable('flag' , vtCommand, @chFlag , false);
+ RegisterVariable('script' , vtCommand, @chScript , false);
+ RegisterVariable('proto' , vtCommand, @chCheckProto , true );
+ RegisterVariable('spectate', vtBoolean, @fastUntilLag , false);
+ RegisterVariable('capture' , vtCommand, @chCapture , true );
+ RegisterVariable('rotmask' , vtCommand, @chRotateMask , true );
+ RegisterVariable('addteam' , vtCommand, @chAddTeam , false);
+ RegisterVariable('rdriven' , vtCommand, @chTeamLocal , false);
+ RegisterVariable('map' , vtCommand, @chSetMap , false);
+ RegisterVariable('theme' , vtCommand, @chSetTheme , false);
+ RegisterVariable('seed' , vtCommand, @chSetSeed , false);
+ RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
+ RegisterVariable('mapgen' , vtLongInt, @cMapGen , false);
+ RegisterVariable('maze_size',vtLongInt, @cMazeSize , false);
+ RegisterVariable('delay' , vtLongInt, @cInactDelay , false);
+ RegisterVariable('ready' , vtLongInt, @cReadyDelay , false);
+ RegisterVariable('casefreq', vtLongInt, @cCaseFactor , false);
+ RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false);
+ RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false);
+ RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns , false);
+ RegisterVariable('waterrise', vtLongInt, @cWaterRise , false);
+ RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
+ RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
+ RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
+ RegisterVariable('minesnum', vtLongInt, @cLandMines , false);
+ RegisterVariable('explosives',vtLongInt,@cExplosives , false);
+ RegisterVariable('gmflags' , vtLongInt, @GameFlags , false);
+ RegisterVariable('trflags' , vtLongInt, @TrainingFlags , false);
+ RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
+ RegisterVariable('minestime',vtLongInt, @cMinesTime , false);
+ RegisterVariable('fort' , vtCommand, @chFort , false);
+ RegisterVariable('voicepack',vtCommand, @chVoicepack , false);
+ RegisterVariable('grave' , vtCommand, @chGrave , false);
+ RegisterVariable('bind' , vtCommand, @chBind , true );
+ RegisterVariable('addhh' , vtCommand, @chAddHH , false);
+ RegisterVariable('hat' , vtCommand, @chSetHat , false);
+ RegisterVariable('hhcoords', vtCommand, @chSetHHCoords , false);
+ RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false);
+ RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false);
+ RegisterVariable('ammprob', vtCommand, @chSetAmmoProbability, false);
+ RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false);
+ RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
+ RegisterVariable('quit' , vtCommand, @chQuit , true );
+ RegisterVariable('confirm' , vtCommand, @chConfirm , true );
+ RegisterVariable('+speedup', vtCommand, @chSpeedup_p , true );
+ RegisterVariable('-speedup', vtCommand, @chSpeedup_m , true );
+ RegisterVariable('zoomin' , vtCommand, @chZoomIn , true );
+ RegisterVariable('zoomout' , vtCommand, @chZoomOut , true );
+ RegisterVariable('zoomreset',vtCommand, @chZoomReset , true );
+ RegisterVariable('skip' , vtCommand, @chSkip , false);
+ RegisterVariable('history' , vtCommand, @chHistory , true );
+ RegisterVariable('chat' , vtCommand, @chChat , true );
+ RegisterVariable('say' , vtCommand, @chSay , true );
+ RegisterVariable('hogsay' , vtCommand, @chHogSay , true );
+ RegisterVariable('team' , vtCommand, @chTeamSay , true );
+ RegisterVariable('ammomenu', vtCommand, @chAmmoMenu , true);
+ RegisterVariable('+precise', vtCommand, @chPrecise_p , false);
+ RegisterVariable('-precise', vtCommand, @chPrecise_m , false);
+ RegisterVariable('+left' , vtCommand, @chLeft_p , false);
+ RegisterVariable('-left' , vtCommand, @chLeft_m , false);
+ RegisterVariable('+right' , vtCommand, @chRight_p , false);
+ RegisterVariable('-right' , vtCommand, @chRight_m , false);
+ RegisterVariable('+up' , vtCommand, @chUp_p , false);
+ RegisterVariable('-up' , vtCommand, @chUp_m , false);
+ RegisterVariable('+down' , vtCommand, @chDown_p , false);
+ RegisterVariable('-down' , vtCommand, @chDown_m , false);
+ RegisterVariable('+attack' , vtCommand, @chAttack_p , false);
+ RegisterVariable('-attack' , vtCommand, @chAttack_m , false);
+ RegisterVariable('switch' , vtCommand, @chSwitch , false);
+ RegisterVariable('nextturn', vtCommand, @chNextTurn , false);
+ RegisterVariable('timer' , vtCommand, @chTimer , false);
+ RegisterVariable('taunt' , vtCommand, @chTaunt , false);
+ RegisterVariable('setweap' , vtCommand, @chSetWeapon , false);
+ RegisterVariable('slot' , vtCommand, @chSlot , false);
+ RegisterVariable('put' , vtCommand, @chPut , false);
+ RegisterVariable('ljump' , vtCommand, @chLJump , false);
+ RegisterVariable('hjump' , vtCommand, @chHJump , false);
+ RegisterVariable('fullscr' , vtCommand, @chFullScr , true );
+ RegisterVariable('+volup' , vtCommand, @chVol_p , true );
+ RegisterVariable('-volup' , vtCommand, @chVol_m , true );
+ RegisterVariable('+voldown', vtCommand, @chVol_m , true );
+ RegisterVariable('-voldown', vtCommand, @chVol_p , true );
+ RegisterVariable('findhh' , vtCommand, @chFindhh , true );
+ RegisterVariable('pause' , vtCommand, @chPause , true );
+ RegisterVariable('+cur_u' , vtCommand, @chCurU_p , true );
+ RegisterVariable('-cur_u' , vtCommand, @chCurU_m , true );
+ RegisterVariable('+cur_d' , vtCommand, @chCurD_p , true );
+ RegisterVariable('-cur_d' , vtCommand, @chCurD_m , true );
+ RegisterVariable('+cur_l' , vtCommand, @chCurL_p , true );
+ RegisterVariable('-cur_l' , vtCommand, @chCurL_m , true );
+ RegisterVariable('+cur_r' , vtCommand, @chCurR_p , true );
+ RegisterVariable('-cur_r' , vtCommand, @chCurR_m , true );
+end;
+
+procedure freeModule;
+var t, tt: PVariable;
+begin
+ tt:= Variables;
+ Variables:= nil;
+ while tt <> nil do
+ begin
+ t:= tt;
+ tt:= tt^.Next;
+ Dispose(t)
+ end;
+end;
+
+end.
\ No newline at end of file
--- a/hedgewars/uConsole.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uConsole.pas Thu Nov 18 09:12:27 2010 +0300
@@ -20,45 +20,26 @@
unit uConsole;
interface
-uses uFloat;
-
-var isDeveloperMode: boolean;
-type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
- TCommandHandler = procedure (var params: shortstring);
procedure initModule;
procedure freeModule;
procedure WriteToConsole(s: shortstring);
procedure WriteLnToConsole(s: shortstring);
-procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
-procedure StopMessages(Message: Longword);
function GetLastConsoleLine: shortstring;
-procedure doPut(putX, putY: LongInt; fromAI: boolean);
-
implementation
-uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uMobile,
- uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes,
- uVariables;
+uses uMisc, Types, uVariables;
const cLineWidth: LongInt = 0;
cLinesCount = 256;
-type PVariable = ^TVariable;
- TVariable = record
- Next: PVariable;
- Name: string[15];
- VType: TVariableType;
- Handler: pointer;
- Trusted: boolean;
- end;
+type
TTextLine = record
s: shortstring;
end;
var ConsoleLines: array[byte] of TTextLine;
CurrLine: LongInt;
- Variables: PVariable;
procedure SetLine(var tl: TTextLine; str: shortstring);
begin
@@ -66,26 +47,6 @@
s:= str;
end;
-function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
-var value: PVariable;
-begin
-New(value);
-TryDo(value <> nil, 'RegisterVariable: value = nil', true);
-FillChar(value^, sizeof(TVariable), 0);
-value^.Name:= Name;
-value^.VType:= VType;
-value^.Handler:= p;
-value^.Trusted:= Trusted;
-
-if Variables = nil then Variables:= value
- else begin
- value^.Next:= Variables;
- Variables:= value
- end;
-
-RegisterVariable:= value;
-end;
-
procedure WriteToConsole(s: shortstring);
var Len: LongInt;
done: boolean;
@@ -123,60 +84,6 @@
{$ENDIF}
end;
-procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
-var ii: LongInt;
- s: shortstring;
- t: PVariable;
- c: char;
-begin
-//WriteLnToConsole(CmdStr);
-if CmdStr[0]=#0 then exit;
-{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF}
-c:= CmdStr[1];
-if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
-s:= '';
-SplitBySpace(CmdStr, s);
-t:= Variables;
-while t <> nil do
- begin
- if t^.Name = CmdStr then
- begin
- if TrustedSource or t^.Trusted then
- case t^.VType of
- vtCommand: if c='/' then
- begin
- TCommandHandler(t^.Handler)(s);
- end;
- vtLongInt: if c='$' then
- if s[0]=#0 then
- begin
- str(PLongInt(t^.Handler)^, s);
- WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
- end else val(s, PLongInt(t^.Handler)^);
- vthwFloat: if c='$' then
- if s[0]=#0 then
- begin
- //str(PhwFloat(t^.Handler)^:4:6, s);
- WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
- end else; //val(s, PhwFloat(t^.Handler)^, i);
- vtBoolean: if c='$' then
- if s[0]=#0 then
- begin
- str(ord(boolean(t^.Handler^)), s);
- WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
- end else
- begin
- val(s, ii);
- boolean(t^.Handler^):= not (ii = 0)
- end;
- end;
- exit
- end else t:= t^.Next
- end;
-case c of
- '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
- else WriteLnToConsole(errmsgUnknownCommand + ': "/' + CmdStr + '"') end
-end;
function GetLastConsoleLine: shortstring;
var valueStr: shortstring;
@@ -193,22 +100,10 @@
GetLastConsoleLine:= valueStr;
end;
-procedure StopMessages(Message: Longword);
-begin
-if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else
-if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else
-if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else
-if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else
-if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true)
-end;
-
-{$INCLUDE "CCHandlers.inc"}
procedure initModule;
var i: LongInt;
begin
CurrLine:= 0;
- Variables:= nil;
- isDeveloperMode:= true;
// initConsole
cLineWidth:= cScreenWidth div 10;
@@ -216,113 +111,11 @@
cLineWidth:= 255;
for i:= 0 to Pred(cLinesCount) do
PByte(@ConsoleLines[i])^:= 0;
-
- // NOTE: please, keep most frequently used commands on bottom
- RegisterVariable('flag' , vtCommand, @chFlag , false);
- RegisterVariable('script' , vtCommand, @chScript , false);
- RegisterVariable('proto' , vtCommand, @chCheckProto , true );
- RegisterVariable('spectate', vtBoolean, @fastUntilLag , false);
- RegisterVariable('capture' , vtCommand, @chCapture , true );
- RegisterVariable('rotmask' , vtCommand, @chRotateMask , true );
- RegisterVariable('addteam' , vtCommand, @chAddTeam , false);
- RegisterVariable('rdriven' , vtCommand, @chTeamLocal , false);
- RegisterVariable('map' , vtCommand, @chSetMap , false);
- RegisterVariable('theme' , vtCommand, @chSetTheme , false);
- RegisterVariable('seed' , vtCommand, @chSetSeed , false);
- RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
- RegisterVariable('mapgen' , vtLongInt, @cMapGen , false);
- RegisterVariable('maze_size',vtLongInt, @cMazeSize , false);
- RegisterVariable('delay' , vtLongInt, @cInactDelay , false);
- RegisterVariable('ready' , vtLongInt, @cReadyDelay , false);
- RegisterVariable('casefreq', vtLongInt, @cCaseFactor , false);
- RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false);
- RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false);
- RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns , false);
- RegisterVariable('waterrise', vtLongInt, @cWaterRise , false);
- RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
- RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
- RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
- RegisterVariable('minesnum', vtLongInt, @cLandMines , false);
- RegisterVariable('explosives',vtLongInt,@cExplosives , false);
- RegisterVariable('gmflags' , vtLongInt, @GameFlags , false);
- RegisterVariable('trflags' , vtLongInt, @TrainingFlags , false);
- RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
- RegisterVariable('minestime',vtLongInt, @cMinesTime , false);
- RegisterVariable('fort' , vtCommand, @chFort , false);
- RegisterVariable('voicepack',vtCommand, @chVoicepack , false);
- RegisterVariable('grave' , vtCommand, @chGrave , false);
- RegisterVariable('bind' , vtCommand, @chBind , true );
- RegisterVariable('addhh' , vtCommand, @chAddHH , false);
- RegisterVariable('hat' , vtCommand, @chSetHat , false);
- RegisterVariable('hhcoords', vtCommand, @chSetHHCoords , false);
- RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false);
- RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false);
- RegisterVariable('ammprob', vtCommand, @chSetAmmoProbability, false);
- RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false);
- RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
- RegisterVariable('quit' , vtCommand, @chQuit , true );
- RegisterVariable('confirm' , vtCommand, @chConfirm , true );
- RegisterVariable('+speedup', vtCommand, @chSpeedup_p , true );
- RegisterVariable('-speedup', vtCommand, @chSpeedup_m , true );
- RegisterVariable('zoomin' , vtCommand, @chZoomIn , true );
- RegisterVariable('zoomout' , vtCommand, @chZoomOut , true );
- RegisterVariable('zoomreset',vtCommand, @chZoomReset , true );
- RegisterVariable('skip' , vtCommand, @chSkip , false);
- RegisterVariable('history' , vtCommand, @chHistory , true );
- RegisterVariable('chat' , vtCommand, @chChat , true );
- RegisterVariable('say' , vtCommand, @chSay , true );
- RegisterVariable('hogsay' , vtCommand, @chHogSay , true );
- RegisterVariable('team' , vtCommand, @chTeamSay , true );
- RegisterVariable('ammomenu', vtCommand, @chAmmoMenu , true);
- RegisterVariable('+precise', vtCommand, @chPrecise_p , false);
- RegisterVariable('-precise', vtCommand, @chPrecise_m , false);
- RegisterVariable('+left' , vtCommand, @chLeft_p , false);
- RegisterVariable('-left' , vtCommand, @chLeft_m , false);
- RegisterVariable('+right' , vtCommand, @chRight_p , false);
- RegisterVariable('-right' , vtCommand, @chRight_m , false);
- RegisterVariable('+up' , vtCommand, @chUp_p , false);
- RegisterVariable('-up' , vtCommand, @chUp_m , false);
- RegisterVariable('+down' , vtCommand, @chDown_p , false);
- RegisterVariable('-down' , vtCommand, @chDown_m , false);
- RegisterVariable('+attack' , vtCommand, @chAttack_p , false);
- RegisterVariable('-attack' , vtCommand, @chAttack_m , false);
- RegisterVariable('switch' , vtCommand, @chSwitch , false);
- RegisterVariable('nextturn', vtCommand, @chNextTurn , false);
- RegisterVariable('timer' , vtCommand, @chTimer , false);
- RegisterVariable('taunt' , vtCommand, @chTaunt , false);
- RegisterVariable('setweap' , vtCommand, @chSetWeapon , false);
- RegisterVariable('slot' , vtCommand, @chSlot , false);
- RegisterVariable('put' , vtCommand, @chPut , false);
- RegisterVariable('ljump' , vtCommand, @chLJump , false);
- RegisterVariable('hjump' , vtCommand, @chHJump , false);
- RegisterVariable('fullscr' , vtCommand, @chFullScr , true );
- RegisterVariable('+volup' , vtCommand, @chVol_p , true );
- RegisterVariable('-volup' , vtCommand, @chVol_m , true );
- RegisterVariable('+voldown', vtCommand, @chVol_m , true );
- RegisterVariable('-voldown', vtCommand, @chVol_p , true );
- RegisterVariable('findhh' , vtCommand, @chFindhh , true );
- RegisterVariable('pause' , vtCommand, @chPause , true );
- RegisterVariable('+cur_u' , vtCommand, @chCurU_p , true );
- RegisterVariable('-cur_u' , vtCommand, @chCurU_m , true );
- RegisterVariable('+cur_d' , vtCommand, @chCurD_p , true );
- RegisterVariable('-cur_d' , vtCommand, @chCurD_m , true );
- RegisterVariable('+cur_l' , vtCommand, @chCurL_p , true );
- RegisterVariable('-cur_l' , vtCommand, @chCurL_m , true );
- RegisterVariable('+cur_r' , vtCommand, @chCurR_p , true );
- RegisterVariable('-cur_r' , vtCommand, @chCurR_m , true );
end;
procedure freeModule;
-var t, tt: PVariable;
begin
- tt:= Variables;
- Variables:= nil;
- while tt <> nil do
- begin
- t:= tt;
- tt:= tt^.Next;
- Dispose(t)
- end;
+
end;
end.
--- a/hedgewars/uGears.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uGears.pas Thu Nov 18 09:12:27 2010 +0300
@@ -45,8 +45,9 @@
function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
implementation
-uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
- uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables;
+uses uWorld, uMisc, uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
+ uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
+ uCommands;
const MAXROPEPOINTS = 384;
var RopePoints: record
--- a/hedgewars/uIO.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uIO.pas Thu Nov 18 09:12:27 2010 +0300
@@ -42,7 +42,7 @@
procedure NetGetNextCmd;
implementation
-uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uTypes, uVariables;
+uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uTypes, uVariables, uCommands;
type PCmd = ^TCmd;
TCmd = packed record
--- a/hedgewars/uKeys.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uKeys.pas Thu Nov 18 09:12:27 2010 +0300
@@ -82,7 +82,7 @@
{$ENDIF}
{$ENDIF}
implementation
-uses uConsole, uMisc, uVariables, uConsts;
+uses uConsole, uCommands, uMisc, uVariables, uConsts;
//const KeyNumber = 1024;
var tkbd, tkbdn: TKeyboardState;
--- a/hedgewars/uScript.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uScript.pas Thu Nov 18 09:12:27 2010 +0300
@@ -53,7 +53,8 @@
uStats,
uRandom,
uTypes,
- uVariables;
+ uVariables,
+ uCommands;
var luaState : Plua_State;
ScriptAmmoLoadout : shortstring;
--- a/hedgewars/uVisualGears.pas Wed Nov 17 22:09:07 2010 -0500
+++ b/hedgewars/uVisualGears.pas Thu Nov 18 09:12:27 2010 +0300
@@ -34,7 +34,7 @@
procedure AddDamageTag(X, Y, Damage, Color: LongWord);
implementation
-uses uWorld, uMisc, uStore, uSound, uMobile, uVariables;
+uses uMisc, uStore, uSound, uMobile, uVariables;
const cExplFrameTicks = 110;