DEADSOFTWARE

Revert "fixed weapon switching over the network; bumped protocol version"
[d2df-sdl.git] / src / game / g_player.pas
index f9de6195596b43fa555a80dcbff9ba1d6c241388..f770a8c34270ed8d139d41ba8b5784d7af6d7aa9 100644 (file)
@@ -274,7 +274,6 @@ type
     function    GetRespawnPoint(): Byte;
     procedure   PressKey(Key: Byte; Time: Word = 1);
     procedure   ReleaseKeys();
-    procedure   ReleaseKeysNoWeapon();
     procedure   SetModel(ModelName: String);
     procedure   SetColor(Color: TRGB);
     procedure   SetWeapon(W: Byte);
@@ -314,6 +313,7 @@ type
     procedure   DrawPickup();
     procedure   DrawRulez();
     procedure   DrawAim();
+    procedure   DrawIndicator();
     procedure   DrawBubble();
     procedure   DrawGUI();
     procedure   Update(); virtual;
@@ -551,6 +551,7 @@ var
   gFly: Boolean = False;
   gAimLine: Boolean = False;
   gChatBubble: Byte = 0;
+  gPlayerIndicator: Boolean = True;
   gNumBots: Word = 0;
   gLMSPID1: Word = 0;
   gLMSPID2: Word = 0;
@@ -2326,6 +2327,25 @@ begin
   inherited;
 end;
 
+procedure TPlayer.DrawIndicator();
+var
+  indX, indY: Integer;
+  indW, indH: Word;
+  ID: DWORD;
+begin
+  if FAlive then
+    begin
+      indX := FObj.X+FObj.Rect.X;
+      indY := FObj.Y - 12;
+      if g_Texture_Get('TEXTURE_PLAYER_INDICATOR', ID) then
+        begin
+          e_GetTextureSize(ID, @indW, @indH);
+          e_Draw(ID, indX + indW div 2, indY, 0, True, False);
+        end;
+    end;
+  //e_TextureFontPrint(indX, indY, FName, gStdFont); // Shows player name overhead
+end;
+
 procedure TPlayer.DrawBubble();
 var
   bubX, bubY: Integer;
@@ -3590,7 +3610,7 @@ end;
 
 procedure TPlayer.QueueWeaponSwitch(Weapon: Byte);
 begin
-  //if g_Game_IsClient then Exit;
+  if g_Game_IsClient then Exit;
   if Weapon > High(FWeapon) then Exit;
   FNextWeap := FNextWeap or (1 shl Weapon);
 end;
@@ -3842,13 +3862,13 @@ end;
 
 procedure TPlayer.NextWeapon();
 begin
-  //if g_Game_IsClient then Exit;
+  if g_Game_IsClient then Exit;
   FNextWeap := $8000;
 end;
 
 procedure TPlayer.PrevWeapon();
 begin
-  //if g_Game_IsClient then Exit;
+  if g_Game_IsClient then Exit;
   FNextWeap := $4000;
 end;
 
@@ -4231,7 +4251,6 @@ begin
           Result := True;
           remove := True;
           FFireTime := 0;
-          //k8:do we need it? if g_Game_IsNet and g_Game_IsServer then MH_SEND_PlayerStats(FUID);
         end;
         if FHealth < PLAYER_HP_SOFT then
         begin
@@ -4967,7 +4986,6 @@ begin
       DoLerp(4);
 
   if NetServer then
-  begin
     if FClientID >= 0 then
     begin
       FPing := NetClients[FClientID].Peer^.lastRoundTripTime;
@@ -4980,7 +4998,6 @@ begin
       FPing := 0;
       FLoss := 0;
     end;
-  end;
 
   if FAlive and (FPunchAnim <> nil) then
     FPunchAnim.Update();
@@ -5011,8 +5028,8 @@ begin
   end;
 
   // no need to do that each second frame, weapon queue will take care of it
-  if FAlive and FKeys[KEY_NEXTWEAPON].Pressed {and AnyServer} then NextWeapon();
-  if FAlive and FKeys[KEY_PREVWEAPON].Pressed {and AnyServer} then PrevWeapon();
+  if FAlive and FKeys[KEY_NEXTWEAPON].Pressed and AnyServer then NextWeapon();
+  if FAlive and FKeys[KEY_PREVWEAPON].Pressed and AnyServer then PrevWeapon();
 
   if gTime mod (GAME_TICK*2) <> 0 then
   begin
@@ -5832,18 +5849,6 @@ begin
   end;
 end;
 
-procedure TPlayer.ReleaseKeysNoWeapon();
-var
-  a: Integer;
-begin
-  for a := Low(FKeys) to High(FKeys) do
-  begin
-    if (a = KEY_PREVWEAPON) or (a = KEY_NEXTWEAPON) then continue;
-    FKeys[a].Pressed := False;
-    FKeys[a].Time := 0;
-  end;
-end;
-
 procedure TPlayer.OnDamage(Angle: SmallInt);
 begin
 end;
@@ -7050,7 +7055,7 @@ begin
             end;
         end;
 
-  //HACK! (does it belong there?)
+  //HACK! (does it belongs there?)
   RealizeCurrentWeapon();
 
 // Åñëè åñòü âîçìîæíûå öåëè: