summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba8cb45)
raw | patch | inline | side by side (parent: ba8cb45)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 6 May 2019 15:50:22 +0000 (18:50 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 6 May 2019 15:50:22 +0000 (18:50 +0300) |
can only specify it for bots for now
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 4282e66642f47be224e827ff0cefef9c2f894a3e..7a70840b33b47db24b85276e7d1d63f77f1f26e1 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
else if (cmd = 'addbot') or
(cmd = 'bot_add') then
begin
- if Length(P) > 1 then
+ if Length(P) > 2 then
+ g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2), StrToIntDef(P[2], 100))
+ else if Length(P) > 1 then
g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2))
else
g_Bot_Add(TEAM_NONE, 2);
else if cmd = 'bot_addlist' then
begin
if Length(P) > 1 then
+ begin
if Length(P) = 2 then
g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1))
+ else if Length(P) = 3 then
+ g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1), StrToIntDef(P[2], 100))
else
g_Bot_AddList(IfThen(P[2] = 'red', TEAM_RED, TEAM_BLUE), P[1], StrToIntDef(P[1], -1));
+ end;
end
else if cmd = 'bot_removeall' then
g_Bot_RemoveAll()
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index da4c43a84e12561afef525e41c84ce7eb8e04d4a..88070c61c04866a6c79bcea7dc8d39f88545fa12 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
FReady: Boolean;
FDummy: Boolean;
FFireTime: Integer;
+ FHandicap: Integer;
// debug: viewport offset
viewPortX, viewPortY, viewPortW, viewPortH: Integer;
procedure g_Player_Corpses_SaveState (st: TStream);
procedure g_Player_Corpses_LoadState (st: TStream);
procedure g_Player_ResetReady();
-procedure g_Bot_Add(Team, Difficult: Byte);
-procedure g_Bot_AddList(Team: Byte; lname: ShortString; num: Integer = -1);
+procedure g_Bot_Add(Team, Difficult: Byte; Handicap: Integer = 100);
+procedure g_Bot_AddList(Team: Byte; lname: ShortString; num: Integer = -1; Handicap: Integer = 100);
procedure g_Bot_MixNames();
procedure g_Bot_RemoveAll();
if b = 1 then gPlayers[a].FDirection := TDirection.D_LEFT else gPlayers[a].FDirection := TDirection.D_RIGHT; // b = 2
// Çäîðîâüå
gPlayers[a].FHealth := utils.readLongInt(st);
+ // Ôîðà
+ gPlayers[a].FHandicap := utils.readLongInt(st);
// Æèçíè
gPlayers[a].FLives := utils.readByte(st);
// Áðîíÿ
end;
end;
-procedure g_Bot_Add(Team, Difficult: Byte);
+procedure g_Bot_Add(Team, Difficult: Byte; Handicap: Integer = 100);
var
m: SSArray;
_name, _model: String;
//FDifficult.SafeWeaponPrior[a] := WEAPON_PRIOR3[a];
end;
+ FHandicap := Handicap;
+
g_Console_Add(Format(_lc[I_PLAYER_JOIN], [Name]), True);
if g_Game_IsNet then MH_SEND_PlayerCreate(UID);
end;
end;
-procedure g_Bot_AddList(Team: Byte; lName: ShortString; num: Integer = -1);
+procedure g_Bot_AddList(Team: Byte; lName: ShortString; num: Integer = -1; Handicap: Integer = 100);
var
m: SSArray;
_name, _model: String;
FDifficult.Cover := BotList[num].cover;
FDifficult.CloseJump := BotList[num].close_jump;
+ FHandicap := Handicap;
+
for a := WP_FIRST to WP_LAST do
begin
FDifficult.WeaponPrior[a] := BotList[num].w_prior1[a];
FFireTime := 0;
FFirePainTime := 0;
FFireAttacker := 0;
+ FHandicap := 100;
FActualModelName := 'doomer';
// Âîñêðåøåíèå áåç îðóæèÿ:
if not FAlive then
begin
- FHealth := PLAYER_HP_SOFT;
+ FHealth := Round(PLAYER_HP_SOFT * (FHandicap / 100));
FArmor := 0;
FAlive := True;
FAir := AIR_DEF;
utils.writeInt(st, Byte(b));
// Çäîðîâüå
utils.writeInt(st, LongInt(FHealth));
+ // Êîýôôèöèåíò èíâàëèäíîñòè
+ utils.writeInt(st, LongInt(FHandicap));
// Æèçíè
utils.writeInt(st, Byte(FLives));
// Áðîíÿ
if b = 1 then FDirection := TDirection.D_LEFT else FDirection := TDirection.D_RIGHT; // b = 2
// Çäîðîâüå
FHealth := utils.readLongInt(st);
+ // Êîýôôèöèåíò èíâàëèäíîñòè
+ FHandicap := utils.readLongInt(st);
// Æèçíè
FLives := utils.readByte(st);
// Áðîíÿ