diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 5e95a6a57dd97b42a4d31178c153e94589092816..bdcd38c0e10721756aa391592059a3a0642ce8ff 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
implementation
uses
- Math, ENet, e_input, e_graphics, e_log,
- g_textures, g_gfx, g_sound, g_console, g_basic, g_options, g_main,
+ Math, ENet, e_input, e_log, g_base, g_basic, r_animations, r_gfx,
+ g_textures, g_gfx, g_sound, g_console, g_options,
g_game, g_player, g_map, g_panel, g_items, g_weapons, g_phys, g_gui,
g_language, g_monsters, g_netmaster, utils, wadreader, MAPDEF;
if IsKeyPressed(KEY_UP) then kByte := kByte or NET_KEY_UP;
if IsKeyPressed(KEY_DOWN) then kByte := kByte or NET_KEY_DOWN;
if IsKeyPressed(KEY_JUMP) then kByte := kByte or NET_KEY_JUMP;
- if JustTeleported then kByte := kByte or NET_KEY_FORCEDIR;
end;
+ if JustTeleported then kByte := kByte or NET_KEY_FORCEDIR;
+
NetOut.Write(kByte);
if Direction = TDirection.D_LEFT then NetOut.Write(Byte(0)) else NetOut.Write(Byte(1));
NetOut.Write(GameX);
if Mode <> NET_CHAT_SYSTEM then
begin
- if Mode = NET_CHAT_PLAYER then
+ if NetDeafLevel = 0 then
begin
- g_Console_Add(Txt, True);
- e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
- g_Game_ChatSound(b_Text_Unformat(Txt));
- end else
- if (Mode = NET_CHAT_TEAM) and (gPlayer1 <> nil) then
- begin
- if gPlayer1.Team = TEAM_RED then
- g_Console_Add(b_Text_Format('\r[Team] ') + Txt, True);
- if gPlayer1.Team = TEAM_BLUE then
- g_Console_Add(b_Text_Format('\b[Team] ') + Txt, True);
- e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
- g_Game_ChatSound(b_Text_Unformat(Txt));
+ if Mode = NET_CHAT_PLAYER then
+ begin
+ g_Console_Add(Txt, True);
+ e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
+ g_Game_ChatSound(b_Text_Unformat(Txt));
+ end else
+ if (Mode = NET_CHAT_TEAM) and (gPlayer1 <> nil) then
+ begin
+ if gPlayer1.Team = TEAM_RED then
+ g_Console_Add(b_Text_Format('\r[Team] ') + Txt, True);
+ if gPlayer1.Team = TEAM_BLUE then
+ g_Console_Add(b_Text_Format('\b[Team] ') + Txt, True);
+ e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
+ g_Game_ChatSound(b_Text_Unformat(Txt));
+ end;
end;
- end else
+ end else if (NetDeafLevel < 2) then
g_Console_Add(Txt, True);
end;
Kind: Byte;
X, Y: Integer;
Ang: SmallInt;
- Anim: TAnimation;
- ID: LongWord;
begin
if not gGameOn then Exit;
Kind := M.ReadByte();
NET_GFX_TELE:
begin
- if g_Frames_Get(ID, 'FRAMES_TELEPORT') then
- begin
- Anim := TAnimation.Create(ID, False, 3);
- g_GFX_OnceAnim(X, Y, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(R_GFX_TELEPORT_FAST, X, Y);
if Ang = 1 then
g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y);
end;
NET_GFX_EXPLODE:
begin
- if g_Frames_Get(ID, 'FRAMES_EXPLODE_ROCKET') then
- begin
- Anim := TAnimation.Create(ID, False, 6);
- Anim.Blending := False;
- g_GFX_OnceAnim(X-64, Y-64, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, X - 64, Y - 64);
if Ang = 1 then
g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', X, Y);
end;
NET_GFX_BFGEXPL:
begin
- if g_Frames_Get(ID, 'FRAMES_EXPLODE_BFG') then
- begin
- Anim := TAnimation.Create(ID, False, 6);
- Anim.Blending := False;
- g_GFX_OnceAnim(X-64, Y-64, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, X - 64, Y - 64);
if Ang = 1 then
g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', X, Y);
end;
NET_GFX_BFGHIT:
begin
- if g_Frames_Get(ID, 'FRAMES_BFGHIT') then
- begin
- Anim := TAnimation.Create(ID, False, 4);
- g_GFX_OnceAnim(X-32, Y-32, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(R_GFX_BFG_HIT, X - 32, Y - 32);
end;
NET_GFX_FIRE:
begin
- if g_Frames_Get(ID, 'FRAMES_FIRE') then
- begin
- Anim := TAnimation.Create(ID, False, 4);
- g_GFX_OnceAnim(X, Y, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(R_GFX_FIRE, X, Y);
if Ang = 1 then
g_Sound_PlayExAt('SOUND_FIRE', X, Y);
end;
NET_GFX_RESPAWN:
begin
- if g_Frames_Get(ID, 'FRAMES_ITEM_RESPAWN') then
- begin
- Anim := TAnimation.Create(ID, False, 4);
- g_GFX_OnceAnim(X, Y, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X, Y);
if Ang = 1 then
g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y);
end;
NET_EV_CHANGE_TEAM:
begin
- if EvNum = TEAM_RED then
- g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_RED], [EvStr]), True);
- if EvNum = TEAM_BLUE then
- g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_BLUE], [EvStr]), True);
+ if NetDeafLevel < 2 then
+ begin
+ if EvNum = TEAM_RED then
+ g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_RED], [EvStr]), True);
+ if EvNum = TEAM_BLUE then
+ g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_BLUE], [EvStr]), True);
+ end;
end;
NET_EV_PLAYER_KICK:
g_Console_Add('*** ' + _lc[I_MESSAGE_LMS_SURVIVOR] + ' ***', True);
NET_EV_BIGTEXT:
- g_Game_Message(AnsiUpperCase(EvStr), Word(EvNum));
+ if NetDeafLevel < 2 then g_Game_Message(AnsiUpperCase(EvStr), Word(EvNum));
NET_EV_SCORE:
begin
end;
end;
- g_Console_Add(Format(_lc[I_PLAYER_JOIN], [PName]), True);
+ if NetDeafLevel < 3 then
+ g_Console_Add(Format(_lc[I_PLAYER_JOIN], [PName]), True);
e_WriteLog('NET: Player ' + PName + ' [' + IntToStr(PID) + '] added.', TMsgType.Notify);
Result := PID;
end;
ReleaseKeys;
- if (kByte = NET_KEY_CHAT) then
+ if LongBool(kByte and NET_KEY_CHAT) then
PressKey(KEY_CHAT, 10000)
else
begin
if LongBool(kByte and NET_KEY_JUMP) then PressKey(KEY_JUMP, 10000);
end;
- if ((Pl <> gPlayer1) and (Pl <> gPlayer2)) or LongBool(kByte and NET_KEY_FORCEDIR) then
+ JustTeleported := LongBool(kByte and NET_KEY_FORCEDIR);
+
+ if ((Pl <> gPlayer1) and (Pl <> gPlayer2)) or JustTeleported then
SetDirection(TDirection(Dir));
GameVelX := M.ReadLongInt();
Result := 0;
if Pl = nil then Exit;
- g_Console_Add(Format(_lc[I_PLAYER_LEAVE], [Pl.Name]), True);
+ if NetDeafLevel < 3 then
+ g_Console_Add(Format(_lc[I_PLAYER_LEAVE], [Pl.Name]), True);
e_WriteLog('NET: Player ' + Pl.Name + ' [' + IntToStr(PID) + '] removed.', TMsgType.Notify);
g_Player_Remove(PID);
if Pl.Name <> TmpName then
begin
- g_Console_Add(Format(_lc[I_PLAYER_NAME], [Pl.Name, TmpName]), True);
+ if NetDeafLevel < 3 then
+ g_Console_Add(Format(_lc[I_PLAYER_NAME], [Pl.Name, TmpName]), True);
Pl.Name := TmpName;
end;
procedure MC_RECV_ItemSpawn(var M: TMsg);
var
ID: Word;
- AID: DWord;
X, Y, VX, VY: Integer;
T: Byte;
Quiet, Fall{, Resp}: Boolean;
- Anim: TAnimation;
it: PItem;
begin
if not gGameOn then Exit;
if not Quiet then
begin
g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y);
- if g_Frames_Get(AID, 'FRAMES_ITEM_RESPAWN') then
- begin
- Anim := TAnimation.Create(AID, False, 4);
- g_GFX_OnceAnim(X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16);
end;
end;
Str1 := M.ReadString();
Str2 := M.ReadString();
- case EvID of
- NET_VE_STARTED:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_STARTED], [Str1, Str2, Int1]), True);
- NET_VE_PASSED:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_PASSED], [Str1]), True);
- NET_VE_FAILED:
- g_Console_Add(_lc[I_MESSAGE_VOTE_FAILED], True);
- NET_VE_VOTE:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_VOTE], [Str1, Int1, Int2]), True);
- NET_VE_INPROGRESS:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_INPROGRESS], [Str1]), True);
- end;
+ if NetDeafLevel < 2 then
+ case EvID of
+ NET_VE_STARTED:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_STARTED], [Str1, Str2, Int1]), True);
+ NET_VE_PASSED:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_PASSED], [Str1]), True);
+ NET_VE_FAILED:
+ g_Console_Add(_lc[I_MESSAGE_VOTE_FAILED], True);
+ NET_VE_VOTE:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_VOTE], [Str1, Int1, Int2]), True);
+ NET_VE_INPROGRESS:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_INPROGRESS], [Str1]), True);
+ end;
end;
// CLIENT SEND