summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0968d19)
raw | patch | inline | side by side (parent: 0968d19)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 9 Apr 2016 05:08:02 +0000 (08:08 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 16 Apr 2016 08:38:17 +0000 (11:38 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 27ca859c4167563426b36a324b4e0e4876db1b48..5f26b864ba8d064a5df1dcde85f9f7efa8c1fc45 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('clientlist', GameCommands);
AddCommand('event', GameCommands);
+ AddCommand('god', GameCheats);
+ AddCommand('notarget', GameCheats);
+ AddCommand('give', GameCheats); // "exit" too ;-)
+ AddCommand('open', GameCheats);
+ AddCommand('fly', GameCheats);
+ AddCommand('noclip', GameCheats);
+ AddCommand('speedy', GameCheats);
+ AddCommand('jumpy', GameCheats);
+ AddCommand('noreload', GameCheats);
+ AddCommand('aimline', GameCheats);
+ AddCommand('automap', GameCheats);
+
WhitelistCommand('say');
WhitelistCommand('tell');
WhitelistCommand('overtime');
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 30605bf67bb66304dc330250e5fd3d3fbed975c7..f678380c6b6a494b975f62a5669cefa8b21edee1 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
procedure g_Game_DeleteTestMap();
procedure GameCVars(P: SArray);
procedure GameCommands(P: SArray);
+procedure GameCheats(P: SArray);
procedure DebugCommands(P: SArray);
procedure g_Game_Process_Params;
procedure g_Game_SetLoadingText(Text: String; Max: Integer; reWrite: Boolean);
g_Console_Add(_lc[I_MSG_NOT_DEBUG]);
end;
+
+procedure GameCheats(P: SArray);
+var
+ cmd: string;
+ f, a: Integer;
+ plr: TPlayer;
+begin
+ if (not gGameOn) or (not gCheats) or ((gGameSettings.GameType <> GT_SINGLE) and
+ (gGameSettings.GameMode <> GM_COOP) and (not gDebugMode)) or g_Game_IsNet then
+ begin
+ g_Console_Add('not available');
+ exit;
+ end;
+ plr := gPlayer1;
+ if plr = nil then
+ begin
+ g_Console_Add('where is the player?!');
+ exit;
+ end;
+ cmd := LowerCase(P[0]);
+ // god
+ if cmd = 'god' then
+ begin
+ plr.GodMode := not plr.GodMode;
+ if plr.GodMode then g_Console_Add('player is godlike now') else g_Console_Add('player is mortal now');
+ exit;
+ end;
+ // give <health|exit|weapons|air|suit|jetpack|berserk|all>
+ if cmd = 'give' then
+ begin
+ if length(P) < 2 then begin g_Console_Add('give what?!'); exit; end;
+ for f := 1 to High(P) do
+ begin
+ cmd := LowerCase(P[f]);
+ if cmd = 'health' then begin plr.RestoreHealthArmor(); g_Console_Add('player feels himself better'); continue; end;
+ if (cmd = 'all') or (cmd = 'weapons') then begin plr.AllRulez(False); g_Console_Add('player got the gifts'); continue; end;
+ if cmd = 'exit' then
+ begin
+ if gTriggers <> nil then
+ begin
+ for a := 0 to High(gTriggers) do
+ begin
+ if gTriggers[a].TriggerType = TRIGGER_EXIT then
+ begin
+ g_Console_Add('player left the map');
+ gExitByTrigger := True;
+ g_Game_ExitLevel(gTriggers[a].Data.MapName);
+ break;
+ end;
+ end;
+ end;
+ continue;
+ end;
+ if cmd = 'air' then begin plr.GiveItem(ITEM_OXYGEN); g_Console_Add('player got some air'); continue; end;
+ if cmd = 'jetpack' then begin plr.GiveItem(ITEM_JETPACK); g_Console_Add('player got jetpack'); continue; end;
+ if cmd = 'suit' then begin plr.GiveItem(ITEM_SUIT); g_Console_Add('player got envirosuit'); continue; end;
+ if cmd = 'berserk' then begin plr.GiveItem(ITEM_MEDKIT_BLACK); g_Console_Add('player got berserk pack'); continue; end;
+ g_Console_Add('i don''t know how to give '''+cmd+'''!');
+ end;
+ exit;
+ end;
+ // open
+ if cmd = 'open' then
+ begin
+ g_Console_Add('player activated sesame');
+ g_Triggers_OpenAll();
+ exit;
+ end;
+ // fly
+ if cmd = 'fly' then
+ begin
+ gFly := not gFly;
+ if gFly then g_Console_Add('player feels himself lighter') else g_Console_Add('player lost his wings');
+ exit;
+ end;
+ // noclip
+ if cmd = 'noclip' then
+ begin
+ plr.SwitchNoClip;
+ g_Console_Add('wall hardeness adjusted');
+ exit;
+ end;
+ // notarget
+ if cmd = 'notarget' then
+ begin
+ plr.NoTarget := not plr.NoTarget;
+ if plr.NoTarget then g_Console_Add('player hides in shadows') else g_Console_Add('player is brave again');
+ exit;
+ end;
+ // noreload
+ if cmd = 'noreload' then
+ begin
+ plr.NoReload := not plr.NoReload;
+ if plr.NoReload then g_Console_Add('player is action hero now') else g_Console_Add('player is ordinary man now');
+ exit;
+ end;
+ // speedy
+ if cmd = 'speedy' then
+ begin
+ MAX_RUNVEL := 32-MAX_RUNVEL;
+ g_Console_Add('speed adjusted');
+ exit;
+ end;
+ // jumpy
+ if cmd = 'jumpy' then
+ begin
+ VEL_JUMP := 30-VEL_JUMP;
+ g_Console_Add('jump height adjusted');
+ exit;
+ end;
+ // automap
+ if cmd = 'automap' then
+ begin
+ gShowMap := not gShowMap;
+ if gShowMap then g_Console_Add('player gains second sight') else g_Console_Add('player lost second sight');
+ exit;
+ end;
+ // aimline
+ if cmd = 'aimline' then
+ begin
+ gAimLine := not gAimLine;
+ if gAimLine then g_Console_Add('player gains laser sight') else g_Console_Add('player lost laser sight');
+ exit;
+ end;
+end;
+
procedure GameCommands(P: SArray);
var
a, b: Integer;
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 6ffbe28dfc882c3fff794a6f788895c414ce5985..9d79504ac4e87136ffd6a0ab95f1bbc406444c9b 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
procedure SetFlag(Flag: Byte);
function DropFlag(): Boolean;
procedure AllRulez(Health: Boolean);
+ procedure RestoreHealthArmor();
procedure FragCombo();
procedure GiveItem(ItemType: Byte);
procedure Damage(value: Word; SpawnerUID: Word; vx, vy: Integer; t: Byte); virtual;
FRulez := FRulez+[R_KEY_RED, R_KEY_GREEN, R_KEY_BLUE];
end;
+procedure TPlayer.RestoreHealthArmor();
+begin
+ FHealth := PLAYER_HP_LIMIT;
+ FArmor := PLAYER_AP_LIMIT;
+end;
+
procedure TPlayer.FragCombo();
var
Param: Integer;