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

Commit

Permalink
respawn on any player key
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed May 16, 2015
1 parent bd75230 commit 5f9a4d7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 8 deletions.
47 changes: 42 additions & 5 deletions DF Sources/g_netmsg.pas
Expand Up @@ -15,8 +15,7 @@ interface
NET_MSG_COOP = 106;
NET_MSG_FLAG = 107;
NET_MSG_REQFST = 108;
NET_MSG_SHDEL = 109;
NET_MSG_GSET = 110;
NET_MSG_GSET = 109;

NET_MSG_PLR = 111;
NET_MSG_PLRPOS = 112;
Expand All @@ -43,9 +42,13 @@ interface
NET_MSG_TSOUND = 151;
NET_MSG_TMUSIC = 152;

NET_MSG_RCON_AUTH = 161;
NET_MSG_RCON_CMD = 162;
NET_MSG_VOTE_EVENT = 165;
NET_MSG_SHDEL = 161;
NET_MSG_SHADD = 162;
NET_MSG_SHPOS = 163;

NET_MSG_RCON_AUTH = 191;
NET_MSG_RCON_CMD = 192;
NET_MSG_VOTE_EVENT = 195;

NET_MSG_MAP_REQUEST = 201;
NET_MSG_MAP_RESPONSE = 202;
Expand Down Expand Up @@ -101,6 +104,8 @@ procedure MH_SEND_Info(ID: Byte);
procedure MH_SEND_Chat(Txt: string; ID: Integer = NET_EVERYONE);
procedure MH_SEND_Effect(X, Y: Integer; Ang: SmallInt; Kind: Byte; ID: Integer = NET_EVERYONE);
procedure MH_SEND_Sound(X, Y: Integer; Name: string; ID: Integer = NET_EVERYONE);
procedure MH_SEND_CreateShot(Proj: LongInt; ID: Integer = NET_EVERYONE);
procedure MH_SEND_UpdateShot(Proj: LongInt; ID: Integer = NET_EVERYONE);
procedure MH_SEND_DeleteShot(Proj: LongInt; X, Y: LongInt; Loud: Boolean = True; ID: Integer = NET_EVERYONE);
procedure MH_SEND_GameStats(ID: Integer = NET_EVERYONE);
procedure MH_SEND_CoopStats(ID: Integer = NET_EVERYONE);
Expand Down Expand Up @@ -708,6 +713,38 @@ procedure MH_SEND_Sound(X, Y: Integer; Name: string; ID: Integer = NET_EVERYONE)
g_Net_Host_Send(ID, False, NET_CHAN_GAME);
end;

procedure MH_SEND_CreateShot(Proj: LongInt; ID: Integer = NET_EVERYONE);
begin
if (Shots = nil) or (Proj < 0) or (Proj > High(Shots)) then Exit;

e_Buffer_Write(@NetOut, Byte(NET_MSG_SHADD));
e_Buffer_Write(@NetOut, Proj);
e_Buffer_Write(@NetOut, Shots[Proj].ShotType);
e_Buffer_Write(@NetOut, Shots[Proj].Target);
e_Buffer_Write(@NetOut, Shots[Proj].SpawnerUID);
e_Buffer_Write(@NetOut, Shots[Proj].Timeout);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.X);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.Y);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.Vel.X);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.Vel.Y);

g_Net_Host_Send(ID, True, NET_CHAN_LARGEDATA);
end;

procedure MH_SEND_UpdateShot(Proj: LongInt; ID: Integer = NET_EVERYONE);
begin
if (Shots = nil) or (Proj < 0) or (Proj > High(Shots)) then Exit;

e_Buffer_Write(@NetOut, Byte(NET_MSG_SHPOS));
e_Buffer_Write(@NetOut, Proj);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.X);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.Y);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.Vel.X);
e_Buffer_Write(@NetOut, Shots[Proj].Obj.Vel.Y);

g_Net_Host_Send(ID, False, NET_CHAN_GAME);
end;

procedure MH_Send_DeleteShot(Proj: LongInt; X, Y: LongInt; Loud: Boolean = True; ID: Integer = NET_EVERYONE);
begin
e_Buffer_Write(@NetOut, Byte(NET_MSG_SHDEL));
Expand Down
15 changes: 12 additions & 3 deletions DF Sources/g_player.pas
Expand Up @@ -3265,8 +3265,8 @@ function nonz(a: Single): Single;
procedure TPlayer.Update();
var
b: Byte;
i, ii, wx, wy, xd, yd: Integer;
blockmon, headwater: Boolean;
i, ii, wx, wy, xd, yd, k: Integer;
blockmon, headwater, dospawn: Boolean;
st: Word;
NetServer: Boolean;
AnyServer: Boolean;
Expand Down Expand Up @@ -3336,7 +3336,16 @@ procedure TPlayer.Update();
end
else // Dead
begin
if (FKeys[KEY_UP].Pressed) then
dospawn := False;
for k := Low(FKeys) to KEY_CHAT-1 do
begin
if FKeys[k].Pressed then
begin
dospawn := True;
break;
end;
end;
if (dospawn) then
begin
if FGhost then
begin
Expand Down

0 comments on commit 5f9a4d7

Please sign in to comment.