X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=7436e7a95a77d928002f0dd974b74fe045cebda9;hb=2ce8c39f1c6e2ade354a14bd7fce6be00c8c7b0a;hp=66f0099063c3027084c4b32418d174acf77ed4e3;hpb=249437fb26187bc1db9b35f59ad597e169ec9c01;p=d2df-sdl.git diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 66f0099..7436e7a 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -280,7 +280,7 @@ type procedure ReleaseKeysNoWeapon(); procedure SetModel(ModelName: String); procedure SetColor(Color: TRGB); - procedure SetWeaponHost(W: Byte); + procedure SetWeapon(W: Byte); function IsKeyPressed(K: Byte): Boolean; function GetKeys(): Byte; function PickItem(ItemType: Byte; arespawn: Boolean; var remove: Boolean): Boolean; virtual; @@ -317,6 +317,7 @@ type procedure DrawPickup(); procedure DrawRulez(); procedure DrawAim(); + procedure DrawIndicator(); procedure DrawBubble(); procedure DrawGUI(); procedure Update(); virtual; @@ -557,6 +558,7 @@ var gFly: Boolean = False; gAimLine: Boolean = False; gChatBubble: Byte = 0; + gPlayerIndicator: Boolean = True; gNumBots: Word = 0; gLMSPID1: Word = 0; gLMSPID2: Word = 0; @@ -1370,10 +1372,12 @@ begin begin if gPlayers[i] is TPlayer then begin - //if (gPlayers[i].NetForceWeapFIdx > gTime) then writeln('*** PLAYER #', i, '; gTime=', gTime, '; nfwf=', gPlayers[i].NetForceWeapFIdx); gPlayers[i].Update(); - if (not gPlayers[i].alive) or (gPlayers[i].NetForceWeapFIdx >= gTime+15) then gPlayers[i].NetForceWeapFIdx := 0; // just in case - gPlayers[i].RealizeCurrentWeapon(); // WARNING! DO NOT MOVE THIS INTO `Update()`! + if (not gPlayers[i].alive) then gPlayers[i].NetForceWeapFIdx := 0; // just in case + //if g_Game_IsClient or not g_Game_IsNet then + begin + gPlayers[i].RealizeCurrentWeapon(); // WARNING! DO NOT MOVE THIS INTO `Update()`! + end; end else begin @@ -2339,6 +2343,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; @@ -3706,13 +3729,6 @@ begin WEAPON_FLAMETHROWER = 10; *) - { - if (FNextWeap <> 0) or (FNextWeapDelay <> 0) then - begin - e_WriteLog(Format('!!! FNextWeap=%04x; FNextWeapDelay=%d', [FNextWeap, FNextWeapDelay]), TMsgType.Warning); - end; - } - // cycling has priority if (FNextWeap and $C000) <> 0 then begin @@ -3835,14 +3851,11 @@ begin if not switchAllowed then begin - //writeln('WEAPON SWITCHING IS NOT ALLOWED! FBFGFireCounter=', FBFGFireCounter, '; gTime=', gTime, '; FTime[T_SWITCH]=', FTime[T_SWITCH]); //HACK for weapon cycling if (FNextWeap and $E000) <> 0 then FNextWeap := 0; exit; end; - if (FNetForceWeapFIdx >= gTime+15) then FNetForceWeapFIdx := 0; - nw := getNextWeaponIndex(); if nw = 255 then exit; // don't reset anything here if nw > High(FWeapon) then @@ -3887,12 +3900,9 @@ begin FNextWeap := $4000; end; -// used exclusively by network layer -procedure TPlayer.SetWeaponHost(W: Byte); +// used by network layer +procedure TPlayer.SetWeapon(W: Byte); begin - if (W > High(FWeapon)) then exit; - if (not FWeapon[W]) then exit; // server is authority! - if FCurrWeap <> W then if (W = WEAPON_SAW) then FSawSoundSelect.PlayAt(FObj.X, FObj.Y); @@ -4355,8 +4365,6 @@ begin end; procedure TPlayer.Reset(Force: Boolean); -var - i: Integer; begin if Force then FAlive := False; @@ -4377,7 +4385,6 @@ begin //FCurrFrameIdx := 0; //FNetForceWeap := FCurrWeap; FNetForceWeapFIdx := 0; - resetWeaponQueue(); if FNoRespawn then begin FSpectator := False; @@ -4388,16 +4395,10 @@ begin end; FLives := gGameSettings.MaxLives; - FBFGFireCounter := -1; - FTime[T_SWITCH] := 0; - for i := WP_FIRST to WP_LAST do FReloading[i] := 0; - SetFlag(FLAG_NONE); end; procedure TPlayer.SoftReset(); -var - i: Integer; begin ReleaseKeys(); @@ -4410,11 +4411,6 @@ begin FLastFrag := 0; FComboEvnt := -1; FNetForceWeapFIdx := 0; - resetWeaponQueue(); - - FBFGFireCounter := -1; - FTime[T_SWITCH] := 0; - for i := WP_FIRST to WP_LAST do FReloading[i] := 0; SetFlag(FLAG_NONE); SetAction(A_STAND, True); @@ -4575,7 +4571,6 @@ var a, b, c: Byte; Anim: TAnimation; ID: DWORD; - i: Integer; begin FIncCam := 0; FBFGFireCounter := -1; @@ -4584,11 +4579,6 @@ begin FLastHit := 0; //FNetForceWeap := FCurrWeap; FNetForceWeapFIdx := 0; - resetWeaponQueue(); - - FBFGFireCounter := -1; - FTime[T_SWITCH] := 0; - for i := WP_FIRST to WP_LAST do FReloading[i] := 0; if not g_Game_IsServer then Exit; @@ -4653,7 +4643,6 @@ begin FWeapon[WEAPON_KASTET] := True; FCurrWeap := WEAPON_PISTOL; //FNetForceWeap := FCurrWeap; - FNetForceWeapFIdx := 0; resetWeaponQueue(); FModel.SetWeapon(FCurrWeap); @@ -6267,7 +6256,6 @@ begin begin FCurrWeap := WEAPON_KASTET; //FNetForceWeap := FCurrWeap; - FNetForceWeapFIdx := 0; resetWeaponQueue(); FModel.SetWeapon(WEAPON_KASTET); end; @@ -6696,7 +6684,6 @@ begin FAIFlags := nil; FSelectedWeapon := FCurrWeap; - FNetForceWeapFIdx := 0; resetWeaponQueue(); FTargetUID := 0; end;