X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_game.pas;h=12c9824f0ba05c9617745d5b57a47f9bfd49f12b;hp=de729fae42e2b139d809d3e451dccd8c7afee1b2;hb=05c4488d67219fb60a2687af2a06397fea1dffbb;hpb=0f19f863e4ed346794b6ce5a56571027b4c8cd0b diff --git a/src/game/g_game.pas b/src/game/g_game.pas index de729fa..12c9824 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -237,6 +237,10 @@ var goodsnd: array[0..3] of TPlayableSound; killsnd: array[0..3] of TPlayableSound; hahasnd: array[0..2] of TPlayableSound; + sound_get_flag: array[0..1] of TPlayableSound; + sound_lost_flag: array[0..1] of TPlayableSound; + sound_ret_flag: array[0..1] of TPlayableSound; + sound_cap_flag: array[0..1] of TPlayableSound; gBodyKillEvent: Integer = -1; gDefInterTime: ShortInt = -1; gInterEndTime: LongWord = 0; @@ -1504,18 +1508,11 @@ begin result := false; end; -function isOneKeyPressed (key1: Word): Boolean; -begin - if (key1 <> 0) and e_KeyPressed(key1) then begin result := true; exit; end; - result := false; -end; - procedure processPlayerControls (plr: TPlayer; var ctrl: TPlayerControl; var MoveButton: Byte; p2hack: Boolean=false); var time: Word; strafeDir: Byte; i: Integer; - rwk: Boolean; begin if (plr = nil) then exit; if (p2hack) then time := 1000 else time := 1; @@ -1559,42 +1556,13 @@ begin if isKeyPressed(KeyUp, KeyUp2) then plr.PressKey(KEY_UP, time); if isKeyPressed(KeyDown, KeyDown2) then plr.PressKey(KEY_DOWN, time); if isKeyPressed(KeyFire, KeyFire2) then plr.PressKey(KEY_FIRE); - if isKeyPressed(KeyNextWeapon, KeyNextWeapon2) then - begin - rwk := plr.isWeaponSwitchKeyReleased(-1); - if rwk then plr.PressKey(KEY_NEXTWEAPON); - plr.weaponSwitchKeysStateChange(-1, true); - end - else - begin - plr.weaponSwitchKeysStateChange(-1, false); - end; - if isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2) then - begin - rwk := plr.isWeaponSwitchKeyReleased(-2); - if rwk then plr.PressKey(KEY_PREVWEAPON); - plr.weaponSwitchKeysStateChange(-2, true); - end - else - begin - plr.weaponSwitchKeysStateChange(-2, false); - end; + if isKeyPressed(KeyNextWeapon, KeyNextWeapon2) then plr.PressKey(KEY_NEXTWEAPON); + if isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2) then plr.PressKey(KEY_PREVWEAPON); if isKeyPressed(KeyOpen, KeyOpen2) then plr.PressKey(KEY_OPEN); for i := 0 to High(KeyWeapon) do - begin if isKeyPressed(KeyWeapon[i], KeyWeapon2[i]) then - begin - rwk := plr.isWeaponSwitchKeyReleased(i); - //writeln('rwk:', rwk); - plr.weaponSwitchKeysStateChange(i, true); - if rwk then plr.QueueWeaponSwitch(i); // all choices are passed there, and god will take the best - end - else - begin - plr.weaponSwitchKeysStateChange(i, false); - end; - end; + plr.QueueWeaponSwitch(i); // all choices are passed there, and god will take the best end; // HACK: add dynlight here @@ -2329,6 +2297,7 @@ begin g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG_D', GameWAD+':TEXTURES\FLAGHUD_B_DROP'); g_Texture_CreateWADEx('TEXTURE_PLAYER_TALKBUBBLE', GameWAD+':TEXTURES\TALKBUBBLE'); g_Texture_CreateWADEx('TEXTURE_PLAYER_INVULPENTA', GameWAD+':TEXTURES\PENTA'); + g_Texture_CreateWADEx('TEXTURE_PLAYER_INDICATOR', GameWAD+':TEXTURES\PLRIND'); hasPBarGfx := true; if not g_Texture_CreateWADEx('UI_GFX_PBAR_LEFT', GameWAD+':TEXTURES\LLEFT') then hasPBarGfx := false; @@ -2381,6 +2350,14 @@ begin g_Sound_CreateWADEx('SOUND_ANNOUNCER_MUHAHA1', GameWAD+':SOUNDS\MUHAHA1'); g_Sound_CreateWADEx('SOUND_ANNOUNCER_MUHAHA2', GameWAD+':SOUNDS\MUHAHA2'); g_Sound_CreateWADEx('SOUND_ANNOUNCER_MUHAHA3', GameWAD+':SOUNDS\MUHAHA3'); + g_Sound_CreateWADEx('SOUND_CTF_GET1', GameWAD+':SOUNDS\GETFLAG1'); + g_Sound_CreateWADEx('SOUND_CTF_GET2', GameWAD+':SOUNDS\GETFLAG2'); + g_Sound_CreateWADEx('SOUND_CTF_LOST1', GameWAD+':SOUNDS\LOSTFLG1'); + g_Sound_CreateWADEx('SOUND_CTF_LOST2', GameWAD+':SOUNDS\LOSTFLG2'); + g_Sound_CreateWADEx('SOUND_CTF_RETURN1', GameWAD+':SOUNDS\RETFLAG1'); + g_Sound_CreateWADEx('SOUND_CTF_RETURN2', GameWAD+':SOUNDS\RETFLAG2'); + g_Sound_CreateWADEx('SOUND_CTF_CAPTURE1', GameWAD+':SOUNDS\CAPFLAG1'); + g_Sound_CreateWADEx('SOUND_CTF_CAPTURE2', GameWAD+':SOUNDS\CAPFLAG2'); goodsnd[0] := TPlayableSound.Create(); goodsnd[1] := TPlayableSound.Create(); @@ -2410,6 +2387,24 @@ begin hahasnd[1].SetByName('SOUND_ANNOUNCER_MUHAHA2'); hahasnd[2].SetByName('SOUND_ANNOUNCER_MUHAHA3'); + sound_get_flag[0] := TPlayableSound.Create(); + sound_get_flag[1] := TPlayableSound.Create(); + sound_lost_flag[0] := TPlayableSound.Create(); + sound_lost_flag[1] := TPlayableSound.Create(); + sound_ret_flag[0] := TPlayableSound.Create(); + sound_ret_flag[1] := TPlayableSound.Create(); + sound_cap_flag[0] := TPlayableSound.Create(); + sound_cap_flag[1] := TPlayableSound.Create(); + + sound_get_flag[0].SetByName('SOUND_CTF_GET1'); + sound_get_flag[1].SetByName('SOUND_CTF_GET2'); + sound_lost_flag[0].SetByName('SOUND_CTF_LOST1'); + sound_lost_flag[1].SetByName('SOUND_CTF_LOST2'); + sound_ret_flag[0].SetByName('SOUND_CTF_RETURN1'); + sound_ret_flag[1].SetByName('SOUND_CTF_RETURN2'); + sound_cap_flag[0].SetByName('SOUND_CTF_CAPTURE1'); + sound_cap_flag[1].SetByName('SOUND_CTF_CAPTURE2'); + g_Game_LoadChatSounds(GameWAD+':CHATSND\SNDCFG'); g_Game_SetLoadingText(_lc[I_LOAD_ITEMS_DATA], 0, False); @@ -2491,6 +2486,24 @@ begin g_Sound_Delete('SOUND_ANNOUNCER_MUHAHA2'); g_Sound_Delete('SOUND_ANNOUNCER_MUHAHA3'); + sound_get_flag[0].Free(); + sound_get_flag[1].Free(); + sound_lost_flag[0].Free(); + sound_lost_flag[1].Free(); + sound_ret_flag[0].Free(); + sound_ret_flag[1].Free(); + sound_cap_flag[0].Free(); + sound_cap_flag[1].Free(); + + g_Sound_Delete('SOUND_CTF_GET1'); + g_Sound_Delete('SOUND_CTF_GET2'); + g_Sound_Delete('SOUND_CTF_LOST1'); + g_Sound_Delete('SOUND_CTF_LOST2'); + g_Sound_Delete('SOUND_CTF_RETURN1'); + g_Sound_Delete('SOUND_CTF_RETURN2'); + g_Sound_Delete('SOUND_CTF_CAPTURE1'); + g_Sound_Delete('SOUND_CTF_CAPTURE2'); + g_Game_FreeChatSounds(); DataLoaded := False; @@ -3069,10 +3082,10 @@ begin aY2 := aY + aY2 - 1; case LiftType of - 0: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 72, 36, 0); - 1: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 124, 96, 0); - 2: e_DrawFillQuad(aX, aY, aX2, aY2, 200, 80, 4, 0); - 3: e_DrawFillQuad(aX, aY, aX2, aY2, 252, 140, 56, 0); + LIFTTYPE_UP: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 72, 36, 0); + LIFTTYPE_DOWN: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 124, 96, 0); + LIFTTYPE_LEFT: e_DrawFillQuad(aX, aY, aX2, aY2, 200, 80, 4, 0); + LIFTTYPE_RIGHT: e_DrawFillQuad(aX, aY, aX2, aY2, 252, 140, 56, 0); end; end; end; @@ -3601,6 +3614,8 @@ begin renderMapInternal(-c, -d, true); + if (gGameSettings.GameMode <> GM_SINGLE) and gPlayerIndicator then + p.DrawIndicator(); if p.FSpectator then e_TextureFontPrintEx(p.GameX + PLAYER_RECT_CX - 4, p.GameY + PLAYER_RECT_CY - 4,