Skip to content
This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
/ DF Public archive

Commit

Permalink
a lot of small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed May 16, 2015
1 parent 8dd24e7 commit 2073cd5
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 10 deletions.
4 changes: 3 additions & 1 deletion DF Sources/g_console.pas
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ procedure g_Console_Init();
AddCommand('spectate', GameCommands);
AddCommand('ready', GameCommands);
AddCommand('kick', GameCommands);
AddCommand('kick_id', GameCommands);
AddCommand('connect', GameCommands);
AddCommand('disconnect', GameCommands);
AddCommand('reconnect', GameCommands);
Expand All @@ -255,6 +256,7 @@ procedure g_Console_Init();
AddCommand('rcon', GameCommands);
AddCommand('callvote', GameCommands);
AddCommand('vote', GameCommands);
AddCommand('clientlist', GameCommands);

WhitelistCommand('broadcast');
WhitelistCommand('tell');
Expand Down Expand Up @@ -452,7 +454,7 @@ procedure g_Console_Control(K: Byte);
begin
case K of
VK_BACK:
if Length(Line) > 0 then
if (Length(Line) > 0) and (CPos > 1) then
begin
Delete(Line, CPos-1, 1);
CPos := CPos-1;
Expand Down
51 changes: 50 additions & 1 deletion DF Sources/g_game.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3546,6 +3546,7 @@ procedure GameCommands(P: SArray);
chstr: string;
cmd: string;
pl: pTNetClient;
plr: TPlayer;
prt: Word;
begin
// Îáùèå êîìàíäû:
Expand Down Expand Up @@ -3586,7 +3587,55 @@ procedure GameCommands(P: SArray);
end;

pl := g_Net_Client_ByName(P[1]);
if (pl <> nil) then enet_peer_disconnect(pl^.Peer, NET_DISC_KICK);
if (pl <> nil) then
enet_peer_disconnect(pl^.Peer, NET_DISC_KICK)
else if gPlayers <> nil then
for a := Low(gPlayers) to High(gPlayers) do
if gPlayers[a] <> nil then
if gPlayers[a] is TBot then
begin
gPlayers[a].Lives := 0;
gPlayers[a].Kill(K_SIMPLEKILL, 0, 0);
g_Player_Remove(gPlayers[a].UID);
end;
end;
end
else if cmd = 'kick_id' then
begin
if g_Game_IsServer and g_Game_IsNet then
begin
if Length(P) < 2 then
begin
g_Console_Add('kick_id client_id');
Exit;
end;
if P[1] = '' then
begin
g_Console_Add('kick_id client_id');
Exit;
end;

a := StrToIntDef(P[1], 0);
if (NetClients <> nil) and (a <= High(NetClients)) then
begin
if NetClients[a].Used and (NetClients[a].Peer <> nil) then
enet_peer_disconnect(NetClients[a].Peer, NET_DISC_KICK);
end;
end;
end
else if cmd = 'clientlist' then
begin
if g_Game_IsServer and g_Game_IsNet and (NetClients <> nil) then
begin
for a := Low(NetClients) to High(NetClients) do
if NetClients[a].Used and (NetClients[a].Peer <> nil) then
begin
plr := g_Player_Get(NetClients[a].Player);
if plr = nil then continue;
g_Console_Add('#' + IntToStr(a) + ': ' +
IpToStr(NetClients[a].Peer^.address.host) +
' | ' + plr.Name);
end;
end;
end
else if cmd = 'connect' then
Expand Down
8 changes: 8 additions & 0 deletions DF Sources/g_main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,21 @@ procedure KeyPress(K: Byte);
g_ActiveWindow.OnMessage(Msg);
end
else
begin
if (gState = STATE_MENU) then
begin
g_GUI_ShowWindow('MainMenu');
g_Sound_PlayEx('MENU_OPEN');
end
else
begin // Êëàâèøè -> íàáîðó êîäà
for a := 0 to 14 do
charbuff[a] := charbuff[a+1];
charbuff[15] := Chr(K);

Cheat();
end;
end;
end;
end;
end;
Expand Down
2 changes: 1 addition & 1 deletion DF Sources/g_net.pas
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ function g_Net_Client_ByName(Name: string): pTNetClient;
begin
pl := g_Player_Get(NetClients[a].Player);
if pl = nil then continue;
if LowerCase(pl.Name) <> LowerCase(Name) then continue;
if Copy(pl.Name, 1, Length(Name)) <> LowerCase(Name) then continue;
if NetClients[a].Peer <> nil then
begin
Result := @NetClients[a];
Expand Down
2 changes: 1 addition & 1 deletion DF Sources/g_weapons.pas
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ procedure throw(i, x, y, xd, yd, s: Integer);
if Shots[i].ShotType in [WEAPON_BSP_FIRE, WEAPON_PLASMA] then
Shots[i].Timeout := 550 // ~15 sec
else
Shots[i].Timeout := 1050 // ~30 sec
Shots[i].Timeout := 900 // ~25 sec
end;

function g_Weapon_Hit(obj: PObj; d: Integer; SpawnerUID: Word; t: Byte): Byte;
Expand Down
8 changes: 2 additions & 6 deletions DF Sources/g_window.pas
Original file line number Diff line number Diff line change
Expand Up @@ -737,16 +737,12 @@ function ProcessMessage(): Boolean;

// Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ:
if flag then
Time_Old := Time - (Time_Delta mod 27777);

// Íå ðèñóåì â íåàêòèâíîì:
if (not wMinimized) then
begin
if flag then
Time_Old := Time - (Time_Delta mod 27777);
if (not wMinimized) then
begin
Draw();
SwapBuffers(h_DC);

ReShowCursor();
end;
end
Expand Down

0 comments on commit 2073cd5

Please sign in to comment.